[U-Boot] [PATCH 2/2] net: macb: let miiphy_read/_write pass arbitrary addresses

Josef Holzmayr holzmayr at rsi-elektrotechnik.de
Wed Oct 2 19:22:52 UTC 2019


This allows passing arbitrary addresses through macb_miiphy_read and
macb_miiphy_write, therefore enabling the mii command to access
all mdio bus devices instead of only the defined phy.

Signed-off-by: Josef Holzmayr <holzmayr at rsi-elektrotechnik.de>
---
 drivers/net/macb.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 5da490efb7..e801d4c4ec 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -240,11 +240,8 @@ int macb_miiphy_read(struct mii_dev *bus, int phy_adr, int devad, int reg)
 	struct macb_device *macb = to_macb(dev);
 #endif
 
-	if (macb->phy_addr != phy_adr)
-		return -1;
-
 	arch_get_mdio_control(bus->name);
-	value = macb_mdio_read(macb, macb->phy_addr, reg);
+	value = macb_mdio_read(macb, phy_adr, reg);
 
 	return value;
 }
@@ -260,11 +257,8 @@ int macb_miiphy_write(struct mii_dev *bus, int phy_adr, int devad, int reg,
 	struct macb_device *macb = to_macb(dev);
 #endif
 
-	if (macb->phy_addr != phy_adr)
-		return -1;
-
 	arch_get_mdio_control(bus->name);
-	macb_mdio_write(macb, macb->phy_addr, reg, value);
+	macb_mdio_write(macb, phy_adr, reg, value);
 
 	return 0;
 }
-- 
2.23.0


-- 
_____________________________________________________________
R-S-I Elektrotechnik GmbH & Co. KG
Woelkestrasse 11
D-85301 Schweitenkirchen
Fon: +49 8444 9204-0
Fax: +49 8444 9204-50
www.rsi-elektrotechnik.de

_____________________________________________________________
Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
USt-IdNr.: DE 128592548



More information about the U-Boot mailing list