Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: dsa: mv88e6xxx: do not override PHYIDs on external MDIO
@ 2026-11-19 10:50 Blake Alexander via B4 Relay
  2026-11-19 15:19 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Blake Alexander via B4 Relay @ 2026-11-19 10:50 UTC (permalink / raw)
  To: Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Florian Fainelli, Vivien Didelot
  Cc: netdev, linux-kernel, stable, Blake Alexander

From: Blake Alexander <blake.alexander@airbus.com>

Some variants of the Marvell 88E6xxx family (such as MV88E6390) support
an external MDIO bus (in addition to the internal MDIO bus for
configuring internal PHYs). A typical use-case for the external bus is
to configure PHYs that are external to the switch. On switches that do
not assign a PHYID for internal PHYs (i.e. the value is 0), the
mv88e6xxx_mdio_read() function traps read calls to the PHYID registers
and sets the PHYID equal to the family ID of the switch.

The mv88e6xxx_mdio_read() function is reused for both internal and mdio
bus operations. The PHYID overwrite trap does not check whether the MDIO
bus is internal or external and wrongly modifies the PHYID of devices on
the external bus when their PHYID2 register reports a value of 0. When a
C22 device reports a PHYID of 0, get_phy_device() will reprobe the
device as C45 and if successful create a C45 device. Overriding the
PHYID in this case will prevent a C45 device (such as Aquantia AQR115)
from being reprobed and their driver will fail to bind.

This was observed on a development board during the bring-up phase. The
board included an MV88E6393X with external AQR115 PHYs. The MDIO bus of
the PHYs was connected to the external MDIO bus of the Marvell switch.
Prior to applying this patch, the aquantia driver failed to detect the
AQR115 and instead detected a generic C22 device (as a PHYID of
0x00000393 does not match a known PHY). After applying this fix, the
external AQR115s were detected correctly and their respective driver
bound to them successfully.

Do not modify the returned PHYID in mv88e6xxx_mdio_read() when reading
from a device on the external MDIO bus.

Fixes: da9f33018e2c ("net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390")
Cc: stable@vger.kernel.org
Signed-off-by: Blake Alexander <blake.alexander@airbus.com>
---
 drivers/net/dsa/mv88e6xxx/chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 46aef6dfe77e..bf077e476fd1 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3779,7 +3779,7 @@ static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg)
 	mv88e6xxx_reg_unlock(chip);
 
 	/* Some internal PHYs don't have a model number. */
-	if (reg == MII_PHYSID2 && !(val & 0x3f0) &&
+	if (!mdio_bus->external && reg == MII_PHYSID2 && !(val & 0x3f0) &&
 	    chip->info->family < ARRAY_SIZE(family_prod_id_table)) {
 		prod_id = family_prod_id_table[chip->info->family];
 		if (prod_id)

---
base-commit: af6f95c3300e3d234c813b80f831dd7b80b3eaf2
change-id: 20261110-mv88e6xxx-fix-f29e7214897e

Best regards,
--  
Blake Alexander <blake.alexander@airbus.com>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: dsa: mv88e6xxx: do not override PHYIDs on external MDIO
  2026-11-19 10:50 [PATCH net] net: dsa: mv88e6xxx: do not override PHYIDs on external MDIO Blake Alexander via B4 Relay
@ 2026-11-19 15:19 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2026-11-19 15:19 UTC (permalink / raw)
  To: blake.alexander
  Cc: Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Florian Fainelli, Vivien Didelot, netdev,
	linux-kernel, stable

On Thu, Nov 19, 2026 at 11:50:00AM +0100, Blake Alexander via B4 Relay wrote:
> From: Blake Alexander <blake.alexander@airbus.com>
> 
> Some variants of the Marvell 88E6xxx family (such as MV88E6390) support
> an external MDIO bus (in addition to the internal MDIO bus for
> configuring internal PHYs). A typical use-case for the external bus is
> to configure PHYs that are external to the switch. On switches that do
> not assign a PHYID for internal PHYs (i.e. the value is 0), the
> mv88e6xxx_mdio_read() function traps read calls to the PHYID registers
> and sets the PHYID equal to the family ID of the switch.
> 
> The mv88e6xxx_mdio_read() function is reused for both internal and mdio
> bus operations. The PHYID overwrite trap does not check whether the MDIO
> bus is internal or external and wrongly modifies the PHYID of devices on
> the external bus when their PHYID2 register reports a value of 0. When a
> C22 device reports a PHYID of 0, get_phy_device() will reprobe the
> device as C45 and if successful create a C45 device. Overriding the
> PHYID in this case will prevent a C45 device (such as Aquantia AQR115)
> from being reprobed and their driver will fail to bind.

Ah, my bad. I added this code. I did not think an external PHY would
return 0. But at that time, C22 PHYs dominated.

> This was observed on a development board during the bring-up phase. The
> board included an MV88E6393X with external AQR115 PHYs.

We probably have not seen this before because most Marvell switches
are paired with Marvell PHYs.

> Fixes: da9f33018e2c ("net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390")
> Cc: stable@vger.kernel.org
> Signed-off-by: Blake Alexander <blake.alexander@airbus.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-19 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 10:50 [PATCH net] net: dsa: mv88e6xxx: do not override PHYIDs on external MDIO Blake Alexander via B4 Relay
2026-11-19 15:19 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox