[U-Boot] [PATCH] net/phy: fix select line for TN80xx

TN80xx has same PHY ID as TN2020, but it needs different setting to register 30.93 which used to select line, so we read register 30.32 which has bit 15:12 to indicate PHY hardware version, for TN20xx we will get 3 or 2, for TN80xx we will get 5 or 4.
Signed-off-by: Shaohui Xie Shaohui.Xie@freescale.com --- drivers/net/phy/teranetics.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index 78447b7..c0f13b8 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -34,9 +34,20 @@ int tn2020_config(struct phy_device *phydev) unsigned short restart_an = (MDIO_AN_CTRL1_RESTART | MDIO_AN_CTRL1_ENABLE | MDIO_AN_CTRL1_XNP); + u8 phy_hwversion;
- phy_write(phydev, 30, 93, 2); - phy_write(phydev, MDIO_MMD_AN, MDIO_CTRL1, restart_an); + /* + * bit 15:12 of register 30.32 indicates PHY hardware + * version. It can be used to distinguish TN80xx from + * TN2020. TN2020 needs write 0x2 to 30.93, but TN80xx + * needs 0x1. + */ + phy_hwversion = (phy_read(phydev, 30, 32) >> 12) & 0xf; + if (phy_hwversion <= 3) { + phy_write(phydev, 30, 93, 2); + phy_write(phydev, MDIO_MMD_AN, MDIO_CTRL1, restart_an); + } else + phy_write(phydev, 30, 93, 1); }
return 0;

Hi, All,
I'm not sure who would be the maintainer should I ask for review, and no comments till now. Could the patch be applied? Thanks!
Best Regards, Shaohui Xie
-----Original Message----- From: Xie Shaohui-B21989 Sent: Tuesday, December 18, 2012 2:11 PM To: u-boot@lists.denx.de Cc: Xie Shaohui-B21989 Subject: [PATCH] net/phy: fix select line for TN80xx
TN80xx has same PHY ID as TN2020, but it needs different setting to register 30.93 which used to select line, so we read register 30.32 which has bit 15:12 to indicate PHY hardware version, for TN20xx we will get 3 or 2, for TN80xx we will get 5 or 4.
Signed-off-by: Shaohui Xie Shaohui.Xie@freescale.com
drivers/net/phy/teranetics.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index 78447b7..c0f13b8 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -34,9 +34,20 @@ int tn2020_config(struct phy_device *phydev) unsigned short restart_an = (MDIO_AN_CTRL1_RESTART | MDIO_AN_CTRL1_ENABLE | MDIO_AN_CTRL1_XNP);
u8 phy_hwversion;
phy_write(phydev, 30, 93, 2);
phy_write(phydev, MDIO_MMD_AN, MDIO_CTRL1, restart_an);
/*
* bit 15:12 of register 30.32 indicates PHY hardware
* version. It can be used to distinguish TN80xx from
* TN2020. TN2020 needs write 0x2 to 30.93, but TN80xx
* needs 0x1.
*/
phy_hwversion = (phy_read(phydev, 30, 32) >> 12) & 0xf;
if (phy_hwversion <= 3) {
phy_write(phydev, 30, 93, 2);
phy_write(phydev, MDIO_MMD_AN, MDIO_CTRL1, restart_an);
} else
phy_write(phydev, 30, 93, 1);
}
return 0;
-- 1.6.4
participants (2)
-
Shaohui Xie
-
Xie Shaohui-B21989