[PATCH] net: bcmgenet: Fix attaching to PYH failed on RPi 4B

Florian Fainelli f.fainelli at gmail.com
Mon Jun 21 09:37:10 PDT 2021

On 6/21/21 6:09 AM, Andrew Lunn wrote:
> On Mon, Jun 21, 2021 at 06:33:11PM +0800, Jian-Hong Pan wrote:
>> The Broadcom UniMAC MDIO bus comes too late. So, GENET cannot find the
>> ethernet PHY on UniMAC MDIO bus. This leads GENET fail to attach the
>> PHY.
>> bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
>> ...
>> could not attach to PHY
>> bcmgenet fd580000.ethernet eth0: failed to connect to PHY
>> uart-pl011 fe201000.serial: no DMA platform data
>> libphy: bcmgenet MII bus: probed
>> ...
>> unimac-mdio unimac-mdio.-19: Broadcom UniMAC MDIO bus
>> This patch makes GENET try to connect the PHY up to 3 times. Also, waits
>> a while between each time for mdio-bcm-unimac module's loading and
>> probing.
> Don't loop. Return -EPROBE_DEFER. The driver core will then probed the
> driver again later, by which time, the MDIO bus driver should of
> probed.

This is unlikely to work because GENET register the mdio-bcm-unimac
platform device so we will likely run into a chicken and egg problem,
though surprisingly I have not seen this on STB platforms where GENET is
used, I will try building everything as a module like you do. Can you
see if the following helps:

diff --git a/drivers/net/mdio/mdio-bcm-unimac.c
index bfc9be23c973..d1844ef3724a 100644
--- a/drivers/net/mdio/mdio-bcm-unimac.c
+++ b/drivers/net/mdio/mdio-bcm-unimac.c
@@ -351,6 +351,7 @@ static struct platform_driver unimac_mdio_driver = {
                .pm = &unimac_mdio_pm_ops,
        .probe  = unimac_mdio_probe,
+       .probe_type = PROBE_FORCE_SYNCHRONOUS,
        .remove = unimac_mdio_remove,

More information about the linux-rpi-kernel mailing list