Skip to content

Commit

Permalink
mmc: Allow tuning to be prevented during card initialization
Browse files Browse the repository at this point in the history
Add a new field to the mmc_host struct to track when the card should never retune
and use it to conditionally stop tuning in the mmc_sd_init_uhs_card function.
Currently the new field only gets set when a DDR50 card fails to tune, which
indicates the card does not support tuning.

Signed-off-by: Erick Shepherd <[email protected]>
  • Loading branch information
erickshepherdNI committed Jan 23, 2025
1 parent 8680ea0 commit a99a2bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/mmc/core/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,8 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
if (!mmc_host_is_spi(card->host) &&
(card->host->ios.timing == MMC_TIMING_UHS_SDR50 ||
card->host->ios.timing == MMC_TIMING_UHS_DDR50 ||
card->host->ios.timing == MMC_TIMING_UHS_SDR104)) {
card->host->ios.timing == MMC_TIMING_UHS_SDR104) &&
!card->host->never_retune) {
err = mmc_execute_tuning(card);

/*
Expand All @@ -681,6 +682,7 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
if (err && card->host->ios.timing == MMC_TIMING_UHS_DDR50) {
pr_warn("%s: ddr50 tuning failed\n",
mmc_hostname(card->host));
card->host->never_retune = 1;
err = 0;
}
}
Expand Down
1 change: 1 addition & 0 deletions include/linux/mmc/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ struct mmc_host {
unsigned int claimed:1; /* host exclusively claimed */
unsigned int doing_init_tune:1; /* initial tuning in progress */
unsigned int can_retune:1; /* re-tuning can be used */
unsigned int never_retune:1; /* re-tuning can never be used */
unsigned int doing_retune:1; /* re-tuning in progress */
unsigned int retune_now:1; /* do re-tuning at next req */
unsigned int retune_paused:1; /* re-tuning is temporarily disabled */
Expand Down

0 comments on commit a99a2bc

Please sign in to comment.