diff mbox

macb phy address bug?

Message ID 492281C9.6060006@st.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Giuseppe CAVALLARO Nov. 18, 2008, 8:50 a.m. UTC
In my opinion, we need to rework this patch again for two reasons:
1) it doesn't cover the case when the PHYID is 0xffffffff.
2) we need to add an explicit comment on the PHYID check to highlight that
    this is a  work-around the broken hardware (in case we get 0xffff or 
0x0).
I've also tested it on several PHY devices: e.g. smsc lan 8700, ste101p, 
ste100p,
DP83865 National GPHY.
Where, for some of these, we need to treat the phyid=0 as wrong UID.
Please, review the attached patch.

Regards,
Peppe

David Miller wrote:
> I've applied this patch to net-2.6, thanks.
>
> As mentioned there is some rare chance that the new
> zero test could cause problems, in which case we'll
> need to undo that part.
> --
> 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
>
>

Comments

Giulio Benetti Nov. 18, 2008, 11:54 a.m. UTC | #1
Giuseppe CAVALLARO wrote:

> In my opinion, we need to rework this patch again for two reasons:
> 1) it doesn't cover the case when the PHYID is 0xffffffff.
> 2) we need to add an explicit comment on the PHYID check to highlight that
>     this is a  work-around the broken hardware (in case we get 0xffff or
> 0x0).
> I've also tested it on several PHY devices: e.g. smsc lan 8700, ste101p,
> ste100p,
> DP83865 National GPHY.
> Where, for some of these, we need to treat the phyid=0 as wrong UID.
> Please, review the attached patch.
> 
> Regards,
> Peppe
> 
> David Miller wrote:
>> I've applied this patch to net-2.6, thanks.
>>
>> As mentioned there is some rare chance that the new
>> zero test could cause problems, in which case we'll
>> need to undo that part.
>> --
>> 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
>>
>>

You're right on hardware, it's my fault. The problem is on the primitives of 
mdio from atmel, I will patch them.

Giulio


--
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
David Miller Nov. 20, 2008, 9:04 a.m. UTC | #2
From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
Date: Tue, 18 Nov 2008 09:50:17 +0100

> Fix phy_id detection also for broken hardware.
> 
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> 
> --- phy_device.c.orig	2008-11-18 09:25:06.929041000 +0100
> +++ phy_device.c	2008-11-18 09:27:15.876041000 +0100

Please -p1 base your patches with the top-level kernel tree,
as described in linux/Documentation/SubmittingPatches

Please make a full resubmission, with full changelog and
signoffs, when you correct this.  Don't just resend the
fixed patch.

Thank you.
--
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
Giuseppe CAVALLARO Nov. 20, 2008, 3:59 p.m. UTC | #3
I've just sent a new patch (named " phy: fix phy_id detection also for 
broken hardware.").

Peppe

David Miller wrote:
> From: Giuseppe CAVALLARO <peppe.cavallaro@st.com>
> Date: Tue, 18 Nov 2008 09:50:17 +0100
>
>   
>> Fix phy_id detection also for broken hardware.
>>
>> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>>
>> --- phy_device.c.orig	2008-11-18 09:25:06.929041000 +0100
>> +++ phy_device.c	2008-11-18 09:27:15.876041000 +0100
>>     
>
> Please -p1 base your patches with the top-level kernel tree,
> as described in linux/Documentation/SubmittingPatches
>
> Please make a full resubmission, with full changelog and
> signoffs, when you correct this.  Don't just resend the
> fixed patch.
>
> Thank you.
> --
> 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
>
>   

--
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
diff mbox

Patch

Fix phy_id detection also for broken hardware.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

--- phy_device.c.orig	2008-11-18 09:25:06.929041000 +0100
+++ phy_device.c	2008-11-18 09:27:15.876041000 +0100
@@ -227,7 +227,16 @@  struct phy_device * get_phy_device(struc
 	if (r)
 		return ERR_PTR(r);
 
-	/* If the phy_id is all Fs or all 0s, there is no device there */
+	/* If the phy_id is mostly Fs, there is no device there */
+	if ((phy_id & 0x1fffffff) == 0x1fffffff)
+		return NULL;
+
+	/*
+	 * 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. Catch this here and treat 0 as a non-existent
+	 * device as well.
+	 */ 
 	if ((0xffff == phy_id) || (0x00 == phy_id))
 		return NULL;