mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] MMC power cycle
@ 2004-10-10 12:22 Pierre Ossman
  0 siblings, 0 replies; only message in thread
From: Pierre Ossman @ 2004-10-10 12:22 UTC (permalink / raw)
  To: linux-kernel, Russell King

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

I think I've found the special magic required to initialise my problem 
card without causing issues with other cards/controllers.

After the initial scan to determine a correct voltage, the host cycles 
power to reboot any cards (like mine) that have gone into shutdown. This 
patch works with the two cards I have (one good, one bad).

Russell, do you think this will work in all discussed scenarios?

Rgds
Pierre

[-- Attachment #2: mmc-powercycle.patch --]
[-- Type: text/x-patch, Size: 1038 bytes --]

Index: linux-wbsd/drivers/mmc/mmc.c
===================================================================
--- linux-wbsd/drivers/mmc/mmc.c	(revision 71)
+++ linux-wbsd/drivers/mmc/mmc.c	(working copy)
@@ -666,13 +666,24 @@
 		host->ocr = mmc_select_voltage(host, ocr);
 
 		/*
-		 * Since we're changing the OCR value, we seem to
-		 * need to tell some cards to go back to the idle
-		 * state.  We wait 1ms to give cards time to
-		 * respond.
+		 * Some cards shut down when receiving an OCR of
+		 * zero. But since they send their mask before
+		 * shutting down we can still calculate a correct
+		 * voltage. To get them back to life we need to
+		 * cycle power.
+		 *
+		 * When changing OCR values we also need to put
+		 * the cards in idle state. But since we restart
+		 * them here that point is moot.
 		 */
 		if (host->ocr)
+		{
+			mmc_power_off(host);
+			mmc_delay(100);
+			mmc_power_up(host);
+
 			mmc_idle_cards(host);
+		}
 	} else {
 		host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
 		host->ios.clock = host->f_min;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-10 12:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-10 12:22 [PATCH] MMC power cycle Pierre Ossman

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

all inboxes | Powered by JetHome®