]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mmc/mmc.c
h63xx: mmc and sd card support
[linux-2.6-omap-h63xx.git] / drivers / mmc / mmc.c
index 1888060c5e0c415cf5701250f845bf4d27a5e0a4..8865175effddbacae7f04b0193672e343b256e6e 100644 (file)
@@ -21,6 +21,8 @@
 #include <asm/scatterlist.h>
 #include <linux/scatterlist.h>
 
+#include <asm/mach-types.h>
+
 #include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/protocol.h>
@@ -705,6 +707,7 @@ static void mmc_power_up(struct mmc_host *host)
        int bit = fls(host->ocr_avail) - 1;
 
        host->ios.vdd = bit;
+       host->ios.clock = host->f_min;
        host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN;
        host->ios.chip_select = MMC_CS_DONTCARE;
        host->ios.power_mode = MMC_POWER_UP;
@@ -713,7 +716,6 @@ static void mmc_power_up(struct mmc_host *host)
 
        mmc_delay(1);
 
-       host->ios.clock = host->f_min;
        host->ios.power_mode = MMC_POWER_ON;
        host->ops->set_ios(host, &host->ios);
 
@@ -747,7 +749,7 @@ static int mmc_send_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr)
 
                if (cmd.resp[0] & MMC_CARD_BUSY || ocr == 0)
                        break;
-
+               mmc_delay(1);
                err = MMC_ERR_TIMEOUT;
 
                mmc_delay(10);
@@ -963,8 +965,9 @@ static void mmc_read_scrs(struct mmc_host *host)
 
                mmc_decode_scr(card);
        }
-
-       mmc_deselect_cards(host);
+       if (!machine_is_omap_h6300()) {
+               mmc_deselect_cards(host);
+       }
 }
 
 static unsigned int mmc_calculate_clock(struct mmc_host *host)
@@ -1089,6 +1092,14 @@ static void mmc_setup(struct mmc_host *host)
        host->ios.bus_mode = MMC_BUSMODE_PUSHPULL;
        host->ops->set_ios(host, &host->ios);
 
+       /*
+        * Some already detectd cards get confused in the card identification
+        * mode and futher commands can fail.  Doing an extra status inquiry
+        * after the identification mode seems to get cards back to their
+        * senses.
+        */
+       mmc_check_cards(host);
+
        mmc_read_csds(host);
 
        if (host->mode == MMC_MODE_SD)