All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Pierluigi Passaro <pierluigi.passaro@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	eran.m@variscite.com, nate.d@variscite.com,
	francesco.f@variscite.com, pierluigi.p@variscite.com
Subject: Re: [PATCH] net: mdio: force deassert MDIO reset signal
Date: Sun, 15 Jan 2023 14:56:22 -0800	[thread overview]
Message-ID: <54dd8952-dd39-cab2-8716-cd59d3266d1a@metafoo.de> (raw)
In-Reply-To: <CAJ=UCjUo3t+D9S=J_yEhxCOo5OMj3d-UW6Z6HdwY+O+Q6JO0+A@mail.gmail.com>

On 1/15/23 14:33, Pierluigi Passaro wrote:
> On Sun, Jan 15, 2023 at 10:59 PM Lars-Peter Clausen <lars@metafoo.de> wrote:
>> On 1/15/23 09:08, Andrew Lunn 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 happen 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 conclusions 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.
>> I've been running into this same problem again and again over the past
>> years.
>>
>> Specifying the ID as part of the compatible string works for clause 22
>> PHYs, but for clause 45 PHYs it does not work. The code always wants to
>> read the ID from the PHY itself. But I do not understand things well
>> enough to tell whether that's a fundamental restriction of C45 or just
>> our implementation and the implementation can be changed to fix it.
>>
>> Do you have some thoughts on this?
>>
> IMHO, since the framework allows defining the reset GPIO, it does not sound
> reasonable to manage it only after checking if the PHY can communicate:
> if the reset is asserted, the PHY cannot communicate at all.
> This patch just ensures that, if the reset GPIO is defined, it's not asserted
> while checking the communication.

I fully agree with you and I think this is the right approach, cause it 
is required to make systems work. But I've seen two attempts in the past 
that did the very same thing and they always got rejected. I can't find 
the patches anymore, but I think one was maybe 2 years ago.


  reply	other threads:[~2023-01-15 22:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-15 16:10 [PATCH] net: mdio: force deassert MDIO reset signal Pierluigi Passaro
2023-01-15 17:08 ` Andrew Lunn
2023-01-15 18:38   ` Pierluigi Passaro
2023-01-15 19:02     ` Andrew Lunn
2023-01-15 20:34       ` Pierluigi Passaro
2023-01-15 21:58   ` Lars-Peter Clausen
2023-01-15 22:33     ` Pierluigi Passaro
2023-01-15 22:56       ` Lars-Peter Clausen [this message]
2023-01-15 23:16         ` Pierluigi Passaro
2023-01-16  0:11       ` Andrew Lunn
2023-01-16  9:44         ` Pierluigi Passaro
2023-01-16 10:21           ` Russell King (Oracle)
2023-01-17 14:01           ` Andrew Lunn
2023-01-17 15:20             ` Pierluigi Passaro
2023-01-15 23:55     ` Andrew Lunn
2023-01-16  2:21       ` Lars-Peter Clausen
2023-01-16  9:51         ` Pierluigi Passaro
2023-01-17 13:40         ` Andrew Lunn
2023-01-17 13:48           ` Lars-Peter Clausen
2023-01-17 14:13             ` Andrew Lunn
2023-01-16  8:39       ` Pierluigi Passaro
2023-01-17 13:43         ` Andrew Lunn
2023-01-16  8:43 ` kernel test robot
2023-01-16 10:32   ` Pierluigi Passaro
2023-01-16 10:34     ` Russell King (Oracle)
2023-01-16 14:35   ` Pierluigi Passaro
2023-01-17 19:25 kernel test robot
2023-01-17 20:30 ` Dan Carpenter

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=54dd8952-dd39-cab2-8716-cd59d3266d1a@metafoo.de \
    --to=lars@metafoo.de \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eran.m@variscite.com \
    --cc=francesco.f@variscite.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=nate.d@variscite.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pierluigi.p@variscite.com \
    --cc=pierluigi.passaro@gmail.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.