mmc: Add support for wait_dat0 callback
authorLoic Poulain <loic.poulain@linaro.org>
Thu, 26 May 2022 14:37:21 +0000 (16:37 +0200)
committerJaehoon Chung <jh80.chung@samsung.com>
Wed, 15 Jun 2022 06:39:56 +0000 (15:39 +0900)
There is no wait_dat0 mmc ops, causing operations waiting for data
line state change (e.g mmc_switch_voltage) to fallback to a 250ms
active delay. mmc_ops still used when DM_MMC is not enabled, which
is often the case for SPL. The result can be unexpectly long SPL
boot time.

This change adds support for wait_dat0() mmc operation.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/mmc/mmc.c
include/mmc.h

index 8a7d073..12d29da 100644 (file)
@@ -34,6 +34,9 @@ static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage);
 
 static int mmc_wait_dat0(struct mmc *mmc, int state, int timeout_us)
 {
+       if (mmc->cfg->ops->wait_dat0)
+               return mmc->cfg->ops->wait_dat0(mmc, state, timeout_us);
+
        return -ENOSYS;
 }
 
index 9b4dc68..073b01f 100644 (file)
@@ -561,6 +561,7 @@ struct mmc_ops {
        int (*getwp)(struct mmc *mmc);
        int (*host_power_cycle)(struct mmc *mmc);
        int (*get_b_max)(struct mmc *mmc, void *dst, lbaint_t blkcnt);
+       int (*wait_dat0)(struct mmc *mmc, int state, int timeout_us);
 };
 
 static inline int mmc_hs400_prepare_ddr(struct mmc *mmc)