From: Florian Fainelli <f.fainelli@gmail.com>
To: Nathan Sullivan <nathan.sullivan@ni.com>
Cc: netdev <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] net/phy: micrel: Add workaround for bad autoneg
Date: Wed, 21 Oct 2015 14:46:50 -0700 [thread overview]
Message-ID: <562807CA.8020503@gmail.com> (raw)
In-Reply-To: <20151021194234.GA5746@nathan3500-linux-VM>
On 21/10/15 12:42, Nathan Sullivan wrote:
> On Wed, Oct 21, 2015 at 12:20:21PM -0700, Florian Fainelli wrote:
>> 2015-10-21 12:17 GMT-07:00 Nathan Sullivan <nathan.sullivan@ni.com>:
>>> Very rarely, the KSZ9031 will appear to complete autonegotiation, but
>>> will drop all traffic afterwards. When this happens, the idle error
>>> count will read 0xFF after autonegotiation completes. Reset the PHY
>>> when in that state.
>>>
>>> Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
>>> ---
>>> drivers/net/phy/micrel.c | 23 ++++++++++++++++++++++-
>>> 1 file changed, 22 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
>>> index 499185e..cf6312f 100644
>>> --- a/drivers/net/phy/micrel.c
>>> +++ b/drivers/net/phy/micrel.c
>>> @@ -514,6 +514,27 @@ static int ksz8873mll_read_status(struct phy_device *phydev)
>>> return 0;
>>> }
>>>
>>> +static int ksz9031_read_status(struct phy_device *phydev)
>>> +{
>>> + int err;
>>> + int regval;
>>> +
>>> + err = genphy_read_status(phydev);
>>> + if (err)
>>> + return err;
>>> +
>>> + /* Make sure the PHY is not broken. Read idle error count,
>>> + * and reset the PHY if it is maxed out.
>>> + */
>>> + regval = phy_read(phydev, MII_STAT1000);
>>> + if ((regval & 0xFF) == 0xFF) {
>>
>> Don't you also need to set phydev->state to PHY_READY here to force
>> the state machine to restart?
>>
>
> I don't think so, we stay in the PHY_AN state since phy_init_hw will restart
> autonegotiation. Setting link=0 will go through PHY_NOLINK then back to
> PHY_AN, so we wait for autoneg to complete again.
Good point, thanks for clarifiying that part.
--
Florian
next prev parent reply other threads:[~2015-10-21 21:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-21 19:17 [PATCH] net/phy: micrel: Add workaround for bad autoneg Nathan Sullivan
2015-10-21 19:20 ` Florian Fainelli
2015-10-21 19:42 ` Nathan Sullivan
2015-10-21 21:46 ` Florian Fainelli [this message]
2015-10-23 9:57 ` David Miller
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=562807CA.8020503@gmail.com \
--to=f.fainelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan.sullivan@ni.com \
--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;
as well as URLs for NNTP newsgroup(s).