Skip to content

Commit 6f08e98

Browse files
Arun Parameswarandavem330
authored andcommitted
net: phy: restore mdio regs in the iproc mdio driver
The mii management register in iproc mdio block does not have a retention register so it is lost on suspend. Save and restore value of register while resuming from suspend. Fixes: bb1a619 ("net: phy: Initialize mdio clock at probe function") Signed-off-by: Arun Parameswaran <[email protected]> Signed-off-by: Scott Branden <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e08ad80 commit 6f08e98

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/net/phy/mdio-bcm-iproc.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,23 @@ static int iproc_mdio_remove(struct platform_device *pdev)
178178
return 0;
179179
}
180180

181+
#ifdef CONFIG_PM_SLEEP
182+
int iproc_mdio_resume(struct device *dev)
183+
{
184+
struct platform_device *pdev = to_platform_device(dev);
185+
struct iproc_mdio_priv *priv = platform_get_drvdata(pdev);
186+
187+
/* restore the mii clock configuration */
188+
iproc_mdio_config_clk(priv->base);
189+
190+
return 0;
191+
}
192+
193+
static const struct dev_pm_ops iproc_mdio_pm_ops = {
194+
.resume = iproc_mdio_resume
195+
};
196+
#endif /* CONFIG_PM_SLEEP */
197+
181198
static const struct of_device_id iproc_mdio_of_match[] = {
182199
{ .compatible = "brcm,iproc-mdio", },
183200
{ /* sentinel */ },
@@ -188,6 +205,9 @@ static struct platform_driver iproc_mdio_driver = {
188205
.driver = {
189206
.name = "iproc-mdio",
190207
.of_match_table = iproc_mdio_of_match,
208+
#ifdef CONFIG_PM_SLEEP
209+
.pm = &iproc_mdio_pm_ops,
210+
#endif
191211
},
192212
.probe = iproc_mdio_probe,
193213
.remove = iproc_mdio_remove,

0 commit comments

Comments
 (0)