Skip to contentSkip to conversation

net: phy: restore mdio regs in the iproc mdio driver

PATCH In review Scott Branden 4 participants 4 messages Feb 14, 2020 – Feb 17, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: phy: restore mdio regs in the iproc mdio driver

From: Arun Parameswaran <[email protected]>

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 bb1a619735b4 ("net: phy: Initialize mdio clock at probe function")
---
 drivers/net/phy/mdio-bcm-iproc.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/net/phy/mdio-bcm-iproc.c +20 -0
index 7e9975d25066..f1ded03f0229 100644
@@ -178,6 +178,23 @@ static int iproc_mdio_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+int iproc_mdio_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct iproc_mdio_priv *priv = platform_get_drvdata(pdev);
+
+	/* restore the mii clock configuration */
+	iproc_mdio_config_clk(priv->base);
+
+	return 0;
+}
+
+static const struct dev_pm_ops iproc_mdio_pm_ops = {
+	.resume = iproc_mdio_resume
+};
+#endif /* CONFIG_PM_SLEEP */
+
 static const struct of_device_id iproc_mdio_of_match[] = {
 	{ .compatible = "brcm,iproc-mdio", },
 	{ /* sentinel */ },
@@ -188,6 +205,9 @@ static struct platform_driver iproc_mdio_driver = {
 	.driver = {
 		.name = "iproc-mdio",
 		.of_match_table = iproc_mdio_of_match,
+#ifdef CONFIG_PM_SLEEP
+		.pm = &iproc_mdio_pm_ops,
+#endif
 	},
 	.probe = iproc_mdio_probe,
 	.remove = iproc_mdio_remove,
Signature · 1 line
2.17.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Scott Branden

From: Arun Parameswaran <[email protected]>

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.

You actually just reconfigure, you don't save it. But that is minor.

Andrew

Reviewed-by on v2 1/1
#2 lore raw
In reply to Scott Branden
Quoted 10 lines · Scott Branden

From: Arun Parameswaran <[email protected]>

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 bb1a619735b4 ("net: phy: Initialize mdio clock at probe function")
Signature · 6 lines
Florian

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#3 lore raw
In reply to Scott Branden

From: Scott Branden <[email protected]>
Date: Fri, 14 Feb 2020 13:47:46 -0800

Quoted 10 lines

From: Arun Parameswaran <[email protected]>

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 bb1a619735b4 ("net: phy: Initialize mdio clock at probe function")

Applied and queued up for -stable.