Skip to content

Commit d85cf67

Browse files
Doug Bergerdavem330
authored andcommitted
net: bcmgenet: synchronize EXT_RGMII_OOB_CTRL access
The EXT_RGMII_OOB_CTRL register can be written from different contexts. It is predominantly written from the adjust_link handler which is synchronized by the phydev->lock, but can also be written from a different context when configuring the mii in bcmgenet_mii_config(). The chances of contention are quite low, but it is conceivable that adjust_link could occur during resume when WoL is enabled so use the phydev->lock synchronizer in bcmgenet_mii_config() to be sure. Fixes: afe3f90 ("net: bcmgenet: power on MII block for all MII modes") Cc: [email protected] Signed-off-by: Doug Berger <[email protected]> Acked-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b2ff42c commit d85cf67

File tree

1 file changed

+3
-1
lines changed
  • drivers/net/ethernet/broadcom/genet

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Broadcom GENET MDIO routines
44
*
5-
* Copyright (c) 2014-2017 Broadcom
5+
* Copyright (c) 2014-2024 Broadcom
66
*/
77

88
#include <linux/acpi.h>
@@ -275,6 +275,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
275275
* block for the interface to work, unconditionally clear the
276276
* Out-of-band disable since we do not need it.
277277
*/
278+
mutex_lock(&phydev->lock);
278279
reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
279280
reg &= ~OOB_DISABLE;
280281
if (priv->ext_phy) {
@@ -286,6 +287,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
286287
reg |= RGMII_MODE_EN;
287288
}
288289
bcmgenet_ext_writel(priv, reg, EXT_RGMII_OOB_CTRL);
290+
mutex_unlock(&phydev->lock);
289291

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

0 commit comments

Comments
 (0)