From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: netdev@vger.kernel.org, Heiko Schocher <heiko.schocher@gmail.com>,
hs@denx.de
Cc: Clark Wang <xiaoning.wang@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
NXP Linux Team <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
Date: Thu, 23 Nov 2023 16:42:35 +0100 [thread overview]
Message-ID: <2305704.ElGaqSPkdT@steina-w> (raw)
In-Reply-To: <1af63dea-e333-cef7-2bc6-bbf4eb8c3881@denx.de>
Hello Heiko,
Am Donnerstag, 23. November 2023, 16:26:18 CET schrieb Heiko Schocher:
> Hello Alexander,
>
> On 23.11.23 16:11, Alexander Stein wrote:
> > Hello Heiko,
> >
> > Am Donnerstag, 23. November 2023, 14:27:43 CET schrieb Heiko Schocher:
> >> 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.
> >
> > But FEC_QUIRK_SINGLE_MDIO is only set for imx28. How is this related to
> > imx8qxp?
>
> Ah, yes ... customer uses NXP based kernel there is:
>
> /* board only enable one mii bus in default */
> if (!of_get_property(np, "fsl,mii-exclusive", NULL))
> fep->quirks |= FEC_QUIRK_SINGLE_MDIO;
>
> which is missing in mainline... nevertheless patch fixes a problem
> with boards having quirk FEC_QUIRK_SINGLE_MDIO set.
But this seems wrong. Apparently fec driver fails if MDIO bus is not (yet)
available. But 'fsl,mii-exclusive' + FEC_QUIRK_SINGLE_MDIO assumes both
interfaces use fec, no? Will this work e.g. on imx8mp if the FEC PHY is
attached to STMMAC (EQOS) PHY?
> > Will this also help for imx6ul when fec1 is almost always probed before
> > fec0 due to order of DT nodes?
>
> Yep, I think so... do you have the chance to test such a setup?
I have a board for that. But I'm not able to test at the moment.
Best regards,
Alexander
> bye,
> Heiko
>
> > Best regards,
> > Alexander
> >
> >> 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;
> >>
> >> }
> >>
> >> bus_freq = 2500000; /* 2.5MHz by default */
--
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/
next prev parent reply other threads:[~2023-11-23 15:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 13:27 [PATCH] net: fec: fix probing of fec1 when fec0 is not probed yet Heiko Schocher
2023-11-23 15:11 ` Alexander Stein
2023-11-23 15:26 ` Heiko Schocher
2023-11-23 15:42 ` Alexander Stein [this message]
2023-11-23 20:09 ` Andrew Lunn
2023-11-24 2:33 ` Wei Fang
2023-11-24 5:19 ` Heiko Schocher
2023-11-27 6:55 ` Wei Fang
2023-11-28 4:41 ` Heiko Schocher
2023-11-29 2:34 ` Wei Fang
2023-11-24 5:09 ` Heiko Schocher
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=2305704.ElGaqSPkdT@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=heiko.schocher@gmail.com \
--cc=hs@denx.de \
--cc=kuba@kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shenwei.wang@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).