[PATCH v2 0/5] mmc: mmci: stm32: silent data corruption and HS200 fixes

From: Mateusz Nowicki

Date: Wed Nov 04 2026 - 10:45:29 EST


The eMMC of the STM32MP257F-DK in HS200 returned stale data and lost
writes without any error. Patch 1 makes data CRC errors visible to the
core again. Patches 2 and 3 are the fixes of the ST downstream kernel
for the causes seen on the DK, as Christophe pointed out. Patches 4 and
5 move the eMMC of the DK back to the sdmmc2 pins_a groups and remove
the pins_b groups I added for it in 7.4: the corruption came from the
delay block, not from the slew rate, and the slower pins avoid
overshoots on the SDMMC2 clock. Patches 1-3 are for the mmc tree, 4 and
5 for the STM32 device tree, patch 4 needs patch 3.

Tested on the STM32MP257F-DK with a v7.3-rc6 based kernel with the same
changes, each run writing 832 MiB to the eMMC and reading it back:

- SDMMC2 kernel clock 200 MHz, HS200 at 100 MHz as in mainline: without
patch 3 the writes failed with I/O errors in all 9 runs (sdmmc2 pins_a
or pins_b, with or without NEGEDGE), with it all 6 runs were correct
(pins_a and pins_b).
- SDMMC2 kernel clock 150 MHz, HS200 at 150 MHz with the delay block:
all 6 runs correct (pins_a and pins_b), the tuning picked the same
phase in all 10 rebinds on each pin group.

Build tested on v7.4-rc1 (arm64 defconfig, W=1). Not tested on
STM32MP1x.

Changes in v2:
- Drop "mmc: mmci: stm32: do not use NEGEDGE in HS200 mode". NEGEDGE
has no effect with CLKDIV = 0 and is valid with a divider, I misread
RM0457 (Christophe). The writes at 100 MHz fail because of the delay
block, not NEGEDGE.
- Replace "mmc: mmci: stm32: lock the STM32MP25 delay block again before
tuning" with the same change from the ST downstream kernel, "mmc: mmci:
stm32: release the delay block before enabling it" (Christophe).
- Add "mmc: mmci: stm32: use the delay block above 100 MHz on stm32mp25
SoC" from the ST downstream kernel (Christophe), with dlyb checked
before reading min_freq from it.
- Add "arm64: dts: st: use sdmmc2 pins_a on stm32mp257f-dk" and
"arm64: dts: st: remove sdmmc2 pins_b from stm32mp25" (Christophe).
- Rebase on v7.4-rc1.
- Link to v1: https://lore.kernel.org/r/20261031120700.42576-1-mateusz.nowicki@xxxxxxxxxx

Christophe Kerello (2):
mmc: mmci: stm32: release the delay block before enabling it
mmc: mmci: stm32: use the delay block above 100 MHz on stm32mp25 SoC

Mateusz Nowicki (3):
mmc: mmci: do not count a data CRC error as a complete transfer
arm64: dts: st: use sdmmc2 pins_a on stm32mp257f-dk
arm64: dts: st: remove sdmmc2 pins_b from stm32mp25

arch/arm64/boot/dts/st/stm32mp25-pinctrl.dtsi | 58 -------------------
arch/arm64/boot/dts/st/stm32mp257f-dk.dts | 4 +-
drivers/mmc/host/mmci.c | 5 +-
drivers/mmc/host/mmci_stm32_sdmmc.c | 28 +++++++--
4 files changed, 27 insertions(+), 68 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
--
2.56.0