mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
emmc: add tuning retry.
PD#167389: add tuning retry when tuning points num == clk_div. Change-Id: I9cc68c9c69c1aad55e8cc916a5d5a4f6441e3ace Signed-off-by: Nan Li <nan.li@amlogic.com>
This commit is contained in:
@@ -716,6 +716,7 @@ int aml_sd_emmc_execute_tuning_(struct mmc_host *mmc, u32 opcode,
|
||||
u32 clock, clk_div;
|
||||
u32 adj_delay_find;
|
||||
int best_win_start = -1, best_win_size = 0;
|
||||
u32 rxdly[4] = {0x44444444, 0x88888888, 0xcccccccc, 0xFFFFFFFF};
|
||||
|
||||
writel(0, host->base + SD_EMMC_ADJUST);
|
||||
|
||||
@@ -746,6 +747,17 @@ tunning:
|
||||
pr_err("%s: tuning failed, reduce freq and retuning\n",
|
||||
mmc_hostname(host->mmc));
|
||||
goto tunning;
|
||||
} else if (best_win_size == clk_div) {
|
||||
if (++tuning_num > MAX_TUNING_RETRY) {
|
||||
pr_err("%s: tuning failed\n",
|
||||
mmc_hostname(host->mmc));
|
||||
return -1;
|
||||
}
|
||||
pr_warn("wave is not sharp, again\n");
|
||||
/* add basic data rx delay */
|
||||
writel(rxdly[tuning_num-1], host->base + SD_EMMC_DELAY);
|
||||
pr_warn("rxdly @ %x\n", rxdly[tuning_num-1]);
|
||||
goto tunning;
|
||||
} else {
|
||||
pr_info("%s: best_win_start =%d, best_win_size =%d\n",
|
||||
mmc_hostname(host->mmc), best_win_start, best_win_size);
|
||||
|
||||
Reference in New Issue
Block a user