]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
mmc: dw_mmc: Add support for platform specific eMMC HW reset
authorLiming Sun <limings@nvidia.com>
Wed, 12 Jun 2024 22:52:37 +0000 (18:52 -0400)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 8 Jul 2024 13:02:33 +0000 (15:02 +0200)
This commit adds a new callback to allow drivers to support platform
specific eMMC HW reset.

Reviewed-by: David Thompson <davthompson@nvidia.com>
Signed-off-by: Liming Sun <limings@nvidia.com>
Link: https://lore.kernel.org/r/3df02ffa8bdaa74f5261c8914d2545b97fb3478a.1718213918.git.limings@nvidia.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/dw_mmc.h

index 7195de2cde448789018bfe24251a13014a7e5ad6..2333ef4893ee0da0b63ad2b37ebf8b7ccb330f29 100644 (file)
@@ -1617,6 +1617,7 @@ static void dw_mci_hw_reset(struct mmc_host *mmc)
 {
        struct dw_mci_slot *slot = mmc_priv(mmc);
        struct dw_mci *host = slot->host;
+       const struct dw_mci_drv_data *drv_data = host->drv_data;
        int reset;
 
        if (host->use_dma == TRANS_MODE_IDMAC)
@@ -1626,6 +1627,11 @@ static void dw_mci_hw_reset(struct mmc_host *mmc)
                                     SDMMC_CTRL_FIFO_RESET))
                return;
 
+       if (drv_data && drv_data->hw_reset) {
+               drv_data->hw_reset(host);
+               return;
+       }
+
        /*
         * According to eMMC spec, card reset procedure:
         * tRstW >= 1us:   RST_n pulse width
index b504f7ae513a48e5aa418aae80cad31a779418aa..6447b916990dcd9ce91fca46e38985054d7e9612 100644 (file)
@@ -566,6 +566,7 @@ struct dw_mci_slot {
  * @execute_tuning: implementation specific tuning procedure.
  * @set_data_timeout: implementation specific timeout.
  * @get_drto_clks: implementation specific cycle count for data read timeout.
+ * @hw_reset: implementation specific HW reset.
  *
  * Provide controller implementation specific extensions. The usage of this
  * data structure is fully optional and usage of each member in this structure
@@ -586,5 +587,6 @@ struct dw_mci_drv_data {
        void            (*set_data_timeout)(struct dw_mci *host,
                                          unsigned int timeout_ns);
        u32             (*get_drto_clks)(struct dw_mci *host);
+       void            (*hw_reset)(struct dw_mci *host);
 };
 #endif /* _DW_MMC_H_ */