diff options
-rw-r--r-- | drivers/of/fdt.c | 4 | ||||
-rw-r--r-- | include/linux/of.h | 8 | ||||
-rw-r--r-- | include/linux/of_fdt.h | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 56fbd6e3122a..968a86af5301 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -431,9 +431,9 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname, | |||
431 | return 1; | 431 | return 1; |
432 | } | 432 | } |
433 | 433 | ||
434 | u64 __init dt_mem_next_cell(int s, u32 **cellp) | 434 | u64 __init dt_mem_next_cell(int s, __be32 **cellp) |
435 | { | 435 | { |
436 | u32 *p = *cellp; | 436 | __be32 *p = *cellp; |
437 | 437 | ||
438 | *cellp = p + s; | 438 | *cellp = p + s; |
439 | return of_read_number(p, s); | 439 | return of_read_number(p, s); |
diff --git a/include/linux/of.h b/include/linux/of.h index fd47c81d7a25..fa5571b6e219 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -20,6 +20,8 @@ | |||
20 | #include <linux/kref.h> | 20 | #include <linux/kref.h> |
21 | #include <linux/mod_devicetable.h> | 21 | #include <linux/mod_devicetable.h> |
22 | 22 | ||
23 | #include <asm/byteorder.h> | ||
24 | |||
23 | typedef u32 phandle; | 25 | typedef u32 phandle; |
24 | typedef u32 ihandle; | 26 | typedef u32 ihandle; |
25 | 27 | ||
@@ -95,16 +97,16 @@ extern void of_node_put(struct device_node *node); | |||
95 | */ | 97 | */ |
96 | 98 | ||
97 | /* Helper to read a big number; size is in cells (not bytes) */ | 99 | /* Helper to read a big number; size is in cells (not bytes) */ |
98 | static inline u64 of_read_number(const u32 *cell, int size) | 100 | static inline u64 of_read_number(const __be32 *cell, int size) |
99 | { | 101 | { |
100 | u64 r = 0; | 102 | u64 r = 0; |
101 | while (size--) | 103 | while (size--) |
102 | r = (r << 32) | *(cell++); | 104 | r = (r << 32) | be32_to_cpu(*(cell++)); |
103 | return r; | 105 | return r; |
104 | } | 106 | } |
105 | 107 | ||
106 | /* Like of_read_number, but we want an unsigned long result */ | 108 | /* Like of_read_number, but we want an unsigned long result */ |
107 | static inline unsigned long of_read_ulong(const u32 *cell, int size) | 109 | static inline unsigned long of_read_ulong(const __be32 *cell, int size) |
108 | { | 110 | { |
109 | /* toss away upper bits if unsigned long is smaller than u64 */ | 111 | /* toss away upper bits if unsigned long is smaller than u64 */ |
110 | return of_read_number(cell, size); | 112 | return of_read_number(cell, size); |
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index f32f0fc5314a..6a35d91a53a6 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h | |||
@@ -78,7 +78,7 @@ extern void early_init_dt_check_for_initrd(unsigned long node); | |||
78 | extern int early_init_dt_scan_memory(unsigned long node, const char *uname, | 78 | extern int early_init_dt_scan_memory(unsigned long node, const char *uname, |
79 | int depth, void *data); | 79 | int depth, void *data); |
80 | extern void early_init_dt_add_memory_arch(u64 base, u64 size); | 80 | extern void early_init_dt_add_memory_arch(u64 base, u64 size); |
81 | extern u64 dt_mem_next_cell(int s, u32 **cellp); | 81 | extern u64 dt_mem_next_cell(int s, __be32 **cellp); |
82 | 82 | ||
83 | /* | 83 | /* |
84 | * If BLK_DEV_INITRD, the fdt early init code will call this function, | 84 | * If BLK_DEV_INITRD, the fdt early init code will call this function, |