net: dsa: mv88e6xxx: do not override PHYIDs on external MDIO
Subsystems (5)
PATCH 1/1 net: dsa: mv88e6xxx: do not override PHYIDs on external MDIO
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.
--- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx/chip.c +1 -1
@@ -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,
Signature · 1 line
Blake Alexander <[email protected]>
Quoted 10 lines · On Thu, Nov 19, 2026 at 11:50:00AM +0100, Blake Alexander via B4 Relay wrote:
From: Blake Alexander <[email protected]>
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.
Quoted 8 lines
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.
Quoted 2 lines
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.
Quoted 3 lines
Fixes da9f33018e2c ("net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390")Signed-off-by Blake Alexander <[email protected]>
Andrew
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 11 lines · On Thu, 19 Nov 2026 11:50:00 +0100 you wrote:
From: Blake Alexander <[email protected]>
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.[...]
Here is the summary with links:
- [net] net: dsa: mv88e6xxx: do not override PHYIDs on external MDIO
https://git.kernel.org/netdev/net/c/dd206ec7ed36
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html