diff options
author | Francesco Dolcini <francesco.dolcini@toradex.com> | 2021-10-07 18:45:35 +0200 |
---|---|---|
committer | Hiago De Franco <hiago.franco@toradex.com> | 2023-06-29 12:14:22 +0200 |
commit | ddc6ca4d76ea764aaec9837fb9c82297473e6edc (patch) | |
tree | 4646c5d74b899d055422a74fed7f80e6492e6b8a /drivers | |
parent | e6282b64a8347281312635c9b9145eea44ef14cb (diff) |
net: phy: micrel: ksz9131 led errata workaroundtoradex_5.15-2.1.x-imx
Micrel KSZ9131 PHY LED behavior is not correct when configured in
Individual Mode, LED1 (Activity LED) is in the ON state when there is
no-link.
Workaround this by setting bit 9 of register 0x1e after verifying that
the LED configuration is Individual Mode.
This issue is described in KSZ9131RNX Silicon Errata DS80000693B [*]
and according to that it will not be corrected in a future silicon
revision.
[*] https://ww1.microchip.com/downloads/en/DeviceDoc/KSZ9131RNX-Silicon-Errata-and-Data-Sheet-Clarification-80000863B.pdf
Upstream-Status: Backport [0316c7e66bbd16cf2d01a4e2f5afa6afb01278f2]
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Philippe Schenker <philippe.schenker@toradex.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/phy/micrel.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 05a8985d7107..b7fcc15ac491 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -1003,6 +1003,26 @@ static int ksz9131_config_rgmii_delay(struct phy_device *phydev) txcdll_val); } +/* Silicon Errata DS80000693B + * + * When LEDs are configured in Individual Mode, LED1 is ON in a no-link + * condition. Workaround is to set register 0x1e, bit 9, this way LED1 behaves + * according to the datasheet (off if there is no link). + */ +static int ksz9131_led_errata(struct phy_device *phydev) +{ + int reg; + + reg = phy_read_mmd(phydev, 2, 0); + if (reg < 0) + return reg; + + if (!(reg & BIT(4))) + return 0; + + return phy_set_bits(phydev, 0x1e, BIT(9)); +} + static int ksz9131_config_init(struct phy_device *phydev) { struct device_node *of_node; @@ -1058,6 +1078,10 @@ static int ksz9131_config_init(struct phy_device *phydev) if (ret < 0) return ret; + ret = ksz9131_led_errata(phydev); + if (ret < 0) + return ret; + return 0; } |