[U-Boot] [PATCH] drivers: core: Add translation in live tree case

Mario Six mario.six at gdsys.cc
Fri Oct 13 11:21:19 UTC 2017


The function dev_read_addr calls ofnode_get_addr_index in the live tree
case, which does not apply bus translations to the address read from the
device tree. This results in illegal addresses on boards that rely on
bus translations being applied.

Fix this situation by applying bus translations in the live tree case as
well.

Signed-off-by: Mario Six <mario.six at gdsys.cc>
---
 drivers/core/ofnode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 9123e88425..d7d8f039b9 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -215,13 +215,15 @@ fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
 		uint flags;
 		u64 size;
 		int na;
+		__be32 addr;
 
 		prop_val = of_get_address(ofnode_to_np(node), index, &size,
 					  &flags);
 		if (!prop_val)
 			return FDT_ADDR_T_NONE;
 		na = of_n_addr_cells(ofnode_to_np(node));
-		return of_read_number(prop_val, na);
+		addr = of_read_number(prop_val, na);
+		return of_translate_address(ofnode_to_np(node), &addr);
 	} else {
 		return fdt_get_base_address(gd->fdt_blob,
 					    ofnode_to_offset(node));
-- 
2.11.0



More information about the U-Boot mailing list