diff options
author | Radu Pirea (NXP OSS) <radu-nicolae.pirea@oss.nxp.com> | 2023-12-13 18:14:21 +0200 |
---|---|---|
committer | Peng Fan <peng.fan@nxp.com> | 2024-02-08 10:41:23 +0800 |
commit | 84e57e7dfb395fc16bec50cf477d25144ab9747a (patch) | |
tree | da03a371d11f735a9b7e89e9f5db89625010fb42 /drivers/net/phy | |
parent | 6c43208a6de13a3b622c7f8ac491f66edc1126f0 (diff) | |
download | u-boot-84e57e7dfb395fc16bec50cf477d25144ab9747a.zip u-boot-84e57e7dfb395fc16bec50cf477d25144ab9747a.tar.gz u-boot-84e57e7dfb395fc16bec50cf477d25144ab9747a.tar.bz2 |
net: phy: nxp-c45-tja11xx: read PHY the speed from hardware
Read PHY speed from hardware instead of assuming 100Mbps by default.
The TJA1103 works only at 100Mbps, but the driver will support more PHYs.
Signed-off-by: "Radu Pirea (NXP OSS)" <radu-nicolae.pirea@oss.nxp.com>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/nxp-c45-tja11xx.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c index 38fb38b..27d871c 100644 --- a/drivers/net/phy/nxp-c45-tja11xx.c +++ b/drivers/net/phy/nxp-c45-tja11xx.c @@ -306,13 +306,33 @@ static int nxp_c45_config(struct phy_device *phydev) return nxp_c45_start_op(phydev); } +static int nxp_c45_speed(struct phy_device *phydev) +{ + int val; + + val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1); + if (val < 0) + return val; + + if (val & MDIO_PMA_CTRL1_SPEED100) + phydev->speed = SPEED_100; + else + phydev->speed = 0; + + return 0; +} + static int nxp_c45_startup(struct phy_device *phydev) { u32 reg; + int ret; reg = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_STAT1); phydev->link = !!(reg & MDIO_STAT1_LSTATUS); - phydev->speed = SPEED_100; + ret = nxp_c45_speed(phydev); + if (ret < 0) + return ret; + phydev->duplex = DUPLEX_FULL; return 0; } |