From: Andrew Lunn <andrew@lunn.ch>
To: Maxime Ripard <maxime@cerno.tech>
Cc: "Florian Fainelli" <f.fainelli@gmail.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Rob Herring" <robh+dt@kernel.org>,
"Frank Rowand" <frowand.list@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Antoine Ténart" <antoine.tenart@bootlin.com>
Subject: Re: PHY reset handling during DT parsing
Date: Tue, 7 Jul 2020 16:19:18 +0200 [thread overview]
Message-ID: <20200707141918.GA928075@lunn.ch> (raw)
In-Reply-To: <20200706181331.x2tn5cl5jn5kqmhx@gilmour.lan>
On Mon, Jul 06, 2020 at 08:13:31PM +0200, Maxime Ripard wrote:
> Hi,
>
> I came across an issue today on an Allwinner board, but I believe it's a
> core issue.
>
> That board is using the stmac driver together with a phy that happens to
> have a reset GPIO, except that that GPIO will never be claimed, and the
> PHY will thus never work.
>
> You can find an example of such a board here:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/sun6i-a31-hummingbird.dts#n195
>
> It looks like when of_mdiobus_register() will parse the DT, it will then
> call of_mdiobus_register_phy() for each PHY it encounters [1].
> of_mdiobus_register_phy() will then if the phy doesn't have an
> ethernet-phy-id* compatible call get_phy_device() [2], and will later on
> call phy_register_device [3].
>
> get_phy_device() will then call get_phy_id() [4], that will try to
> access the PHY through the MDIO bus [5].
>
> The code that deals with the PHY reset line / GPIO is however only done
> in mdiobus_device_register, called through phy_device_register. Since
> this is happening way after the call to get_phy_device, our PHY might
> still very well be in reset if the bootloader hasn't put it out of reset
> and left it there.
Hi Maxime
If you look at the history of this code,
commit bafbdd527d569c8200521f2f7579f65a044271be
Author: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Mon Dec 4 13:35:05 2017 +0100
phylib: Add device reset GPIO support
you will see there is an assumption the PHY can be detected while in
reset. The reset was originally handled inside the at803x PHY driver
probe function, before it got moved into the core.
What you are asking for it reasonable, but you have some history to
deal with, changing some assumptions as to what the reset is all
about.
Andrew
next prev parent reply other threads:[~2020-07-07 14:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 18:13 PHY reset handling during DT parsing Maxime Ripard
2020-07-07 14:19 ` Andrew Lunn [this message]
2020-07-07 14:54 ` Maxime Ripard
2020-07-07 16:39 ` Florian Fainelli
2020-07-07 17:18 ` Rob Herring
2020-07-07 21:15 ` Florian Fainelli
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=20200707141918.GA928075@lunn.ch \
--to=andrew@lunn.ch \
--cc=antoine.tenart@bootlin.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=frowand.list@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maxime@cerno.tech \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
/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).