Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] net: phy: restore mdio regs in the iproc mdio driver
@ 2020-02-14 19:48 Scott Branden
  2020-02-14 20:33 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Branden @ 2020-02-14 19:48 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit
  Cc: Russell King, David S . Miller, Ray Jui,
	bcm-kernel-feedback-list, netdev, linux-arm-kernel, linux-kernel,
	Arun Parameswaran, Scott Branden

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(+)

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,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: restore mdio regs in the iproc mdio driver
  2020-02-14 19:48 [PATCH] net: phy: restore mdio regs in the iproc mdio driver Scott Branden
@ 2020-02-14 20:33 ` Andrew Lunn
  2020-02-14 20:37   ` Florian Fainelli
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2020-02-14 20:33 UTC (permalink / raw)
  To: Scott Branden
  Cc: Florian Fainelli, Heiner Kallweit, Ray Jui, Arun Parameswaran,
	Russell King, linux-kernel, bcm-kernel-feedback-list, netdev,
	David S . Miller, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: restore mdio regs in the iproc mdio driver
  2020-02-14 20:33 ` Andrew Lunn
@ 2020-02-14 20:37   ` Florian Fainelli
  2020-02-14 21:45     ` Scott Branden
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Fainelli @ 2020-02-14 20:37 UTC (permalink / raw)
  To: Andrew Lunn, Scott Branden
  Cc: Heiner Kallweit, Ray Jui, Arun Parameswaran, Russell King,
	linux-kernel, bcm-kernel-feedback-list, netdev, David S . Miller,
	linux-arm-kernel

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.
-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: phy: restore mdio regs in the iproc mdio driver
  2020-02-14 20:37   ` Florian Fainelli
@ 2020-02-14 21:45     ` Scott Branden
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Branden @ 2020-02-14 21:45 UTC (permalink / raw)
  To: Florian Fainelli, Andrew Lunn
  Cc: Heiner Kallweit, Ray Jui, Arun Parameswaran, Russell King,
	linux-kernel, bcm-kernel-feedback-list, netdev, David S . Miller,
	linux-arm-kernel



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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 19:48 [PATCH] net: phy: restore mdio regs in the iproc mdio driver Scott Branden
2020-02-14 20:33 ` Andrew Lunn
2020-02-14 20:37   ` Florian Fainelli
2020-02-14 21:45     ` Scott Branden

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git