mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Kochetkov <al.kochet@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt
Date: Wed, 19 Apr 2017 17:05:53 +0300	[thread overview]
Message-ID: <24E19B31-CCD8-4032-B17B-D226D4DB881D@gmail.com> (raw)
In-Reply-To: <1492609604-16359-1-git-send-email-al.kochet@gmail.com>

Just found similar problem fixed in another PHY. See commit 99f81afc139c
("phy: micrel: Disable auto negotiation on startup»)

> 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
> 

  reply	other threads:[~2017-04-19 14:06 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 [this message]
2017-04-19 16:32   ` Florian Fainelli
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=24E19B31-CCD8-4032-B17B-D226D4DB881D@gmail.com \
    --to=al.kochet@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®