diff mbox

[U-Boot] freescale: fman: make sure phy-handle property is big endian

Message ID 1447154416-23916-1-git-send-email-shh.xie@gmail.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

shaohui xie Nov. 10, 2015, 11:20 a.m. UTC
From: Shaohui Xie <Shaohui.Xie@freescale.com>

When creating phy-handle property, an unsigned int value is created by
fdt_create_phandle, and memcpy is used to get the value, since DTS is
big endian, the value cannot be used directly on little endian SoCs,
it should be converted by cpu_to_fdt32.

Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
 board/freescale/common/fman.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

York Sun Dec. 15, 2015, 12:42 a.m. UTC | #1
On 11/10/2015 07:20 PM, shh.xie@gmail.com wrote:
> From: Shaohui Xie <Shaohui.Xie@freescale.com>
> 
> When creating phy-handle property, an unsigned int value is created by
> fdt_create_phandle, and memcpy is used to get the value, since DTS is
> big endian, the value cannot be used directly on little endian SoCs,
> it should be converted by cpu_to_fdt32.
> 
> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> ---

Applied to fsl-qoriq master. Awaiting upstream.

York
diff mbox

Patch

diff --git a/board/freescale/common/fman.c b/board/freescale/common/fman.c
index 26cf517..b5025ab 100644
--- a/board/freescale/common/fman.c
+++ b/board/freescale/common/fman.c
@@ -52,6 +52,8 @@  int fdt_set_phy_handle(void *fdt, char *compat, phys_addr_t addr,
 	if (!ph)
 		return -FDT_ERR_BADPHANDLE;
 
+	ph = cpu_to_fdt32(ph);
+
 	offset = fdt_node_offset_by_compat_reg(fdt, compat, addr);
 	if (offset < 0)
 		return offset;