diff options
author | Thomas Richard <thomas.richard@bootlin.com> | 2024-01-25 18:17:54 +0100 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2024-02-07 15:02:13 +0100 |
commit | bc25f0b57133ae6157c98e38f0eea7de6dc2a114 (patch) | |
tree | 0c345f1f51663f129aae04193c28453e90f434c5 /drivers/phy | |
parent | 442f34ede7afd23e0fa1d838790f531d5e59d697 (diff) | |
download | lwn-bc25f0b57133ae6157c98e38f0eea7de6dc2a114.tar.gz lwn-bc25f0b57133ae6157c98e38f0eea7de6dc2a114.zip |
phy: ti: gmii-sel: add resume support
The resume callback restores the submode of each PHY.
It uses the submode stored in struct phy_gmii_sel_phy_priv (variable
phy_if_mode). The submode was saved by the set_mode PHY operation.
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://lore.kernel.org/r/20240125171754.773909-1-thomas.richard@bootlin.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/phy')
-rw-r--r-- | drivers/phy/ti/phy-gmii-sel.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/phy/ti/phy-gmii-sel.c b/drivers/phy/ti/phy-gmii-sel.c index 0f4818adb440..81dd1c3449d9 100644 --- a/drivers/phy/ti/phy-gmii-sel.c +++ b/drivers/phy/ti/phy-gmii-sel.c @@ -494,11 +494,35 @@ static int phy_gmii_sel_probe(struct platform_device *pdev) return 0; } +static int phy_gmii_sel_resume_noirq(struct device *dev) +{ + struct phy_gmii_sel_priv *priv = dev_get_drvdata(dev); + struct phy_gmii_sel_phy_priv *if_phys = priv->if_phys; + int ret, i; + + for (i = 0; i < priv->num_ports; i++) { + if (if_phys[i].phy_if_mode) { + ret = phy_gmii_sel_mode(if_phys[i].if_phy, + PHY_MODE_ETHERNET, if_phys[i].phy_if_mode); + if (ret) { + dev_err(dev, "port%u: restore mode fail %d\n", + if_phys[i].if_phy->id, ret); + return ret; + } + } + } + + return 0; +} + +static DEFINE_NOIRQ_DEV_PM_OPS(phy_gmii_sel_pm_ops, NULL, phy_gmii_sel_resume_noirq); + static struct platform_driver phy_gmii_sel_driver = { .probe = phy_gmii_sel_probe, .driver = { .name = "phy-gmii-sel", .of_match_table = phy_gmii_sel_id_table, + .pm = pm_sleep_ptr(&phy_gmii_sel_pm_ops), }, }; module_platform_driver(phy_gmii_sel_driver); |