All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers
@ 2012-07-17 18:09 Mugunthan V N
  2012-07-17 18:09 ` [PATCH 1/2] driver: net: ethernet: davinci_mdio: runtime PM support Mugunthan V N
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Mugunthan V N @ 2012-07-17 18:09 UTC (permalink / raw)
  To: netdev; +Cc: davem, Mugunthan V N

This patch set adds support for runtime PM support for CPSW and Davinci MDIO
drivers

Mugunthan V N (2):
  driver: net: ethernet: davinci_mdio: runtime PM support
  driver: net: ethernet: cpsw: runtime PM support

 drivers/net/ethernet/ti/cpsw.c         |   23 ++++++++++++++---------
 drivers/net/ethernet/ti/davinci_mdio.c |   25 ++++++++++++-------------
 2 files changed, 26 insertions(+), 22 deletions(-)

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

* [PATCH 1/2] driver: net: ethernet: davinci_mdio: runtime PM support
  2012-07-17 18:09 [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers Mugunthan V N
@ 2012-07-17 18:09 ` Mugunthan V N
  2012-07-17 18:09 ` [PATCH 2/2] driver: net: ethernet: cpsw: " Mugunthan V N
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Mugunthan V N @ 2012-07-17 18:09 UTC (permalink / raw)
  To: netdev; +Cc: davem, Mugunthan V N

Enabling runtime PM support for davinci mdio driver

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 drivers/net/ethernet/ti/davinci_mdio.c |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index e4e4708..cd7ee20 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -34,6 +34,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/pm_runtime.h>
 #include <linux/davinci_emac.h>
 
 /*
@@ -321,7 +322,9 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
 	snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s-%x",
 		pdev->name, pdev->id);
 
-	data->clk = clk_get(dev, NULL);
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_get_sync(&pdev->dev);
+	data->clk = clk_get(&pdev->dev, "fck");
 	if (IS_ERR(data->clk)) {
 		dev_err(dev, "failed to get device clock\n");
 		ret = PTR_ERR(data->clk);
@@ -329,8 +332,6 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
 		goto bail_out;
 	}
 
-	clk_enable(data->clk);
-
 	dev_set_drvdata(dev, data);
 	data->dev = dev;
 	spin_lock_init(&data->lock);
@@ -378,10 +379,10 @@ bail_out:
 	if (data->bus)
 		mdiobus_free(data->bus);
 
-	if (data->clk) {
-		clk_disable(data->clk);
+	if (data->clk)
 		clk_put(data->clk);
-	}
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 
 	kfree(data);
 
@@ -396,10 +397,10 @@ static int __devexit davinci_mdio_remove(struct platform_device *pdev)
 	if (data->bus)
 		mdiobus_free(data->bus);
 
-	if (data->clk) {
-		clk_disable(data->clk);
+	if (data->clk)
 		clk_put(data->clk);
-	}
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 
 	dev_set_drvdata(dev, NULL);
 
@@ -421,8 +422,7 @@ static int davinci_mdio_suspend(struct device *dev)
 	__raw_writel(ctrl, &data->regs->control);
 	wait_for_idle(data);
 
-	if (data->clk)
-		clk_disable(data->clk);
+	pm_runtime_put_sync(data->dev);
 
 	data->suspended = true;
 	spin_unlock(&data->lock);
@@ -436,8 +436,7 @@ static int davinci_mdio_resume(struct device *dev)
 	u32 ctrl;
 
 	spin_lock(&data->lock);
-	if (data->clk)
-		clk_enable(data->clk);
+	pm_runtime_put_sync(data->dev);
 
 	/* restart the scan state machine */
 	ctrl = __raw_readl(&data->regs->control);
-- 
1.7.0.4

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

* [PATCH 2/2] driver: net: ethernet: cpsw: runtime PM support
  2012-07-17 18:09 [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers Mugunthan V N
  2012-07-17 18:09 ` [PATCH 1/2] driver: net: ethernet: davinci_mdio: runtime PM support Mugunthan V N
