From patchwork Fri Oct 21 14:08:44 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 4777 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 29F3E23EF6 for ; Fri, 21 Oct 2011 14:09:45 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 0DBFBA1805A for ; Fri, 21 Oct 2011 14:09:45 +0000 (UTC) Received: by bkbzs2 with SMTP id zs2so6799255bkb.11 for ; Fri, 21 Oct 2011 07:09:44 -0700 (PDT) Received: by 10.223.77.71 with SMTP id f7mr24998808fak.33.1319206184336; Fri, 21 Oct 2011 07:09:44 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.1.71 with SMTP id 7cs16113lak; Fri, 21 Oct 2011 07:09:44 -0700 (PDT) Received: by 10.213.102.17 with SMTP id e17mr1892205ebo.126.1319206182063; Fri, 21 Oct 2011 07:09:42 -0700 (PDT) Received: from eu1sys200aog101.obsmtp.com (eu1sys200aog101.obsmtp.com. [207.126.144.111]) by mx.google.com with SMTP id a10si4125052een.51.2011.10.21.07.09.28 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 21 Oct 2011 07:09:42 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.111 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) client-ip=207.126.144.111; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.111 is neither permitted nor denied by best guess record for domain of ulf.hansson@stericsson.com) smtp.mail=ulf.hansson@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob101.postini.com ([207.126.147.11]) with SMTP; Fri, 21 Oct 2011 14:09:41 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 604D61A1; Fri, 21 Oct 2011 14:08:51 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id EE4442649; Fri, 21 Oct 2011 14:08:50 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 37DB524C2F0; Fri, 21 Oct 2011 16:08:43 +0200 (CEST) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 21 Oct 2011 16:08:50 +0200 From: Ulf Hansson To: Grant Likely , Cc: , Lee Jones , Ulf Hansson Subject: [PATCH] spi/pl022: Enable clock in probe an use runtime_idle Date: Fri, 21 Oct 2011 16:08:44 +0200 Message-ID: <1319206124-17549-1-git-send-email-ulf.hansson@stericsson.com> X-Mailer: git-send-email 1.7.5.4 MIME-Version: 1.0 Since we are always runtime resumed when leaving probe the clock must be enabled. To accomplish that we are able to be runtime suspended after probe in the case when no request is going to be recieved, a runtime_idle function has been implemented. Change-Id: I6cb86f2cad30ecaab16f512daf4674b039b18213 Signed-off-by: Ulf Hansson Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34447 --- drivers/spi/spi-pl022.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index f103e47..ad48fba 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -2184,6 +2184,12 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) goto err_clk_prep; } + status = clk_enable(pl022->clk); + if (status) { + dev_err(&adev->dev, "could not enable SSP/SPI bus clock\n"); + goto err_no_clk_en; + } + /* Disable SSP */ writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), SSP_CR1(pl022->virtbase)); @@ -2237,6 +2243,8 @@ pl022_probe(struct amba_device *adev, const struct amba_id *id) free_irq(adev->irq[0], pl022); err_no_irq: + clk_disable(pl022->clk); + err_no_clk_en: clk_unprepare(pl022->clk); err_clk_prep: clk_put(pl022->clk); @@ -2342,11 +2350,19 @@ static int pl022_runtime_resume(struct device *dev) return 0; } + +static int pl022_runtime_idle(struct device *dev) +{ + pm_runtime_suspend(dev); + return 0; +} #endif static const struct dev_pm_ops pl022_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pl022_suspend, pl022_resume) - SET_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL) + SET_RUNTIME_PM_OPS(pl022_runtime_suspend, + pl022_runtime_resume, + pl022_runtime_idle) }; static struct vendor_data vendor_arm = {