[U-Boot] [PATCH v5 02/20] dm: core: Fix up ofnode_get_addr_index() for 64-bit values
Simon Glass
sjg at chromium.org
Tue Jul 25 14:29:56 UTC 2017
At present this function only supports 32-bit (single-cell) values. Update
it to support two-cell values also.
Signed-off-by: Simon Glass <sjg at chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>
Tested-on: Beaver, Jetson-TK1
---
Changes in v5: None
Changes in v4:
- Add new patch to fix up ofnode_get_addr_index() for 64-bit values
Changes in v3: None
Changes in v2: None
drivers/core/ofnode.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index e4b2a85f19..c3fb0ae7b9 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -199,13 +199,14 @@ fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
const __be32 *prop_val;
uint flags;
u64 size;
+ int na;
- prop_val = of_get_address(
- (struct device_node *)ofnode_to_np(node), index,
- &size, &flags);
+ prop_val = of_get_address(ofnode_to_np(node), index, &size,
+ &flags);
if (!prop_val)
return FDT_ADDR_T_NONE;
- return be32_to_cpup(prop_val);
+ na = of_n_addr_cells(ofnode_to_np(node));
+ return of_read_number(prop_val, na);
} else {
return fdt_get_base_address(gd->fdt_blob,
ofnode_to_offset(node));
--
2.14.0.rc0.284.gd933b75aa4-goog
More information about the U-Boot
mailing list