[U-Boot] [PATCH 3/4] tsec: Fix reading phy registers from DT

Mario Six mario.six at gdsys.cc
Wed Mar 28 12:38:51 UTC 2018


Bus translations should be applied when reading the address of the sgmii
phy registers from the DT. Use ofnode_get_addr_index instead of the
plain ofnode_read_u32_default to fix this.

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

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 6829e32dae..7a7ae1dccc 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -797,8 +797,9 @@ int tsec_probe(struct udevice *dev)
 
 	parent = ofnode_get_parent(phandle_args.node);
 	if (ofnode_valid(parent)) {
-		int reg = ofnode_read_u32_default(parent, "reg", 0);
-		priv->phyregs_sgmii = (struct tsec_mii_mng *)(reg + 0x520);
+		int reg = ofnode_get_addr_index(parent, 0);
+
+		priv->phyregs_sgmii = (struct tsec_mii_mng *)reg;
 	} else {
 		debug("No parent node for PHY?\n");
 		return -ENOENT;
-- 
2.16.1



More information about the U-Boot mailing list