lkml.org 
[lkml]   [2023]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH] net: fec: fix probing of fec1 when fec0 is not probed yet
Date
> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 2023年11月24日 4:09
> To: Heiko Schocher <heiko.schocher@gmail.com>
> Cc: netdev@vger.kernel.org; Heiko Schocher <hs@denx.de>; Clark Wang
> <xiaoning.wang@nxp.com>; David S. Miller <davem@davemloft.net>; Eric
> Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>;
> dl-linux-imx <linux-imx@nxp.com>; Paolo Abeni <pabeni@redhat.com>;
> Shenwei Wang <shenwei.wang@nxp.com>; Wei Fang <wei.fang@nxp.com>;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] net: fec: fix probing of fec1 when fec0 is not probed yet
>
> On Thu, Nov 23, 2023 at 02:27:43PM +0100, Heiko Schocher wrote:
> > it is possible that fec1 is probed before fec0. On SoCs with
> > FEC_QUIRK_SINGLE_MDIO set (which means fec1 uses mii from fec0) init
> > of mii fails for fec1 when fec0 is not yet probed, as fec0 setups mii
> > bus. In this case fec_enet_mii_init for fec1 returns with -ENODEV, and
> > so fec1 never comes up.
> >
> > Return here with -EPROBE_DEFER so interface gets later probed again.
> >
> > Found this on imx8qxp based board, using 2 ethernet interfaces, and
> > from time to time, fec1 interface came not up.
> >
> > Signed-off-by: Heiko Schocher <hs@denx.de>
> > ---
> >
> > drivers/net/ethernet/freescale/fec_main.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index c3b7694a7485..d956f95e7a65 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -2445,7 +2445,7 @@ static int fec_enet_mii_init(struct
> platform_device *pdev)
> > mii_cnt++;
> > return 0;
> > }
> > - return -ENOENT;
> > + return -EPROBE_DEFER;
>
> I think this has been tried before.
>
Yes, there was indeed a similar patch [1] before. but this issue seems to only exist
in downstream tree, because there is a local patch which is not in the upstream.

/* board only enable one mii bus in default */
if (!of_get_property(np, "fsl,mii-exclusive", NULL))
fep->quirks |= FEC_QUIRK_SINGLE_MDIO;

I will think about how to solve this issue in downstream if I'm free later.

[1] https://lore.kernel.org/lkml/20230208101821.871269-1-alexander.sverdlin@siemens.com/T/#r6313852054bf12baabe21418584fbb6d58343197

> Are there any issues with the mii_cnt++; I thought the previous attempt as
> this had problems with the wrong mdio bus being assigned to
> fep->mii_bus ? But i could be remembering wrongly.
>
\
 
 \ /
  Last update: 2023-11-24 03:33    [W:0.182 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site