@@ -757,7 +757,11 @@ static void esdhc_post_tuning(struct sdhci_host *host)
static int esdhc_executing_tuning(struct sdhci_host *host, u32 opcode)
{
- int min, max, avg, ret;
+ int min, max, avg, ret, present;
+
+ present = host->mmc->ops->get_cd(host->mmc);
+ if (!present)
+ return -ENOMEDIUM;
/* find the mininum delay first which can pass tuning */
min = ESDHC_TUNE_CTRL_MIN;
@@ -1767,6 +1767,11 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
unsigned long flags;
unsigned int tuning_count = 0;
bool hs400_tuning;
+ int present;
+
+ present = mmc->ops->get_cd(mmc);
+ if (!present)
+ return -ENOMEDIUM;
And if we need fix all platforms, do you think we should
do it in MMC core mmc_execute_tuning()?