static int initr_mmc(void) common/board_r.c
int mmc_initialize(bd_t *bis) drivers/mmc/mmc.c
int board_mmc_init(bd_t *bis) board/atmel/sama5d2_xplained/sama5d2_xplained.c
int atmel_sdhci_init(void *regbase, int id) drivers/mmc/atmel_sdhci.c
static void do_preinit(void)
int mmc_start_init(struct mmc *mmc)
void mmc_set_clock(struct mmc *mmc, uint clock)
static void mmc_set_ios(struct mmc *mmc)
static void sdhci_set_ios(struct mmc *mmc) drivers/mmc/sdhci.c
static int sdhci_set_clock(struct mmc *mmc, unsigned int clock)
问题出在这个函数
if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) {
if (host->clk_mul) {
for (div = 1; div <= 1024; div++) {
if ((mmc->cfg->f_max / div) <= clock)
break;
}
/*
* Set Programmable Clock Mode in the Clock
* Control register.
*/
clk = SDHCI_PROG_CLOCK_MODE;
div--;
}
}
timeout = 20;
while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
& SDHCI_CLOCK_INT_STABLE)) {
if (timeout == 0) {
printf("%s: Internal clock never stabilised.\n",
__func__);
return -1;
}
timeout--;
udelay(1000);
}
从log上看,sdhci_set_clock是走的上面流程,并且有时会在打印Internal clock never stabilised,所以增大
timeout再测试