From patchwork Wed Nov 19 18:51:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 5340311 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 C241C9F1E1 for ; Wed, 19 Nov 2014 18:51:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3D2A20172 for ; Wed, 19 Nov 2014 18:51:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E997200E3 for ; Wed, 19 Nov 2014 18:51:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756572AbaKSSvh (ORCPT ); Wed, 19 Nov 2014 13:51:37 -0500 Received: from mail-ie0-f175.google.com ([209.85.223.175]:39536 "EHLO mail-ie0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756168AbaKSSvg (ORCPT ); Wed, 19 Nov 2014 13:51:36 -0500 Received: by mail-ie0-f175.google.com with SMTP id at20so1124634iec.34 for ; Wed, 19 Nov 2014 10:51:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=7y//tOypwOaF2/Fax8+MHrpFe0k2sGofR881BG1bE9I=; b=hBltlpuT3z8puFq5GlHTh81XXCHBpYgyljsh9og10kN/vGIkW07UBVGYuMafd6go/f jz5uSbvA91Qvs3cl8mEKBTlHY4jG9FKCvnSEWBkBknAiJCfP5i6awEiE+oSst2EXSyDQ O7TuzLGpm4JGySB1eZUltyGE7yf3uXACQmth8= 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; bh=7y//tOypwOaF2/Fax8+MHrpFe0k2sGofR881BG1bE9I=; b=kyGIMWX/YPk7YdeH9DpMcqUbGsu+tnAfQOcYc3Yh6LmwyR/i1/KhqQXZ51Zl9WIkzp G2/A0EdXyVNoOqu4HxbvfmksQTU6mpnKfo9hlYrsmVjpzxdoY/dAmm7B1xugaJ7hhCO+ Ns1ZoDKCEiVIT+08fqMl6ZVvnocVFjBJNCXzl046uy+hdEqgVHdexQM3edCFBInX7QWJ MFFw3HuqPW/wUhB1U0cyP+EJNwy1Ix95PJddB16FTu+quaB3ZkRUgt5yCxOyu23Tng+v kRFFT3+YmUx1sru3Gq2uD72a5xnFUtvqVHWiJBuTsVTyCWr5drR+7UZL30GE9O9ZrCfW MhYg== X-Gm-Message-State: ALoCoQm2tV387RE/NZ+bmeOPLdPPfj7L+t2T28cnw7NdbSMeObYttLc5y0700bw1vd67AymoKcXj X-Received: by 10.107.165.19 with SMTP id o19mr46205052ioe.1.1416423095653; Wed, 19 Nov 2014 10:51:35 -0800 (PST) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by mx.google.com with ESMTPSA id d1sm303108igz.13.2014.11.19.10.51.34 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Nov 2014 10:51:35 -0800 (PST) From: Doug Anderson To: Jaehoon Chung , Seungwon Jeon , Ulf Hansson Cc: Alim Akhtar , Sonny Rao , Andrew Bresticker , Heiko Stuebner , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Doug Anderson , chris@printf.net, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: dw_mmc: Turn the card clock off at suspend time Date: Wed, 19 Nov 2014 10:51:13 -0800 Message-Id: <1416423073-8105-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_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 Since the dw_mmc driver was first added to Linux it's had a TODO in it that we should turn off the card clock during suspend. I have no idea for sure why it wasn't done originally, but if I had to guess I'd guess it was related to the lack of a common clock framework. Let's do it now. There is no reason for the card clock to be left on during suspend and most systems will eventually turn it off anyway (when whole clock trees are disabled). However, it's good to be explicit that it's disabled at the time that the MMC subsystem is disabled. This actually fixes a bug on Rockchip rk3288 where an SDIO card wakes the system back up during suspend. Signed-off-by: Doug Anderson --- drivers/mmc/host/dw_mmc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 5a37c33..c448159 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2825,11 +2825,10 @@ EXPORT_SYMBOL(dw_mci_remove); #ifdef CONFIG_PM_SLEEP -/* - * TODO: we should probably disable the clock to the card in the suspend path. - */ int dw_mci_suspend(struct dw_mci *host) { + clk_disable(host->ciu_clk); + return 0; } EXPORT_SYMBOL(dw_mci_suspend); @@ -2838,6 +2837,8 @@ int dw_mci_resume(struct dw_mci *host) { int i, ret; + clk_enable(host->ciu_clk); + if (!dw_mci_ctrl_reset(host, SDMMC_CTRL_ALL_RESET_FLAGS)) { ret = -ENODEV; return ret;