From a56c64e1b36e0cbc4736489667611d538ba033a5 Mon Sep 17 00:00:00 2001 From: Kevin Mihelich Date: Sun, 25 Feb 2018 16:38:04 -0700 Subject: [PATCH 4/7] Fix mvsdio SD card detection Helps SD card detection on PPv4. Signed-off-by: Kevin Mihelich --- drivers/mmc/core/core.c | 2 +- drivers/mmc/core/sd.c | 9 +++++++++ drivers/mmc/host/mvsdio.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index d42037f0f10d..fa9e472061f8 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -695,7 +695,7 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card) */ limit_us = 3000000; else - limit_us = 100000; + limit_us = 200000; /* * SDHC cards always use these fixed values. diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 6f054c449d46..1ca7d8593e5c 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -376,6 +376,15 @@ int mmc_sd_switch_hs(struct mmc_card *card) if (!status) return -ENOMEM; + /* + * Some SDHC cards, notably those with a Sandisk SD controller + * (also found in Kingston products) need a bit of slack + * before successfully handling the SWITCH command. So far, + * cards identifying themselves as "SD04G" and "SD08G" are + * affected + */ + udelay(100); + err = mmc_sd_switch(card, 1, 0, HIGH_SPEED_BUS_SPEED, status); if (err) goto out; diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c index 629efbe639c4..bc342d88d2d1 100644 --- a/drivers/mmc/host/mvsdio.c +++ b/drivers/mmc/host/mvsdio.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -147,6 +148,7 @@ static void mvsd_request(struct mmc_host *mmc, struct mmc_request *mrq) dev_dbg(host->dev, "cmd %d (hw state 0x%04x)\n", cmd->opcode, mvsd_read(MVSD_HW_STATE)); + if (cmd->opcode == SD_SWITCH) mdelay(1); /* Voodoo */ cmdreg = MVSD_CMD_INDEX(cmd->opcode); -- 2.30.0