drivers/disk: sdmmc_stm32: Add Hardware FC Kconfig option
Add a Kconfig symbol to enable use of SDMMC hardware flow control. In specific cases, this feature could help to avoid FIFO ovderrun and underrun errors. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
5fb5b7fff8
commit
9f6246c325
2 changed files with 21 additions and 0 deletions
|
@ -51,6 +51,14 @@ config SDMMC_STM32
|
|||
help
|
||||
File system on sdmmc accessed through stm32 sdmmc.
|
||||
|
||||
config SDMMC_STM32_HWFC
|
||||
bool "STM32 SDMMC Hardware Flow control"
|
||||
depends on SDMMC_STM32
|
||||
depends on SOC_SERIES_STM32H7X || SOC_SERIES_STM32F7X || SOC_SERIES_STM32L4X
|
||||
help
|
||||
Enable SDMMC Hardware Flow Control to avoid FIFO underrun (TX mode) and
|
||||
overrun (RX mode) errors.
|
||||
|
||||
module = SDMMC
|
||||
module-str = sdmmc
|
||||
source "subsys/logging/Kconfig.template.log_config"
|
||||
|
|
|
@ -287,6 +287,15 @@ static struct disk_info stm32_sdmmc_info = {
|
|||
.ops = &stm32_sdmmc_ops,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_SDMMC_STM32_HWFC
|
||||
static void stm32_sdmmc_fc_enable(struct stm32_sdmmc_priv *priv)
|
||||
{
|
||||
MMC_TypeDef *sdmmcx = priv->hsd.Instance;
|
||||
|
||||
sdmmcx->CLKCR |= SDMMC_CLKCR_HWFC_EN;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Check if the card is present or not. If no card detect gpio is set, assume
|
||||
* the card is present. If reading the gpio fails for some reason, assume the
|
||||
|
@ -444,6 +453,10 @@ static int disk_stm32_sdmmc_init(const struct device *dev)
|
|||
k_sem_init(&priv->thread_lock, 1, 1);
|
||||
k_sem_init(&priv->sync, 0, 1);
|
||||
|
||||
#ifdef CONFIG_SDMMC_STM32_HWFC
|
||||
stm32_sdmmc_fc_enable(priv);
|
||||
#endif
|
||||
|
||||
err = stm32_sdmmc_card_detect_init(priv);
|
||||
if (err) {
|
||||
return err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue