From 37fc0a0208a93067f0b712d43d5839c32212dbc8 Mon Sep 17 00:00:00 2001 From: dongjiuzhu1 Date: Fri, 19 May 2023 12:03:34 +0800 Subject: [PATCH] drivers/mmcsd_sdio: config timout to write one data block Some hardware needs to config this delay to write one data block, because the hardware needs more time to wear leveling and bad block manage. Signed-off-by: dongjiuzhu1 --- drivers/mmcsd/Kconfig | 7 +++++++ drivers/mmcsd/mmcsd_sdio.c | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/mmcsd/Kconfig b/drivers/mmcsd/Kconfig index 4f8e2ff9c5..790f67caf3 100644 --- a/drivers/mmcsd/Kconfig +++ b/drivers/mmcsd/Kconfig @@ -163,6 +163,13 @@ config SDIO_BLOCKSETUP number of blocks. Others just work on the byte stream. This option enables the block setup method in the SDIO vtable. +config MMCSD_BLOCK_WDATADELAY + int "The wait timeout to write one data block" + default 260 + ---help--- + Some hardware needs to configure this delay to write one data block, because + the hardware needs more time for wear leveling and bad block management. + endif endif # MMCSD diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index b21a8fdea4..1baee5e782 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -83,7 +83,10 @@ #define MMCSD_SCR_DATADELAY (100) /* Wait up to 100MS to get SCR */ #define MMCSD_BLOCK_RDATADELAY (100) /* Wait up to 100MS to get one data block */ -#define MMCSD_BLOCK_WDATADELAY (260) /* Wait up to 260MS to write one data block */ + +/* Wait timeout to write one data block */ + +#define MMCSD_BLOCK_WDATADELAY CONFIG_MMCSD_BLOCK_WDATADELAY #define IS_EMPTY(priv) (priv->type == MMCSD_CARDTYPE_UNKNOWN)