
On Wed, Jan 11, 2012 at 9:31 AM, Andreas Müller schnitzeltony@gmx.de wrote:
On Wednesday, January 04, 2012 01:22:29 AM Peter Bigot <bigotp at acm.org> wrote:
I got this to work with two changes:
- s/MMC_TIMEOUT_USEC/MMC_TIMEOUT_MSEC/g and define MMC_TIMEOUT_MSEC
20, since get_timer does 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).
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index c38b9e6..62b659a 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -198,7 +198,8 @@ static int mmc_send_cmd(struct mmc *mmc, struct mmc_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;
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
Andreas