diff mbox series

[1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit

Message ID 20220511182713.26790-1-pali@kernel.org
State Accepted
Commit a29eb319a3f8ccfb657053b2941581fa1933974e
Delegated to: Peng Fan
Headers show
Series [1/2] mmc: fsl_esdhc: Set fallback mode to 1-bit | expand

Commit Message

Pali Rohár May 11, 2022, 6:27 p.m. UTC
8-bit mode is not supported by SD cards and on P2020 are four SDHC pins
shared with SPI (so if P2020 board have also SPI then only 4-bit SDHC mode
is provided). So 8-bit SDHC mode is really bad default.

When max bus width is not provided then set mode to 1-bit. This mode is
supported by all cards, so it is the best option for fallback mode.

Also P2020 bootrom sets mode to 1-bit when booting from SD/MMC card.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/mmc/fsl_esdhc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Jaehoon Chung May 16, 2022, 11:39 p.m. UTC | #1
On 5/12/22 03:27, Pali Rohár wrote:
> 8-bit mode is not supported by SD cards and on P2020 are four SDHC pins
> shared with SPI (so if P2020 board have also SPI then only 4-bit SDHC mode
> is provided). So 8-bit SDHC mode is really bad default.
> 
> When max bus width is not provided then set mode to 1-bit. This mode is
> supported by all cards, so it is the best option for fallback mode.
> 
> Also P2020 bootrom sets mode to 1-bit when booting from SD/MMC card.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>

Add minor comment.

> ---
>  drivers/mmc/fsl_esdhc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index 3b3587bd8d72..834f8933b0c6 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -963,9 +963,8 @@ int fsl_esdhc_initialize(struct bd_info *bis, struct fsl_esdhc_cfg *cfg)
>  	} else if (cfg->max_bus_width == 1) {
>  		mmc_cfg->host_caps |= MMC_MODE_1BIT;
>  	} else {
> -		mmc_cfg->host_caps |= MMC_MODE_1BIT | MMC_MODE_4BIT |
> -				      MMC_MODE_8BIT;
> -		printf("No max bus width provided. Assume 8-bit supported.\n");
> +		mmc_cfg->host_caps |= MMC_MODE_1BIT;

I'm not sure that it really needs to use "|". 

Best Regards,
Jaehoon Chung

> +		printf("No max bus width provided. Fallback to 1-bit mode.\n");
>  	}
>  
>  	if (IS_ENABLED(CONFIG_ESDHC_DETECT_8_BIT_QUIRK))
diff mbox series

Patch

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 3b3587bd8d72..834f8933b0c6 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -963,9 +963,8 @@  int fsl_esdhc_initialize(struct bd_info *bis, struct fsl_esdhc_cfg *cfg)
 	} else if (cfg->max_bus_width == 1) {
 		mmc_cfg->host_caps |= MMC_MODE_1BIT;
 	} else {
-		mmc_cfg->host_caps |= MMC_MODE_1BIT | MMC_MODE_4BIT |
-				      MMC_MODE_8BIT;
-		printf("No max bus width provided. Assume 8-bit supported.\n");
+		mmc_cfg->host_caps |= MMC_MODE_1BIT;
+		printf("No max bus width provided. Fallback to 1-bit mode.\n");
 	}
 
 	if (IS_ENABLED(CONFIG_ESDHC_DETECT_8_BIT_QUIRK))