From b06582f7a59ade2f683454d4d916d1d92acb198d Mon Sep 17 00:00:00 2001 From: Grygorii Strashko Date: Wed, 10 Jul 2024 15:38:36 +0300 Subject: [PATCH] drivers: sdhc: brcm_bcm2712: add sdhc_command retry Add proper handling of sdhc_command->retries for SDHC requests. Signed-off-by: Grygorii Strashko Acked-by: Mykola Kvach Acked-by: Oleksii Moisieiev Acked-by: Dmytro Firsov --- drivers/sdhc/brcm_bcm2712_sdhci.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/sdhc/brcm_bcm2712_sdhci.c b/drivers/sdhc/brcm_bcm2712_sdhci.c index f954d1153e2040..b33ea18e58fbc7 100644 --- a/drivers/sdhc/brcm_bcm2712_sdhci.c +++ b/drivers/sdhc/brcm_bcm2712_sdhci.c @@ -75,12 +75,15 @@ static int bcm2712_sdhci_request(const struct device *dev, struct sdhc_command * struct sdhc_data *sd_data) { struct bcm2712_sdhci_data *data = dev->data; + unsigned int retry = cmd->retries; int ret; - ret = sdhci_send_req(&data->sdhci_ctx, cmd, sd_data); - if (ret) { - LOG_DEV_ERR(dev, "sd cmd request failed (%d)", ret); - } + do { + ret = sdhci_send_req(&data->sdhci_ctx, cmd, sd_data); + if (ret) { + LOG_DEV_ERR(dev, "sd cmd request failed (%d)", ret); + } + } while (ret != 0 && retry--); return ret; }