mmc: core: Add HS400 tuning in HS400es initialization
authorMengqi Zhang <mengqi.zhang@mediatek.com>
Mon, 25 Dec 2023 09:38:40 +0000 (17:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2024 14:22:53 +0000 (16:22 +0200)
commit 77e01b49e35f24ebd1659096d5fc5c3b75975545 upstream.

During the initialization to HS400es stage, add a HS400 tuning flow as an
optional process. For Mediatek IP, the HS400es mode requires a specific
tuning to ensure the correct HS400 timing setting.

Signed-off-by: Mengqi Zhang <mengqi.zhang@mediatek.com>
Link: https://lore.kernel.org/r/20231225093839.22931-2-mengqi.zhang@mediatek.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Lin Gui (桂林)" <Lin.Gui@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/core/mmc.c

index 3a927452a6501b62bfe2e5260ba2bf8c5ed494c7..7e39017e440fb2275ed95e6b9aaff197884122d3 100644 (file)
@@ -1819,8 +1819,13 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 
                if (err)
                        goto free_card;
-
-       } else if (!mmc_card_hs400es(card)) {
+       } else if (mmc_card_hs400es(card)) {
+               if (host->ops->execute_hs400_tuning) {
+                       err = host->ops->execute_hs400_tuning(host, card);
+                       if (err)
+                               goto free_card;
+               }
+       } else {
                /* Select the desired bus width optionally */
                err = mmc_select_bus_width(card);
                if (err > 0 && mmc_card_hs(card)) {