From patchwork Thu Sep 20 18:42:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Rudholm X-Patchwork-Id: 11584 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 CABF323E54 for ; Thu, 20 Sep 2012 18:42:49 +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 1A6B6A181DD for ; Thu, 20 Sep 2012 18:42:49 +0000 (UTC) Received: by ieje10 with SMTP id e10so3411225iej.11 for ; Thu, 20 Sep 2012 11:42:48 -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=IoQKnGF0EztyJBKftK63u10Ju0fq8HrhQ4dRtwihUGY=; b=RwC+FQEniTqoITqILVeO/3otiqzDp2Y4x7vSLflUf1kJIV1OBxWqDAZjPcG+oJyWSq Ei7hr8Gv+PyTLaZHcv4jJ5t2Ey4NsZL+0gFgQ/8hHYjbIk/MrxrXaPUsKKMiJiYBhrIx WK9GELr+FvyILarej+MVVSj9cHlFBMX2w5/7mfTbgH0RkPPtwHritRVVtP+itmXlms3M 5MDEpt+vshWc5DWROsdfCzm3FTXDAQR80QIJ16bRxs9VHtb/OHbZ389PwUwePitUaJ1S uj9qTKygb5Rb0cRr6K/hhVxt39YkzeJ+Gx+2fzEfsRaq6fH+mM2M/xM5PTEDcsWFT9xa 4OTg== Received: by 10.50.217.227 with SMTP id pb3mr3322114igc.28.1348166568367; Thu, 20 Sep 2012 11:42:48 -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 ex8csp92005igc; Thu, 20 Sep 2012 11:42:47 -0700 (PDT) Received: by 10.14.221.132 with SMTP id r4mr3313056eep.29.1348166566677; Thu, 20 Sep 2012 11:42:46 -0700 (PDT) Received: from eu1sys200aog101.obsmtp.com (eu1sys200aog101.obsmtp.com [207.126.144.111]) by mx.google.com with SMTP id 43si4353191eei.125.2012.09.20.11.42.43 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 11:42:46 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.111 is neither permitted nor denied by best guess record for domain of johan.rudholm@stericsson.com) client-ip=207.126.144.111; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.111 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-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob101.postini.com ([207.126.147.11]) with SMTP ID DSNKUFtjoFvu5d2HzyH7ZoMrxNRh/+Uy0gFY@postini.com; Thu, 20 Sep 2012 18:42:46 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 04EA3B3; Thu, 20 Sep 2012 18:34:22 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 50D26B72; Thu, 20 Sep 2012 18:42:37 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id F18A024C07C; Thu, 20 Sep 2012 20:42:26 +0200 (CEST) Received: from steludxu1610.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 20 Sep 2012 20:42:36 +0200 From: Johan Rudholm To: , Chris Ball Cc: Per Forlin , Ulf Hansson , Johan Rudholm Subject: [PATCH 2/2] mmc: core: Power cycle card on voltage switch fail Date: Thu, 20 Sep 2012 20:42:22 +0200 Message-ID: <1348166542-3247-1-git-send-email-johan.rudholm@stericsson.com> X-Mailer: git-send-email 1.7.10 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQlPGctUOfAvzW+a+OmXFNUrP26bphV5N24PuAljo7R9dUwrGz8Mfl7gZRXUlrxaxicZFZvx 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 3779431..671986a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1346,7 +1346,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; } }