From patchwork Wed Jul 10 15:42:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 2825772 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 779DDC0AB2 for ; Wed, 10 Jul 2013 15:43:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B439C20198 for ; Wed, 10 Jul 2013 15:43:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6266820196 for ; Wed, 10 Jul 2013 15:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754810Ab3GJPmd (ORCPT ); Wed, 10 Jul 2013 11:42:33 -0400 Received: from mail-ye0-f202.google.com ([209.85.213.202]:44137 "EHLO mail-ye0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754469Ab3GJPmP (ORCPT ); Wed, 10 Jul 2013 11:42:15 -0400 Received: by mail-ye0-f202.google.com with SMTP id r11so615697yen.3 for ; Wed, 10 Jul 2013 08:42:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=qXp1qTtrH3H0nq3NCZxLS1pycIjLXYn4OQrak/dovos=; b=WiC5qWZcJeXIQg22063Zz+x1/2KiRFaqdg2lBwc56e0otlDnbyJig+poZvzrmueizA Nbk3B3RjGDqQSl7EuNAbsl5Cycep2G5fNzjsvt2JCsGmrMPHbivdCMtEe/R+WWb1B8ub 8JSsc3F4f3LNfqcrPP9p4tx/615NNGn03J7APHHhr9DZHAA9Yh5KomhabAzGDDHl9brZ N3ZaMlKRGJ1rZuT7vAn3lGqg4ZYqgyxDPYoB+GYUTLpUDIlnLT8XpXcRHVy+bXDoMjPO Xknqni8F4UXHoDdPk1UzKYEvmVYgR6lpNCK9pjFQspMdFtnlIOeoaJvNF2edlg8vrTFo h8oA== X-Received: by 10.236.125.200 with SMTP id z48mr17281770yhh.55.1373470934894; Wed, 10 Jul 2013 08:42:14 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id n70si1952821yhj.7.2013.07.10.08.42.14 for (version=TLSv1.1 cipher=AES128-SHA bits=128/128); Wed, 10 Jul 2013 08:42:14 -0700 (PDT) Received: from tictac.mtv.corp.google.com (tictac.mtv.corp.google.com [172.22.162.34]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id B7CA65A40F7; Wed, 10 Jul 2013 08:42:14 -0700 (PDT) Received: by tictac.mtv.corp.google.com (Postfix, from userid 121310) id 6D91880919; Wed, 10 Jul 2013 08:42:14 -0700 (PDT) From: Doug Anderson To: Chris Ball Cc: Olof Johansson , Jaehoon Chung , Seungwon Jeon , James Hogan , Grant Grundler , Alim Akhtar , Abhilash Kesavan , Tomasz Figa , Doug Anderson , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/5] mmc: dw_mmc: Always setup the bus after suspend/resume Date: Wed, 10 Jul 2013 08:42:05 -0700 Message-Id: <1373470926-19314-5-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 1.8.3 In-Reply-To: <1373470926-19314-1-git-send-email-dianders@chromium.org> References: <1373411961-23812-1-git-send-email-dianders@chromium.org> <1373470926-19314-1-git-send-email-dianders@chromium.org> X-Gm-Message-State: ALoCoQnvmp9AtsTu5vgEDU3anMsEI8vl20ja2dUmBIyLD5GuyBwc4crAVa3pfE7FkjQCqOgrd1RQiESDoS0ddQborBOItHEa0BErDFTTlOYgHrNaN6hSZ3vwh7N+pdE3axBBwJUMN1TQIsVHAHtd+k4SoSLZMmLgJUiglucmKZASKuye4YRccWnQnjMYKqLm1mS7VbrH8TUdRW+gtbbdk2HIMZ2S6oaHSw== 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.2 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 After suspend/resume all of the dw_mmc registers are reset to defaults. We restore most of them, but specifically don't setup the clock registers after resume unless we've got a powered card. Things still work because the core will eventually call set_ios() and we'll set things up. There doesn't seem to be any reason that I can see _not_ to set things up after resume. Restoring this state makes the code easier to reason about and should help prevent bugs. It also allows us to do a register dump before and after suspend/resume to confirm that we've set things up OK. I examined the state of the dw_mmc instance before and after suspend after this patch. I had no card inserted in an SD card slot. Before this patch, differences were: * CLKDIV (0x08) * CLKENA (0x10) * TMOUT (0x14) * CMD (0x2C) - difference is not important * CLKSEL (0x9C - exynos specific) After this patch, only TMOUT was different. I have a separate patch for that. Signed-off-by: Doug Anderson --- Changes in v3: None Changes in v2: None drivers/mmc/host/dw_mmc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 7a5ce6a..be095b7 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -2499,9 +2499,7 @@ int dw_mci_resume(struct dw_mci *host) struct dw_mci_slot *slot = host->slot[i]; if (!slot) continue; - if (slot->mmc->pm_flags & MMC_PM_KEEP_POWER) { - dw_mci_set_ios(slot->mmc, &slot->mmc->ios); - } + dw_mci_set_ios(slot->mmc, &slot->mmc->ios); ret = mmc_resume_host(host->slot[i]->mmc); if (ret < 0)