Patchwork macb phy address bug?

login
register
mail settings
Submitter Giulio Benetti
Date Nov. 14, 2008, 7:53 a.m.
Message ID <200811140853.13729.giulio.benetti@micronovasrl.com>
Download mbox | patch
Permalink /patch/8728/
State Accepted
Delegated to: David Miller
Headers show

Comments

Giulio Benetti - Nov. 14, 2008, 7:53 a.m.
PHYID returns 0xffff and not 0xffffffff when not found and in some 
case(at91sam9263) 0x0. Maybe this patch could be useful.



Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
Giuseppe CAVALLARO - Nov. 14, 2008, 8:46 a.m.
Giulio Benetti wrote:
> PHYID returns 0xffff and not 0xffffffff when not found and in some 
> case(at91sam9263) 0x0. Maybe this patch could be useful.
>
>
>
> Signed-off-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
>   
Hi Giulio,
it sounds like a work around for a hardware error.
Is my understanding that, broken hardware is sometimes missing the pull 
down resistor on the  MDIO line, which results in reads to non-existent 
devices returning  0 rather than 0xffff.
Your fix looks good for me, although, I don't know if some vendors 
actually use 0 as valid UID.
Moreover, when I met this problem, I decided to move just this hack 
within the MAC driver  (as soon as the PHY is connected to the driver) 
instead of patching the PAL code.
Hoping this could be useful.
Ciao
 Peppe
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -urN -X exclude linux.orig/drivers/net/phy/phy_device.c linux/drivers/net/phy/phy_device.c
--- linux.orig/drivers/net/phy/phy_device.c	2008-11-11 17:52:13.000000000 +0100
+++ linux/drivers/net/phy/phy_device.c	2008-11-12 19:20:47.000000000 +0100
@@ -227,8 +227,8 @@ 
 	if (r)
 		return ERR_PTR(r);
 
-	/* If the phy_id is all Fs, there is no device there */
-	if (0xffffffff == phy_id)
+	/* If the phy_id is all Fs or all 0s, there is no device there */
+	if ((0xffff == phy_id) || (0x00 == phy_id))
 		return NULL;
 
 	dev = phy_device_create(bus, addr, phy_id);