From: Philippe Schenker <philippe.schenker@toradex.com>
To: "linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"kuba@kernel.org" <kuba@kernel.org>,
Francesco Dolcini <francesco.dolcini@toradex.com>,
"hkallweit1@gmail.com" <hkallweit1@gmail.com>,
"andrew@lunn.ch" <andrew@lunn.ch>,
"davem@davemloft.net" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v2] net: phy: micrel: ksz9131 led errata workaround
Date: Thu, 7 Oct 2021 17:08:37 +0000 [thread overview]
Message-ID: <71c35967a1a40557cc034ff7d716fec367d5b4a1.camel@toradex.com> (raw)
In-Reply-To: <20211007164535.657245-1-francesco.dolcini@toradex.com>
On Thu, 2021-10-07 at 18:45 +0200, Francesco Dolcini 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
>
> Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
This patch looks good to me, functionality wise it will work. I would
still do some defines for the raw values you used that are described in
the datasheet and maybe change the strange defines I introduced some
while ago, but I don't see this as a blocker.
Reviewed-by: Philippe Schenker <philippe.schenker@toradex.com>
> ---
> Changes v1 => v2:
> 1. corrected errata URL in commit message
> 2. check phy_read_mmd return value
> ---
> drivers/net/phy/micrel.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index c330a5a9f665..b70f62efdbc3 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;
> }
>
next prev parent reply other threads:[~2021-10-07 17:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-07 16:45 Francesco Dolcini
2021-10-07 17:08 ` Philippe Schenker [this message]
2021-10-07 17:50 ` Andrew Lunn
2021-10-08 16:30 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=71c35967a1a40557cc034ff7d716fec367d5b4a1.camel@toradex.com \
--to=philippe.schenker@toradex.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=francesco.dolcini@toradex.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®