[U-Boot] [PATCH 1/6] ofnode: Add missing address translation into ofnode_get_addr_size()

Marek Vasut marek.vasut at gmail.com
Fri Sep 21 22:59:16 UTC 2018


Of CONFIG_OF_TRANSLATE is enabled, this function still returns
untranslated bogus results. Add the missing translation.

Signed-off-by: Marek Vasut <marek.vasut+renesas at gmail.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at konsulko.com>
---
 drivers/core/ofnode.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index a7e1927723..035023ca91 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -542,8 +542,15 @@ fdt_addr_t ofnode_get_addr_size(ofnode node, const char *property,
 			return FDT_ADDR_T_NONE;
 		na = of_n_addr_cells(np);
 		ns = of_n_addr_cells(np);
+
 		*sizep = of_read_number(prop + na, ns);
-		return of_read_number(prop, na);
+
+		if (IS_ENABLED(CONFIG_OF_TRANSLATE) && ns > 0) {
+			return of_translate_address(ofnode_to_np(node), prop);
+		} else {
+			na = of_n_addr_cells(ofnode_to_np(node));
+			return of_read_number(prop, na);
+		}
 	} else {
 		return fdtdec_get_addr_size(gd->fdt_blob,
 					    ofnode_to_offset(node), property,
-- 
2.18.0



More information about the U-Boot mailing list