[RFC PATCH V3 20/21] mmc: sdhci-uhs2: add post-mmc_attach_sd hook

From: Ben Chuang
Date: Fri Jul 10 2020 - 07:12:34 EST


From: Ben Chuang <ben.chuang@xxxxxxxxxxxxxxxxxxx>

This "post" hook for mmc_attach_sd(), uhs2_post_attach_sd, will be required
to enable UHS-II support, at least, on GL9755.

Signed-off-by: Ben Chuang <ben.chuang@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@xxxxxxxxxx>
---
drivers/mmc/host/sdhci.c | 9 +++++++++
drivers/mmc/host/sdhci.h | 1 +
2 files changed, 10 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 5d84e61f6ad9..a2cc5f758547 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3155,6 +3155,14 @@ static void sdhci_uhs2_enable_clk(struct mmc_host *mmc)
udelay(10);
}
}
+
+static void sdhci_uhs2_post_attach_sd(struct mmc_host *mmc)
+{
+ struct sdhci_host *host = mmc_priv(mmc);
+
+ if (host->ops && host->ops->uhs2_post_attach_sd)
+ host->ops->uhs2_post_attach_sd(host);
+}
#endif /* CONFIG_MMC_SDHCI_UHS2 */

static const struct mmc_host_ops sdhci_ops = {
@@ -3177,6 +3185,7 @@ static const struct mmc_host_ops sdhci_ops = {
.uhs2_set_reg = sdhci_uhs2_set_reg,
.uhs2_disable_clk = sdhci_uhs2_disable_clk,
.uhs2_enable_clk = sdhci_uhs2_enable_clk,
+ .uhs2_post_attach_sd = sdhci_uhs2_post_attach_sd,
#endif /* CONFIG_MMC_SDHCI_UHS2 */
};

diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index c825a8130bc1..d613ff8daaf6 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -723,6 +723,7 @@ struct sdhci_ops {
void (*dump_vendor_regs)(struct sdhci_host *host);
/* UHS-2 support */
void (*uhs2_pre_detect_init)(struct sdhci_host *host);
+ void (*uhs2_post_attach_sd)(struct sdhci_host *host);
};

struct sdhci_uhs2_ops {
--
2.27.0