aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/goldfish/patches-2.6.30/0100-mmc-sd-Add-retries-in-re-detection.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/goldfish/patches-2.6.30/0100-mmc-sd-Add-retries-in-re-detection.patch')
-rw-r--r--target/linux/goldfish/patches-2.6.30/0100-mmc-sd-Add-retries-in-re-detection.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/target/linux/goldfish/patches-2.6.30/0100-mmc-sd-Add-retries-in-re-detection.patch b/target/linux/goldfish/patches-2.6.30/0100-mmc-sd-Add-retries-in-re-detection.patch
new file mode 100644
index 0000000000..090e9e6913
--- /dev/null
+++ b/target/linux/goldfish/patches-2.6.30/0100-mmc-sd-Add-retries-in-re-detection.patch
@@ -0,0 +1,91 @@
+From 39e3d37b1f7194277b8a3ea3536a67ec2d24491e Mon Sep 17 00:00:00 2001
+From: San Mehat <san@android.com>
+Date: Thu, 4 Dec 2008 11:18:00 -0800
+Subject: [PATCH 100/134] mmc: sd: Add retries in re-detection
+
+Signed-off-by: San Mehat <san@android.com>
+---
+ drivers/mmc/core/sd.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
+ 1 files changed, 43 insertions(+), 3 deletions(-)
+
+--- a/drivers/mmc/core/sd.c
++++ b/drivers/mmc/core/sd.c
+@@ -558,18 +558,37 @@ static void mmc_sd_remove(struct mmc_hos
+ */
+ static void mmc_sd_detect(struct mmc_host *host)
+ {
+- int err;
++ int err = 0;
++#ifdef CONFIG_MMC_PARANOID_SD_INIT
++ int retries = 5;
++#endif
+
+ BUG_ON(!host);
+ BUG_ON(!host->card);
+-
++
+ mmc_claim_host(host);
+
+ /*
+ * Just check if our card has been removed.
+ */
++#ifdef CONFIG_MMC_PARANOID_SD_INIT
++ while(retries) {
++ err = mmc_send_status(host->card, NULL);
++ printk("%s(%s): err = %d\n", __func__, mmc_hostname(host), err);
++ if (err) {
++ retries--;
++ udelay(5);
++ continue;
++ }
++ break;
++ }
++ if (!retries) {
++ printk(KERN_ERR "%s(%s): Unable to re-detect card (%d)\n",
++ __func__, mmc_hostname(host), err);
++ }
++#else
+ err = mmc_send_status(host->card, NULL);
+-
++#endif
+ mmc_release_host(host);
+
+ if (err) {
+@@ -664,6 +683,9 @@ static const struct mmc_bus_ops mmc_sd_o
+ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
+ {
+ int err;
++#ifdef CONFIG_MMC_PARANOID_SD_INIT
++ int retries;
++#endif
+
+ BUG_ON(!host);
+ WARN_ON(!host->claimed);
+@@ -712,9 +734,27 @@ int mmc_attach_sd(struct mmc_host *host,
+ /*
+ * Detect and init the card.
+ */
++#ifdef CONFIG_MMC_PARANOID_SD_INIT
++ retries = 5;
++ while (retries) {
++ err = mmc_sd_init_card(host, host->ocr, NULL);
++ if (err) {
++ retries--;
++ continue;
++ }
++ break;
++ }
++
++ if (!retries) {
++ printk(KERN_ERR "%s: mmc_sd_init_card() failure (err = %d)\n",
++ mmc_hostname(host), err);
++ goto err;
++ }
++#else
+ err = mmc_sd_init_card(host, host->ocr, NULL);
+ if (err)
+ goto err;
++#endif
+
+ mmc_release_host(host);
+