1 From 66983857a54479d76ce6dbd8399e1276698bd3c5 Mon Sep 17 00:00:00 2001
2 From: San Mehat <san@google.com>
3 Date: Tue, 11 Nov 2008 09:35:36 -0800
4 Subject: [PATCH 094/134] mmc: sd: Add new CONFIG_MMC_PARANOID_SD_INIT for enabling retries during SD detection
6 Signed-off-by: San Mehat <san@google.com>
8 drivers/mmc/core/Kconfig | 8 ++++++++
9 drivers/mmc/core/sd.c | 24 ++++++++++++++++++++++--
10 2 files changed, 30 insertions(+), 2 deletions(-)
12 --- a/drivers/mmc/core/Kconfig
13 +++ b/drivers/mmc/core/Kconfig
14 @@ -14,3 +14,11 @@ config MMC_UNSAFE_RESUME
15 This option is usually just for embedded systems which use
16 a MMC/SD card for rootfs. Most people should say N here.
18 +config MMC_PARANOID_SD_INIT
19 + bool "Enable paranoid SD card initialization (EXPERIMENTAL)"
21 + If you say Y here, the MMC layer will be extra paranoid
22 + about re-trying SD init requests. This can be a useful
23 + work-around for buggy controllers and hardware. Enable
24 + if you are experiencing issues with SD detection.
26 --- a/drivers/mmc/core/sd.c
27 +++ b/drivers/mmc/core/sd.c
28 @@ -336,7 +336,9 @@ static int mmc_sd_init_card(struct mmc_h
33 +#ifdef CONFIG_MMC_PARANOID_SD_INIT
37 WARN_ON(!host->claimed);
39 @@ -439,11 +441,29 @@ static int mmc_sd_init_card(struct mmc_h
40 err = mmc_decode_scr(card);
45 * Fetch switch information from card.
47 +#ifdef CONFIG_MMC_PARANOID_SD_INIT
48 + for (retries = 1; retries <= 3; retries++) {
49 + err = mmc_read_switch(card);
54 + mmc_hostname(host));
59 + "%s: read switch failed (attempt %d)\n",
60 + mmc_hostname(host), retries);
64 err = mmc_read_switch(card);