Files
infix/patches/linux/6.18.39/0002-net-phy-marvell10g-Fix-power-up-when-strapped-to-sta.patch
T

45 lines
1.6 KiB
Diff

From 48bb808a5c8d7d0d7c49e4453f4809a9fdeefddc Mon Sep 17 00:00:00 2001
From: Tobias Waldekranz <tobias@waldekranz.com>
Date: Tue, 21 Nov 2023 20:15:24 +0100
Subject: [PATCH 02/50] net: phy: marvell10g: Fix power-up when strapped to
start powered down
On devices which are hardware strapped to start powered down (PDSTATE
== 1), make sure that we clear the power-down bit on all units
affected by this setting.
---
drivers/net/phy/marvell10g.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/net/phy/marvell10g.c b/drivers/net/phy/marvell10g.c
index 44294519231e..40439db49601 100644
--- a/drivers/net/phy/marvell10g.c
+++ b/drivers/net/phy/marvell10g.c
@@ -322,11 +322,23 @@ static int mv3310_power_down(struct phy_device *phydev)
static int mv3310_power_up(struct phy_device *phydev)
{
+ static const u16 resets[][2] = {
+ { MDIO_MMD_PCS, MV_PCS_BASE_R + MDIO_CTRL1 },
+ { MDIO_MMD_PCS, MV_PCS_BASE_T + MDIO_CTRL1 },
+ { MDIO_MMD_PMAPMD, MDIO_CTRL1 },
+ };
struct mv3310_priv *priv = dev_get_drvdata(&phydev->mdio.dev);
- int ret;
+ int i, ret;
+
+ for (i = 0; i < ARRAY_SIZE(resets); i++) {
+ ret = phy_clear_bits_mmd(phydev, resets[i][0], resets[i][1],
+ MDIO_CTRL1_LPOWER);
+ if (ret)
+ break;
+ }
- ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
- MV_V2_PORT_CTRL_PWRDOWN);
+ ret = ret ? : phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,
+ MV_V2_PORT_CTRL_PWRDOWN);
/* Sometimes, the power down bit doesn't clear immediately, and
* a read of this register causes the bit not to clear. Delay