2010-11-05 09:36:04

by Linus Walleij

[permalink] [raw]
Subject: [PATCH] mmci: reset voltage after power off.

From: Ulf Hansson <[email protected]>

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.

Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
---
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 8f86d70..508ed2b 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -940,6 +940,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;
--
1.6.3.3


2010-11-07 17:16:17

by Russell King - ARM Linux

[permalink] [raw]
Subject: Re: [PATCH] mmci: reset voltage after power off.

On Fri, Nov 05, 2010 at 10:35:41AM +0100, Linus Walleij wrote:
> From: Ulf Hansson <[email protected]>
>
> 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.

Surely this should already be done by:

/* If ocr is set, we use it */
if (host->ocr)
bit = ffs(host->ocr) - 1;
else
bit = fls(host->ocr_avail) - 1;

in mmc_power_up ?