[U-Boot] mmc: get mmc_spi working again
Marcel Eckert
eckert at hsu-hh.de
Tue Oct 16 12:02:02 UTC 2018
Trying to migrate to the latest U-Boot version (my old version was
u-boot-2016.09.y), mmc_spi command fails with "unable to select a mode".
I hunted this down to a rewrite in mmc.c regarding MMC/SD mode handling
(d0c221fe7336fc7d9ada57d96f4a8911a3aac041).
Current mmc.c tries to perform SD commands (like sd_set_card_speed or
sd_select_bus_width) that produce a "illegal command" response from
different of my SD-Cards when used in SPI-Mode.
Attached patch just skips these illegal command sequences, when mmc_host
uses SPI-mode. The patch is a straightforward solution, maybe SPI-mode
needs to be added in "enum bus_mode" (see mmc.h) and handled properly in
mmc.c.
Signed-off-by: Marcel Eckert <eckert at hsu-hh.de>
---
drivers/mmc/mmc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 585951cd78..d78b58ac77 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1286,6 +1286,9 @@ static int sd_set_card_speed(struct mmc *mmc, enum
bus_mode mode)
{
int err;
+ if (mmc_host_is_spi(mmc))
+ return 0;
+
ALLOC_CACHE_ALIGN_BUFFER(uint, switch_status, 16);
int speed;
@@ -1332,6 +1335,9 @@ static int sd_select_bus_width(struct mmc *mmc, int w)
int err;
struct mmc_cmd cmd;
+ if (mmc_host_is_spi(mmc))
+ return 0;
+
if ((w != 4) && (w != 1))
return -EINVAL;
@@ -1375,6 +1381,9 @@ static int sd_read_ssr(struct mmc *mmc)
int timeout = 3;
unsigned int au, eo, et, es;
+ if (mmc_host_is_spi(mmc))
+ return 0;
+
cmd.cmdidx = MMC_CMD_APP_CMD;
cmd.resp_type = MMC_RSP_R1;
cmd.cmdarg = mmc->rca << 16;
--
2.11.0
More information about the U-Boot
mailing list