]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net/phy: realtek: Fix the PHY ID mask to ensure the correct Realtek PHY is detected
authorBhupesh Sharma <bhupesh.sharma@freescale.com>
Sat, 31 Aug 2013 23:10:52 +0000 (04:40 +0530)
committerJoe Hershberger <joe.hershberger@ni.com>
Fri, 22 Nov 2013 22:50:51 +0000 (16:50 -0600)
The 'get_phy_driver' code in 'drivers/net/phy/phy.c' uses the following
method to determine which driver is to be loaded for a particular PHY
module:

list_for_each(entry, &phy_drivers) {
drv = list_entry(entry, struct phy_driver, list);
if ((drv->uid & drv->mask) == (phy_id & drv->mask))
return drv;
}

This means that a drv->mask of 0xfffff0 will return incorrect phy driver
for the logic above, even if the drv->uid is anything other than
something ending with a 0x0.

For e.g. if the RTL8211E drv->uid is 0x1cc915 and drv->mask is 0xffffff
and the RTL8211B drv->uid is 0x1cc910 and drv->mask is 0xffffff0, then
the phy driver selected will always be RTL8211B even though the
underlying phy connected on the board is a 8211E module.

This patch fixes this issue.

Signed-off-by: Bhupesh Sharma <bhupesh.sharma@freescale.com>
drivers/net/phy/realtek.c

index ddbbc35e27e4e6e95ad9ce5ea084d6c42db2362c..a3ace685262441219c400b69fa5db765643041c0 100644 (file)
@@ -102,7 +102,7 @@ static int rtl8211x_startup(struct phy_device *phydev)
 static struct phy_driver RTL8211B_driver = {
        .name = "RealTek RTL8211B",
        .uid = 0x1cc910,
-       .mask = 0xfffff0,
+       .mask = 0xffffff,
        .features = PHY_GBIT_FEATURES,
        .config = &rtl8211x_config,
        .startup = &rtl8211x_startup,
@@ -113,7 +113,7 @@ static struct phy_driver RTL8211B_driver = {
 static struct phy_driver RTL8211E_driver = {
        .name = "RealTek RTL8211E",
        .uid = 0x1cc915,
-       .mask = 0xfffff0,
+       .mask = 0xffffff,
        .features = PHY_GBIT_FEATURES,
        .config = &rtl8211x_config,
        .startup = &rtl8211x_startup,
@@ -124,7 +124,7 @@ static struct phy_driver RTL8211E_driver = {
 static struct phy_driver RTL8211DN_driver = {
        .name = "RealTek RTL8211DN",
        .uid = 0x1cc914,
-       .mask = 0xfffff0,
+       .mask = 0xffffff,
        .features = PHY_GBIT_FEATURES,
        .config = &rtl8211x_config,
        .startup = &rtl8211x_startup,