public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: core: reset sigal voltage on power up
@ 2012-07-10  8:55 Aaron Lu
  2012-07-17 11:16 ` S, Venkatraman
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Lu @ 2012-07-10  8:55 UTC (permalink / raw)
  To: Chris Ball, Ulf Hansson, Philip Rakity, Subhash Jadavani
  Cc: linux-mmc, Aaron Lu, Aaron Lu

Add a call to mmc_set_signal_voltage to set signal voltage to 3.3v in
mmc_power_up so that we do not need to touch signal voltage setting in
mmc/sd/sdio init functions and rescan function.

For mmc/sd cards, when doing a suspend/resume cycle, consider the unsafe
resume case, the card will lose its power and when powered on again, we
will set signal voltage to 3.3v in mmc_power_up before its resume function
gets called, which will re-init the card.

And for sdio cards, when doing a suspend/resume cycle, consider the unsafe
resume case, the card will either lose its power or not depending on if it
wants to wakeup the host. If power is not maintained, it is the same case as
mmc/sd cards. If power is maintained, mmc_power_up will not be called and
the card's signal voltage will remain at the last setting.

Signed-off-by: Aaron Lu <aaron.lu@amd.com>
---
 drivers/mmc/core/core.c | 6 +++---
 drivers/mmc/core/mmc.c  | 3 ---
 drivers/mmc/core/sd.c   | 3 ---
 drivers/mmc/core/sdio.c | 7 -------
 4 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 9503cab..8ac5246 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1212,6 +1212,9 @@ static void mmc_power_up(struct mmc_host *host)
 	host->ios.timing = MMC_TIMING_LEGACY;
 	mmc_set_ios(host);
 
+	/* Set signal voltage to 3.3V */
+	mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, false);
+
 	/*
 	 * This delay should be sufficient to allow the power supply
 	 * to reach the minimum voltage.
@@ -1963,9 +1966,6 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
 	 */
 	mmc_hw_reset_for_init(host);
 
-	/* Initialization should be done at 3.3 V I/O voltage. */
-	mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
-
 	/*
 	 * sdio_reset sends CMD52 to reset card.  Since we do not know
 	 * if the card is being re-initialized, just send it.  CMD52
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 4f4489a..396b258 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -818,9 +818,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	if (!mmc_host_is_spi(host))
 		mmc_set_bus_mode(host, MMC_BUSMODE_OPENDRAIN);
 
-	/* Initialization should be done at 3.3 V I/O voltage. */
-	mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
-
 	/*
 	 * Since we're changing the OCR value, we seem to
 	 * need to tell some cards to go back to the idle
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 312b78d..2182d92 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -892,9 +892,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
 	BUG_ON(!host);
 	WARN_ON(!host->claimed);
 
-	/* The initialization should be done at 3.3 V I/O voltage. */
-	mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
-
 	err = mmc_sd_get_cid(host, ocr, cid, &rocr);
 	if (err)
 		return err;
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 41c5fd8..d4619e2 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -591,9 +591,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
 	 * Inform the card of the voltage
 	 */
 	if (!powered_resume) {
-		/* The initialization should be done at 3.3 V I/O voltage. */
-		mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
-
 		err = mmc_send_io_op_cond(host, host->ocr, &ocr);
 		if (err)
 			goto err;
@@ -1006,10 +1003,6 @@ static int mmc_sdio_power_restore(struct mmc_host *host)
 	 * restore the correct voltage setting of the card.
 	 */
 
-	/* The initialization should be done at 3.3 V I/O voltage. */
-	if (!mmc_card_keep_power(host))
-		mmc_set_signal_voltage(host, MMC_SIGNAL_VOLTAGE_330, 0);
-
 	sdio_reset(host);
 	mmc_go_idle(host);
 	mmc_send_if_cond(host, host->ocr_avail);
-- 
1.7.11.1.3.g4c8a9db



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: core: reset sigal voltage on power up
  2012-07-10  8:55 [PATCH] mmc: core: reset sigal voltage on power up Aaron Lu
@ 2012-07-17 11:16 ` S, Venkatraman
  2012-07-19  6:20   ` Chris Ball
  0 siblings, 1 reply; 3+ messages in thread
From: S, Venkatraman @ 2012-07-17 11:16 UTC (permalink / raw)
  To: Aaron Lu
  Cc: Chris Ball, Ulf Hansson, Philip Rakity, Subhash Jadavani,
	linux-mmc, Aaron Lu

On Tue, Jul 10, 2012 at 2:25 PM, Aaron Lu <aaron.lu@amd.com> wrote:
> Add a call to mmc_set_signal_voltage to set signal voltage to 3.3v in
> mmc_power_up so that we do not need to touch signal voltage setting in
> mmc/sd/sdio init functions and rescan function.
>
> For mmc/sd cards, when doing a suspend/resume cycle, consider the unsafe
> resume case, the card will lose its power and when powered on again, we
> will set signal voltage to 3.3v in mmc_power_up before its resume function
> gets called, which will re-init the card.
>
> And for sdio cards, when doing a suspend/resume cycle, consider the unsafe
> resume case, the card will either lose its power or not depending on if it
> wants to wakeup the host. If power is not maintained, it is the same case as
> mmc/sd cards. If power is maintained, mmc_power_up will not be called and
> the card's signal voltage will remain at the last setting.
>
> Signed-off-by: Aaron Lu <aaron.lu@amd.com>

Nice cleanup. I tested this patch on my OMAP board for MMC and SD,
but not for SDIO..
Tested-by: Venkatraman S <svenkatr@ti.com>

> ---
>  drivers/mmc/core/core.c | 6 +++---
>  drivers/mmc/core/mmc.c  | 3 ---
>  drivers/mmc/core/sd.c   | 3 ---
>  drivers/mmc/core/sdio.c | 7 -------
>  4 files changed, 3 insertions(+), 16 deletions(-)
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: core: reset sigal voltage on power up
  2012-07-17 11:16 ` S, Venkatraman
