Skip to content

Commit a642c4f

Browse files
ffainellidavem330
authored andcommitted
net: bcmgenet: power up and down integrated GPHY when unused
Power up the GPHY while we are bringing-up the network interface, and conversely, upon bring down, power the GPHY down. In order to avoid creating hardware hazards, make sure that the GPHY gets powered on during bcmgenet_open() prior to the UniMAC being reset as the UniMAC may start creating activity towards the GPHY if we reverse the steps. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a9d608c commit a642c4f

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,8 @@ static int bcmgenet_power_down(struct bcmgenet_priv *priv,
869869
reg |= (EXT_PWR_DOWN_PHY |
870870
EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS);
871871
bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
872+
873+
bcmgenet_phy_power_set(priv->dev, false);
872874
}
873875
break;
874876
default:
@@ -2465,9 +2467,6 @@ static void bcmgenet_netif_start(struct net_device *dev)
24652467

24662468
umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, true);
24672469

2468-
if (phy_is_internal(priv->phydev))
2469-
bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
2470-
24712470
netif_tx_start_all_queues(dev);
24722471

24732472
phy_start(priv->phydev);
@@ -2486,6 +2485,12 @@ static int bcmgenet_open(struct net_device *dev)
24862485
if (!IS_ERR(priv->clk))
24872486
clk_prepare_enable(priv->clk);
24882487

2488+
/* If this is an internal GPHY, power it back on now, before UniMAC is
2489+
* brought out of reset as absolutely no UniMAC activity is allowed
2490+
*/
2491+
if (phy_is_internal(priv->phydev))
2492+
bcmgenet_power_up(priv, GENET_POWER_PASSIVE);
2493+
24892494
/* take MAC out of reset */
24902495
bcmgenet_umac_reset(priv);
24912496

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ int bcmgenet_mii_init(struct net_device *dev);
664664
int bcmgenet_mii_config(struct net_device *dev, bool init);
665665
void bcmgenet_mii_exit(struct net_device *dev);
666666
void bcmgenet_mii_reset(struct net_device *dev);
667+
void bcmgenet_phy_power_set(struct net_device *dev, bool enable);
667668
void bcmgenet_mii_setup(struct net_device *dev);
668669

669670
/* Wake-on-LAN routines */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ void bcmgenet_mii_reset(struct net_device *dev)
168168
}
169169
}
170170

171-
static void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
171+
void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
172172
{
173173
struct bcmgenet_priv *priv = netdev_priv(dev);
174174
u32 reg = 0;

0 commit comments

Comments
 (0)