Skip to content

Commit 697542b

Browse files
jh80chungstorulf
authored andcommitted
mmc: dw_mmc: exynos: fix the finding clock sample value
Even though there are candiates value if can't find best value, it's returned -EIO. It's not proper behavior. If there is not best value, use a first candiate value to work eMMC. Signed-off-by: Jaehoon Chung <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Tested-by: Christian Hewitt <[email protected]> Cc: [email protected] Fixes: c537a1c ("mmc: dw_mmc: exynos: add variable delay tuning sequence") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 162079f commit 697542b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/mmc/host/dw_mmc-exynos.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,18 @@ static s8 dw_mci_exynos_get_best_clksmpl(u8 candiates)
464464
}
465465
}
466466

467+
/*
468+
* If there is no cadiates value, then it needs to return -EIO.
469+
* If there are candiates values and don't find bset clk sample value,
470+
* then use a first candiates clock sample value.
471+
*/
472+
for (i = 0; i < iter; i++) {
473+
__c = ror8(candiates, i);
474+
if ((__c & 0x1) == 0x1) {
475+
loc = i;
476+
goto out;
477+
}
478+
}
467479
out:
468480
return loc;
469481
}
@@ -494,6 +506,8 @@ static int dw_mci_exynos_execute_tuning(struct dw_mci_slot *slot, u32 opcode)
494506
priv->tuned_sample = found;
495507
} else {
496508
ret = -EIO;
509+
dev_warn(&mmc->class_dev,
510+
"There is no candiates value about clksmpl!\n");
497511
}
498512

499513
return ret;

0 commit comments

Comments
 (0)