@ 2012-07-17 18:09 ` Mugunthan V N
  2012-07-17 18:13 ` [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers David Miller
  2012-07-18 16:45 ` David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: Mugunthan V N @ 2012-07-17 18:09 UTC (permalink / raw)
  To: netdev; +Cc: davem, Mugunthan V N

Enabling runtime PM support for cpsw driver

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 drivers/net/ethernet/ti/cpsw.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index ca381d3..1e5d85b 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -27,6 +27,7 @@
 #include <linux/phy.h>
 #include <linux/workqueue.h>
 #include <linux/delay.h>
+#include <linux/pm_runtime.h>
 
 #include <linux/platform_data/cpsw.h>
 
@@ -494,11 +495,7 @@ static int cpsw_ndo_open(struct net_device *ndev)
 	cpsw_intr_disable(priv);
 	netif_carrier_off(ndev);
 
-	ret = clk_enable(priv->clk);
-	if (ret < 0) {
-		dev_err(priv->dev, "unable to turn on device clock\n");
-		return ret;
-	}
+	pm_runtime_get_sync(&priv->pdev->dev);
 
 	reg = __raw_readl(&priv->regs->id_ver);
 
@@ -569,7 +566,7 @@ static int cpsw_ndo_stop(struct net_device *ndev)
 	netif_carrier_off(priv->ndev);
 	cpsw_ale_stop(priv->ale);
 	for_each_slave(priv, cpsw_slave_stop, priv);
-	clk_disable(priv->clk);
+	pm_runtime_put_sync(&priv->pdev->dev);
 	return 0;
 }
 
@@ -763,10 +760,12 @@ static int __devinit cpsw_probe(struct platform_device *pdev)
 	for (i = 0; i < data->slaves; i++)
 		priv->slaves[i].slave_num = i;
 
-	priv->clk = clk_get(&pdev->dev, NULL);
+	pm_runtime_enable(&pdev->dev);
+	priv->clk = clk_get(&pdev->dev, "fck");
 	if (IS_ERR(priv->clk)) {
-		dev_err(priv->dev, "failed to get device clock)\n");
-		ret = -EBUSY;
+		dev_err(&pdev->dev, "fck is not found\n");
+		ret = -ENODEV;
+		goto clean_slave_ret;
 	}
 
 	priv->cpsw_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -935,6 +934,8 @@ clean_cpsw_iores_ret:
 			   resource_size(priv->cpsw_res));
 clean_clk_ret:
 	clk_put(priv->clk);
+clean_slave_ret:
+	pm_runtime_disable(&pdev->dev);
 	kfree(priv->slaves);
 clean_ndev_ret:
 	free_netdev(ndev);
@@ -959,6 +960,7 @@ static int __devexit cpsw_remove(struct platform_device *pdev)
 			   resource_size(priv->cpsw_res));
 	release_mem_region(priv->cpsw_ss_res->start,
 			   resource_size(priv->cpsw_ss_res));
+	pm_runtime_disable(&pdev->dev);
 	clk_put(priv->clk);
 	kfree(priv->slaves);
 	free_netdev(ndev);
@@ -973,6 +975,8 @@ static int cpsw_suspend(struct device *dev)
 
 	if (netif_running(ndev))
 		cpsw_ndo_stop(ndev);
+	pm_runtime_put_sync(&pdev->dev);
+
 	return 0;
 }
 
@@ -981,6 +985,7 @@ static int cpsw_resume(struct device *dev)
 	struct platform_device	*pdev = to_platform_device(dev);
 	struct net_device	*ndev = platform_get_drvdata(pdev);
 
+	pm_runtime_get_sync(&pdev->dev);
 	if (netif_running(ndev))
 		cpsw_ndo_open(ndev);
 	return 0;
-- 
1.7.0.4

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

* Re: [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers
  2012-07-17 18:09 [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers Mugunthan V N
  2012-07-17 18:09 ` [PATCH 1/2] driver: net: ethernet: davinci_mdio: runtime PM support Mugunthan V N
  2012-07-17 18:09 ` [PATCH 2/2] driver: net: ethernet: cpsw: " Mugunthan V N
@ 2012-07-17 18:13 ` David Miller
  2012-07-17 18:42   ` N, Mugunthan V
  2012-07-18 16:45 ` David Miller
  3 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2012-07-17 18:13 UTC (permalink / raw)
  To: mugunthanvnm; +Cc: netdev


How many times do you plan on posting this patch set?

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

* RE: [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers
  2012-07-17 18:13 ` [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers David Miller
@ 2012-07-17 18:42   ` N, Mugunthan V
  0 siblings, 0 replies; 6+ messages in thread
From: N, Mugunthan V @ 2012-07-17 18:42 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Tuesday, July 17, 2012 11:44 PM
> To: N, Mugunthan V
> Cc: netdev@vger.kernel.org
> Subject: Re: [PATCH 0/2] runtime PM support for cpsw and davinci mdio
> drivers
> 
> 
> How many times do you plan on posting this patch set?

Sorry, the first patch set was sent by mistake.

Regards,
Mugunthan V N.

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

* Re: [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers
  2012-07-17 18:09 [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers Mugunthan V N
                   ` (2 preceding siblings ...)
  2012-07-17 18:13 ` [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers David Miller
@ 2012-07-18 16:45 ` David Miller
  3 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2012-07-18 16:45 UTC (permalink / raw)
  To: mugunthanvnm; +Cc: netdev

From: Mugunthan V N <mugunthanvnm@ti.com>
Date: Tue, 17 Jul 2012 23:39:48 +0530

> This patch set adds support for runtime PM support for CPSW and Davinci MDIO
> drivers
> 
> Mugunthan V N (2):
>   driver: net: ethernet: davinci_mdio: runtime PM support
>   driver: net: ethernet: cpsw: runtime PM support

All applied to net-next, thanks.

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

end of thread, other threads:[~2012-07-18 16:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-17 18:09 [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers Mugunthan V N
2012-07-17 18:09 ` [PATCH 1/2] driver: net: ethernet: davinci_mdio: runtime PM support Mugunthan V N
2012-07-17 18:09 ` [PATCH 2/2] driver: net: ethernet: cpsw: " Mugunthan V N
2012-07-17 18:13 ` [PATCH 0/2] runtime PM support for cpsw and davinci mdio drivers David Miller
2012-07-17 18:42   ` N, Mugunthan V
2012-07-18 16:45 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.