From: Kevin Liu Subject: [PATCH] mmc: core: restore ocr and operation voltage in resume Date: Wed, 20 Feb 2013 17:31:01 +0800 Message-ID: <1361352662-12263-1-git-send-email-kliu5@marvell.com> Return-path: Received: from na3sys009aog104.obsmtp.com ([74.125.149.73]:54559 "EHLO na3sys009aog104.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932912Ab3BTJdJ (ORCPT ); Wed, 20 Feb 2013 04:33:09 -0500 Sender: linux-mmc-owner@vger.kernel.org List-Id: linux-mmc@vger.kernel.org To: linux-mmc@vger.kernel.org, Chris Ball , Sujit Reddy Thumma , Jaehoon Chung , Andy Shevchenko , Aaron Lu , Ulf Hansson , Alexander Stein , Wei WANG , Fabio Estevam Cc: Anton Vorontsov , Stephen Warren , Lars-Peter Clausen , Mike Rapoport , Nicolas Pitre , Adrian Hunter , Philip Rakity , Shawn Guo , Johan Rudholm , Daniel Drake , Guennadi Liakhovetski , Jerry Huang , Girish K S , Haijun Zhang , Viresh Kumar , Heiko Stuebner , Thomas Abraham , Chander Kashyap , Sebastian Hesselbarth , Zhangfei Gao , Haojian Zhuang , Chao host->ocr has been reset in power off but not restored after power up in resume. And operation voltage will be set to the highest after resume back. This patch fix these two bugs. Signed-off-by: Kevin Liu --- drivers/mmc/core/core.c | 3 ++- include/linux/mmc/host.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 08a3cf2..b8c3d41 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1523,6 +1523,7 @@ void mmc_power_off(struct mmc_host *host) * 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_bak = host->ocr; host->ocr = 1 << (fls(host->ocr_avail) - 1); if (!mmc_host_is_spi(host)) { @@ -2666,7 +2667,7 @@ int mmc_resume_host(struct mmc_host *host) if (host->bus_ops && !host->bus_dead) { if (!mmc_card_keep_power(host)) { mmc_power_up(host); - mmc_select_voltage(host, host->ocr); + host->ocr = mmc_select_voltage(host, host->ocr_bak); /* * Tell runtime PM core we just powered up the card, * since it still believes the card is powered off. diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index d6f20cc..6e355d1 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -309,6 +309,7 @@ struct mmc_host { struct mmc_ios ios; /* current io bus settings */ u32 ocr; /* the current OCR setting */ + u32 ocr_bak; /* save current OCR setting */ /* group bitfields together to minimize padding */ unsigned int use_spi_crc:1; -- 1.7.9.5