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>
This commit is contained in:
Timur Tabi
2017-01-27 16:43:48 -06:00
committed by David S. Miller
parent e7e7454b40
commit fd0e97b806
4 changed files with 153 additions and 7 deletions

View File

@@ -951,12 +951,16 @@ static void emac_mac_rx_descs_refill(struct emac_adapter *adpt,
static void emac_adjust_link(struct net_device *netdev)
{
struct emac_adapter *adpt = netdev_priv(netdev);
struct emac_sgmii *sgmii = &adpt->phy;
struct phy_device *phydev = netdev->phydev;
if (phydev->link)
if (phydev->link) {
emac_mac_start(adpt);
else
sgmii->link_up(adpt);
} else {
sgmii->link_down(adpt);
emac_mac_stop(adpt);
}
phy_print_status(phydev);
}