diff mbox series

[U-Boot,v3,2/6] mmc: skip select_mode_and_width for MMC SPI host

Message ID 20190708041004.6252-3-anup.patel@wdc.com
State Accepted
Commit f49ff79935730279cca0e6a288bcc9ad4f4f63dd
Delegated to: Peng Fan
Headers show
Series SiFive SPI MMC Support | expand

Commit Message

Anup Patel July 8, 2019, 4:10 a.m. UTC
The MMC mode and width are fixed for MMC SPI host hence we skip
sd_select_mode_and_width() and mmc_select_mode_and_width() for
MMC SPI host.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
---
 drivers/mmc/mmc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Peng Fan July 15, 2019, 7:05 a.m. UTC | #1
> Subject: [PATCH v3 2/6] mmc: skip select_mode_and_width for MMC SPI host
> 
> The MMC mode and width are fixed for MMC SPI host hence we skip
> sd_select_mode_and_width() and mmc_select_mode_and_width() for MMC
> SPI host.
> 
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> Tested-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>  drivers/mmc/mmc.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index
> 456c1b4cc9..95008c72c3 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -1672,6 +1672,13 @@ static int sd_select_mode_and_width(struct mmc
> *mmc, uint card_caps)
>  	mmc_dump_capabilities("host", mmc->host_caps);  #endif
> 
> +	if (mmc_host_is_spi(mmc)) {
> +		mmc_set_bus_width(mmc, 1);
> +		mmc_select_mode(mmc, SD_LEGACY);
> +		mmc_set_clock(mmc, mmc->tran_speed, MMC_CLK_ENABLE);
> +		return 0;
> +	}
> +
>  	/* Restrict card's capabilities by what the host can do */
>  	caps = card_caps & mmc->host_caps;
> 
> @@ -1934,6 +1941,13 @@ static int mmc_select_mode_and_width(struct
> mmc *mmc, uint card_caps)
>  	mmc_dump_capabilities("host", mmc->host_caps);  #endif
> 
> +	if (mmc_host_is_spi(mmc)) {
> +		mmc_set_bus_width(mmc, 1);
> +		mmc_select_mode(mmc, MMC_LEGACY);
> +		mmc_set_clock(mmc, mmc->tran_speed, MMC_CLK_ENABLE);
> +		return 0;
> +	}
> +
>  	/* Restrict card's capabilities by what the host can do */
>  	card_caps &= mmc->host_caps;

Applied to mmc/master.

Thanks,
Peng.
> 
> --
> 2.17.1
diff mbox series

Patch

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 456c1b4cc9..95008c72c3 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1672,6 +1672,13 @@  static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps)
 	mmc_dump_capabilities("host", mmc->host_caps);
 #endif
 
+	if (mmc_host_is_spi(mmc)) {
+		mmc_set_bus_width(mmc, 1);
+		mmc_select_mode(mmc, SD_LEGACY);
+		mmc_set_clock(mmc, mmc->tran_speed, MMC_CLK_ENABLE);
+		return 0;
+	}
+
 	/* Restrict card's capabilities by what the host can do */
 	caps = card_caps & mmc->host_caps;
 
@@ -1934,6 +1941,13 @@  static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps)
 	mmc_dump_capabilities("host", mmc->host_caps);
 #endif
 
+	if (mmc_host_is_spi(mmc)) {
+		mmc_set_bus_width(mmc, 1);
+		mmc_select_mode(mmc, MMC_LEGACY);
+		mmc_set_clock(mmc, mmc->tran_speed, MMC_CLK_ENABLE);
+		return 0;
+	}
+
 	/* Restrict card's capabilities by what the host can do */
 	card_caps &= mmc->host_caps;