mmc: am654_sdhci: Add am654_sdhci_set_control_reg
This patch adds am654_sdhci_set_control_reg to am654_sdhci.
This is required to fix UHS_MODE_SELECT for TI K3 boards.
If any of HIGH_SPEED_ENA, V1P8_SIGNAL_ENA, UHS_MODE_SELECT
are set, then data will be launched on the pos-edge of the
clock.
Since K3 SoCs did not meet timing requirements for High Speed
SDR mode at rising clock edge, none of these three should be
set, therefore limit UHS_MODE_SELECT to only be set for modes
above MMC_HS_52.
This fixes MMC write issue on am64x evm at mode High Speed
SDR.
Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: Bryan Brattlof <bb@ti.com>
diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
index 28d82af..0df3568 100644
--- a/drivers/mmc/am654_sdhci.c
+++ b/drivers/mmc/am654_sdhci.c
@@ -523,13 +523,24 @@
return 0;
}
#endif
+
+void am654_sdhci_set_control_reg(struct sdhci_host *host)
+{
+ struct mmc *mmc = host->mmc;
+
+ sdhci_set_voltage(host);
+
+ if (mmc->selected_mode > MMC_HS_52)
+ sdhci_set_uhs_timing(host);
+}
+
const struct sdhci_ops am654_sdhci_ops = {
#if CONFIG_IS_ENABLED(MMC_SUPPORTS_TUNING)
.platform_execute_tuning = am654_sdhci_execute_tuning,
#endif
.deferred_probe = am654_sdhci_deferred_probe,
.set_ios_post = &am654_sdhci_set_ios_post,
- .set_control_reg = sdhci_set_control_reg,
+ .set_control_reg = am654_sdhci_set_control_reg,
.write_b = am654_sdhci_write_b,
};
@@ -589,7 +600,7 @@
#endif
.deferred_probe = am654_sdhci_deferred_probe,
.set_ios_post = &j721e_4bit_sdhci_set_ios_post,
- .set_control_reg = sdhci_set_control_reg,
+ .set_control_reg = am654_sdhci_set_control_reg,
.write_b = am654_sdhci_write_b,
};
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index dc7f072..648dfa4 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -549,7 +549,7 @@
sdhci_writew(host, reg, SDHCI_HOST_CONTROL2);
}
-static void sdhci_set_voltage(struct sdhci_host *host)
+void sdhci_set_voltage(struct sdhci_host *host)
{
if (IS_ENABLED(CONFIG_MMC_IO_VOLTAGE)) {
struct mmc *mmc = (struct mmc *)host->mmc;
diff --git a/include/sdhci.h b/include/sdhci.h
index 31a49ca..2372697 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -518,6 +518,7 @@
/* Export the operations to drivers */
int sdhci_probe(struct udevice *dev);
int sdhci_set_clock(struct mmc *mmc, unsigned int clock);
+void sdhci_set_voltage(struct sdhci_host *host);
/**
* sdhci_set_control_reg - Set control registers