[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230712062634.21288-1-jiawenwu@trustnetic.com>
Date: Wed, 12 Jul 2023 14:26:34 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: linux@...linux.org.uk,
kabel@...nel.org,
andrew@...n.ch,
hkallweit1@...il.com,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
netdev@...r.kernel.org
Cc: Jiawen Wu <jiawenwu@...stnetic.com>
Subject: [PATCH net] net: phy: marvell10g: fix 88x3310 power up
Clear MV_V2_PORT_CTRL_PWRDOWN bit to set power up for 88x3310 PHY,
it sometimes does not take effect immediately. This will cause
mv3310_reset() to time out, which will fail the config initialization.
So add to poll PHY power up.
Signed-off-by: Jiawen Wu <jiawenwu@...stnetic.com>
---
drivers/net/phy/marvell10g.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 55d9d7acc32e..2bed654b7c33 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -323,13 +323,20 @@ static int mv3310_power_down(struct phy_device *phydev)
static int mv3310_power_up(struct phy_device *phydev)
{
struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
- int ret;
+ int ret, val;
ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
MV_V2_PORT_CTRL_PWRDOWN);
+ if (ret < 0)
+ return ret;
+
+ ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND2,
+ MV_V2_PORT_CTRL, val,
+ !(val & MV_V2_PORT_CTRL_PWRDOWN),
+ 1000, 100000, true);
if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310 ||
- priv->firmware_ver < 0x00030000)
+ priv->firmware_ver < 0x00030000 || ret < 0)
return ret;
return phy_set_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
--
2.27.0
Powered by blists - more mailing lists