]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mmc: sdhci-cadence: Enable software tuning for both SD and eMMC interfaces
authorTanmay Kathpalia <tanmay.kathpalia@altera.com>
Wed, 3 Dec 2025 12:21:37 +0000 (04:21 -0800)
committerPeng Fan <peng.fan@nxp.com>
Thu, 11 Dec 2025 12:53:52 +0000 (20:53 +0800)
Remove interface type restrictions in sdhci_cdns_execute_tuning() to
enable software tuning for both SD and eMMC devices. The previous
assumption that SD timing should be handled by SDHCI core is incorrect
based on the actual function assignment logic.

The execute_tuning function is assigned based on MMC_SUPPORTS_TUNING
config, which is enabled by both MMC_UHS_SUPPORT and MMC_HS200_SUPPORT.

Changes:
Remove IS_MMC() check that restricted tuning to eMMC only
Remove opcode validation limited to MMC_CMD_SEND_TUNING_BLOCK_HS200

Signed-off-by: Tanmay Kathpalia <tanmay.kathpalia@altera.com>
Reviewed-by: Balsundar Ponnusamy <balsundar.ponnusamy@altera.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/mmc/sdhci-cadence.c

index a0b9434e4f01871b95e2d3e7e5fe6a3d848d4ccd..c7f88977ef92b9b78876ee78da9eea215d1caed7 100644 (file)
@@ -207,16 +207,10 @@ static int __maybe_unused sdhci_cdns_execute_tuning(struct udevice *dev,
        int i;
 
        /*
-        * This handler only implements the eMMC tuning that is specific to
-        * this controller.  The tuning for SD timing should be handled by the
-        * SDHCI core.
+        * This function performs the tuning process for both SD and eMMC
+        * interfaces. It sweeps through all available tuning points,
+        * sending tuning commands at each step.
         */
-       if (!IS_MMC(mmc))
-               return -ENOTSUPP;
-
-       if (WARN_ON(opcode != MMC_CMD_SEND_TUNING_BLOCK_HS200))
-               return -EINVAL;
-
        for (i = 0; i < SDHCI_CDNS_MAX_TUNING_LOOP; i++) {
                if (sdhci_cdns_set_tune_val(plat, i) ||
                    mmc_send_tuning(mmc, opcode)) { /* bad */