aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/microchip.c
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-01-12 15:50:28 +0000
committersaturneric <[email protected]>2025-01-12 15:50:28 +0000
commitb7c94eb866dd341a28367bdfabd7c2d1b14d688e (patch)
treeb6df897425af99dbfef5ad4d91a969f1e58fdae6 /drivers/net/phy/microchip.c
parentMerge tag 'hwmon-for-v6.13-rc7' of git://git.kernel.org/pub/scm/linux/kernel/... (diff)
downloadkernel-b7c94eb866dd341a28367bdfabd7c2d1b14d688e.tar.gz
kernel-b7c94eb866dd341a28367bdfabd7c2d1b14d688e.zip
fix: drivers patch make raspberry pi 5 work properly
Diffstat (limited to 'drivers/net/phy/microchip.c')
-rw-r--r--drivers/net/phy/microchip.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c
index 691969a4910f..ae3d8d248511 100644
--- a/drivers/net/phy/microchip.c
+++ b/drivers/net/phy/microchip.c
@@ -239,6 +239,7 @@ static int lan88xx_probe(struct phy_device *phydev)
struct device *dev = &phydev->mdio.dev;
struct lan88xx_priv *priv;
u32 led_modes[4];
+ u32 downshift_after = 0;
int len;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
@@ -268,6 +269,32 @@ static int lan88xx_probe(struct phy_device *phydev)
return -EINVAL;
}
+ if (!of_property_read_u32(dev->of_node,
+ "microchip,downshift-after",
+ &downshift_after)) {
+ u32 mask = LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_MASK;
+ u32 val= LAN78XX_PHY_CTRL3_AUTO_DOWNSHIFT;
+
+ switch (downshift_after) {
+ case 2: val |= LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_2;
+ break;
+ case 3: val |= LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_3;
+ break;
+ case 4: val |= LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_4;
+ break;
+ case 5: val |= LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_5;
+ break;
+ case 0: // Disable completely
+ mask = LAN78XX_PHY_CTRL3_AUTO_DOWNSHIFT;
+ val = 0;
+ break;
+ default:
+ return -EINVAL;
+ }
+ (void)phy_modify_paged(phydev, 1, LAN78XX_PHY_CTRL3,
+ mask, val);
+ }
+
/* these values can be used to identify internal PHY */
priv->chip_id = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_ID);
priv->chip_rev = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_REV);