Skip to content

Commit

Permalink
netsec: restore phy power state after controller reset
Browse files Browse the repository at this point in the history
commit 804741a upstream.

Since commit 8e850f2 ("net: socionext: Stop PHY before resetting
netsec") netsec_netdev_init() power downs phy before resetting the
controller. However, the state is not restored once the reset is
complete. As a result it is not possible to bring up network on a
platform with Broadcom BCM5482 phy.

Fix the issue by restoring phy power state after controller reset is
complete.

Fixes: 8e850f2 ("net: socionext: Stop PHY before resetting netsec")
Cc: stable@vger.kernel.org
Signed-off-by: Mian Yousaf Kaukab <ykaukab@suse.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Mian Yousaf Kaukab authored and gregkh committed Mar 30, 2021
1 parent d7e5ee6 commit a2035c9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/ethernet/socionext/netsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1718,14 +1718,17 @@ static int netsec_netdev_init(struct net_device *ndev)
goto err1;

/* set phy power down */
data = netsec_phy_read(priv->mii_bus, priv->phy_addr, MII_BMCR) |
BMCR_PDOWN;
netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR, data);
data = netsec_phy_read(priv->mii_bus, priv->phy_addr, MII_BMCR);
netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR,
data | BMCR_PDOWN);

ret = netsec_reset_hardware(priv, true);
if (ret)
goto err2;

/* Restore phy power state */
netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR, data);

spin_lock_init(&priv->desc_ring[NETSEC_RING_TX].lock);
spin_lock_init(&priv->desc_ring[NETSEC_RING_RX].lock);

Expand Down

0 comments on commit a2035c9

Please sign in to comment.