At the end of HS400ES initialization by the core mmc driver, mmc_set_enhanced_strobe() is called. This expects the host driver to have an ops function for it.
The DW-MMC driver does not have it, thus the call fails with -ENOSUPP. Add the ops function to allow control to be passed to the host side. Since DW-MMC driver implementation depends on the platform, the above ops function is made to pass its control to the implementation-specific function available in the platform-specific driver. Signed-off-by: Kaustabh Chakraborty <[email protected]> --- drivers/mmc/dw_mmc.c | 19 +++++++++++++++++++ include/dwmmc.h | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index d9c05b223d5..0a245d72881 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -730,6 +730,19 @@ static int dwmci_init(struct mmc *mmc) return 0; } +#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT) +static int dwmci_set_enhanced_strobe(struct udevice *dev) +{ + struct mmc *mmc = mmc_get_mmc_dev(dev); + struct dwmci_host *host = mmc->priv; + + if (host && host->set_enhanced_strobe) + return host->set_enhanced_strobe(host); + + return 0; +} +#endif + #if CONFIG_IS_ENABLED(DM_MMC) int dwmci_probe(struct udevice *dev) { @@ -741,6 +754,9 @@ int dwmci_probe(struct udevice *dev) const struct dm_mmc_ops dm_dwmci_ops = { .send_cmd = dwmci_send_cmd, .set_ios = dwmci_set_ios, +#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT) + .set_enhanced_strobe = dwmci_set_enhanced_strobe, +#endif }; #else @@ -748,6 +764,9 @@ static const struct mmc_ops dwmci_ops = { .send_cmd = dwmci_send_cmd, .set_ios = dwmci_set_ios, .init = dwmci_init, +#if CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT) + .set_enhanced_strobe = dwmci_set_enhanced_strobe, +#endif }; #endif diff --git a/include/dwmmc.h b/include/dwmmc.h index 7e1a6646518..49488709a82 100644 --- a/include/dwmmc.h +++ b/include/dwmmc.h @@ -225,6 +225,16 @@ struct dwmci_host { * return that value too. Then DWMMC will put itself in bypass mode. */ unsigned int (*get_mmc_clk)(struct dwmci_host *host, uint freq); + /** + * @set_enhanced_strobe: (Optional) Platform function to run on enabling + * HS400ES strobe + * + * @host: DWMMC host + * + * This is used to enable the enhanced strobe for the HS400ES MMC mode. + * The caller invokes this at the end of the HS400ES frequency dance. + */ + unsigned int (*set_enhanced_strobe)(struct dwmci_host *host); #ifndef CONFIG_BLK struct mmc_config cfg; -- 2.53.0

