2021-01-14 11:08:43

by Heiner Kallweit

[permalink] [raw]
Subject: Re: [PATCH] net: phy: micrel: reconfigure the phy on resume

On 14.01.2021 11:41, [email protected] wrote:
>
>
> On 14.01.2021 12:25, Russell King - ARM Linux admin wrote:
>>
>> As I've said, if phylib/PHY driver is not restoring the state of the
>> PHY on resume from suspend-to-ram, then that's an issue with phylib
>> and/or the phy driver.
>
> In the patch I proposed in this thread the restoring is done in PHY driver.
> Do you think I should continue the investigation and check if something
> should be done from the phylib itself?
>
It was the right move to approach the PM maintainers to clarify whether
the resume PM callback has to assume that power had been cut off and
it has to completely reconfigure the device. If they confirm this
understanding, then:
- the general question remains why there's separate resume and restore
callbacks, and what restore is supposed to do that resume doesn't
have to do
- it should be sufficient to use mdio_bus_phy_restore also as resume
callback (instead of changing each and every PHY driver's resume),
because we can expect that somebody cutting off power to the PHY
properly suspends the MDIO bus before

> Thank you,
> Claudiu Beznea
>
>>
>> --
>> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
>> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!


2021-02-11 12:23:18

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] net: phy: micrel: reconfigure the phy on resume

On Thu 2021-01-14 12:05:21, Heiner Kallweit wrote:
> On 14.01.2021 11:41, [email protected] wrote:
> >
> >
> > On 14.01.2021 12:25, Russell King - ARM Linux admin wrote:
> >>
> >> As I've said, if phylib/PHY driver is not restoring the state of the
> >> PHY on resume from suspend-to-ram, then that's an issue with phylib
> >> and/or the phy driver.
> >
> > In the patch I proposed in this thread the restoring is done in PHY driver.
> > Do you think I should continue the investigation and check if something
> > should be done from the phylib itself?
> >
> It was the right move to approach the PM maintainers to clarify whether
> the resume PM callback has to assume that power had been cut off and
> it has to completely reconfigure the device. If they confirm this
> understanding, then:

Power to some devices can be cut during s2ram, yes.

> - the general question remains why there's separate resume and restore
> callbacks, and what restore is supposed to do that resume doesn't
> have to do

You'll often have same implementation, yes.

> - it should be sufficient to use mdio_bus_phy_restore also as resume
> callback (instead of changing each and every PHY driver's resume),
> because we can expect that somebody cutting off power to the PHY
> properly suspends the MDIO bus before

If restore works with power cut and power not cut then yes, you should
get away with that.

Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek


Attachments:
(No filename) (1.49 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2021-02-11 13:04:01

by Heiner Kallweit

[permalink] [raw]
Subject: Re: [PATCH] net: phy: micrel: reconfigure the phy on resume

On 11.02.2021 13:17, Pavel Machek wrote:
> On Thu 2021-01-14 12:05:21, Heiner Kallweit wrote:
>> On 14.01.2021 11:41, [email protected] wrote:
>>>
>>>
>>> On 14.01.2021 12:25, Russell King - ARM Linux admin wrote:
>>>>
>>>> As I've said, if phylib/PHY driver is not restoring the state of the
>>>> PHY on resume from suspend-to-ram, then that's an issue with phylib
>>>> and/or the phy driver.
>>>
>>> In the patch I proposed in this thread the restoring is done in PHY driver.
>>> Do you think I should continue the investigation and check if something
>>> should be done from the phylib itself?
>>>
>> It was the right move to approach the PM maintainers to clarify whether
>> the resume PM callback has to assume that power had been cut off and
>> it has to completely reconfigure the device. If they confirm this
>> understanding, then:
>
> Power to some devices can be cut during s2ram, yes.
>
Thanks for the confirmation.

>> - the general question remains why there's separate resume and restore
>> callbacks, and what restore is supposed to do that resume doesn't
>> have to do
>
> You'll often have same implementation, yes.
>

If resume and restore both have to assume that power was cut off,
then they have to fully re-initialize the device. Therefore it's still
not clear to me when you would have differing implementations for both
callbacks.

>> - it should be sufficient to use mdio_bus_phy_restore also as resume
>> callback (instead of changing each and every PHY driver's resume),
>> because we can expect that somebody cutting off power to the PHY
>> properly suspends the MDIO bus before
>
> If restore works with power cut and power not cut then yes, you should
> get away with that.
>
> Best regards,
> Pavel
>

Heiner

2021-02-11 20:37:38

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] net: phy: micrel: reconfigure the phy on resume

On Thu 2021-02-11 13:36:16, Heiner Kallweit wrote:
> On 11.02.2021 13:17, Pavel Machek wrote:
> > On Thu 2021-01-14 12:05:21, Heiner Kallweit wrote:
> >> On 14.01.2021 11:41, [email protected] wrote:
> >>>
> >>>
> >>> On 14.01.2021 12:25, Russell King - ARM Linux admin wrote:
> >>>>
> >>>> As I've said, if phylib/PHY driver is not restoring the state of the
> >>>> PHY on resume from suspend-to-ram, then that's an issue with phylib
> >>>> and/or the phy driver.
> >>>
> >>> In the patch I proposed in this thread the restoring is done in PHY driver.
> >>> Do you think I should continue the investigation and check if something
> >>> should be done from the phylib itself?
> >>>
> >> It was the right move to approach the PM maintainers to clarify whether
> >> the resume PM callback has to assume that power had been cut off and
> >> it has to completely reconfigure the device. If they confirm this
> >> understanding, then:
> >
> > Power to some devices can be cut during s2ram, yes.
> >
> Thanks for the confirmation.
>
> >> - the general question remains why there's separate resume and restore
> >> callbacks, and what restore is supposed to do that resume doesn't
> >> have to do
> >
> > You'll often have same implementation, yes.
> >
>
> If resume and restore both have to assume that power was cut off,
> then they have to fully re-initialize the device. Therefore it's still
> not clear to me when you would have differing implementations for both
> callbacks.

Full re-init is easiest way, yes.

But restore had different Linux kernel already booting on device, and
maybe touching the hardware, and resume may or may not cut power to
all devices.

So yes they can be different.

Regards,
Pavel
--
http://www.livejournal.com/~pavelmachek


Attachments:
(No filename) (1.79 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments