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: 2973401 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2BEB39F954 for ; Wed, 2 Oct 2013 08:31:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB6AD201BE for ; Wed, 2 Oct 2013 08:31:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6F9E20115 for ; Wed, 2 Oct 2013 08:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753385Ab3JBIbS (ORCPT ); Wed, 2 Oct 2013 04:31:18 -0400 Received: from mail-lb0-f178.google.com ([209.85.217.178]:50788 "EHLO mail-lb0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753151Ab3JBIbR (ORCPT ); Wed, 2 Oct 2013 04:31:17 -0400 Received: by mail-lb0-f178.google.com with SMTP id z5so472765lbh.9 for ; Wed, 02 Oct 2013 01:31:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q2IphTswhAWBIsPMQkUrzFljwEKpJYWB7+KsHFezzJQ=; b=E1Ta9fHVAIbgBafe0DUUeqNhtQTkSloZhzUp1aRvy9GY3r9H4jKywCGEOzDVEV/PEO uK74oeEGjDCnW90hXtu/XZ+vQcxl0TVB95vnhkqVjk104uIEi/gL11rf5jh3lDCw6CP2 e8t57toT2iA34bSjjE9M1i3chUW8WhoD2Udkc+vOunUurVTAy6OaD6Jxoza+oObHb/+Z 77UvMSzJPgniwk8c/AqHmuxvb+JSJ4QPTUXspgf3Hv3Gg5bfYcJI3q7BX1n3ahvnfY/3 UdBxjLpSMdC/IHjn/uwvN8x9YeofyaWD8KGEtxAOUZo2DbzrULoZFqQZg4ILaMtVVcHC F0uA== X-Gm-Message-State: ALoCoQlZnHIjcHQ3NpDvo31VGdOIjcJlrB/9L4WkBXmLfpaW32Bi06+1kfkWGM8WOBmwD7pjsVuo 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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