From patchwork Sat Mar 5 13:36:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 389 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:42:07 -0000 Delivered-To: patches@linaro.org Received: by 10.224.60.68 with SMTP id o4cs47171qah; Sat, 5 Mar 2011 05:36:48 -0800 (PST) Received: by 10.213.97.12 with SMTP id j12mr1201792ebn.56.1299332207257; Sat, 05 Mar 2011 05:36:47 -0800 (PST) Received: from eu1sys200aog107.obsmtp.com (eu1sys200aog107.obsmtp.com [207.126.144.123]) by mx.google.com with SMTP id s8si1061114eeh.59.2011.03.05.05.36.41 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 05 Mar 2011 05:36:46 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.123 is neither permitted nor denied by best guess record for domain of linus.walleij@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 linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from source ([138.198.100.35]) (using TLSv1) by eu1sys200aob107.postini.com ([207.126.147.11]) with SMTP ID DSNKTXI8ZN3dpS+d/JkkP5aS4zbJvw1s3r2O@postini.com; Sat, 05 Mar 2011 13:36:45 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 53422DB; Sat, 5 Mar 2011 13:36:31 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id B7BEC605; Sat, 5 Mar 2011 13:36:30 +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 relay2.stm.gmessaging.net (Postfix) with ESMTPS id CCE8AA807D; Sat, 5 Mar 2011 14:36:24 +0100 (CET) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.2.254.0; Sat, 5 Mar 2011 14:36:29 +0100 From: Linus Walleij To: , Chris Ball Cc: Lee Jones , Ulf Hansson , Linus Walleij Subject: [PATCH] mmc: reset card voltage after power off Date: Sat, 5 Mar 2011 14:36:24 +0100 Message-ID: <1299332184-13803-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.3.2 MIME-Version: 1.0 From: Ulf Hansson At power off, reset OCR mask to be the highest possible voltage supported for the current mmc host. This solves the re-initialization during the power up sequence. The voltage may have been decreased due to the card accepts a lower voltage than the voltage used during the initialization sequence. We need to reset the voltage to by the host highest possible value since according to specification the initialization must always be done at high voltage. Reviewed-by: Jonas Aberg Signed-off-by: Ulf Hansson Signed-off-by: Linus Walleij --- drivers/mmc/core/core.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 2521794..b9d39ec 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1002,6 +1002,13 @@ static void mmc_power_off(struct mmc_host *host) { host->ios.clock = 0; host->ios.vdd = 0; + + /* + * Reset ocr mask to be the highest possible voltage supported for + * this mmc host. This value will be used at next power up. + */ + host->ocr = 1 << (fls(host->ocr_avail) - 1); + if (!mmc_host_is_spi(host)) { host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; host->ios.chip_select = MMC_CS_DONTCARE;