All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [PATCH v2] net: au1000_eth: fix PHY detection
@ 2016-06-10 22:13 Manuel Lauss
  2016-06-11  6:35 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Manuel Lauss @ 2016-06-10 22:13 UTC (permalink / raw)
  To: netdev; +Cc: Florian Fainelli, Manuel Lauss, Andrew Lunn

Commit 7f854420fbfe9d49afe2ffb1df052cfe8e215541
("phy: Add API for {un}registering an mdio device to a bus.")
broke PHY detection on this driver with a copy-paste bug:
The code is looking 32 times for a PHY at address 0.

Fixes ethernet on AMD DB1100/DB1500/DB1550 boards which have
their (autodetected) PHYs at address 31.

Cc: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
v2: unbreak "use highest phy addr" case.

before:
libphy: au1000_eth_mii: probed
au1000-eth au1000-eth.0 (unnamed net_device) (uninitialized): no PHY found
au1000-eth: probe of au1000-eth.0 failed with error -1

after:
libphy: au1000_eth_mii: probed
AM79C874 au1000-eth-0:1f: attached PHY driver [AM79C874] (mii_bus:phy_addr=au1000-eth-0:1f, irq=-1)
au1000-eth au1000-eth.0 eth0: Au1xx0 Ethernet found at 0x11500000, irq 36

 drivers/net/ethernet/amd/au1000_eth.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c
index e0fb0f1..20760e1 100644
--- a/drivers/net/ethernet/amd/au1000_eth.c
+++ b/drivers/net/ethernet/amd/au1000_eth.c
@@ -509,8 +509,8 @@ static int au1000_mii_probe(struct net_device *dev)
 	 * on the current MAC's MII bus
 	 */
 	for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++)
-		if (mdiobus_get_phy(aup->mii_bus, aup->phy_addr)) {
-			phydev = mdiobus_get_phy(aup->mii_bus, aup->phy_addr);
+		if (mdiobus_get_phy(aup->mii_bus, phy_addr)) {
+			phydev = mdiobus_get_phy(aup->mii_bus, phy_addr);
 			if (!aup->phy_search_highest_addr)
 				/* break out with first one found */
 				break;
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] [PATCH v2] net: au1000_eth: fix PHY detection
  2016-06-10 22:13 [PATCH] [PATCH v2] net: au1000_eth: fix PHY detection Manuel Lauss
@ 2016-06-11  6:35 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-06-11  6:35 UTC (permalink / raw)
  To: manuel.lauss; +Cc: netdev, f.fainelli, andrew

From: Manuel Lauss <manuel.lauss@gmail.com>
Date: Sat, 11 Jun 2016 00:13:04 +0200

> Commit 7f854420fbfe9d49afe2ffb1df052cfe8e215541
> ("phy: Add API for {un}registering an mdio device to a bus.")
> broke PHY detection on this driver with a copy-paste bug:
> The code is looking 32 times for a PHY at address 0.
> 
> Fixes ethernet on AMD DB1100/DB1500/DB1550 boards which have
> their (autodetected) PHYs at address 31.
> 
> Cc: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
> ---
> v2: unbreak "use highest phy addr" case.

I just noticed this and fixed up my tree to use this version instead.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-11  6:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-10 22:13 [PATCH] [PATCH v2] net: au1000_eth: fix PHY detection Manuel Lauss
2016-06-11  6:35 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.