diff options
author | Tom Rini <trini@konsulko.com> | 2016-02-02 07:24:52 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-02-02 07:24:52 -0500 |
commit | 161b1fe745394f34c4aa506edc964089785919f6 (patch) | |
tree | 8d7c40866bfd9df6e5ed6e848469e43ed9f77b42 /drivers/mmc | |
parent | 008e61f5120e7d3acb937953b1322e3aee3160d4 (diff) | |
parent | 37dadbca0c8b9bff00f892fd87a978cbe0a98b3a (diff) | |
download | u-boot-imx-161b1fe745394f34c4aa506edc964089785919f6.zip u-boot-imx-161b1fe745394f34c4aa506edc964089785919f6.tar.gz u-boot-imx-161b1fe745394f34c4aa506edc964089785919f6.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-atmel
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/gen_atmel_mci.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c index da870c6..0474a15 100644 --- a/drivers/mmc/gen_atmel_mci.c +++ b/drivers/mmc/gen_atmel_mci.c @@ -36,6 +36,7 @@ struct atmel_mci_priv { struct mmc_config cfg; struct atmel_mci *mci; unsigned int initialized:1; + unsigned int curr_clk; }; /* Read Atmel MCI IP version */ @@ -91,7 +92,10 @@ static void mci_set_mode(struct mmc *mmc, u32 hz, u32 blklen) } } - + if (version >= 0x500) + priv->curr_clk = bus_hz / (clkdiv * 2 + clkodd + 2); + else + priv->curr_clk = (bus_hz / (clkdiv + 1)) / 2; blklen &= 0xfffc; mr = MMCI_BF(CLKDIV, clkdiv); @@ -118,8 +122,6 @@ static void mci_set_mode(struct mmc *mmc, u32 hz, u32 blklen) if (mmc->card_caps & mmc->cfg->host_caps & MMC_MODE_HS) writel(MMCI_BIT(HSMODE), &mci->cfg); - udelay(50); - priv->initialized = 1; } @@ -323,6 +325,13 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) } } + /* + * After the switch command, wait for 8 clocks before the next + * command + */ + if (cmd->cmdidx == MMC_CMD_SWITCH) + udelay(8*1000000 / priv->curr_clk); /* 8 clk in us */ + return 0; } |