aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qualcomm/emac/emac.c
diff options
context:
space:
mode:
authorTimur Tabi <timur@codeaurora.org>2017-01-27 16:43:48 -0600
committerDavid S. Miller <davem@davemloft.net>2017-01-29 19:07:02 -0500
commitfd0e97b806f0331df95f5fc58cdd488d169efb7f (patch)
tree0dc31f4a8d67dbc675a99c5e7def5aa10f058ab2 /drivers/net/ethernet/qualcomm/emac/emac.c
parentnet: qcom/emac: remove extraneous wake-on-lan code (diff)
downloadlinux-dev-fd0e97b806f0331df95f5fc58cdd488d169efb7f.tar.xz
linux-dev-fd0e97b806f0331df95f5fc58cdd488d169efb7f.zip
net: qcom/emac: add an error interrupt handler for the sgmii
The SGMII (internal PHY) can report decode errors via an interrupt. It can also report autonegotiation status changes, but we don't need to track those. The SGMII can recover automatically from most decode errors, so we only reset the interface if we get multiple consecutive errors. It's possible for bogus decode errors to be reported while the link is being brought up. The interrupt is registered when the interface is opened, and it's enabled after the link is up. Signed-off-by: Timur Tabi <timur@codeaurora.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm/emac/emac.c')
-rw-r--r--drivers/net/ethernet/qualcomm/emac/emac.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 75305ad436d5..f519351ef3a2 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -280,6 +280,14 @@ static int emac_open(struct net_device *netdev)
return ret;
}
+ ret = adpt->phy.open(adpt);
+ if (ret) {
+ emac_mac_down(adpt);
+ emac_mac_rx_tx_rings_free_all(adpt);
+ free_irq(irq->irq, irq);
+ return ret;
+ }
+
return 0;
}
@@ -290,6 +298,7 @@ static int emac_close(struct net_device *netdev)
mutex_lock(&adpt->reset_lock);
+ adpt->phy.close(adpt);
emac_mac_down(adpt);
emac_mac_rx_tx_rings_free_all(adpt);
@@ -645,6 +654,7 @@ static int emac_probe(struct platform_device *pdev)
adpt->msg_enable = EMAC_MSG_DEFAULT;
phy = &adpt->phy;
+ atomic_set(&phy->decode_error_count, 0);
mutex_init(&adpt->reset_lock);
spin_lock_init(&adpt->stats.lock);