summaryrefslogtreecommitdiff
path: root/drivers/mmc/imx_esdhc.c
diff options
context:
space:
mode:
authorTerry Lv <r65388@freescale.com>2010-03-25 18:34:40 +0800
committerTerry Lv <r65388@freescale.com>2010-03-26 17:48:54 +0800
commit76ca5d255b4920986c66c1a66e826420719f433c (patch)
tree2d580d9010e02d240e725c44950a80e6fc0ce421 /drivers/mmc/imx_esdhc.c
parentc86131164139fcb0ce1b448856ef452bdf6a346c (diff)
downloadu-boot-imx-76ca5d255b4920986c66c1a66e826420719f433c.zip
u-boot-imx-76ca5d255b4920986c66c1a66e826420719f433c.tar.gz
u-boot-imx-76ca5d255b4920986c66c1a66e826420719f433c.tar.bz2
ENGR00122050: mmc can't read data whose size exceeds 32M
mmc can't read data whose size exceeds 32M. Signed-off-by: Terry Lv <r65388@freescale.com>
Diffstat (limited to 'drivers/mmc/imx_esdhc.c')
-rw-r--r--drivers/mmc/imx_esdhc.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/drivers/mmc/imx_esdhc.c b/drivers/mmc/imx_esdhc.c
index 95eee80..f9b35ea 100644
--- a/drivers/mmc/imx_esdhc.c
+++ b/drivers/mmc/imx_esdhc.c
@@ -72,21 +72,6 @@ struct fsl_esdhc {
uint scr;
};
-
-static inline void mdelay(unsigned long msec)
-{
- unsigned long i;
- for (i = 0; i < msec; i++)
- udelay(1000);
-}
-
-static inline void sdelay(unsigned long sec)
-{
- unsigned long i;
- for (i = 0; i < sec; i++)
- mdelay(1000);
-}
-
/* Return the XFERTYP flags for a given command and data packet */
uint esdhc_xfertyp(struct mmc_cmd *cmd, struct mmc_data *data)
{
@@ -144,7 +129,7 @@ static int esdhc_setup_data(struct mmc *mmc, struct mmc_data *data)
/* Calculate the timeout period for data transactions */
/*
- timeout = __ilog2(mmc->tran_speed/10);
+ timeout = fls(mmc->tran_speed / 10) - 1;
timeout -= 13;
if (timeout > 14)
@@ -193,7 +178,7 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
* Note: This is way more than 8 cycles, but 1ms seems to
* resolve timing issues with some cards
*/
- udelay(1000);
+ udelay(10000);
/* Set up for a data transfer if we have one */
if (data) {
@@ -321,7 +306,7 @@ void set_sysctl(struct mmc *mmc, uint clock)
tmp = (readl(&regs->sysctl) & (~SYSCTL_CLOCK_MASK)) | clk;
writel(tmp, &regs->sysctl);
- mdelay(100);
+ udelay(10000);
#ifdef CONFIG_IMX_ESDHC_V1
tmp = readl(&regs->sysctl) | SYSCTL_PEREN;
@@ -358,7 +343,9 @@ static void esdhc_set_ios(struct mmc *mmc)
static int esdhc_init(struct mmc *mmc)
{
struct fsl_esdhc *regs = mmc->priv;
+ /*
int timeout = 1000;
+ */
u32 tmp;
/* Reset the eSDHC by writing 1 to RSTA bit of SYSCTRL Register */
@@ -366,7 +353,7 @@ static int esdhc_init(struct mmc *mmc)
writel(tmp, &regs->sysctl);
while (readl(&regs->sysctl) & SYSCTL_RSTA)
- mdelay(1);
+ ;
#ifdef CONFIG_IMX_ESDHC_V1
tmp = readl(&regs->sysctl) | (SYSCTL_HCKEN | SYSCTL_IPGEN);
@@ -382,7 +369,7 @@ static int esdhc_init(struct mmc *mmc)
/* FIXME: For our CINS bit doesn't work. So this section is disabled. */
/*
while (!(readl(&regs->prsstat) & PRSSTAT_CINS) && --timeout)
- mdelay(1);
+ ;
if (timeout <= 0) {
printf("No MMC card detected!\n");
@@ -395,7 +382,7 @@ static int esdhc_init(struct mmc *mmc)
writel(tmp, &regs->sysctl);
while (readl(&regs->sysctl) & SYSCTL_INITA)
- mdelay(1);
+ ;
#endif
return 0;
@@ -423,9 +410,8 @@ static int esdhc_initialize(bd_t *bis)
mmc->set_ios = esdhc_set_ios;
mmc->init = esdhc_init;
- /*
caps = regs->hostcapblt;
-
+ /*
if (caps & ESDHC_HOSTCAPBLT_VS18)
mmc->voltages |= MMC_VDD_165_195;
if (caps & ESDHC_HOSTCAPBLT_VS30)