[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJ=UCjX0YzVgedO1hDu_NsFAGhxe8HouUmHmbO6AXZqT=OUYLg@mail.gmail.com>
Date: Sun, 15 Jan 2023 19:38:38 +0100
From: Pierluigi Passaro <pierluigi.passaro@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: hkallweit1@...il.com, linux@...linux.org.uk, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
eran.m@...iscite.com, nate.d@...iscite.com,
francesco.f@...iscite.com, pierluigi.p@...iscite.com
Subject: Re: [PATCH] net: mdio: force deassert MDIO reset signal
On Sun, Jan 15, 2023 at 6:08 PM Andrew Lunn <andrew@...n.ch> wrote:
> On Sun, Jan 15, 2023 at 05:10:06PM +0100, Pierluigi Passaro wrote:
> > When the reset gpio is defined within the node of the device tree
> > describing the PHY, the reset is initialized and managed only after
> > calling the fwnode_mdiobus_phy_device_register function.
> > However, before calling it, the MDIO communication is checked by the
> > get_phy_device function.
> > When this happens and the reset GPIO was somehow previously set down,
> > the get_phy_device function fails, preventing the PHY detection.
> > These changes force the deassert of the MDIO reset signal before
> > checking the MDIO channel.
> > The PHY may require a minimum deassert time before being responsive:
> > use a reasonable sleep time after forcing the deassert of the MDIO
> > reset signal.
> > Once done, free the gpio descriptor to allow managing it later.
>
> This has been discussed before. The problem is, it is not just a reset
> GPIO. There could also be a clock which needs turning on, a regulator,
> and/or a linux reset controller. And what order do you turn these on?
>
> The conclusion of the discussion is you assume the device cannot be
> found by enumeration, and you put the ID in the compatible. That is
> enough to get the driver to load, and the driver can then turn
> everything on in the correct order, with the correct delays, etc.
>
Can you provide any reference to this discussion?
>From our investigation, the MDIO communication is checked before managing
the "reset" gpio .
This behaviour is generally not visible, but easily reproducible with all NXP
platforms with dual fec (iMX28, iMX6UL, iMX7, iMX8QM, iMX8QXP)
where the MDIO bus is owned by the 1st interface but shared with the 2nd.
When the 1st interface is probed, this causes the probe of the MDIO bus
when the 2nd interface is not yet set up.
Here a reference configuration
https://github.com/varigit/linux-imx/blob/5.15-2.0.x-imx_var01/arch/arm64/boot/dts/freescale/imx8qm-var-spear.dtsi#L168-L219
Without this patch, the above settings can fail simply forcing the reset GPIOs
to zero in u-boot.
Please let me know if further details are needed.
>
> I think there has been some work on generic power sequencing. I've not
> being following it, so I've no idea how far it has got. If that could
> be used to solve this problem for all the possible controls of a PHY,
> i would be open for such patches.
>
> Andrew
Powered by blists - more mailing lists