Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+38 −45
Original line number Diff line number Diff line
@@ -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);
	}
}