Skip to contentSkip to conversation

More MMC fixes

PATCH Superseded Judith Mendez 2 participants 8 messages Apr 14, 2025 – Apr 17, 2025 MMC, SD and SDIO

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover More MMC fixes

This patch series fixes MMC_HS_52 mode in am654_sdhci driver, as well as HIGH_SPEED_ENA and UHS_MODE_SELECT for HS modes.

Also Disable eMMC HS400 mode for am62px device according to silicon errata i2458 [0] and add TI_COMMON_CMD_OPTIONS to K3 Sitara board a53 defconfigs.

[0] https://www.ti.com/lit/er/sprz574a/sprz574a.pdf

Changes since v1:
- rebase against master and fix merge conflicts for patch 5/5
- pick up bryans reviewed-by tag

Judith Mendez (5):
mmc: am654_sdhci: Add MMC_HS_52 to timing data
mmc: am654_sdhci: Fix HIGH_SPEED_ENA
mmc: am654_sdhci: Add am654_sdhci_set_control_reg
configs: am62px_evm_r5/a53_defconfig: Disable eMMC HS400
configs: am62*_evm_a53_defconfig: Add TI_COMMON_CMD_OPTIONS

 board/ti/common/Kconfig          |  2 ++
 configs/am62ax_evm_a53_defconfig |  3 +--
 configs/am62px_evm_a53_defconfig | 13 +++----------
 configs/am62px_evm_r5_defconfig  |  1 -
 configs/am62x_evm_a53_defconfig  |  3 +--
 configs/am64x_evm_a53_defconfig  | 11 +----------
 configs/am65x_evm_a53_defconfig  |  9 +--------
 drivers/mmc/am654_sdhci.c        | 25 +++++++++++++++++++------
 drivers/mmc/sdhci.c              |  2 +-
 include/sdhci.h                  |  1 +
 10 files changed, 30 insertions(+), 40 deletions(-)

base-commit: 8c98b57d72d5e5b94ed064fe1041e51216165334

Signature · 1 line
2.49.0
#1 lore raw

PATCH v2 1/5 mmc: am654_sdhci: Add MMC_HS_52 to timing data

This patch adds MMC_HS_52 to the timing data structure.

Previously, this bus mode tap settings were not populated and were instead populated for MMC_HS which is a different bus mode up to 26MHz. Since we intended these settings according to the device data sheet[0] for MMC_HS_52 up to 52MHz, populate MMC_HS tap settings for MMC_HS_52.

While we are here, fix typo in ti,itap-del-sel-mms-hs.

[0] https://www.ti.com/lit/ds/symlink/am625.pdf Table 7-79

---
 drivers/mmc/am654_sdhci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/am654_sdhci.c +5 -2
