u-boot-brain/drivers/mmc
Patrice Chotard 23441fbf2b mmc: stm32_sdmmc2: Increase SDMMC_BUSYD0END_TIMEOUT_US
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>
2019-08-27 09:36:56 +02:00
..
am654_sdhci.c mmc: am654_sdhci: Separate J721E compatible into 8bit and 4bit versions 2019-07-26 21:49:28 -04:00
arm_pl180_mmci.c mmc: arm_pl180_mmci: Sync compatible with kernel 2019-04-23 15:31:30 +02:00
arm_pl180_mmci.h mmc: arm_pl180_mmci: Sync compatible with kernel 2019-04-23 15:31:30 +02:00
atmel_sdhci.c mmc: atmel_sdhci: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00
bcm2835_sdhci.c mmc: bcm: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00
bcm2835_sdhost.c mmc: Unirqify bcm2835_sdhost and fix writes 2018-05-23 22:31:42 +02:00
bcmstb_sdhci.c mmc: bcm: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00
davinci_mmc.c MMC: davinici_mmc: Enable CD and WP with DM and OF_CONTROL 2018-09-11 21:49:02 -04:00
dw_mmc.c dw_mmc: turn on the IO supply 2019-07-31 09:07:30 +08:00
exynos_dw_mmc.c ARM: Odroid XU3: Modify exynos dw_mmc driver to support Odroid XU3 in DM MMC 2018-08-06 10:53:53 +09:00
fsl_esdhc_imx.c mmc: fsl_esdhc_imx: enlarge mmc timeout 2019-07-15 10:30:09 +08:00
fsl_esdhc_spl.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
fsl_esdhc.c mmc: fsl_esdhc: drop i.MX code 2019-06-23 14:18:42 +08:00
ftsdc010_mci.c mmc: ftsdc010_mci: Sync compatible with DT mmc node 2018-05-29 14:45:03 +08:00
ftsdc010_mci.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
gen_atmel_mci.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
hi6220_dw_mmc.c mmc: Add support for HI3660 SoC reusing hi6220_dw_mmc driver 2019-08-11 16:43:41 -04:00
jz_mmc.c mmc: jz_mmc: Compile-out write support if disabled 2019-01-16 13:56:43 +01:00
Kconfig Convert CONFIG_FSL_USDHC to Kconfig 2019-08-23 16:42:38 -04:00
kona_sdhci.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Makefile arm64: dts: k3: Sync sdhci0 node from kernel and change driver name 2019-07-17 11:12:08 -04:00
meson_gx_mmc.c mmc: meson-gx: Add AXG compatible 2018-11-26 14:39:57 +01:00
mmc_boot.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
mmc_legacy.c mmc: Register only the first MMC device on MMC_TINY 2019-07-13 11:11:26 -04:00
mmc_private.h mmc: add mmc_poll_for_busy() and change the purpose of mmc_send_status() 2019-07-15 10:16:49 +08:00
mmc_spi.c mmc: mmc_spi: Use SPI_XFER_BEGIN and SPI_XFER_END flags 2019-07-18 17:11:16 +05:30
mmc_write.c mmc: add mmc_poll_for_busy() and change the purpose of mmc_send_status() 2019-07-15 10:16:49 +08:00
mmc-uclass.c mmc: Parse no-1-8-v DT property 2019-07-15 10:30:08 +08:00
mmc.c mmc: relocate code comment 2019-07-31 15:31:36 +08:00
msm_sdhci.c mmc: msm_sdhci: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00
mtk-sd.c mmc: mtk-sd: Add MT8183 SoC support 2019-08-20 12:20:32 -04:00
mv_sdhci.c mmc: mv_sdhci: fix uninitialized pointer deref on probe 2019-07-31 15:31:36 +08:00
mvebu_mmc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
mxcmmc.c mmc: change the set_ios return type from void to int 2017-01-11 19:40:13 +09:00
mxsmmc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
omap_hsmmc.c mmc: omap_hsmmc: provide wait_dat0 even if UHS modes are not supported 2019-07-15 10:16:49 +08:00
pci_mmc.c mmc: pci: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00
pic32_sdhci.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
pxa_mmc_gen.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
renesas-sdhi.c mmc: tmio: sdhi: HS400 manual adjustment 2019-05-21 22:15:32 +02:00
rockchip_dw_mmc.c rockchip: use 'arch-rockchip' as header file path 2019-05-01 00:00:05 +02:00
rockchip_sdhci.c rockchip: sdhci: Fix sdhci mmc driver probe abort 2019-07-20 23:59:44 +08:00
rpmb.c mmc: rpmb: fix response type of CMD25 2019-07-15 10:16:49 +08:00
s5p_sdhci.c mmc: s5p: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00
sandbox_mmc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
sdhci-cadence.c mmc: sdhci-cadence: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00
sdhci.c mmc: sdhci: fix chip detect gpio property name 2019-07-31 15:31:36 +08:00
sh_mmcif.c mmc: sh_mmcif: Set default MMCIF clock rate 2019-03-25 20:26:53 +01:00
sh_mmcif.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
sh_sdhi.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
snps_dw_mmc.c ARC: dwmmc: Adding DesignWare MMC driver support for ARC devboards 2019-04-18 09:12:38 +03:00
socfpga_dw_mmc.c mmc: socfpga: Add clock framework support 2018-08-13 22:35:42 +02:00
sti_sdhci.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
stm32_sdmmc2.c mmc: stm32_sdmmc2: Increase SDMMC_BUSYD0END_TIMEOUT_US 2019-08-27 09:36:56 +02:00
sunxi_mmc.c mmc: sunxi: Honour non-removable property in DT 2019-01-29 23:49:41 +05:30
tangier_sdhci.c mmc: tangier_sdhci: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00
tegra_mmc.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
tmio-common.c mmc: tmio: Clamp SD_SECCNT to 16bit values on 16bit IP 2019-03-25 20:26:53 +01:00
tmio-common.h mmc: tmio: sdhi: HS400 manual adjustment 2019-05-21 22:15:32 +02:00
uniphier-sd.c mmc: tmio: Make DMA transfer end bit configurable 2019-02-09 11:08:40 +01:00
xenon_sdhci.c mmc: sdhci: Make set_ios_post() return int 2019-07-17 11:12:08 -04:00
zynq_sdhci.c mmc: zynq_sdhci: fix uninitialized pointer deref on probe 2019-08-09 13:45:25 +08:00