From: Johan Hovold <johan@kernel.org>
To: Bruno Thomsen <bth@kamstrup.dk>
Cc: netdev@vger.kernel.org, f.fainelli@gmail.com,
s.hauer@pengutronix.de, bruno.thomsen@gmail.com,
linux-kernel@vger.kernel.org
Subject: Re: phy/micrel: KSZ8031RNL RMII clock reconfiguration bug
Date: Tue, 11 Nov 2014 20:41:01 +0100 [thread overview]
Message-ID: <20141111194101.GI29789@localhost> (raw)
In-Reply-To: <1412866094-4972-1-git-send-email-bth@kamstrup.dk>
Hi Bruno,
On Thu, Oct 09, 2014 at 04:48:14PM +0200, Bruno Thomsen wrote:
> Bug: Unable to send and receive Ethernet packets with Micrel PHY.
>
> Affected devices:
> KSZ8031RNL (commercial temp)
> KSZ8031RNLI (industrial temp)
>
> Description:
> PHY device is correctly detected during probe.
> PHY power-up default is 25MHz crystal clock input
> and output 50MHz RMII clock to MAC.
> Reconfiguration of PHY to input 50MHz RMII clock from MAC
> causes PHY to become unresponsive if clock source is changed
> after Operation Mode Strap Override (OMSO) register setup.
>
> Cause:
> Long lead times on parts where clock setup match circuit design
> forces the usage of similar parts with wrong default setup.
>
> Solution:
> Swapped KSZ8031 register setup and added phy_write return code validation.
>
> Tested with Freescale i.MX28 Fast Ethernet Controler (fec).
>
> Signed-off-by: Bruno Thomsen <bth@kamstrup.dk>
> ---
> drivers/net/phy/micrel.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 011dbda..ec3f646 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -194,8 +194,10 @@ static int ksz8021_config_init(struct phy_device *phydev)
> if (rc)
> dev_err(&phydev->dev, "failed to set led mode\n");
>
> - phy_write(phydev, MII_KSZPHY_OMSO, val);
> rc = ksz_config_flags(phydev);
> + if (rc < 0)
> + return rc;
> + rc = phy_write(phydev, MII_KSZPHY_OMSO, val);
> return rc < 0 ? rc : 0;
> }
As you may have seen by now, I've been working on refactoring the
micrel phy driver to be able to use common initialisation code.
Specifically, I've added generic support for disabling the broadcast
address, which is what the MII_KSZPHY_OMSO write above does.
Generally you want this to be the first thing you do in order to avoid
unnecessary reconfigurations. If we ever were to allow concurrent
probing this would also be a requirement.
Could you provide some detail about the setup were you find that the PHY
becomes unresponsive without your patch? Do you have more than one PHY
on the bus? Using what addresses? And using what clock modes (i.e. 25
MHz or 50 MHz)?
Also, what exactly do you mean by "unresponsive"? Are you still able to
read the PHY registers for example?
Thanks,
Johan
next prev parent reply other threads:[~2014-11-11 19:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-09 14:48 [PATCH] phy/micrel: KSZ8031RNL RMII clock reconfiguration bug Bruno Thomsen
2014-10-10 10:02 ` Angelo Dureghello
2014-10-10 11:24 ` Bruno Thomsen
2014-10-14 16:41 ` David Miller
2014-11-11 19:41 ` Johan Hovold [this message]
2014-11-12 12:17 ` Bruno Thomsen
2014-11-15 14:18 ` Johan Hovold
2014-11-17 14:56 ` Bruno Thomsen
2014-11-17 16:00 ` Johan Hovold
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=20141111194101.GI29789@localhost \
--to=johan@kernel.org \
--cc=bruno.thomsen@gmail.com \
--cc=bth@kamstrup.dk \
--cc=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).