From patchwork Fri Feb 20 18:57:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 5858261 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 788A49F269 for ; Fri, 20 Feb 2015 18:57:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9E80F204B5 for ; Fri, 20 Feb 2015 18:57:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ABEB7203AE for ; Fri, 20 Feb 2015 18:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbbBTS5f (ORCPT ); Fri, 20 Feb 2015 13:57:35 -0500 Received: from mail-ig0-f171.google.com ([209.85.213.171]:61388 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbbBTS5e (ORCPT ); Fri, 20 Feb 2015 13:57:34 -0500 Received: by mail-ig0-f171.google.com with SMTP id h15so5287872igd.4 for ; Fri, 20 Feb 2015 10:57:33 -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=oLoS4m6usJhs3J6Q8t/ROWxfHvit6d6fh53rz/sF4Zw=; b=GliRCOb0K+lizbuGO1z48t82+9coJSQnd5tz3fMnm5UaNy4fWqdqv5hOH+jhHIMjwp 46qfZZuQsr9Fa/YiE/+t0aaO1yHx/7w+xEcdXLfnIUk+ZusTMml8BnPFww9z5Vn95OQP J6q36qWk5Xdwjq1G4zNV3GxokFDz5WaDNG4tM= 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=oLoS4m6usJhs3J6Q8t/ROWxfHvit6d6fh53rz/sF4Zw=; b=cqWEF77YcE6RGucicj7ZhOnYrEQPWGEiup+nVkR4o1HiQQ/w6HNvkjgkv/tk6TImhk 7nh13lQO541FgopAmAN/JhvcdOECNtLaTM4RKiWyGzMGWFiw8k6YC7G+R5pJH80Andvv OVos0zkvaRHIRhJzEqT6DdlEkXJYQ09w/+gCr/opWOMkx01Q3AQxJKKspxnzTIxqflLV S2e6GrLC5DuE9ui4/R399sCRjxBbSXrjndQztuDHVswMw5WOUa2B03G3uwSuOyFwIcCu ly8T7htB3ek8xw0AFu0PWeyhakgrLzRjBSUn+nmqGRwWcrkj4P5O9/rHDUtN2LseLc1j Byeg== X-Gm-Message-State: ALoCoQmIuLcsdQiJf7mx3KQR5mXz76gFRhSUbxYvKtF7/ciMcX2YUG3qSjboJRIuZX2hfY8D4ifT X-Received: by 10.43.66.9 with SMTP id xo9mr1332583icb.67.1424458653377; Fri, 20 Feb 2015 10:57:33 -0800 (PST) Received: from tictac.mtv.corp.google.com ([172.22.65.76]) by mx.google.com with ESMTPSA id m38sm17411723ioi.39.2015.02.20.10.57.32 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Feb 2015 10:57:32 -0800 (PST) From: Doug Anderson To: Jaehoon Chung , Seungwon Jeon , Ulf Hansson Cc: Alim Akhtar , Sonny Rao , Andrew Bresticker , Heiko Stuebner , Addy Ke , Alexandru Stan , javier.martinez@collabora.co.uk, Doug Anderson , chris@printf.net, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] mmc: dw_mmc: Make sure we only adjust the clock when power is on Date: Fri, 20 Feb 2015 10:57:18 -0800 Message-Id: <1424458639-23330-1-git-send-email-dianders@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 It appears that we can confuse things if we try to turn on the MMC clock when the power is off. Adjust is so that we turn the clock on (using dw_mci_setup_bus) after power is all the way on and we turn the clock off before the power goes off. Signed-off-by: Doug Anderson Acked-by: Jaehoon Chung Tested-by: Javier Martinez Canillas --- drivers/mmc/host/dw_mmc.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 4d2e3c2..43fcae1 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1101,12 +1101,6 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (drv_data && drv_data->set_ios) drv_data->set_ios(slot->host, ios); - /* Slot specific timing and width adjustment */ - dw_mci_setup_bus(slot, false); - - if (slot->host->state == STATE_WAITING_CMD11_DONE && ios->clock != 0) - slot->host->state = STATE_IDLE; - switch (ios->power_mode) { case MMC_POWER_UP: if (!IS_ERR(mmc->supply.vmmc)) { @@ -1133,8 +1127,15 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) else slot->host->vqmmc_enabled = true; } + + /* Adjust clock / bus width after power is up */ + dw_mci_setup_bus(slot, false); + break; case MMC_POWER_OFF: + /* Turn clock off before power goes down */ + dw_mci_setup_bus(slot, false); + if (!IS_ERR(mmc->supply.vmmc)) mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); @@ -1150,6 +1151,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) default: break; } + + if (slot->host->state == STATE_WAITING_CMD11_DONE && ios->clock != 0) + slot->host->state = STATE_IDLE; } static int dw_mci_card_busy(struct mmc_host *mmc)