drivers/disk: sdmmc: stm32: Enable hw fc only after card init
During SDMMC card init, HW_FC is disabled by default, overwriting driver configuration. To avoid this, move HW FC configuration after card init. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
2ae9a54a09
commit
34a50e313d
1 changed files with 13 additions and 13 deletions
|
@ -51,6 +51,15 @@ struct stm32_sdmmc_priv {
|
|||
} pinctrl;
|
||||
};
|
||||
|
||||
#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
|
||||
|
||||
static void stm32_sdmmc_isr(const struct device *dev)
|
||||
{
|
||||
struct stm32_sdmmc_priv *priv = dev->data;
|
||||
|
@ -154,6 +163,10 @@ static int stm32_sdmmc_access_init(struct disk_info *disk)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SDMMC_STM32_HWFC
|
||||
stm32_sdmmc_fc_enable(priv);
|
||||
#endif
|
||||
|
||||
priv->status = DISK_STATUS_OK;
|
||||
return 0;
|
||||
}
|
||||
|
@ -287,15 +300,6 @@ 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
|
||||
|
@ -453,10 +457,6 @@ 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