mmc: sdhci: add the quirk for broken r1b response
[oweals/u-boot.git] / drivers / mmc / sdhci.c
index fce0ef091184b39e07adf8a0acc8c29ab6a2d3dc..7790a1e8da6b59c40fdf5233fd43e66112420092 100644 (file)
@@ -128,6 +128,7 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
        int trans_bytes = 0, is_aligned = 1;
        u32 mask, flags, mode;
        unsigned int timeout, start_addr = 0;
+       unsigned int retry = 10000;
 
        /* Wait max 10 ms */
        timeout = 10;
@@ -210,8 +211,19 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd,
                stat = sdhci_readl(host, SDHCI_INT_STATUS);
                if (stat & SDHCI_INT_ERROR)
                        break;
+               if (--retry == 0)
+                       break;
        } while ((stat & mask) != mask);
 
+       if (retry == 0) {
+               if (host->quirks & SDHCI_QUIRK_BROKEN_R1B)
+                       return 0;
+               else {
+                       printf("Timeout for status update!\n");
+                       return TIMEOUT;
+               }
+       }
+
        if ((stat & (SDHCI_INT_ERROR | mask)) == mask) {
                sdhci_cmd_done(host, cmd);
                sdhci_writel(host, mask, SDHCI_INT_STATUS);
@@ -390,6 +402,7 @@ int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
        mmc->send_cmd = sdhci_send_command;
        mmc->set_ios = sdhci_set_ios;
        mmc->init = sdhci_init;
+       mmc->getcd = NULL;
 
        caps = sdhci_readl(host, SDHCI_CAPABILITIES);
 #ifdef CONFIG_MMC_SDMA