Subject: Re: [PATCH v1 1/2] driver core: fw_devlink: Add support for FWNODE_FLAG_BROKEN_PARENT

From: Andrew Lunn <[email-masked]>
Date: Wed, 1 Sep 2021 01:02:09 +0200

> If the switches are broken without the phy-handle or ethernet change,
> I'm not sure if the "BROKEN_PARENT" patch would help.

> > Which is not enough to fix these Ethernet switches.
> 
> Ok, if you can give more specifics on this, I'll look into it.

The switches probe, but get the wrong PHY driver, genphy, not the
Marvell PHY driver. And genphy is not sufficient for this hardware.

I'd need:
> 1) The DTS file that you see the issue on.

I did the bisect on arch/arm/boot/dts/vf610-zii-dev-rev-c.dts but i
also tested arch/arm/boot/dts/vf610-zii-dev-rev-b.dts.

Rev B is interesting because switch0 and switch1 got genphy, while
switch2 got the correct Marvell PHY driver. switch2 PHYs don't have
interrupt properties, so don't loop back to their parent device.

Here is Rev B. I trimmed out other devices probing in parallel:

[    1.029100] fec 400d1000.ethernet: Invalid MAC address: 00:00:00:00:00:00
[    1.034735] fec 400d1000.ethernet: Using random MAC address: 42:f2:14:33:78:f5
[    1.042272] libphy: fec_enet_mii_bus: probed
[    1.455932] libphy: mdio_mux: probed
[    1.459432] mv88e6085 0.1:00: switch 0x3520 detected: Marvell 88E6352, revision 1
[    1.494076] libphy: mdio: probed
[    1.518958] libphy: mdio_mux: probed
[    1.522553] mv88e6085 0.2:00: switch 0x3520 detected: Marvell 88E6352, revision 1
[    1.537295] libphy: mdio: probed
[    1.556571] libphy: mdio_mux: probed
[    1.559719] mv88e6085 0.4:00: switch 0x1a70 detected: Marvell 88E6185, revision 2
[    1.574614] libphy: mdio: probed
[    1.733104] mv88e6085 0.1:00 lan0 (uninitialized): PHY [!mdio-mux!mdio@1!switch@0!mdio:00] driver [Generic PHY] (irq=POLL)
[    1.750737] mv88e6085 0.1:00 lan1 (uninitialized): PHY [!mdio-mux!mdio@1!switch@0!mdio:01] driver [Generic PHY] (irq=POLL)
[    1.768273] mv88e6085 0.1:00 lan2 (uninitialized): PHY [!mdio-mux!mdio@1!switch@0!mdio:02] driver [Generic PHY] (irq=POLL)
[    1.806561] mv88e6085 0.2:00 lan3 (uninitialized): PHY [!mdio-mux!mdio@2!switch@0!mdio:00] driver [Generic PHY] (irq=POLL)
[    1.824033] mv88e6085 0.2:00 lan4 (uninitialized): PHY [!mdio-mux!mdio@2!switch@0!mdio:01] driver [Generic PHY] (irq=POLL)
[    1.841496] mv88e6085 0.2:00 lan5 (uninitialized): PHY [!mdio-mux!mdio@2!switch@0!mdio:02] driver [Generic PHY] (irq=POLL)
[    1.943535] mv88e6085 0.4:00 lan6 (uninitialized): PHY [!mdio-mux!mdio@4!switch@0!mdio:00] driver [Marvell 88E1545] (irq=POLL)
[    2.003529] mv88e6085 0.4:00 lan7 (uninitialized): PHY [!mdio-mux!mdio@4!switch@0!mdio:01] driver [Marvell 88E1545] (irq=POLL)
[    2.063535] mv88e6085 0.4:00 lan8 (uninitialized): PHY [!mdio-mux!mdio@4!switch@0!mdio:02] driver [Marvell 88E1545] (irq=POLL)
[    2.084768] DSA: tree 0 setup
[    2.087791] libphy: mdio_mux: probed
[    2.265477] Micrel KSZ8041 400d0000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=400d0000.ethernet-1:00, irq=POLL)

root@zii-devel-b:~# cat /sys/kernel/debug/devices_deferred
root@zii-devel-b:~# 

For Rev C we see:

[    1.244417] fec 400d1000.ethernet: Invalid MAC address: 00:00:00:00:00:00
[    1.250081] fec 400d1000.ethernet: Using random MAC address: c6:42:89:ed:5f:dd
[    1.257507] libphy: fec_enet_mii_bus: probed
[    1.570725] libphy: mdio_mux: probed
[    1.574208] mv88e6085 0.1:00: switch 0xa10 detected: Marvell 88E6390X, revision 1
[    1.590272] libphy: mdio: probed
[    1.627721] libphy: mdio_mux: probed
[    1.631222] mv88e6085 0.2:00: switch 0xa10 detected: Marvell 88E6390X, revision 1
[    1.659643] libphy: mdio: probed
[    1.811665] mv88e6085 0.1:00 lan1 (uninitialized): PHY [!mdio-mux!mdio@1!switch@0!mdio:01] driver [Generic PHY] (irq=POLL)
[    1.829230] mv88e6085 0.1:00 lan2 (uninitialized): PHY [!mdio-mux!mdio@1!switch@0!mdio:02] driver [Generic PHY] (irq=POLL)
[    1.845884] mv88e6085 0.1:00 lan3 (uninitialized): PHY [!mdio-mux!mdio@1!switch@0!mdio:03] driver [Generic PHY] (irq=POLL)
[    1.863237] mv88e6085 0.1:00 lan4 (uninitialized): PHY [!mdio-mux!mdio@1!switch@0!mdio:04] driver [Generic PHY] (irq=POLL)
[    1.884078] mv88e6085 0.2:00 lan5 (uninitialized): PHY [!mdio-mux!mdio@2!switch@0!mdio:01] driver [Generic PHY] (irq=POLL)
[    1.901630] mv88e6085 0.2:00 lan6 (uninitialized): PHY [!mdio-mux!mdio@2!switch@0!mdio:02] driver [Generic PHY] (irq=POLL)
[    1.918287] mv88e6085 0.2:00 lan7 (uninitialized): PHY [!mdio-mux!mdio@2!switch@0!mdio:03] driver [Generic PHY] (irq=POLL)
[    1.933721] mv88e6085 0.2:00 lan8 (uninitialized): PHY [!mdio-mux!mdio@2!switch@0!mdio:04] driver [Generic PHY] (irq=POLL)
[    1.948722] DSA: tree 0 setup
[    1.951599] libphy: mdio_mux: probed

[   21.565550] Micrel KSZ8041 400d0000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=400d0000.ethernet-1:00, irq=48)

I have Rev B using NFS root, so the interfaces are configured up by
the kernel during boot. Rev C has a local root filesystem, so user
space brings the interfaces up, and it is only when the FEC is opened
does it attach to the Micrel PHY. That explains the difference between
2.265 and 21.565 seconds for the last line.

Again, nothing deferred.

       Andrew