diff options
Diffstat (limited to 'drivers/mmc/fsl_esdhc.c')
-rw-r--r-- | drivers/mmc/fsl_esdhc.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 0dff226d8fb..835fbe312cd 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -405,12 +405,32 @@ static int esdhc_init(struct mmc *mmc) return 0; } +static void esdhc_reset(struct fsl_esdhc *regs) +{ + unsigned long timeout; + + /* reset the controller */ + out_be32(®s->sysctl, SYSCTL_RSTA); + + /* wait max 100 ms */ + timeout = 100; + /* hardware clears the bit when it is done */ + while ((in_be32(®s->sysctl) & SYSCTL_RSTA) && timeout--) + udelay(1000); + if (!timeout) + printf("MMC/SD: Reset never completed.\n"); + udelay(1000); +} + static int esdhc_initialize(bd_t *bis) { struct fsl_esdhc *regs = (struct fsl_esdhc *)CONFIG_SYS_FSL_ESDHC_ADDR; struct mmc *mmc; u32 caps, voltage_caps; + /* First reset the eSDHC controller */ + esdhc_reset(regs); + mmc = malloc(sizeof(struct mmc)); sprintf(mmc->name, "FSL_ESDHC"); |