From patchwork Wed Oct 2 08:30:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 20746 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 617B425E05 for ; Wed, 2 Oct 2013 08:31:18 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id z20sf1101065yhz.11 for ; Wed, 02 Oct 2013 01:31:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Q2IphTswhAWBIsPMQkUrzFljwEKpJYWB7+KsHFezzJQ=; b=XBOrRXjNi8QclkAVYrkeKUqvVRI/95LL1ZoiOkYxD6LwewYItAWfsgUHyjwvC7HrqD FybODb1qlU5Vc+TXkzW7K1fi+gMcJIk/EFdXmIri5Xs1FycWY0s5tcDz94wzQbIaqCAP z2NmTbq7nY2eJfnUugg439PML1YjUrEt3pqb3xRH4NevlTPiiFQfStEiFirubAEohPGr thI6zi6ROod1Iu28Ob586HhBd2QRWvhoUH+X+e6kuqjALkqU59F6DVmAc2RXNr5rWgX1 UtJ1Om81KLLrEYVBL8u4dr/N+ytX9+ht3Jo8iUpfAukUe2e5GOPGIXk57+2l3dX+hwXv +7aw== X-Received: by 10.236.85.6 with SMTP id t6mr1077690yhe.37.1380702678222; Wed, 02 Oct 2013 01:31:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.29.129 with SMTP id k1ls390627qeh.75.gmail; Wed, 02 Oct 2013 01:31:18 -0700 (PDT) X-Received: by 10.220.181.136 with SMTP id by8mr919842vcb.11.1380702678144; Wed, 02 Oct 2013 01:31:18 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id xs13si90523veb.104.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 01:31:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jy13so307104veb.33 for ; Wed, 02 Oct 2013 01:31:18 -0700 (PDT) X-Gm-Message-State: ALoCoQmlzSDX/oCVqXwMmpVHqFa///CP8COfR4hb+yfBQYAxXX9pc/Jh8PJgmyOVX87alSQY9zAi X-Received: by 10.52.26.69 with SMTP id j5mr756968vdg.21.1380702678077; Wed, 02 Oct 2013 01:31:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp79383vcz; Wed, 2 Oct 2013 01:31:17 -0700 (PDT) X-Received: by 10.112.156.74 with SMTP id wc10mr286325lbb.44.1380702676862; Wed, 02 Oct 2013 01:31:16 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by mx.google.com with ESMTPS id m1si271424lae.130.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 01:31:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.217.178 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id z5so455338lbh.23 for ; Wed, 02 Oct 2013 01:31:16 -0700 (PDT) X-Received: by 10.152.5.162 with SMTP id t2mr960807lat.1.1380702676157; Wed, 02 Oct 2013 01:31:16 -0700 (PDT) Received: from linaro-ulf.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id e4sm890041lba.15.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 01:31:15 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson , Guennadi Liakhovetski Subject: [PATCH 7/7] mmc: sh_mmcif: Extend clock gating routine for runtime suspend Date: Wed, 2 Oct 2013 10:30:51 +0200 Message-Id: <1380702651-13389-8-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1380702651-13389-1-git-send-email-ulf.hansson@linaro.org> References: <1380702651-13389-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , At request inactivity, we don't want to rely on gating the clock only through the clock API since this will depend on the clock tree and the clients using the clocks. To make sure the clock is fully gated towards the card in runtime suspend, we perform clock gating using the internal registers of the controller. Cc: Guennadi Liakhovetski Signed-off-by: Ulf Hansson --- drivers/mmc/host/sh_mmcif.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 0c3a5cf..4e9dbd6 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -230,6 +230,7 @@ struct sh_mmcif_host { struct platform_device *pd; struct clk *hclk; unsigned int clk; + unsigned int clk_cache; int bus_width; unsigned char timing; bool sd_error; @@ -1007,6 +1008,7 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) sh_mmcif_clock_control(host, ios->clock); + host->clk_cache = ios->clock; host->timing = ios->timing; host->bus_width = ios->bus_width; host->state = STATE_IDLE; @@ -1545,6 +1547,9 @@ static int sh_mmcif_runtime_suspend(struct device *dev) { struct sh_mmcif_host *host = dev_get_drvdata(dev); + if (host->clk_cache) + sh_mmcif_clock_control(host, 0); + clk_disable_unprepare(host->hclk); return 0; } @@ -1554,6 +1559,12 @@ static int sh_mmcif_runtime_resume(struct device *dev) struct sh_mmcif_host *host = dev_get_drvdata(dev); clk_prepare_enable(host->hclk); + + if (host->clk_cache) { + sh_mmcif_sync_reset(host); + sh_mmcif_clock_control(host, host->clk_cache); + } + return 0; } #endif