]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: sdhci: add the quirk for broken r1b response
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 23 Apr 2012 02:36:25 +0000 (02:36 +0000)
committerAndy Fleming <afleming@freescale.com>
Tue, 8 May 2012 23:02:22 +0000 (18:02 -0500)
When response type is R1b, mask value is added the SDHCI_INT_DAT_END.
but in while(), didn't check that flag.
So sdhci controller didn't work fine.
CMD6 didn't always complete.

So add the quirks for broken r1b response
and add the timeout value to prevent the infinite loop.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lei Wen<leiwen@marvell.com>
drivers/mmc/sdhci.c
include/sdhci.h

index fc904b5308eaa855a5a758b56e0f840d9892a608..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);
index 800f9d9c0733b9af0deaf45c3bd03c7ffbc8dac4..a2415ba8fc9612240a168921c89fc1d92afa19fa 100644 (file)
  */
 #define SDHCI_QUIRK_32BIT_DMA_ADDR     (1 << 0)
 #define SDHCI_QUIRK_REG32_RW           (1 << 1)
+#define SDHCI_QUIRK_BROKEN_R1B         (1 << 2)
 
 /* to make gcc happy */
 struct sdhci_host;