[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230207154135.6f0e59f8@fixe.home>
Date: Tue, 7 Feb 2023 15:41:35 +0100
From: Clément Léger <clement.leger@...tlin.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Sergey Shtylyov <s.shtylyov@....ru>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Magnus Damm <magnus.damm@...il.com>,
Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Wong Vee Khee <veekhee@...le.com>,
Kurt Kanzenbach <kurt@...utronix.de>,
Revanth Kumar Uppala <ruppala@...dia.com>,
Tan Tee Min <tee.min.tan@...ux.intel.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Herve Codina <herve.codina@...tlin.com>,
Miquèl Raynal <miquel.raynal@...tlin.com>,
Milan Stevanovic <milan.stevanovic@...com>,
Jimmy Lalande <jimmy.lalande@...com>,
Pascal Eberhard <pascal.eberhard@...com>,
Mohammad Athari Bin Ismail <mohammad.athari.ismail@...el.com>,
Jon Hunter <jonathanh@...dia.com>, netdev@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH net-next 3/6] net: stmmac: start phylink before setting
up hardware
Le Mon, 16 Jan 2023 10:53:49 +0000,
"Russell King (Oracle)" <linux@...linux.org.uk> a écrit :
> On Mon, Jan 16, 2023 at 11:39:23AM +0100, Clément Léger wrote:
> > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > index f2247b8cf0a3..88c941003855 100644
> > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> > @@ -3818,6 +3818,12 @@ static int __stmmac_open(struct net_device *dev,
> > }
> > }
> >
> > + /* We need to setup the phy & PCS before accessing the stmmac registers
> > + * because in some cases (RZ/N1), if the stmmac IP is not clocked by the
> > + * PCS, hardware init will fail because it lacks a RGMII RX clock.
> > + */
> > + phylink_start(priv->phylink);
>
> So what happens if you end up with the mac_link_up method being called
> at this point in the driver, before the hardware has been setup ?
>
> If you use a fixed-link, that's a real possibility.
I actually have this setup. On the board, one GMAC is connected to a
DSA switch using a fixed-link and the other using the PCS such as added
by this series.
From what I see, indeed, the mac_link_up() function is called before
stmmac_hw_setup(). This does not seems to have any effect on my setup
(except making it working of course) but I agree this is clearly not
ideal.
What I could do is adding a function in the miic pcs driver that could
be called from my rzn1 stmmac probe function to actually configure the
PCS at probe time based on the detected "phy-mode". Does that seems
better to you ?
Thanks,
--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com
Powered by blists - more mailing lists