From: Florian Fainelli <f.fainelli@gmail.com>
To: Alexander Kochetkov <al.kochet@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
andrew@lunn.ch, Roger Quadros <rogerq@ti.com>,
nsekhar@ti.com, kyle.roeschley@ni.com
Subject: Re: [PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt
Date: Wed, 19 Apr 2017 09:32:51 -0700 [thread overview]
Message-ID: <754f7cfe-6914-570a-d0e5-4a26b6787281@gmail.com> (raw)
In-Reply-To: <24E19B31-CCD8-4032-B17B-D226D4DB881D@gmail.com>
On 04/19/2017 07:05 AM, Alexander Kochetkov wrote:
> Just found similar problem fixed in another PHY. See commit 99f81afc139c
> ("phy: micrel: Disable auto negotiation on startup»)
This specific commit was really a "this works for me, but I have not
investigated what needs fixing in PHYLIB".
Roger has been submitting a couple of patches to fix the same issue and
yours seems to be better in that it also addresses his concerns that
after his fix there was still a 1s delay (the HZ parameter to the
queue_delayed_work call) being seen:
http://patchwork.ozlabs.org/patch/743773/
Roger can you also test Alexander's patch?
>
>> 19 апр. 2017 г., в 16:46, Alexander Kochetkov <al.kochet@gmail.com> написал(а):
>>
>> The problem I fix related to SMSC LAN8710/LAN8720 PHY handled using
>> interrupts. During power-up cycle the PHY do auto-negotiation, generate
>> interrupt and set BMSR_ANEGCOMPLETE flag. Interrupt is handled by PHY
>> state machine but doesn't update link because PHY is in PHY_READY state.
>> After some time MAC bring up and connect with PHY. It start PHY using
>> phy_start(). During startup PHY change state to PHY_AN but doesn't
>> set BMCR_ANRESTART flag due to genphy_config_aneg() doesn't update MII_BMCR
>> because there no new to advertising. As a result, state machine wait for
>> interrupt from PHY and nether get "link is up". Because BMSR_ANEGCOMPLETE
>> already set the patch schedule check link without waiting interrupt.
>> In case genphy_config_aneg() update MII_BMCR and set BMCR_ANRESTART
>> flag, BMSR_ANEGCOMPLETE will be cleared and state machine will continue
>> on auto-negotiation interrupt.
>>
>> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
>> ---
>> drivers/net/phy/phy.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
>> index 7cc1b7d..da8f03d 100644
>> --- a/drivers/net/phy/phy.c
>> +++ b/drivers/net/phy/phy.c
>> @@ -1169,6 +1169,18 @@ void phy_state_machine(struct work_struct *work)
>> if (phydev->irq == PHY_POLL)
>> queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
>> PHY_STATE_TIME * HZ);
>> +
>> + /* Re-schedule a PHY state machine to check PHY status because
>> + * negotiation already done and aneg interrupt may not be generated.
>> + */
>> + if (needs_aneg && (phydev->irq > 0) && (phydev->state == PHY_AN)) {
>> + err = phy_aneg_done(phydev);
>> + if (err > 0)
>> + queue_delayed_work(system_power_efficient_wq,
>> + &phydev->state_queue, 0);
>> + if (err < 0)
>> + phy_error(phydev);
>> + }
>> }
>>
>> /**
>> --
>> 1.7.9.5
>>
>
--
Florian
next prev parent reply other threads:[~2017-04-19 16:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 13:46 Alexander Kochetkov
2017-04-19 14:05 ` Alexander Kochetkov
2017-04-19 16:32 ` Florian Fainelli [this message]
2017-04-19 16:53 ` Alexander Kochetkov
2017-04-20 9:21 ` Roger Quadros
2017-04-19 18:11 ` Sergei Shtylyov
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=754f7cfe-6914-570a-d0e5-4a26b6787281@gmail.com \
--to=f.fainelli@gmail.com \
--cc=al.kochet@gmail.com \
--cc=andrew@lunn.ch \
--cc=kyle.roeschley@ni.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=rogerq@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®