Skip to content

Commit 696450c

Browse files
ffainellikuba-moo
authored andcommitted
net: bcmgenet: Clear RGMII_LINK upon link down
Clear the RGMII_LINK bit upon detecting link down to be consistent with setting the bit upon link up. We also move the clearing of the out-of-band disable to the runtime initialization rather than for each link up/down transition. Signed-off-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4e9a613 commit 696450c

File tree

1 file changed

+14
-5
lines changed
  • drivers/net/ethernet/broadcom/genet

1 file changed

+14
-5
lines changed

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ static void bcmgenet_mac_config(struct net_device *dev)
7272
* Receive clock is provided by the PHY.
7373
*/
7474
reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
75-
reg &= ~OOB_DISABLE;
7675
reg |= RGMII_LINK;
7776
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
7877

@@ -95,10 +94,18 @@ static void bcmgenet_mac_config(struct net_device *dev)
9594
*/
9695
void bcmgenet_mii_setup(struct net_device *dev)
9796
{
97+
struct bcmgenet_priv *priv = netdev_priv(dev);
9898
struct phy_device *phydev = dev->phydev;
99+
u32 reg;
99100

100-
if (phydev->link)
101+
if (phydev->link) {
101102
bcmgenet_mac_config(dev);
103+
} else {
104+
reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
105+
reg &= ~RGMII_LINK;
106+
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
107+
}
108+
102109
phy_print_status(phydev);
103110
}
104111

@@ -266,18 +273,20 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
266273
(priv->phy_interface != PHY_INTERFACE_MODE_MOCA);
267274

268275
/* This is an external PHY (xMII), so we need to enable the RGMII
269-
* block for the interface to work
276+
* block for the interface to work, unconditionally clear the
277+
* Out-of-band disable since we do not need it.
270278
*/
279+
reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
280+
reg &= ~OOB_DISABLE;
271281
if (priv->ext_phy) {
272-
reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
273282
reg &= ~ID_MODE_DIS;
274283
reg |= id_mode_dis;
275284
if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv))
276285
reg |= RGMII_MODE_EN_V123;
277286
else
278287
reg |= RGMII_MODE_EN;
279-
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
280288
}
289+
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
281290

282291
if (init)
283292
dev_info(kdev, "configuring instance for %s\n", phy_name);

0 commit comments

Comments
 (0)