Commit 6903098c authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: Only configure regs if link state changes

Some config regs get set whenever adjust_link() is called. Change this
so that these registers only get set when the link state changes to UP.

Also remove unnecessary second assignment of boot_coma.
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ed73591a
......@@ -3819,9 +3819,20 @@ static void et131x_adjust_link(struct net_device *netdev)
struct et131x_adapter *adapter = netdev_priv(netdev);
struct phy_device *phydev = adapter->phydev;
if (netif_carrier_ok(netdev)) {
adapter->boot_coma = 20;
if (phydev && phydev->link != adapter->link) {
/*
* Check to see if we are in coma mode and if
* so, disable it because we will not be able
* to read PHY values until we are out.
*/
if (et1310_in_phy_coma(adapter))
et1310_disable_phy_coma(adapter);
adapter->link = phydev->link;
phy_print_status(phydev);
if (phydev->link) {
adapter->boot_coma = 20;
if (phydev && phydev->speed == SPEED_10) {
/*
* NOTE - Is there a way to query this without
......@@ -3857,22 +3868,7 @@ static void et131x_adjust_link(struct net_device *netdev)
et131x_set_rx_dma_timer(adapter);
et1310_config_mac_regs2(adapter);
}
if (phydev && phydev->link != adapter->link) {
/*
* Check to see if we are in coma mode and if
* so, disable it because we will not be able
* to read PHY values until we are out.
*/
if (et1310_in_phy_coma(adapter))
et1310_disable_phy_coma(adapter);
if (phydev->link) {
adapter->boot_coma = 20;
} else {
dev_warn(&adapter->pdev->dev,
"Link down - cable problem ?\n");
adapter->boot_coma = 0;
if (phydev->speed == SPEED_10) {
......@@ -3917,9 +3913,6 @@ static void et131x_adjust_link(struct net_device *netdev)
et131x_enable_txrx(netdev);
}
adapter->link = phydev->link;
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