From patchwork Tue Sep 25 07:04:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Rudholm X-Patchwork-Id: 11702 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id BECC823E54 for ; Tue, 25 Sep 2012 07:04:33 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 81E0DA18A7D for ; Tue, 25 Sep 2012 07:04:33 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so12094160iej.11 for ; Tue, 25 Sep 2012 00:04:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=zAdfQhyaldFwlMumpel5IisQOE/z7ALaIQrbw4nVxHc=; b=eWamy7KE2C4fl/7/4C4nlWH4u3q4WYMS6h+P8ZuWEfUr2GUrMKshJ1+xqRUxR/txc4 3txzKUbV49HKaNrtHZPEKRAZ0aOnY/2jq1eP23GKOWLoQP9p+9OqFUpHPEXKi3VB8iaR qFIESA0RNGN33euM9jQToPZlOT3Rv8S8xEY2I2ke4V9Pa4tJM8KOb24dREkqxmiaB6yo fiFxsd82C8ZVV3brn8YCfLv7CIJS5s7YLCfZXtHurzChYvYm7/D/bdzk7SwVFsfJBnLi McIcOUYRVXnC3c+5Wh7PYN7/0UE4qnLL3sSY9ZHRH6M6wIFEkc9jxPNMhtJ5i8O62tCd J04g== Received: by 10.42.109.194 with SMTP id m2mr11179670icp.48.1348556673243; Tue, 25 Sep 2012 00:04:33 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp279551igc; Tue, 25 Sep 2012 00:04:32 -0700 (PDT) Received: by 10.14.224.73 with SMTP id w49mr17486400eep.37.1348556671742; Tue, 25 Sep 2012 00:04:31 -0700 (PDT) Received: from eu1sys200aog107.obsmtp.com (eu1sys200aog107.obsmtp.com [207.126.144.123]) by mx.google.com with SMTP id m5si12713903een.99.2012.09.25.00.04.30 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 25 Sep 2012 00:04:31 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.123 is neither permitted nor denied by best guess record for domain of johan.rudholm@stericsson.com) client-ip=207.126.144.123; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.123 is neither permitted nor denied by best guess record for domain of johan.rudholm@stericsson.com) smtp.mail=johan.rudholm@stericsson.com Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob107.postini.com ([207.126.147.11]) with SMTP ID DSNKUGFXfEYNERv4JJ4Fkd6x1rgv3+QyrS/Z@postini.com; Tue, 25 Sep 2012 07:04:31 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A3DB1C2; Tue, 25 Sep 2012 07:04:23 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id D41DA250D; Tue, 25 Sep 2012 07:04:22 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 5629824C317; Tue, 25 Sep 2012 09:04:18 +0200 (CEST) Received: from steludxu1610.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.83.0; Tue, 25 Sep 2012 09:04:22 +0200 From: Johan Rudholm To: , Chris Ball Cc: Per Forlin , Ulf Hansson , Fredrik Soderstedt , Johan Rudholm Subject: [PATCH v2 2/2] mmc: core: Power cycle card on voltage switch fail Date: Tue, 25 Sep 2012 09:04:14 +0200 Message-ID: <1348556654-2119-1-git-send-email-johan.rudholm@stericsson.com> X-Mailer: git-send-email 1.7.10 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQl1zg16/OmnvzEjyUc3VdNIELOeS2Ql17arqQit62Y6sTz/7YsL9LQdir0WjVsoRHoqM3dW Signed-off-by: Johan Rudholm --- drivers/mmc/core/core.c | 2 +- drivers/mmc/core/core.h | 1 + drivers/mmc/core/sd.c | 8 ++++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index dae6744..fb03bd9 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1348,7 +1348,7 @@ static void mmc_poweroff_notify(struct mmc_host *host) * If a host does all the power sequencing itself, ignore the * initial MMC_POWER_UP stage. */ -static void mmc_power_up(struct mmc_host *host) +void mmc_power_up(struct mmc_host *host) { int bit; diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 3bdafbc..5a5170d 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -45,6 +45,7 @@ int mmc_set_signal_voltage(struct mmc_host *host, int signal_voltage, void mmc_set_timing(struct mmc_host *host, unsigned int timing); void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); void mmc_power_off(struct mmc_host *host); +void mmc_power_up(struct mmc_host *host); static inline void mmc_delay(unsigned int ms) { diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 74972c2..9a165451 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -720,6 +720,7 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr) * state. We wait 1ms to give cards time to * respond. */ +try_again: mmc_go_idle(host); /* @@ -748,7 +749,6 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr) if (max_current > 150) ocr |= SD_OCR_XPC; -try_again: err = mmc_send_app_op_cond(host, ocr, rocr); if (err) return err; @@ -761,7 +761,11 @@ try_again: ((*rocr & 0x41000000) == 0x41000000)) { err = mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_180, true); if (err) { - ocr &= ~SD_OCR_S18R; + /* Power cycle card */ + pr_warning("%s: Signal voltage switch failed, " + "power cycling card\n", mmc_hostname(host)); + mmc_power_off(host); + mmc_power_up(host); goto try_again; } }