summaryrefslogtreecommitdiff
path: root/target/linux/goldfish/patches-2.6.30/0100-mmc-sd-Add-retries-in-re-detection.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-06-14 20:42:33 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-06-14 20:42:33 +0000
commitf88360279f91387dc61725226ad38c3c95d3790a (patch)
tree66d21f3483914eb7e674c45f3497ab8912094ac0 /target/linux/goldfish/patches-2.6.30/0100-mmc-sd-Add-retries-in-re-detection.patch
parenta6d8f8be9e06c5ffb03f815c8c76ba743c64aa3d (diff)
downloadmtk-20170518-f88360279f91387dc61725226ad38c3c95d3790a.zip
mtk-20170518-f88360279f91387dc61725226ad38c3c95d3790a.tar.gz
mtk-20170518-f88360279f91387dc61725226ad38c3c95d3790a.tar.bz2
add the 'goldfish' target, useful for experimenting with virtual phone hardware (includes the emulator)
SVN-Revision: 16459
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 0000000..090e9e6
--- /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);
+