[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH+2xPCrMGzvbtjY14gEDf0EXdMmYP+3R1LX7fNZMUJg8WqMiQ@mail.gmail.com>
Date: Tue, 28 Jul 2020 14:49:16 +0200
From: Bruno Thomsen <bruno.thomsen@...il.com>
To: Fabio Estevam <festevam@...il.com>
Cc: netdev <netdev@...r.kernel.org>, Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Russell King - ARM Linux <linux@...linux.org.uk>,
Heiner Kallweit <hkallweit1@...il.com>,
Lars Alex Pedersen <laa@...strup.com>,
Bruno Thomsen <bth@...strup.com>
Subject: Re: [PATCH 1/2] net: mdiobus: reset deassert delay
Hi Fabio
Den tir. 28. jul. 2020 kl. 14.32 skrev Fabio Estevam <festevam@...il.com>:
> On Tue, Jul 28, 2020 at 6:02 AM Bruno Thomsen <bruno.thomsen@...il.com> wrote:
> >
> > The current reset logic only has a delay during assert.
> > This reuses the delay value as deassert delay to ensure
> > PHYs are ready for commands. Delays are typically needed
> > when external hardware slows down reset release with a
> > RC network. This solution does not need any new device
> > tree bindings.
> > It also improves handling of long delays (>20ms) by using
> > the generic fsleep() for selecting appropriate delay
> > function.
>
> It seems that this patch should be split in two:
>
> One that changes from udelay() to sleep()
> and another one that adds the delay after the reset line is de-asserted.
Okay, I will split it in version 2.
> > drivers/net/phy/mdio_bus.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> > index 6ceee82b2839..84d5ab07fe16 100644
> > --- a/drivers/net/phy/mdio_bus.c
> > +++ b/drivers/net/phy/mdio_bus.c
> > @@ -627,8 +627,9 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner)
> > bus->reset_gpiod = gpiod;
> >
> > gpiod_set_value_cansleep(gpiod, 1);
> > - udelay(bus->reset_delay_us);
> > + fsleep(bus->reset_delay_us);
> > gpiod_set_value_cansleep(gpiod, 0);
> > + fsleep(bus->reset_delay_us);
>
> Shouldn't it use the value passed in the reset-deassert-us property instead?
This place does not use the per PHY reset properties as they are only used
after auto type ID detection. When you need a reset before auto type
ID detection,
it can only be done using the MDIO reset, and it only has
"reset-delay-us" property.
It will be a rather big change if all PHY nodes can choose if reset
should happen
before or after type ID detection.
/Bruno
Powered by blists - more mailing lists