Commit 968b211c authored by Antoine Tenart's avatar Antoine Tenart Committed by David S. Miller

net: mvpp2: simplify the link_event function

The link_event function is somewhat complicated. This cosmetic patch
simplifies it.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 542897d9
...@@ -5740,7 +5740,6 @@ static void mvpp2_link_event(struct net_device *dev) ...@@ -5740,7 +5740,6 @@ static void mvpp2_link_event(struct net_device *dev)
{ {
struct mvpp2_port *port = netdev_priv(dev); struct mvpp2_port *port = netdev_priv(dev);
struct phy_device *phydev = dev->phydev; struct phy_device *phydev = dev->phydev;
int status_change = 0;
u32 val; u32 val;
if (phydev->link) { if (phydev->link) {
...@@ -5771,16 +5770,8 @@ static void mvpp2_link_event(struct net_device *dev) ...@@ -5771,16 +5770,8 @@ static void mvpp2_link_event(struct net_device *dev)
} }
if (phydev->link != port->link) { if (phydev->link != port->link) {
if (!phydev->link) {
port->duplex = -1;
port->speed = 0;
}
port->link = phydev->link; port->link = phydev->link;
status_change = 1;
}
if (status_change) {
if (phydev->link) { if (phydev->link) {
val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG); val = readl(port->base + MVPP2_GMAC_AUTONEG_CONFIG);
val |= (MVPP2_GMAC_FORCE_LINK_PASS | val |= (MVPP2_GMAC_FORCE_LINK_PASS |
...@@ -5789,9 +5780,13 @@ static void mvpp2_link_event(struct net_device *dev) ...@@ -5789,9 +5780,13 @@ static void mvpp2_link_event(struct net_device *dev)
mvpp2_egress_enable(port); mvpp2_egress_enable(port);
mvpp2_ingress_enable(port); mvpp2_ingress_enable(port);
} else { } else {
port->duplex = -1;
port->speed = 0;
mvpp2_ingress_disable(port); mvpp2_ingress_disable(port);
mvpp2_egress_disable(port); mvpp2_egress_disable(port);
} }
phy_print_status(phydev); phy_print_status(phydev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment