Skip to content

Commit 810e08e

Browse files
Fredrik Soderstedtcjb
authored andcommitted
mmc: core: Only execute tuning for SDR50 and SDR104
Only execute tuning for sd and sdio devices that are using SDR50 or SDR104. Make sure clock is hold during tuning for sdio devices. Signed-off-by: Fredrik Soderstedt <fredrik.soderstedt@stericsson.com> Acked-by: Johan Rudholm <jrudholm@gmail.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
1 parent 4a29b55 commit 810e08e

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

‎drivers/mmc/core/sd.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,13 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
646646
if (err)
647647
goto out;
648648

649-
/* SPI mode doesn't define CMD19 */
650-
if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning) {
649+
/*
650+
* SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
651+
* SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
652+
*/
653+
if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning &&
654+
(card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
655+
card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) {
651656
mmc_host_clk_hold(card->host);
652657
err = card->host->ops->execute_tuning(card->host,
653658
MMC_SEND_TUNING_BLOCK);

‎drivers/mmc/core/sdio.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,18 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
563563
if (err)
564564
goto out;
565565

566-
/* Initialize and start re-tuning timer */
567-
if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning)
566+
/*
567+
* SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
568+
* SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
569+
*/
570+
if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning &&
571+
((card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR50) ||
572+
(card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104))) {
573+
mmc_host_clk_hold(card->host);
568574
err = card->host->ops->execute_tuning(card->host,
569575
MMC_SEND_TUNING_BLOCK);
576+
mmc_host_clk_release(card->host);
577+
}
570578

571579
out:
572580

0 commit comments

Comments
 (0)