Skip to content

Commit c96e731

Browse files
ffainellidavem330
authored andcommitted
net: bcmgenet: connect and disconnect from the PHY state machine
phy_disconnect() is the only way to guarantee that we are not going to schedule more work on the PHY state machine workqueue for that particular PHY device. This fixes an issue where a network interface was suspended prior to a system suspend/resume cycle and would then be resumed as part of mdio_bus_resume(), since the GENET interface clocks would have been disabled, this basically resulted in bus errors to appear since we are invoking the GENET driver adjust_link() callback. Fixes: b6e978e ("net: bcmgenet: add suspend/resume callbacks") Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 93ecd26 commit c96e731

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,6 +2140,9 @@ static int bcmgenet_open(struct net_device *dev)
21402140
goto err_irq0;
21412141
}
21422142

2143+
phy_connect_direct(dev, priv->phydev, bcmgenet_mii_setup,
2144+
priv->phy_interface);
2145+
21432146
bcmgenet_netif_start(dev);
21442147

21452148
return 0;
@@ -2184,6 +2187,9 @@ static int bcmgenet_close(struct net_device *dev)
21842187

21852188
bcmgenet_netif_stop(dev);
21862189

2190+
/* Really kill the PHY state machine and disconnect from it */
2191+
phy_disconnect(priv->phydev);
2192+
21872193
/* Disable MAC receive */
21882194
umac_enable_set(priv, CMD_RX_EN, false);
21892195

drivers/net/ethernet/broadcom/genet/bcmgenet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,7 @@ int bcmgenet_mii_init(struct net_device *dev);
620620
int bcmgenet_mii_config(struct net_device *dev);
621621
void bcmgenet_mii_exit(struct net_device *dev);
622622
void bcmgenet_mii_reset(struct net_device *dev);
623+
void bcmgenet_mii_setup(struct net_device *dev);
623624

624625
/* Wake-on-LAN routines */
625626
void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol);

drivers/net/ethernet/broadcom/genet/bcmmii.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static int bcmgenet_mii_write(struct mii_bus *bus, int phy_id,
7777
/* setup netdev link state when PHY link status change and
7878
* update UMAC and RGMII block when link up
7979
*/
80-
static void bcmgenet_mii_setup(struct net_device *dev)
80+
void bcmgenet_mii_setup(struct net_device *dev)
8181
{
8282
struct bcmgenet_priv *priv = netdev_priv(dev);
8383
struct phy_device *phydev = priv->phydev;

0 commit comments

Comments
 (0)