[U-Boot] [PATCH] omap: mmc: Raise timeout value to 20ms

Andreas Müller schnitzeltony at gmx.de
Wed Jan 4 14:47:19 CET 2012


On Wednesday, January 04, 2012 01:22:29 AM you wrote:
> On Tue, Jan 3, 2012 at 2:50 PM, Peter Bigot <bigotp at acm.org> wrote:
> > On Tue, Jan 3, 2012 at 2:24 PM, Tom Rini <trini at ti.com> wrote:
> >> With certain SD cards the code detects a timeout when the hardware
> >> has not timed out.  We change the timeout used to match the kernel
> >> which gives software 20ms to detect a timeout.  We also define to
> >> match the kernel and expand the previously incorrect comment.
> >> Finally, we let get_timer() perform subtraction for us as it offers.
> > 
> > This doesn't work for me with the SanDisk 4GB card on the
> > BeagleBoard-xM.  I updated the recipe to remove Andreas' original
> > patch, substituted the new one, and I get the following, which is the
> > behavior before I used Andreas' patch except that now it takes about
> > 20 seconds for each timeout message to print.
(*)
> 
> 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
Without having tested (have the hardware causing errors on monday next week): 
This version seems correct direction: We need to wait longer _before_ write 
action otherwise it is never finished - see (*). I am not an expert here but 
since this patch affects all mmc_cmds: Does this reduce performance?

Andreas


More information about the U-Boot mailing list