index b4c60a48d2e..e4fa8a88565 100644
@@ -125,12 +125,15 @@ static const struct timing_data td[] = {
 	[MMC_LEGACY]	= {"ti,otap-del-sel-legacy",
 			   "ti,itap-del-sel-legacy",
 			   0},
-	[MMC_HS]	= {"ti,otap-del-sel-mmc-hs",
-			   "ti,itap-del-sel-mms-hs",
+	[MMC_HS]	= {"ti,otap-del-sel-mmc-hs26",
+			   "ti,itap-del-sel-mmc-hs26",
 			   MMC_CAP(MMC_HS)},
 	[SD_HS]		= {"ti,otap-del-sel-sd-hs",
 			   "ti,itap-del-sel-sd-hs",
 			   MMC_CAP(SD_HS)},
+	[MMC_HS_52]	= {"ti,otap-del-sel-mmc-hs",
+			   "ti,itap-del-sel-mmc-hs",
+			   MMC_CAP(MMC_HS_52)},
 	[UHS_SDR12]	= {"ti,otap-del-sel-sdr12",
 			   "ti,itap-del-sel-sdr12",
 			   MMC_CAP(UHS_SDR12)},
Signature · 1 line
2.49.0
#2 lore raw

PATCH v2 2/5 mmc: am654_sdhci: Fix HIGH_SPEED_ENA

In reply to Judith Mendez

High Speed enable bit switches data launch from the falling clock edge (half cycle timing) to the rising clock edge (full cycle timing). For all SD UHS modes, data launch must happen at the rising clock edge, so set HIGH_SPEED_ENA for SDR12 and SDR25 modes. For all HS modes, data launch must happen at the falling clock edge, so do not set HIGH_SPEED_ENA for MMC_HS_52.

---
 drivers/mmc/am654_sdhci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/am654_sdhci.c +1 -2
index e4fa8a88565..28d82afd012 100644
@@ -412,8 +412,7 @@ static void am654_sdhci_write_b(struct sdhci_host *host, u8 val, int reg)
 		 */
 		case SD_HS:
 		case MMC_HS:
-		case UHS_SDR12:
-		case UHS_SDR25:
+		case MMC_HS_52:
 			val &= ~SDHCI_CTRL_HISPD;
 		default:
 			break;
Signature · 1 line
2.49.0
#3 lore raw

PATCH v2 3/5 mmc: am654_sdhci: Add am654_sdhci_set_control_reg

In reply to Judith Mendez

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.

---
 drivers/mmc/am654_sdhci.c | 15 +++++++++++++--
 drivers/mmc/sdhci.c       |  2 +-
 include/sdhci.h           |  1 +
 3 files changed, 15 insertions(+), 3 deletions(-)
drivers/mmc/am654_sdhci.c +13 -2
index 28d82afd012..0df3568f073 100644
@@ -523,13 +523,24 @@ static int am654_sdhci_execute_tuning(struct mmc *mmc, u8 opcode)
 	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 @@ const struct sdhci_ops j721e_4bit_sdhci_ops = {
 #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,
 };
 
drivers/mmc/sdhci.c +1 -1
index dc7f0724a7b..648dfa4b5ef 100644
@@ -549,7 +549,7 @@ void sdhci_set_uhs_timing(struct sdhci_host *host)
 	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;
include/sdhci.h +1 -0
index 31a49ca6a2f..2372697b743 100644
@@ -518,6 +518,7 @@ void sdhci_set_uhs_timing(struct sdhci_host *host);
 /* 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
Signature · 1 line
2.49.0
#4 lore raw

PATCH v2 4/5 configs: am62px_evm_r5/a53_defconfig: Disable eMMC HS400

In reply to Judith Mendez

This patch addresses silicon errata i2458 [0] "MMCHS: eMMC HS400 tDCD timing marginal to JEDEC spec". Where, in some corner cases, MMC0 interface may marginally exceed the tdCD JEDEC spec requirement of 300 ps. As per workaround, switch to HS200 mode instead of HS400.

[0] https://www.ti.com/lit/er/sprz574a/sprz574a.pdf

---
 configs/am62px_evm_a53_defconfig | 4 ++--
 configs/am62px_evm_r5_defconfig  | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
configs/am62px_evm_a53_defconfig +2 -2
index dae87c3b788..d9e68956676 100644
@@ -109,8 +109,8 @@ CONFIG_MMC_IO_VOLTAGE=y
 CONFIG_SPL_MMC_IO_VOLTAGE=y
 CONFIG_MMC_UHS_SUPPORT=y
 CONFIG_SPL_MMC_UHS_SUPPORT=y
-CONFIG_MMC_HS400_SUPPORT=y
-CONFIG_SPL_MMC_HS400_SUPPORT=y
+CONFIG_MMC_HS200_SUPPORT=y
+CONFIG_SPL_MMC_HS200_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
configs/am62px_evm_r5_defconfig +0 -1
index 39b6a83ab42..cba1f057be3 100644
@@ -87,7 +87,6 @@ CONFIG_SYS_I2C_OMAP24XX=y
 CONFIG_DM_MAILBOX=y
 CONFIG_K3_SEC_PROXY=y
 CONFIG_ESM_K3=y
-CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ADMA=y
 CONFIG_SPL_MMC_SDHCI_ADMA=y
Signature · 1 line
2.49.0
#5 lore raw

PATCH v2 5/5 configs: am62*_evm_a53_defconfig: Add TI_COMMON_CMD_OPTIONS

In reply to Judith Mendez

Add TI_COMMON_CMD_OPTIONS config options to Sitara K3 boards at a53 stage since we rely on most of the commands implied for testing and debugging purposes. Since all commands are now enabled by default, remove the redundant CMD_* options in the a53 defconfigs.

Also add MMC_REG & MMC_SPEED_MODE_SET useful commands to TI_COMMON_CMD_OPTIONS.

---
 board/ti/common/Kconfig          |  2 ++
 configs/am62ax_evm_a53_defconfig |  3 +--
 configs/am62px_evm_a53_defconfig |  9 +--------
 configs/am62x_evm_a53_defconfig  |  3 +--
 configs/am64x_evm_a53_defconfig  | 11 +----------
 configs/am65x_evm_a53_defconfig  |  9 +--------
 6 files changed, 7 insertions(+), 30 deletions(-)
board/ti/common/Kconfig +2 -0
index c03aa3a368f..b5978acdded 100644
@@ -41,6 +41,8 @@ config TI_COMMON_CMD_OPTIONS
 	imply CMD_I2C
 	imply CMD_MII
 	imply CMD_MMC
+	imply CMD_MMC_REG
+	imply MMC_SPEED_MODE_SET
 	imply CMD_NFS
 	imply CMD_PART
 	imply CMD_PING
configs/am62ax_evm_a53_defconfig +1 -2
index d77ff2d7221..f32af49a778 100644
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_K3=y
 CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -39,8 +40,6 @@ CONFIG_SPL_I2C=y
 CONFIG_SPL_DM_MAILBOX=y
 CONFIG_SPL_POWER_DOMAIN=y
 CONFIG_SPL_YMODEM_SUPPORT=y
-CONFIG_CMD_MMC=y
-CONFIG_MMC_SPEED_MODE_SET=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_UPSTREAM=y
configs/am62px_evm_a53_defconfig +1 -8
index d9e68956676..f0a6caf079e 100644
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_K3=y
 CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -55,20 +56,12 @@ CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_BOOTEFI_SELFTEST=y
 CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_CMD_CLK=y
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_GPT=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_REMOTEPROC=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_EFIDEBUG=y
-CONFIG_CMD_TIME=y
-CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_UBI=y
-CONFIG_MMC_SPEED_MODE_SET=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_UPSTREAM=y
configs/am62x_evm_a53_defconfig +1 -2
index 130ff392438..0147be3d15d 100644
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_ARCH_K3=y
 CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -55,12 +56,10 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_BOOTEFI_SELFTEST=y
 CONFIG_CMD_NVEDIT_EFI=y
-CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_UBI=y
 CONFIG_CMD_EFIDEBUG=y
-CONFIG_MMC_SPEED_MODE_SET=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_UPSTREAM=y
configs/am64x_evm_a53_defconfig +1 -10
index 22288655bfd..e3389c98186 100644
@@ -3,6 +3,7 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
 CONFIG_ARCH_K3=y
 CONFIG_SYS_MALLOC_LEN=0x2000000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_SPL_GPIO=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
@@ -65,22 +66,12 @@ CONFIG_SYS_SPI_U_BOOT_OFFS=0x300000
 CONFIG_SPL_THERMAL=y
 CONFIG_SPL_YMODEM_SUPPORT=y
 CONFIG_CMD_BOOTEFI_SELFTEST=y
-CONFIG_CMD_ASKENV=y
 CONFIG_CMD_NVEDIT_EFI=y
-CONFIG_CMD_DFU=y
-CONFIG_CMD_GPT=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_MTDPARTS=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
 CONFIG_CMD_EFIDEBUG=y
-CONFIG_CMD_TIME=y
 CONFIG_CMD_UBI=y
-CONFIG_CMD_PMIC=y
-CONFIG_CMD_REGULATOR=y
-CONFIG_MMC_SPEED_MODE_SET=y
 CONFIG_OF_CONTROL=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_UPSTREAM=y
configs/am65x_evm_a53_defconfig +1 -8
index 12c4cb96815..e0bb66c56d7 100644
@@ -3,6 +3,7 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
 CONFIG_ARCH_K3=y
 CONFIG_SYS_MALLOC_LEN=0x2000000
 CONFIG_SYS_MALLOC_F_LEN=0x8000
+CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SOC_K3_AM654=y
@@ -59,15 +60,7 @@ CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x280000
 CONFIG_SPL_YMODEM_SUPPORT=y
-CONFIG_CMD_ASKENV=y
-CONFIG_CMD_DFU=y
-CONFIG_CMD_GPT=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
-CONFIG_MMC_SPEED_MODE_SET=y
 CONFIG_CMD_PCI=y
-CONFIG_CMD_USB=y
-CONFIG_CMD_TIME=y
 CONFIG_MTDIDS_DEFAULT="nor0=47040000.spi.0"
 CONFIG_MTDPARTS_DEFAULT="mtdparts=47040000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),128k(ospi.env),128k(ospi.env.backup),1m(ospi.sysfw),-@8m(ospi.rootfs)"
 CONFIG_CMD_UBI=y
Signature · 1 line
2.49.0
#6 lore raw
In reply to Judith Mendez

Hi Tom,

Quoted 8 lines · Judith Mendez

This patch series fixes MMC_HS_52 mode in am654_sdhci driver, as well as HIGH_SPEED_ENA and UHS_MODE_SELECT for HS modes.

Also Disable eMMC HS400 mode for am62px device according to silicon errata i2458 [0] and add TI_COMMON_CMD_OPTIONS to K3 Sitara board a53 defconfigs.

Please do not merge this patch series just yet,
I will be respinning one more time, apologies.

~ Judith

#7 lore raw
Quoted 8 lines · Judith Mendez

Hi Tom,

Quoted 4 lines · Judith Mendez

This patch series fixes MMC_HS_52 mode in am654_sdhci driver, as well as HIGH_SPEED_ENA and UHS_MODE_SELECT for HS modes.

Quoted 8 lines
Quoted 4 lines

Also Disable eMMC HS400 mode for am62px device according to silicon errata i2458 [0] and add TI_COMMON_CMD_OPTIONS to K3 Sitara board a53 defconfigs.

Please do not merge this patch series just yet,
I will be respinning one more time, apologies.

OK, thanks.

Signature · 1 line
Tom