[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM6PR08MB43761CFA825A9B4A2E68D29EFFC19@AM6PR08MB4376.eurprd08.prod.outlook.com>
Date: Mon, 16 Jan 2023 08:51:44 +0000
From: Pierluigi Passaro <pierluigi.p@...iscite.com>
To: Andrew Lunn <andrew@...n.ch>,
Pierluigi Passaro <pierluigi.passaro@...il.com>
CC: "wei.fang@....com" <wei.fang@....com>,
"shenwei.wang@....com" <shenwei.wang@....com>,
"xiaoning.wang@....com" <xiaoning.wang@....com>,
"linux-imx@....com" <linux-imx@....com>,
"davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>,
"kuba@...nel.org" <kuba@...nel.org>,
"pabeni@...hat.com" <pabeni@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Eran Matityahu <eran.m@...iscite.com>,
Nate Drude <Nate.D@...iscite.com>,
Francesco Ferraro <francesco.f@...iscite.com>
Subject: Re: [PATCH v2] net: fec: manage corner deferred probe condition
On Mon, Jan 16, 2023 at 1:01 AM Andrew Lunn <andrew@...n.ch> wrote:
> On Sun, Jan 15, 2023 at 11:23:51PM +0100, Pierluigi Passaro wrote:
> > On Sun, Jan 15, 2023 at 10:56 PM Andrew Lunn <andrew@...n.ch> wrote:
> > > On Sun, Jan 15, 2023 at 10:38:04PM +0100, Pierluigi Passaro wrote:
> > > > For dual fec interfaces, external phys can only be configured by fec0.
> > > > When the function of_mdiobus_register return -EPROBE_DEFER, the driver
> > > > is lately called to manage fec1, which wrongly register its mii_bus as
> > > > fec0_mii_bus.
> > > > When fec0 retry the probe, the previous assignement prevent the MDIO bus
> > > > registration.
> > > > Use a static boolean to trace the orginal MDIO bus deferred probe and
> > > > prevent further registrations until the fec0 registration completed
> > > > succesfully.
> > >
> > > The real problem here seems to be that fep->dev_id is not
> > > deterministic. I think a better fix would be to make the mdio bus name
> > > deterministic. Use pdev->id instead of fep->dev_id + 1. That is what
> > > most mdiobus drivers use.
> > >
> > Actually, the sequence is deterministic, fec0 and then fec1,
> > but sometimes the GPIO of fec0 is not yet available.
> > The EPROBE_DEFER does not prevent the second instance from being probed.
> > This is the origin of the problem.
>
> Maybe I understood you wrongly, but it sounds like the second instance
> takes the namespace of the first? And when the first probes for the
> second time, the name space is taken and the registration fails? To
> me, this is indeterminate behaviour, the name fec0_mii_bus is not
> determinate.
>
> Andrew
This is the setup of the corner case:
- FEC0 is the owner of MDIO bus, but its own PHY rely on a "delayed" GPIO
- FEC1 rely on FEC0 for MDIO communications
The sequence is something like this
- FEC0 probe start, but being the reset GPIO "delayed" it return EPROBE_DEFERRED
- FEC1 is successfully probed: being the MDIO bus still not owned, the driver assume
that the ownership must be assigned to the 1st one successfully probed, but no
MDIO node is actually present and no communication takes place.
- FEC0 is successfully probed, but MDIO bus is now assigned to FEC1 and cannot and no communication takes place
Powered by blists - more mailing lists