From patchwork Thu Apr 23 08:45:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajendra Nayak X-Patchwork-Id: 6260931 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 62ACEBF4A6 for ; Thu, 23 Apr 2015 08:50:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8838920251 for ; Thu, 23 Apr 2015 08:50:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 925FA20328 for ; Thu, 23 Apr 2015 08:50:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlCnn-0005FI-Dl; Thu, 23 Apr 2015 08:48:07 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YlCmL-0004E4-Qp for linux-arm-kernel@lists.infradead.org; Thu, 23 Apr 2015 08:46:39 +0000 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 62BBD140710; Thu, 23 Apr 2015 08:46:11 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 518DB140715; Thu, 23 Apr 2015 08:46:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from blr-ubuntu-34.ap.qualcomm.com (unknown [202.46.23.61]) (using TLSv1.1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: rnayak@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 301B2140710; Thu, 23 Apr 2015 08:46:07 +0000 (UTC) From: Rajendra Nayak To: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [RFC/RFT 6/6] spi: qup: Get rid of clock handling as its done using runtime callbacks Date: Thu, 23 Apr 2015 14:15:44 +0530 Message-Id: <1429778744-13352-7-git-send-email-rnayak@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 In-Reply-To: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org> References: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150423_014637_959207_3982D996 X-CRM114-Status: GOOD ( 15.99 ) X-Spam-Score: -0.0 (/) Cc: Rajendra Nayak X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Remove all clock handling from the driver as this is not handled from within platform runtime callbacks. Signed-off-by: Rajendra Nayak --- drivers/spi/spi-qup.c | 54 ++++++++++----------------------------------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index 810a7fa..a95993b 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c @@ -131,7 +131,6 @@ struct spi_qup { void __iomem *base; struct device *dev; struct clk *cclk; /* core clock */ - struct clk *iclk; /* interface clock */ int irq; spinlock_t lock; @@ -753,7 +752,7 @@ err_tx: static int spi_qup_probe(struct platform_device *pdev) { struct spi_master *master; - struct clk *iclk, *cclk; + struct clk *cclk; struct spi_qup *controller; struct resource *res; struct device *dev; @@ -775,10 +774,6 @@ static int spi_qup_probe(struct platform_device *pdev) if (IS_ERR(cclk)) return PTR_ERR(cclk); - iclk = devm_clk_get(dev, "iface"); - if (IS_ERR(iclk)) - return PTR_ERR(iclk); - /* This is optional parameter */ if (of_property_read_u32(dev->of_node, "spi-max-frequency", &max_freq)) max_freq = SPI_MAX_RATE; @@ -788,23 +783,15 @@ static int spi_qup_probe(struct platform_device *pdev) return -ENXIO; } - ret = clk_prepare_enable(cclk); - if (ret) { - dev_err(dev, "cannot enable core clock\n"); - return ret; - } - - ret = clk_prepare_enable(iclk); - if (ret) { - clk_disable_unprepare(cclk); - dev_err(dev, "cannot enable iface clock\n"); - return ret; - } + pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); + pm_runtime_use_autosuspend(dev); + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); master = spi_alloc_master(dev, sizeof(struct spi_qup)); if (!master) { - clk_disable_unprepare(cclk); - clk_disable_unprepare(iclk); + pm_runtime_set_suspended(dev); + pm_runtime_disable(dev); dev_err(dev, "cannot allocate master\n"); return -ENOMEM; } @@ -832,7 +819,6 @@ static int spi_qup_probe(struct platform_device *pdev) controller->dev = dev; controller->base = base; - controller->iclk = iclk; controller->cclk = cclk; controller->irq = irq; @@ -904,24 +890,17 @@ static int spi_qup_probe(struct platform_device *pdev) if (ret) goto error_dma; - pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC); - pm_runtime_use_autosuspend(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - ret = devm_spi_register_master(dev, master); if (ret) - goto disable_pm; + goto error_dma; return 0; -disable_pm: - pm_runtime_disable(&pdev->dev); error_dma: spi_qup_release_dma(master); error: - clk_disable_unprepare(cclk); - clk_disable_unprepare(iclk); + pm_runtime_set_suspended(&pdev->dev); + pm_runtime_disable(&pdev->dev); spi_master_put(master); return ret; } @@ -969,8 +948,6 @@ static int spi_qup_suspend(struct device *device) if (ret) return ret; - clk_disable_unprepare(controller->cclk); - clk_disable_unprepare(controller->iclk); return 0; } @@ -980,14 +957,6 @@ static int spi_qup_resume(struct device *device) struct spi_qup *controller = spi_master_get_devdata(master); int ret; - ret = clk_prepare_enable(controller->iclk); - if (ret) - return ret; - - ret = clk_prepare_enable(controller->cclk); - if (ret) - return ret; - ret = spi_qup_set_state(controller, QUP_STATE_RESET); if (ret) return ret; @@ -1012,9 +981,6 @@ static int spi_qup_remove(struct platform_device *pdev) spi_qup_release_dma(master); - clk_disable_unprepare(controller->cclk); - clk_disable_unprepare(controller->iclk); - pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); return 0;