Re: [RFC PATCH] net: phy: micrel: reset KSZ9x31 when resuming

From: Andrew Lunn
Date: Tue Jan 09 2024 - 16:04:51 EST


> +static int ksz9x31_resume(struct phy_device *phydev)
> +{
> + phy_device_reset(phydev, 1);
> + phy_device_reset(phydev, 0);
> +
> + return kszphy_resume(phydev);
> +}
> +
> static int kszphy_probe(struct phy_device *phydev)
> {
> const struct kszphy_type *type = phydev->drv->driver_data;
> @@ -4778,7 +4786,7 @@ static struct phy_driver ksphy_driver[] = {
> .get_strings = kszphy_get_strings,
> .get_stats = kszphy_get_stats,
> .suspend = kszphy_suspend,
> - .resume = kszphy_resume,
> + .resume = ksz9x31_resume,

Humm, i'm not so sure about this.

phy_resume() is called by mdio_bus_phy_resume(). That first does a
call to phy_init_hw(), which will perform a soft reset on the PHY,
call the drivers config_init() callback, and the config_intr()
callback. Then it calls phy_resume().

Does phy_resume() hitting it with a reset clear out the configuration
done by config_init() and the interrupt configuration performed by
config_intr()?

Andrew