diff mbox series

[1/2] mmc: Add support for wait_dat0 callback

Message ID 1653575842-14986-1-git-send-email-loic.poulain@linaro.org
State Accepted
Commit d6ad5a0af9e6a12f47008141259f77b568c73ab2
Headers show
Series [1/2] mmc: Add support for wait_dat0 callback | expand

Commit Message

Loic Poulain May 26, 2022, 2:37 p.m. UTC
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>
---
 drivers/mmc/mmc.c | 3 +++
 include/mmc.h     | 1 +
 2 files changed, 4 insertions(+)

Comments

Jaehoon Chung May 27, 2022, 2:13 a.m. UTC | #1
On 5/26/22 23:37, Loic Poulain wrote:
> 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>

Best Regards,
Jaehoon Chung

> ---
>  drivers/mmc/mmc.c | 3 +++
>  include/mmc.h     | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index f6ccd83..109f340 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -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;
>  }
>  
> diff --git a/include/mmc.h b/include/mmc.h
> index 6bdcce8..b7e94e8 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -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)
diff mbox series

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index f6ccd83..109f340 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -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;
 }
 
diff --git a/include/mmc.h b/include/mmc.h
index 6bdcce8..b7e94e8 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -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)