Message ID | 20241024152448.102-7-paul.barker.ct@bp.renesas.com |
---|---|
State | New |
Delegated to: | Marek Vasut |
Headers | show |
Series | Add support for Ethernet interfaces on RZ/G2L | expand |
On 10/24/24 5:24 PM, Paul Barker wrote: > 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 > > Based on commit 0316c7e66bbd in the Linux kernel. > > Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> > --- > drivers/net/phy/micrel_ksz90x1.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c > index c48ae6e88f30..4f99b115a3c7 100644 > --- a/drivers/net/phy/micrel_ksz90x1.c > +++ b/drivers/net/phy/micrel_ksz90x1.c > @@ -436,6 +436,26 @@ static int ksz9131_config_rgmii_delay(struct phy_device *phydev) > return ret; > } > > +/* 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, KSZ9131RN_MMD_COMMON_CTRL_REG, 0); > + if (reg < 0) > + return reg; > + > + if (!(reg & BIT(4))) It would be good to have symbolic names for these BIT()s , please add some #define ... macros .
On 27/10/2024 16:18, Marek Vasut wrote: > On 10/24/24 5:24 PM, Paul Barker wrote: >> 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 >> >> Based on commit 0316c7e66bbd in the Linux kernel. >> >> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> >> --- >> drivers/net/phy/micrel_ksz90x1.c | 24 ++++++++++++++++++++++++ >> 1 file changed, 24 insertions(+) >> >> diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c >> index c48ae6e88f30..4f99b115a3c7 100644 >> --- a/drivers/net/phy/micrel_ksz90x1.c >> +++ b/drivers/net/phy/micrel_ksz90x1.c >> @@ -436,6 +436,26 @@ static int ksz9131_config_rgmii_delay(struct phy_device *phydev) >> return ret; >> } >> >> +/* 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, KSZ9131RN_MMD_COMMON_CTRL_REG, 0); >> + if (reg < 0) >> + return reg; >> + >> + if (!(reg & BIT(4))) > It would be good to have symbolic names for these BIT()s , please add > some #define ... macros . I can add symbolic names for the values used above (KSZ9131RN_COMMON_CTRL=0 and KSZ9131RN_COMMON_CTRL_LED_MODE=BIT(4)). The arguments used in the following phy_set_bits() call are a bit trickier - all the errata document says is "Register 0x1E (30d), bit 9 must be set to 1". The Linux kernel commit adding this workaround doesn't have any symbolic names either. Thanks,
On 10/28/24 9:47 AM, Paul Barker wrote: > On 27/10/2024 16:18, Marek Vasut wrote: >> On 10/24/24 5:24 PM, Paul Barker wrote: >>> 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 >>> >>> Based on commit 0316c7e66bbd in the Linux kernel. >>> >>> Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> >>> --- >>> drivers/net/phy/micrel_ksz90x1.c | 24 ++++++++++++++++++++++++ >>> 1 file changed, 24 insertions(+) >>> >>> diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c >>> index c48ae6e88f30..4f99b115a3c7 100644 >>> --- a/drivers/net/phy/micrel_ksz90x1.c >>> +++ b/drivers/net/phy/micrel_ksz90x1.c >>> @@ -436,6 +436,26 @@ static int ksz9131_config_rgmii_delay(struct phy_device *phydev) >>> return ret; >>> } >>> >>> +/* 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, KSZ9131RN_MMD_COMMON_CTRL_REG, 0); >>> + if (reg < 0) >>> + return reg; >>> + >>> + if (!(reg & BIT(4))) >> It would be good to have symbolic names for these BIT()s , please add >> some #define ... macros . > > I can add symbolic names for the values used above > (KSZ9131RN_COMMON_CTRL=0 and KSZ9131RN_COMMON_CTRL_LED_MODE=BIT(4)). > > The arguments used in the following phy_set_bits() call are a bit > trickier - all the errata document says is "Register 0x1E (30d), bit 9 > must be set to 1". The Linux kernel commit adding this workaround > doesn't have any symbolic names either. Maybe also send a kernel patch ?
diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c index c48ae6e88f30..4f99b115a3c7 100644 --- a/drivers/net/phy/micrel_ksz90x1.c +++ b/drivers/net/phy/micrel_ksz90x1.c @@ -436,6 +436,26 @@ static int ksz9131_config_rgmii_delay(struct phy_device *phydev) return ret; } +/* 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, KSZ9131RN_MMD_COMMON_CTRL_REG, 0); + if (reg < 0) + return reg; + + if (!(reg & BIT(4))) + return 0; + + return phy_set_bits(phydev, MDIO_DEVAD_NONE, 0x1e, BIT(9)); +} + static int ksz9131_config(struct phy_device *phydev) { int ret; @@ -446,6 +466,10 @@ static int ksz9131_config(struct phy_device *phydev) return ret; } + ret = ksz9131_led_errata(phydev); + if (ret < 0) + return ret; + /* add an option to disable the gigabit feature of this PHY */ if (env_get("disable_giga")) { unsigned features;
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 Based on commit 0316c7e66bbd in the Linux kernel. Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com> --- drivers/net/phy/micrel_ksz90x1.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)