From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Andrew Halaney <ahalaney@redhat.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org,
alexandre.torgue@foss.st.com, joabreu@synopsys.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, mcoquelin.stm32@gmail.com,
hkallweit1@gmail.com
Subject: Re: racing ndo_open()/phylink*connect() with phy_probe()
Date: Wed, 1 May 2024 16:19:16 +0100 [thread overview]
Message-ID: <ZjJddIUpXQqH/IA+@shell.armlinux.org.uk> (raw)
In-Reply-To: <229b5a82-1086-40be-8ee5-16b7f3a03b30@lunn.ch>
On Wed, May 01, 2024 at 05:07:44PM +0200, Andrew Lunn wrote:
> On Tue, Apr 30, 2024 at 04:02:19PM -0500, Andrew Halaney wrote:
> > Hi,
> >
> > I've been taking a look at the following error message:
> >
> > qcom-ethqos 23000000.ethernet end1: __stmmac_open: Cannot attach to PHY (error: -19)
> >
> > end1 is using a phy on the mdio bus of end0, not on its own bus. Something
> > like this devicetree snippet highlights the relationship:
> >
> > // end0
> > ðernet0 {
> > phy-mode = "sgmii";
> > phy-handle = <&sgmii_phy0>;
> >
> > mdio {
> > compatible = "snps,dwmac-mdio";
> > sgmii_phy0: phy@8 {
> > compatible = "ethernet-phy-id0141.0dd4";
> > reg = <0x8>;
> > device_type = "ethernet-phy";
> > };
> >
> > sgmii_phy1: phy@a {
> > compatible = "ethernet-phy-id0141.0dd4";
> > reg = <0xa>;
> > device_type = "ethernet-phy";
> > };
> > };
> > };
> >
> > // end1
> > ðernet1 {
> > phy-mode = "sgmii";
> > phy-handle = <&sgmii_phy1>;
> > };
>
> I agree with Russell here. You need to determine where the ENODEV
> comes from.
>
> It seems unlikely, but one possibility is:
>
> static int stmmac_xgmac2_mdio_read_c22(struct mii_bus *bus, int phyaddr,
> int phyreg)
> {
> struct net_device *ndev = bus->priv;
> struct stmmac_priv *priv;
> u32 addr;
>
> priv = netdev_priv(ndev);
>
> /* Until ver 2.20 XGMAC does not support C22 addr >= 4 */
> if (priv->synopsys_id < DWXGMAC_CORE_2_20 &&
> phyaddr > MII_XGMAC_MAX_C22ADDR)
> return -ENODEV;
>
> Maybe if the interface is down, priv->synopsys_id has not been set
> yet? Your devices are at address 8 and 10, so if priv->synopsys_id
> where 0, this would give you the ENODEV.
Yes, I did look at that, but didn't read the DT snippet to realise
that the addresses would be trapped by that. So, looking at where
priv->synopsys_id is set... is in stmmac_hwif_init(), which is
called from stmmac_hw_init(), which in turn is called from
stmmac_dvr_probe(). This is the only path that leads here.
This all happens before the MDIO bus is registered, so the value of
priv->synopsys_id should be set by the time the MDIO bus is registered.
So I'm unconvinced... but I think Andrew Halaney needs to delve
deeper into debugging what is going on when the failure occurs.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Andrew Halaney <ahalaney@redhat.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org,
alexandre.torgue@foss.st.com, joabreu@synopsys.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, mcoquelin.stm32@gmail.com,
hkallweit1@gmail.com
Subject: Re: racing ndo_open()/phylink*connect() with phy_probe()
Date: Wed, 1 May 2024 16:19:16 +0100 [thread overview]
Message-ID: <ZjJddIUpXQqH/IA+@shell.armlinux.org.uk> (raw)
In-Reply-To: <229b5a82-1086-40be-8ee5-16b7f3a03b30@lunn.ch>
On Wed, May 01, 2024 at 05:07:44PM +0200, Andrew Lunn wrote:
> On Tue, Apr 30, 2024 at 04:02:19PM -0500, Andrew Halaney wrote:
> > Hi,
> >
> > I've been taking a look at the following error message:
> >
> > qcom-ethqos 23000000.ethernet end1: __stmmac_open: Cannot attach to PHY (error: -19)
> >
> > end1 is using a phy on the mdio bus of end0, not on its own bus. Something
> > like this devicetree snippet highlights the relationship:
> >
> > // end0
> > ðernet0 {
> > phy-mode = "sgmii";
> > phy-handle = <&sgmii_phy0>;
> >
> > mdio {
> > compatible = "snps,dwmac-mdio";
> > sgmii_phy0: phy@8 {
> > compatible = "ethernet-phy-id0141.0dd4";
> > reg = <0x8>;
> > device_type = "ethernet-phy";
> > };
> >
> > sgmii_phy1: phy@a {
> > compatible = "ethernet-phy-id0141.0dd4";
> > reg = <0xa>;
> > device_type = "ethernet-phy";
> > };
> > };
> > };
> >
> > // end1
> > ðernet1 {
> > phy-mode = "sgmii";
> > phy-handle = <&sgmii_phy1>;
> > };
>
> I agree with Russell here. You need to determine where the ENODEV
> comes from.
>
> It seems unlikely, but one possibility is:
>
> static int stmmac_xgmac2_mdio_read_c22(struct mii_bus *bus, int phyaddr,
> int phyreg)
> {
> struct net_device *ndev = bus->priv;
> struct stmmac_priv *priv;
> u32 addr;
>
> priv = netdev_priv(ndev);
>
> /* Until ver 2.20 XGMAC does not support C22 addr >= 4 */
> if (priv->synopsys_id < DWXGMAC_CORE_2_20 &&
> phyaddr > MII_XGMAC_MAX_C22ADDR)
> return -ENODEV;
>
> Maybe if the interface is down, priv->synopsys_id has not been set
> yet? Your devices are at address 8 and 10, so if priv->synopsys_id
> where 0, this would give you the ENODEV.
Yes, I did look at that, but didn't read the DT snippet to realise
that the addresses would be trapped by that. So, looking at where
priv->synopsys_id is set... is in stmmac_hwif_init(), which is
called from stmmac_hw_init(), which in turn is called from
stmmac_dvr_probe(). This is the only path that leads here.
This all happens before the MDIO bus is registered, so the value of
priv->synopsys_id should be set by the time the MDIO bus is registered.
So I'm unconvinced... but I think Andrew Halaney needs to delve
deeper into debugging what is going on when the failure occurs.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2024-05-01 15:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-30 21:02 racing ndo_open()/phylink*connect() with phy_probe() Andrew Halaney
2024-04-30 21:02 ` Andrew Halaney
2024-04-30 21:42 ` Russell King (Oracle)
2024-04-30 21:42 ` Russell King (Oracle)
2024-05-02 17:43 ` Andrew Halaney
2024-05-02 17:43 ` Andrew Halaney
2024-05-02 21:26 ` Serge Semin
2024-05-02 21:26 ` Serge Semin
2024-05-03 1:25 ` Andrew Lunn
2024-05-03 1:25 ` Andrew Lunn
2024-05-07 14:48 ` Andrew Halaney
2024-05-07 14:48 ` Andrew Halaney
2024-05-01 15:07 ` Andrew Lunn
2024-05-01 15:07 ` Andrew Lunn
2024-05-01 15:19 ` Russell King (Oracle) [this message]
2024-05-01 15:19 ` Russell King (Oracle)
2024-05-01 15:23 ` Andrew Lunn
2024-05-01 15:23 ` Andrew Lunn
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=ZjJddIUpXQqH/IA+@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=ahalaney@redhat.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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.