From patchwork Tue Oct 22 14:07:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 21216 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 044FF244B2 for ; Tue, 22 Oct 2013 14:07:58 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id 1sf16120095qec.6 for ; Tue, 22 Oct 2013 07:07:57 -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=wp1i3EqFh2FaO7ywq4lY9AXLutTvCH0KiOgF3Faduu0=; b=Y/BVoL8EkGQq0FfXuzz+mtd5H60jWfrZDmK0LB9Qis5xZaAi/zUN9vRP5hXb+SDSAy lUyiVS8xT7R0DT8RfG3VLLlt/ooDHwPFIY5F7VCTWJXE3ULagksZzNEkxhY4H1q7DHhW 2oOUSQzJTz/kYhoYKUHb5fw33UgDl8TYJMAAGRLEcVbEl84xy0nuctnKyG3qCH5xYm7q c6V79RGa/hzik5O/RPiS2bMwF1MhKESW8Y+QKPob/BqC8dpqA69Ht0YVlc5PnutrTPav 3nv00SmA7IBhPf1I4h33bPMMxdjQBboxM2f7ReXayKwlaesM4+5Vfdqmk9dQ/ejbcL/6 Dr8w== X-Received: by 10.224.24.65 with SMTP id u1mr21625613qab.6.1382450877861; Tue, 22 Oct 2013 07:07:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.109.226 with SMTP id hv2ls149986qeb.22.gmail; Tue, 22 Oct 2013 07:07:57 -0700 (PDT) X-Received: by 10.52.22.110 with SMTP id c14mr1073341vdf.28.1382450877344; Tue, 22 Oct 2013 07:07:57 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id gq10si5812937vdc.30.2013.10.22.07.07.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Oct 2013 07:07:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.182 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.182; Received: by mail-ve0-f182.google.com with SMTP id oy12so5405995veb.27 for ; Tue, 22 Oct 2013 07:07:57 -0700 (PDT) X-Gm-Message-State: ALoCoQl5Gpv3fR9UV3adbKv0/AbQZM5eXo76mC6fRDlfQujkT0JXVqk2T3pAvvMsBscLmVaCJp/F X-Received: by 10.220.97.145 with SMTP id l17mr88019vcn.35.1382450877275; Tue, 22 Oct 2013 07:07:57 -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 u4csp233672vcz; Tue, 22 Oct 2013 07:07:56 -0700 (PDT) X-Received: by 10.112.138.164 with SMTP id qr4mr1415716lbb.49.1382450875961; Tue, 22 Oct 2013 07:07:55 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com [209.85.215.51]) by mx.google.com with ESMTPS id k4si9137778lah.150.2013.10.22.07.07.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Oct 2013 07:07:55 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.51 is neither permitted nor denied by best guess record for domain of ulf.hansson@linaro.org) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ea20so2776727lab.24 for ; Tue, 22 Oct 2013 07:07:55 -0700 (PDT) X-Received: by 10.152.203.233 with SMTP id kt9mr6282848lac.29.1382450875353; Tue, 22 Oct 2013 07:07:55 -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 ur6sm15932916lbc.5.2013.10.22.07.07.53 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Oct 2013 07:07:54 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Chris Ball Cc: Ulf Hansson , Guennadi Liakhovetski Subject: [PATCH v2 7/7] mmc: sh_mmcif: Extend clock gating routine for runtime suspend Date: Tue, 22 Oct 2013 16:07:26 +0200 Message-Id: <1382450846-17144-8-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1382450846-17144-1-git-send-email-ulf.hansson@linaro.org> References: <1382450846-17144-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.182 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index 07c3af5..d6ddfe7 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; @@ -1020,6 +1021,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; @@ -1551,6 +1553,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; } @@ -1560,6 +1565,11 @@ static int sh_mmcif_runtime_resume(struct device *dev) struct sh_mmcif_host *host = dev_get_drvdata(dev); sh_mmcif_clk_update(host); + + if (host->clk_cache) { + sh_mmcif_sync_reset(host); + sh_mmcif_clock_control(host, host->clk_cache); + } return 0; } #endif