2020-02-12 04:00:15 +00:00
|
|
|
From 766dab281185d2b9ca82ec49bae357e1ddfe11b7 Mon Sep 17 00:00:00 2001
|
2018-02-27 01:43:53 +00:00
|
|
|
From: Kevin Mihelich <kevin@archlinuxarm.org>
|
|
|
|
Date: Sun, 25 Feb 2018 16:38:04 -0700
|
|
|
|
Subject: [PATCH 7/9] Fix mvsdio SD card detection
|
|
|
|
|
|
|
|
Helps SD card detection on PPv4.
|
|
|
|
|
|
|
|
Signed-off-by: Kevin Mihelich <kevin@archlinuxarm.org>
|
|
|
|
---
|
|
|
|
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
|
2020-02-12 04:00:15 +00:00
|
|
|
index aa54d359dab7..f55a9f6ab3e1 100644
|
2018-02-27 01:43:53 +00:00
|
|
|
--- a/drivers/mmc/core/core.c
|
|
|
|
+++ b/drivers/mmc/core/core.c
|
2019-10-07 00:55:36 +00:00
|
|
|
@@ -712,7 +712,7 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
|
2018-02-27 01:43:53 +00:00
|
|
|
*/
|
|
|
|
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
|
2019-10-07 00:55:36 +00:00
|
|
|
index fe914ff5f5d6..c4794b1b6205 100644
|
2018-02-27 01:43:53 +00:00
|
|
|
--- a/drivers/mmc/core/sd.c
|
|
|
|
+++ b/drivers/mmc/core/sd.c
|
2019-10-07 00:55:36 +00:00
|
|
|
@@ -376,6 +376,15 @@ int mmc_sd_switch_hs(struct mmc_card *card)
|
2018-02-27 01:43:53 +00:00
|
|
|
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, 1, status);
|
|
|
|
if (err)
|
|
|
|
goto out;
|
|
|
|
diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
|
2020-02-12 04:00:15 +00:00
|
|
|
index 203b61712601..eb8c8c451a22 100644
|
2018-02-27 01:43:53 +00:00
|
|
|
--- a/drivers/mmc/host/mvsdio.c
|
|
|
|
+++ b/drivers/mmc/host/mvsdio.c
|
2019-10-07 00:55:36 +00:00
|
|
|
@@ -20,6 +20,7 @@
|
2018-02-27 01:43:53 +00:00
|
|
|
#include <linux/of_irq.h>
|
|
|
|
#include <linux/mmc/host.h>
|
|
|
|
#include <linux/mmc/slot-gpio.h>
|
|
|
|
+#include <linux/mmc/sd.h>
|
|
|
|
|
2019-05-23 00:11:38 +00:00
|
|
|
#include <linux/sizes.h>
|
2018-02-27 01:43:53 +00:00
|
|
|
#include <asm/unaligned.h>
|
2019-10-07 00:55:36 +00:00
|
|
|
@@ -147,6 +148,7 @@ static void mvsd_request(struct mmc_host *mmc, struct mmc_request *mrq)
|
2018-02-27 01:43:53 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
--
|
2020-02-12 04:00:15 +00:00
|
|
|
2.25.0
|
2018-02-27 01:43:53 +00:00
|
|
|
|