On a Raspberry Pi 2 disagreements on cell endianness can be observed:

  U-Boot> fdt print /soc/gpio@7e200000 phandle
  phandle = <0x0000000d>
  U-Boot> fdt get value myvar /soc/gpio@7e200000 phandle; printenv myvar
  myvar=0x0D000000

Fix this by always treating the pointer as __be32 and converting it in
fdt_value_setenv(), like its counterpart fdt_parse_prop() already does.

Fixes: bc80295 ("fdt: Add get commands to fdt")
Cc: Joe Hershberger <joe.hershber...@ni.com>
Cc: Gerald Van Baren <g...@unssw.com>
Signed-off-by: Andreas Färber <afaer...@suse.de>
---
 cmd/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/fdt.c b/cmd/fdt.c
index b503357..a131f17 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -58,7 +58,7 @@ static int fdt_value_setenv(const void *nodep, int len, const 
char *var)
        else if (len == 4) {
                char buf[11];
 
-               sprintf(buf, "0x%08X", *(uint32_t *)nodep);
+               sprintf(buf, "0x%08X", __be32_to_cpu(*(__be32 *)nodep));
                setenv(var, buf);
        } else if (len%4 == 0 && len <= 20) {
                /* Needed to print things like sha1 hashes. */
-- 
2.6.6

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to