From 4f7f751d2adaa2911d8822fbeee87662257d5a36 Mon Sep 17 00:00:00 2001 From: Windrow14 Date: Mon, 12 Aug 2024 13:09:09 +0800 Subject: [PATCH] drivers/mmcsd/mmcsd_sdio.c: fix unable to switch eMMC device to 4-bit bus width mode All eMMC devices support 4-bit bus width, so we should mark the device as supporting 4-bit bus width after detecting that the device type is eMMC. Signed-off-by: Yinzhe Wu Reviewed-by: Yuezhang Mo Reviewed-by: Jacky Cao Tested-by: Yinzhe Wu --- drivers/mmcsd/mmcsd_sdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index a4073fa263d..65357e44004 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -2548,7 +2548,7 @@ static int mmcsd_widebus(FAR struct mmcsd_state_s *priv) /* Configure the SDIO peripheral */ - if ((IS_MMC(priv->type) && ((priv->caps & SDIO_CAPS_1BIT_ONLY) == 0)) || + if ((IS_MMC(priv->type) && ((priv->caps & SDIO_CAPS_1BIT_ONLY) == 0)) && ((priv->buswidth & MMCSD_SCR_BUSWIDTH_4BIT) != 0)) { /* JEDEC specs: A.8.3 Changing the data bus width: 'Bus testing @@ -3500,6 +3500,7 @@ static int mmcsd_cardidentify(FAR struct mmcsd_state_s *priv) finfo("MMC card detected\n"); priv->type = MMCSD_CARDTYPE_MMC; + priv->buswidth |= MMCSD_SCR_BUSWIDTH_4BIT; /* Now, check if this is a MMC card/chip that supports block * addressing