From 4c28c4d9a3a814cebb93e20842ed2c1c90f703d3 Mon Sep 17 00:00:00 2001 From: Christophe Kerello Date: Tue, 12 Aug 2025 14:35:11 +0200 Subject: [PATCH 1/3] mtd: rawnand: stm32_fmc2: set available OOB bytes per page File system such as YAFFS2 need to know the number of available OOB bytes per page to be able to choose if they should locate their metadata in the data area or in the spare area. Signed-off-by: Christophe Kerello Reviewed-by: Patrice Chotard --- drivers/mtd/nand/raw/stm32_fmc2_nand.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index d1c88643c98..21e3c88a55a 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -1034,6 +1034,7 @@ static int stm32_fmc2_nfc_probe(struct udevice *dev) ecclayout->eccpos[i] = oob_index; ecclayout->oobfree->offset = oob_index; ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; + ecclayout->oobavail = ecclayout->oobfree->length; chip->ecc.layout = ecclayout; if (chip->options & NAND_BUSWIDTH_16) From 1067d2060ff017fb58758c0c21ae35504d144ea7 Mon Sep 17 00:00:00 2001 From: Christophe Kerello Date: Tue, 12 Aug 2025 15:55:26 +0200 Subject: [PATCH 2/3] mmc: stm32_sdmmc2: avoid infinite while loop Avoid unlimited while loop by adding a timeout. The timeout is calculated based on a minimal throughput of 256 KB/s. The timeout is set at least to 2 seconds. Signed-off-by: Christophe Kerello Reviewed-by: Patrice Chotard --- drivers/mmc/stm32_sdmmc2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index 9483fb57daf..122690aef3e 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -385,15 +385,29 @@ static int stm32_sdmmc2_end_data(struct udevice *dev, u32 mask = SDMMC_STA_DCRCFAIL | SDMMC_STA_DTIMEOUT | SDMMC_STA_IDMATE | SDMMC_STA_DATAEND; u32 status; + unsigned long timeout_msecs = ctx->data_length >> 8; + unsigned long start_timeout; + + /* At least, a timeout of 2 seconds is set */ + if (timeout_msecs < 2000) + timeout_msecs = 2000; if (data->flags & MMC_DATA_READ) mask |= SDMMC_STA_RXOVERR; else mask |= SDMMC_STA_TXUNDERR; + start_timeout = get_timer(0); status = readl(plat->base + SDMMC_STA); - while (!(status & mask)) + while (!(status & mask)) { + if (get_timer(start_timeout) > timeout_msecs) { + ctx->dpsm_abort = true; + return -ETIMEDOUT; + } + + schedule(); status = readl(plat->base + SDMMC_STA); + } /* * Need invalidate the dcache again to avoid any From 198c48f2657e67ded7fc7679c2ed1c26227f9fdc Mon Sep 17 00:00:00 2001 From: Patrice Chotard Date: Thu, 14 Aug 2025 14:09:38 +0200 Subject: [PATCH 3/3] configs: stm32mp25: Enable OF_UPSTREAM_BUILD_VENDOR Initially, only one STM32MP25 based board was available, the stm32mp257f-ev1 board which was set by default in stm32mp25_defconfig. Since commit 79f3e77133bd ("Subtree merge tag 'v6.16-dts' of dts repo [1] into dts/upstream") we inherited of a second MP25 based board which is the stm32mp257f-dk board. Enable OF_UPSTREAM_BUILD_VENDOR and set OF_UPSTREAM_VENDOR to allow all STMicroelectronics DT compilation. Signed-off-by: Patrice Chotard --- configs/stm32mp25_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/stm32mp25_defconfig b/configs/stm32mp25_defconfig index 14619ffd96c..2b02cd86d61 100644 --- a/configs/stm32mp25_defconfig +++ b/configs/stm32mp25_defconfig @@ -41,6 +41,8 @@ CONFIG_CMD_REGULATOR=y CONFIG_CMD_LOG=y CONFIG_CMD_UBI=y CONFIG_OF_LIVE=y +CONFIG_OF_UPSTREAM_BUILD_VENDOR=y +CONFIG_OF_UPSTREAM_VENDOR="st" CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_IS_IN_SPI_FLASH=y