@ 2012-07-19  6:20   ` Chris Ball
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Ball @ 2012-07-19  6:20 UTC (permalink / raw)
  To: S, Venkatraman
  Cc: Aaron Lu, Ulf Hansson, Philip Rakity, Subhash Jadavani, linux-mmc,
	Aaron Lu

Hi,

On Tue, Jul 17 2012, S, Venkatraman wrote:
> On Tue, Jul 10, 2012 at 2:25 PM, Aaron Lu <aaron.lu@amd.com> wrote:
>> Add a call to mmc_set_signal_voltage to set signal voltage to 3.3v in
>> mmc_power_up so that we do not need to touch signal voltage setting in
>> mmc/sd/sdio init functions and rescan function.
>>
>> For mmc/sd cards, when doing a suspend/resume cycle, consider the unsafe
>> resume case, the card will lose its power and when powered on again, we
>> will set signal voltage to 3.3v in mmc_power_up before its resume function
>> gets called, which will re-init the card.
>>
>> And for sdio cards, when doing a suspend/resume cycle, consider the unsafe
>> resume case, the card will either lose its power or not depending on if it
>> wants to wakeup the host. If power is not maintained, it is the same case as
>> mmc/sd cards. If power is maintained, mmc_power_up will not be called and
>> the card's signal voltage will remain at the last setting.
>>
>> Signed-off-by: Aaron Lu <aaron.lu@amd.com>
>
> Nice cleanup. I tested this patch on my OMAP board for MMC and SD,
> but not for SDIO..
> Tested-by: Venkatraman S <svenkatr@ti.com>

Thanks, pushed to mmc-next for 3.6.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-19  6:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10  8:55 [PATCH] mmc: core: reset sigal voltage on power up Aaron Lu
2012-07-17 11:16 ` S, Venkatraman
2012-07-19  6:20   ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox