Skip to content

Commit 661cf2d

Browse files
osctobestorulf
authored andcommitted
mmc: core: limit probe clock frequency to configured f_max
Currently MMC core disregards host->f_max during card initialization phase. Obey upper boundary for the clock frequency and skip faster speeds when they are above the limit. Signed-off-by: Michał Mirosław <[email protected]> Link: https://lore.kernel.org/r/f471bceaf237d582d746bd289c4c4f3639cb7b45.1577962382.git.mirq-linux@rere.qmqm.pl Signed-off-by: Ulf Hansson <[email protected]>
1 parent 557c031 commit 661cf2d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/mmc/core/core.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,7 +2330,13 @@ void mmc_rescan(struct work_struct *work)
23302330
}
23312331

23322332
for (i = 0; i < ARRAY_SIZE(freqs); i++) {
2333-
if (!mmc_rescan_try_freq(host, max(freqs[i], host->f_min)))
2333+
unsigned int freq = freqs[i];
2334+
if (freq > host->f_max) {
2335+
if (i + 1 < ARRAY_SIZE(freqs))
2336+
continue;
2337+
freq = host->f_max;
2338+
}
2339+
if (!mmc_rescan_try_freq(host, max(freq, host->f_min)))
23342340
break;
23352341
if (freqs[i] <= host->f_min)
23362342
break;
@@ -2344,7 +2350,7 @@ void mmc_rescan(struct work_struct *work)
23442350

23452351
void mmc_start_host(struct mmc_host *host)
23462352
{
2347-
host->f_init = max(freqs[0], host->f_min);
2353+
host->f_init = max(min(freqs[0], host->f_max), host->f_min);
23482354
host->rescan_disable = 0;
23492355
host->ios.power_mode = MMC_POWER_UNDEFINED;
23502356

0 commit comments

Comments
 (0)