All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>, Jian-Hong Pan <jhp@endlessos.org>
Cc: Doug Berger <opendmb@gmail.com>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	bcm-kernel-feedback-list@broadcom.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux@endlessos.org,
	linux-rpi-kernel@lists.infradead.org
Subject: Re: [PATCH] net: bcmgenet: Fix attaching to PYH failed on RPi 4B
Date: Mon, 21 Jun 2021 09:47:21 -0700	[thread overview]
Message-ID: <0f0b2647-ba50-a247-3b6e-aed1e1c77f67@gmail.com> (raw)
In-Reply-To: <35f4baae-a6e1-c87d-279c-74f8c18bb5d1@gmail.com>

On 6/21/21 9:37 AM, Florian Fainelli wrote:
> 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
> b/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,
>  };
>  module_platform_driver(unimac_mdio_driver);

This won't build try this instead:

diff --git a/drivers/net/mdio/mdio-bcm-unimac.c
b/drivers/net/mdio/mdio-bcm-unimac.c
index bfc9be23c973..53fecb53cd65 100644
--- a/drivers/net/mdio/mdio-bcm-unimac.c
+++ b/drivers/net/mdio/mdio-bcm-unimac.c
@@ -349,6 +349,7 @@ static struct platform_driver unimac_mdio_driver = {
                .name = UNIMAC_MDIO_DRV_NAME,
                .of_match_table = unimac_mdio_ids,
                .pm = &unimac_mdio_pm_ops,
+               .probe_type = PROBE_FORCE_SYNCHRONOUS,
        },
        .probe  = unimac_mdio_probe,
        .remove = unimac_mdio_remove,
-- 
Florian

  reply	other threads:[~2021-06-21 17:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 10:33 [PATCH] net: bcmgenet: Fix attaching to PYH failed on RPi 4B Jian-Hong Pan
2021-06-21 13:09 ` Andrew Lunn
2021-06-21 16:37   ` Florian Fainelli
2021-06-21 16:47     ` Florian Fainelli [this message]
2021-06-21 16:56     ` Peter Robinson
2021-06-21 20:15       ` Stefan Wahren
2021-06-21 21:47         ` Florian Fainelli
2021-06-22  6:29           ` Jian-Hong Pan
2021-06-22  6:50             ` Heiner Kallweit
2021-06-22  7:46               ` Jian-Hong Pan
2021-06-23  3:28                 ` [PATCH v2] " Jian-Hong Pan
2021-06-23  4:00                   ` Florian Fainelli
2021-06-23 20:50                   ` patchwork-bot+netdevbpf
2021-06-23 21:19                     ` Florian Fainelli
2021-06-24  2:47                       ` Jian-Hong Pan
2021-06-24  3:27                         ` Florian Fainelli
2021-06-24  3:28                           ` Jian-Hong Pan
2021-06-24  3:22                       ` [PATCH v3] net: bcmgenet: Add mdio-bcm-unimac soft dependency Jian-Hong Pan
2021-06-24 23:00                         ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f0b2647-ba50-a247-3b6e-aed1e1c77f67@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=jhp@endlessos.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux@endlessos.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.