mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-27 23:20:26 +09:00
![]() Increase SDMMC_BUSYD0END_TIMEOUT_US from 1s to 2s to avoid timeout error during blocks erase on some sdcard Issue seen on Kingston 16GB : Device: STM32 SDMMC2 Manufacturer ID: 27 OEM: 5048 Name: SD16G Bus Speed: 50000000 Mode: SD High Speed (50MHz) card capabilities: widths [4, 1] modes [SD Legacy, SD High Speed (50MHz)] host capabilities: widths [4, 1] modes [MMC legacy, SD Legacy, MMC High Speed (26MHz), SD High Speed (50MHz), MMC High Speed (52MHz)] Rd Block Len: 512 SD version 3.0 High Capacity: Yes Capacity: 14.5 GiB Bus Width: 4-bit Erase Group Size: 512 Bytes Issue reproduced with following command: STM32MP> mmc erase 0 100000 MMC erase: dev # 0, block # 0, count 1048576 ... mmc erase failed 16384 blocks erased: ERROR By setting SDMMC_BUSYD0END_TIMEOUT_US at 2 seconds and by adding time measurement in stm32_sdmmc2_end_cmd() as shown below: +start = get_timer(0); /* Polling status register */ ret = readl_poll_timeout(priv->base + SDMMC_STA, status, status & mask, SDMMC_BUSYD0END_TIMEOUT_US); +printf("time = %ld ms\n", get_timer(start)); We get the following trace: STM32MP> mmc erase 0 100000 MMC erase: dev # 0, block # 0, count 1048576 ... time = 17 ms time = 1 ms time = 1025 ms time = 54 ms time = 56 ms time = 1021 ms time = 57 ms time = 56 ms time = 1020 ms time = 53 ms time = 57 ms time = 1021 ms time = 53 ms time = 57 ms time = 1313 ms time = 54 ms time = 56 ms time = 1026 ms time = 54 ms time = 56 ms time = 1036 ms time = 54 ms time = 56 ms time = 1028 ms time = 53 ms time = 56 ms time = 1027 ms time = 54 ms time = 56 ms time = 1024 ms time = 54 ms time = 56 ms time = 1020 ms time = 54 ms time = 57 ms time = 1023 ms time = 54 ms time = 56 ms time = 1033 ms time = 53 ms time = 57 ms .... time = 53 ms time = 57 ms time = 1021 ms time = 56 ms time = 56 ms time = 1026 ms time = 54 ms time = 56 ms 1048576 blocks erased: OK We see that 1 second timeout is not enough, we also see one measurement up to 1313 ms. Set the timeout to 2 second to keep a security margin. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> |
||
---|---|---|
.. | ||
am654_sdhci.c | ||
arm_pl180_mmci.c | ||
arm_pl180_mmci.h | ||
atmel_sdhci.c | ||
bcm2835_sdhci.c | ||
bcm2835_sdhost.c | ||
bcmstb_sdhci.c | ||
davinci_mmc.c | ||
dw_mmc.c | ||
exynos_dw_mmc.c | ||
fsl_esdhc_imx.c | ||
fsl_esdhc_spl.c | ||
fsl_esdhc.c | ||
ftsdc010_mci.c | ||
ftsdc010_mci.h | ||
gen_atmel_mci.c | ||
hi6220_dw_mmc.c | ||
jz_mmc.c | ||
Kconfig | ||
kona_sdhci.c | ||
Makefile | ||
meson_gx_mmc.c | ||
mmc_boot.c | ||
mmc_legacy.c | ||
mmc_private.h | ||
mmc_spi.c | ||
mmc_write.c | ||
mmc-uclass.c | ||
mmc.c | ||
msm_sdhci.c | ||
mtk-sd.c | ||
mv_sdhci.c | ||
mvebu_mmc.c | ||
mxcmmc.c | ||
mxsmmc.c | ||
omap_hsmmc.c | ||
pci_mmc.c | ||
pic32_sdhci.c | ||
pxa_mmc_gen.c | ||
renesas-sdhi.c | ||
rockchip_dw_mmc.c | ||
rockchip_sdhci.c | ||
rpmb.c | ||
s5p_sdhci.c | ||
sandbox_mmc.c | ||
sdhci-cadence.c | ||
sdhci.c | ||
sh_mmcif.c | ||
sh_mmcif.h | ||
sh_sdhi.c | ||
snps_dw_mmc.c | ||
socfpga_dw_mmc.c | ||
sti_sdhci.c | ||
stm32_sdmmc2.c | ||
sunxi_mmc.c | ||
tangier_sdhci.c | ||
tegra_mmc.c | ||
tmio-common.c | ||
tmio-common.h | ||
uniphier-sd.c | ||
xenon_sdhci.c | ||
zynq_sdhci.c |