Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1626124
| From | Alexander Kochetkov <al.kochet@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt |
| Date | 2017-04-19 15:50 +0200 |
| Message-ID | <txY9A-43H-17@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt Alexander Kochetkov <al.kochet@gmail.com> - 2017-04-19 15:50 +0200
Re: [PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt Alexander Kochetkov <al.kochet@gmail.com> - 2017-04-19 16:10 +0200
Re: [PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt Florian Fainelli <f.fainelli@gmail.com> - 2017-04-19 18:40 +0200
Re: [PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt Alexander Kochetkov <al.kochet@gmail.com> - 2017-04-19 19:00 +0200
Re: [PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt Roger Quadros <rogerq@ti.com> - 2017-04-20 11:30 +0200
Re: [PATCH] net: phy: fix auto-negotiation stall due to unavailable interrupt Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2017-04-19 20:20 +0200
csiph-web