omap: mmc: Raise timeout value to 20ms
PATCH 1/1 omap: mmc: Raise timeout value to 20ms
Quoted 25 lines · Peter Bigot
I got this to work with two changes:
* s/MMC_TIMEOUT_USEC/MMC_TIMEOUT_MSEC/g and define
MMC_TIMEOUT_MSEC20, sinceget_timerdoes operate on msec in the current meta-ti BeagleBoard-xM* The patch below, which is what I think fixes the real problem (that PSTATE.CMDI is still lit up when the function is entered).
drivers/mmc/omap_hsmmc.c +2
-1@@ -198,7 +198,8 @@ static int mmc_send_cmd(struct mmc *mmc, structmmc_cmd *cmd, ulong start; start =get_timer (0 ); -while ((readl (&mmc_base->pstate) &DATI_MASK ) ==DATI_CMDDIS ) { +#define CMDI_MASK (0x1 << 0) +while ((readl (&mmc_base->pstate) & (DATI_MASK |CMDI_MASK ))) {if (get_timer (0 ) - start >MAX_RETRY_MS ) { printf("%s: timedout waiting for cmddis!\n",
__func__); return TIMEOUT;
Quoted 1 line
Peter
I tested this with success and I think this is the correct solution.
Peter: can you send a proper patch for this?
Andreas
PATCH 1/1 omap: mmc: Raise timeout value to 20ms
Quoted 27 lines · Andreas M?ller
Quoted 25 lines · Peter Bigot
I got this to work with two changes:
* s/MMC_TIMEOUT_USEC/MMC_TIMEOUT_MSEC/g and define
MMC_TIMEOUT_MSEC20, sinceget_timerdoes operate on msec in the current meta-ti BeagleBoard-xM* The patch below, which is what I think fixes the real problem (that PSTATE.CMDI is still lit up when the function is entered).
drivers/mmc/omap_hsmmc.c +2
-1@@ -198,7 +198,8 @@ static int mmc_send_cmd(struct mmc *mmc, structmmc_cmd *cmd, ? ? ? ? ulong start; ? ? ? ? start = get_timer(0); - ? ? ? while ((readl(&mmc_base->pstate) & DATI_MASK) == DATI_CMDDIS) { +#define CMDI_MASK ? ? ? ? ? ? ? ? ? ? ?(0x1 << 0) + ? ? ? while ((readl(&mmc_base->pstate) & (DATI_MASK | CMDI_MASK))) { ? ? ? ? ? ? ? ? if (get_timer(0) - start > MAX_RETRY_MS) { ? ? ? ? ? ? ? ? ? ? ? ? printf("%s: timedout waiting for cmddis!\n",
__func__); return TIMEOUT;
Quoted 3 lines
Quoted 1 line
Peter
I tested this with success and I think this is the correct solution.
Peter: can you send a proper patch for this?
I ordered the same card Peter sees failure on and it arrived yesterday. I'm formatting it now and will see if I can duplicate the problem here today.
Signature · 1 line
Tom
PATCH 1/1 omap: mmc: Raise timeout value to 20ms
In reply to Andreas MüllerQuoted 27 lines · Andreas M?ller
Quoted 25 lines · Peter Bigot
I got this to work with two changes:
* s/MMC_TIMEOUT_USEC/MMC_TIMEOUT_MSEC/g and define
MMC_TIMEOUT_MSEC20, sinceget_timerdoes operate on msec in the current meta-ti BeagleBoard-xM* The patch below, which is what I think fixes the real problem (that PSTATE.CMDI is still lit up when the function is entered).
drivers/mmc/omap_hsmmc.c +2
-1@@ -198,7 +198,8 @@ static int mmc_send_cmd(struct mmc *mmc, structmmc_cmd *cmd, ? ? ? ? ulong start; ? ? ? ? start = get_timer(0); - ? ? ? while ((readl(&mmc_base->pstate) & DATI_MASK) == DATI_CMDDIS) { +#define CMDI_MASK ? ? ? ? ? ? ? ? ? ? ?(0x1 << 0) + ? ? ? while ((readl(&mmc_base->pstate) & (DATI_MASK | CMDI_MASK))) { ? ? ? ? ? ? ? ? if (get_timer(0) - start > MAX_RETRY_MS) { ? ? ? ? ? ? ? ? ? ? ? ? printf("%s: timedout waiting for cmddis!\n",
__func__); return TIMEOUT;
Quoted 3 lines
Quoted 1 line
Peter
I tested this with success and I think this is the correct solution.
Peter: can you send a proper patch for this?
I'm hoping Tom replicates the problem, but if not, I think the fix is still necessary: it seems "obviously wrong" that the delay waits for data inhibit to clear but not for command inhibit to clear. In my situation I really was seeing DATI_MASK clear but CMDI_MASK set after the loop.
Since the fix requires adding the CMDI_MASK to one or more header files (it's not defined there at this time), and probably a review of all other references to base->pstate to see if they have the same issue, I'd prefer to leave it to Tom or other real maintainers.
Peter
Quoted 2 lines
Andreas