[PATCH 2/3] mmc: mmci: stm32: do not use NEGEDGE in HS200 mode
Mateusz Nowicki
mateusz.nowicki at posteo.net
Sat Oct 31 05:07:12 PDT 2026
RM0457 marks NEGEDGE as not applicable in HS200. With a clock divider it
corrupts multi-block writes: on the STM32MP257F-DK (st,neg-edge, 200 MHz
kernel clock, HS200 at 100 MHz) written data read back different. The
same writes are correct without NEGEDGE.
Fixes: 36240ef8665b ("mmc: mmci: add hs200 support for stm32 sdmmc")
Cc: stable at vger.kernel.org
Signed-off-by: Mateusz Nowicki <mateusz.nowicki at posteo.net>
---
RM0457 describes HS200 only without a divider. If HS200 through a
divider should not be used at all, the alternatives for the DK are:
- Drop mmc-hs200-1_8v from the DK device tree. DDR52 is tested and only
about 5% slower than HS200 at 100 MHz (read/write 78/66 MiB/s against
82/68 MiB/s).
- Drop st,neg-edge from the DK device tree. This also changes DDR52,
which was not tested without NEGEDGE.
- Set the SDMMC2 kernel clock to 150 MHz in the firmware (OP-TEE). HS200
then runs without a divider (tested, 119/86 MiB/s).
Which way is preferred?
drivers/mmc/host/mmci_stm32_sdmmc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/mmc/host/mmci_stm32_sdmmc.c b/drivers/mmc/host/mmci_stm32_sdmmc.c
index 9dc51859c2e5..d74efdff6ac2 100644
--- a/drivers/mmc/host/mmci_stm32_sdmmc.c
+++ b/drivers/mmc/host/mmci_stm32_sdmmc.c
@@ -342,6 +342,10 @@ static void mmci_sdmmc_set_clkreg(struct mmci_host *host, unsigned int desired)
clk |= host->clk_reg_add;
clk |= ddr;
+ /* NEGEDGE is not applicable in HS200 (RM0457), with a divider it corrupts writes */
+ if (host->mmc->ios.timing == MMC_TIMING_MMC_HS200)
+ clk &= ~MCI_STM32_CLK_NEGEDGE;
+
if (host->mmc->ios.timing >= MMC_TIMING_UHS_SDR50)
clk |= MCI_STM32_CLK_BUSSPEED;
--
2.56.0
More information about the linux-arm-kernel
mailing list