diff mbox series

[U-Boot,v2,2/2] tsec: Fix reading phy registers from DT

Message ID 20180427125257.1081-2-mario.six@gdsys.cc
State Accepted
Commit 5e9d9ab
Delegated to: Joe Hershberger
Headers show
Series [U-Boot,v2,1/2] net: Initialize as many ethernet devices as possible | expand

Commit Message

Mario Six April 27, 2018, 12:52 p.m. UTC
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@gdsys.cc>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---

v1 -> v2:
No changes

---
 drivers/net/tsec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Joe Hershberger June 13, 2018, 7:01 p.m. UTC | #1
Hi Mario,

https://patchwork.ozlabs.org/patch/905736/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

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;