[U-Boot] [PATCH/RFC] drivers/mmc/mmc.c: change the controller frequency before the card frequency
Albin Tonnerre
albin.tonnerre at free-electrons.com
Wed Aug 19 14:16:51 CEST 2009
While rewriting the atmel_mci driver to use the new MMC_GENERIC API (and allow
the use of SD/MMC on AT91 in the process), it appeared that switching the card
frequency before the controller frequency resulted in the answer from the card
never being received. Changing the controller frequency before the controller
frequency fixes that.
Signed-off-by: Albin Tonnerre <albin.tonnerre at free-electrons.com>
---
I'm sending this as an RFC, as I only own AT91-based boards. Therefore, I don't
know whether doing so breaks the code for other cards or not. Andy, do you see
any obvious problem with such a change ? Haavard: I did not find evidence of
such a requirement in the AT91SAM9G20 datasheet, is it known behaviour, or do
you think I'm doing something wrong that might cause this ?
drivers/mmc/mmc.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index b69ce15..6ff3624 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -717,14 +717,6 @@ int mmc_startup(struct mmc *mmc)
if (err)
return err;
- if (IS_SD(mmc))
- err = sd_change_freq(mmc);
- else
- err = mmc_change_freq(mmc);
-
- if (err)
- return err;
-
/* Restrict card's capabilities by what the host can do */
mmc->card_caps &= mmc->host_caps;
@@ -786,6 +778,14 @@ int mmc_startup(struct mmc *mmc)
mmc_set_clock(mmc, 20000000);
}
+ if (IS_SD(mmc))
+ err = sd_change_freq(mmc);
+ else
+ err = mmc_change_freq(mmc);
+
+ if (err)
+ return err;
+
/* fill in device description */
mmc->block_dev.lun = 0;
mmc->block_dev.type = 0;
--
1.6.0.4
More information about the U-Boot
mailing list