From patchwork Tue Jul 17 18:09:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mugunthan V N X-Patchwork-Id: 171537 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E064C2C00B0 for ; Wed, 18 Jul 2012 04:10:07 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756225Ab2GQSKD (ORCPT ); Tue, 17 Jul 2012 14:10:03 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:44195 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753835Ab2GQSJ7 (ORCPT ); Tue, 17 Jul 2012 14:09:59 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q6HI9tgu000414; Tue, 17 Jul 2012 13:09:55 -0500 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6HI9s2R000274; Tue, 17 Jul 2012 23:39:54 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Tue, 17 Jul 2012 23:39:54 +0530 Received: from localhost.localdomain (dbdp20.itg.ti.com [172.24.170.38]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6HI9r91012861; Tue, 17 Jul 2012 23:39:53 +0530 From: Mugunthan V N To: CC: , Mugunthan V N Subject: [PATCH 1/2] driver: net: ethernet: davinci_mdio: runtime PM support Date: Tue, 17 Jul 2012 23:39:49 +0530 Message-ID: <1342548590-12502-2-git-send-email-mugunthanvnm@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1342548590-12502-1-git-send-email-mugunthanvnm@ti.com> References: <1342548590-12502-1-git-send-email-mugunthanvnm@ti.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Enabling runtime PM support for davinci mdio driver Signed-off-by: Mugunthan V N --- 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 #include #include +#include #include /* @@ -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);