From 21cdfd199220cd259b5b7d472cee0577b7eb8eca Mon Sep 17 00:00:00 2001 From: Christoph Stoidner Date: Fri, 31 Oct 2025 15:59:51 +0100 Subject: mmc: Fix missing 1 ms delay after mmc power up mmc/sd specification requires a 1 ms delay (stable supply voltage) after vdd was enabled and before issuing first command. For most sdcard/soc combinations, the missing delay seems to be not a problem because the processing time between enabling vdd and the first command is often hundreds of microseconds or more. However, in our specific case, some sdcards were not detected by u-boot: * soc: NXP i.MX 93 * sdcards: SanDisk Ultra, 64GB micro SDXC 1, MediaRange, 8GB, SDHC * measured time between vdd and first command: approx. 784us * symptom: both sdcards did not respond at all to first commands, u-boot mmc subsystem ran into timeout and stops to initialize the cards Signed-off-by: Christoph Stoidner Cc: Peng Fan Cc: Jaehoon Chung Signed-off-by: Peng Fan --- drivers/mmc/mmc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index bf82c515600..71664173016 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -2933,11 +2933,18 @@ static int mmc_power_cycle(struct mmc *mmc) return ret; /* - * SD spec recommends at least 1ms of delay. Let's wait for 2ms - * to be on the safer side. + * SD spec recommends at least 1ms of 'power on' delay. + * Let's wait for 2ms to be on the safer side. */ udelay(2000); - return mmc_power_on(mmc); + ret = mmc_power_on(mmc); + + /* + * SD spec recommends at least 1ms of 'stable supply voltage' delay. + * Let's wait for 2ms to be on the safer side. + */ + udelay(2000); + return ret; } int mmc_get_op_cond(struct mmc *mmc, bool quiet) -- cgit v1.3.1 From 3f208e1a99203c8ff257202a2e8447cc43a666c9 Mon Sep 17 00:00:00 2001 From: Daniel Palmer Date: Sat, 27 Dec 2025 19:59:46 +0900 Subject: mmc: mmc_spi: Select CRC16 if CRC checking is enabled Currently CRC16 is not selected when CRC checking is enabled and if it wasn't enabled in the config otherwise the build will fail because of references to crc16_ccitt() that doesn't exist. Signed-off-by: Daniel Palmer Signed-off-by: Peng Fan --- drivers/mmc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index 4c46df0ffb8..39caf2eff1b 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -91,6 +91,7 @@ config MMC_SPI_CRC_ON bool "Support CRC for SPI-based MMC controller" depends on MMC_SPI default y + select CRC16 help This enables CRC for SPI-based MMC controllers. -- cgit v1.3.1 From c4f5b1d4b037beeb538cf6dee0a16cd196539273 Mon Sep 17 00:00:00 2001 From: Tanmay Kathpalia Date: Thu, 8 Jan 2026 03:40:02 -0800 Subject: Revert "mmc: mmc-uclass: Use max-frequency from device tree with default handling" This reverts commit aebb523a23818a8ee4199c9532b51e3d4020696f. The change to use dev_read_u32_default() with a default value of 0 causes regression for host controller drivers that hardcode f_max before calling mmc_of_parse(). When the "max-frequency" property is not specified in the device tree, dev_read_u32_default() returns 0, which overwrites the previously configured f_max value set by the driver. This effectively resets the maximum frequency to 0, breaking MMC functionality for those controllers. Revert to the original dev_read_u32() behavior which only updates cfg->f_max when the "max-frequency" property is explicitly present in the device tree, preserving driver-configured values otherwise. Signed-off-by: Tanmay Kathpalia Signed-off-by: Peng Fan --- drivers/mmc/mmc-uclass.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index bf0bea93853..2f4dc5bd887 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -243,13 +243,8 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg) return -EINVAL; } - /* - * Maximum frequency is obtained from the optional "max-frequency" property. - * If not specified in device tree, defaults to 0 and sdhci_setup_cfg() - * will set the MMC configuration maximum frequency to the host controller's - * maximum base clock frequency from capabilities register. - */ - cfg->f_max = dev_read_u32_default(dev, "max-frequency", 0); + /* f_max is obtained from the optional "max-frequency" property */ + dev_read_u32(dev, "max-frequency", &cfg->f_max); if (dev_read_bool(dev, "cap-sd-highspeed")) cfg->host_caps |= MMC_CAP(SD_HS); -- cgit v1.3.1