net: phy: restore mdio regs in the iproc mdio driver
diff mbox series

Message ID 20200214194858.8528-1-scott.branden@broadcom.com
State Changes Requested
Delegated to: David Miller
Headers show
Series
  • net: phy: restore mdio regs in the iproc mdio driver
Related show

Commit Message

Scott Branden Feb. 14, 2020, 7:48 p.m. UTC
From: Arun Parameswaran <arun.parameswaran@broadcom.com>

The mii management register in iproc mdio block
does not have a reention 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")

Signed-off-by: Arun Parameswaran <arun.parameswaran@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
---
 drivers/net/phy/mdio-bcm-iproc.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Andrew Lunn Feb. 14, 2020, 8:33 p.m. UTC | #1
On Fri, Feb 14, 2020 at 11:48:58AM -0800, Scott Branden wrote:
> From: Arun Parameswaran <arun.parameswaran@broadcom.com>
> 
> The mii management register in iproc mdio block
> does not have a reention register so it is lost on suspend.

reention?

	Andrew
Florian Fainelli Feb. 14, 2020, 8:37 p.m. UTC | #2
On 2/14/20 12:33 PM, Andrew Lunn wrote:
> On Fri, Feb 14, 2020 at 11:48:58AM -0800, Scott Branden wrote:
>> From: Arun Parameswaran <arun.parameswaran@broadcom.com>
>>
>> The mii management register in iproc mdio block
>> does not have a reention register so it is lost on suspend.
> 
> reention?

Retention presumably.
Scott Branden Feb. 14, 2020, 9:45 p.m. UTC | #3
On 2020-02-14 12:37 p.m., Florian Fainelli wrote:
> On 2/14/20 12:33 PM, Andrew Lunn wrote:
>> On Fri, Feb 14, 2020 at 11:48:58AM -0800, Scott Branden wrote:
>>> From: Arun Parameswaran <arun.parameswaran@broadcom.com>
>>>
>>> The mii management register in iproc mdio block
>>> does not have a reention register so it is lost on suspend.
>> reention?
> Retention presumably.
Yes, typo.  Will fix commit message.

Patch
diff mbox series

diff --git a/drivers/net/phy/mdio-bcm-iproc.c b/drivers/net/phy/mdio-bcm-iproc.c
index 7e9975d25066..f1ded03f0229 100644
--- a/drivers/net/phy/mdio-bcm-iproc.c
+++ b/drivers/net/phy/mdio-bcm-iproc.c
@@ -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,