mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Sekhar Nori <nsekhar@ti.com>
Subject: Re: [PATCH] net: phy: micrel: ksz9031: reconfigure autoneg after phy autoneg workaround
Date: Thu, 21 Dec 2017 14:18:09 -0600	[thread overview]
Message-ID: <2955148a-71bb-6923-4c90-d05146e063de@ti.com> (raw)
In-Reply-To: <20171221092112.GD6683@lunn.ch>



On 12/21/2017 03:21 AM, Andrew Lunn wrote:
> On Wed, Dec 20, 2017 at 06:45:10PM -0600, Grygorii Strashko wrote:
>> Under some circumstances driver will perform PHY reset in
>> ksz9031_read_status() to fix autoneg failure case (idle error count =
>> 0xFF). When this happens ksz9031 will not detect link status change any
>> more when connecting to Netgear 1G switch (link can be recovered sometimes by
>> restarting netdevice "ifconfig down up"). Reproduced with TI am572x board
>> equipped with ksz9031 PHY while connecting to Netgear 1G switch.
>>
>> Fix the issue by reconfiguring autonegotiation after PHY reset in
>> ksz9031_read_status().
> 
> Hi Grygorii
> 
> I can understand the fix.
> 
> But i'm wondering if there is a better way to do this. Can you call
> phy_stop() and phy_start(). You then get the core phy code doing the
> same initialisation as what happened the first time. However, i know
> this is not easy. _read_status() is being called from the middle of
> the state machine, and trying to change the state of the state machine
> at this point is problematic.

It will not work. 
phy_state_machine()->mutex_lock(&phydev->lock);->phy_read_status()->phy_stop()->mutex_lock(&phydev->lock);
at least as is.

This is error recovery, which is, per my understanding, signalizing about hw or
configuration issue. What i'm thinking about is - may be it'll be reasonable
to add err message here:
         if ((regval & 0xFF) == 0xFF) {
+               dev_err_once(&phydev->mdio.dev,
+                            "PHY reset due idle error count maxed out");


-- 
regards,
-grygorii

  reply	other threads:[~2017-12-21 20:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21  0:45 Grygorii Strashko
2017-12-21  9:21 ` Andrew Lunn
2017-12-21 20:18   ` Grygorii Strashko [this message]
2017-12-26 17:27 ` 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=2955148a-71bb-6923-4c90-d05146e063de@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nsekhar@ti.com \
    /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®