[U-Boot] [PATCH 031/080] serial: ns16550: Fix address translation

Mario Six mario.six at gdsys.cc
Fri Sep 29 12:51:49 UTC 2017


The dev_read_addr function does not do any bus translations, and just
returns the raw address read from the device tree, which makes the
driver not work on systems that need bus translations to get the actual
memory address of the device's register space.

Since the dev_read_addr function is widely used, we refrain from
modifying it, and instead read the raw address from the device tree, and
apply the bus translations using the recently introduced
dev_translate_address function.

Signed-off-by: Mario Six <mario.six at gdsys.cc>
---
 drivers/serial/ns16550.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 6f9ce689cf..15d55dfd24 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -389,12 +389,13 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 {
 	struct ns16550_platdata *plat = dev->platdata;
 	const u32 port_type = dev_get_driver_data(dev);
-	fdt_addr_t addr;
+	fdt32_t addr;
 	struct clk clk;
 	int err;
 
 	/* try Processor Local Bus device first */
-	addr = dev_read_addr(dev);
+	addr = dev_read_u32_default(dev, "reg", 0);
+	addr = dev_translate_address(dev, &addr);
 #if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI)
 	if (addr == FDT_ADDR_T_NONE) {
 		/* then try pci device */
-- 
2.11.0



More information about the U-Boot mailing list