Fix phy_id detection also for broken hardware. Signed-off-by: Giuseppe Cavallaro --- 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;