[RFC,2/4] mmc: sdhci: add quriks relevant to broken SDMA

Message ID 20200120102029.14264-3-jh80.chung@samsung.com
State New
Headers show
Series
  • Support SDMA mode on RPI4 target - 32bit
Related show

Commit Message

Jaehoon Chung Jan. 20, 2020, 10:20 a.m.
ADd quirks relevant to broken SDMA.
If set to SDHCI_QUIRK_BROKEN_SDMA, it should be run the pio mode.

Signed-off-by: Jaehoon Chung <jh80.chung at samsung.com>
---
 drivers/mmc/sdhci.c | 10 ++++++++--
 include/sdhci.h     |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 01fa5a9d4d..acda997fbc 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -728,12 +728,18 @@  int sdhci_setup_cfg(struct mmc_config *cfg, struct sdhci_host *host,
 
 #ifdef CONFIG_MMC_SDHCI_SDMA
 	if (!(caps & SDHCI_CAN_DO_SDMA)) {
-		printf("%s: Your controller doesn't support SDMA!!\n",
+		if (host->quirks & SDHCI_QUIRK_BROKEN_SDMA) {
+			caps &= ~SDHCI_CAN_DO_SDMA;
+			goto skip;
+		} else {
+			printf("%s: Your controller doesn't support SDMA!!\n",
 		       __func__);
-		return -EINVAL;
+			return -EINVAL;
+		}
 	}
 
 	host->flags |= USE_SDMA;
+skip:
 #endif
 #if CONFIG_IS_ENABLED(MMC_SDHCI_ADMA)
 	if (!(caps & SDHCI_CAN_DO_ADMA2)) {
diff --git a/include/sdhci.h b/include/sdhci.h
index 01addb7a60..9865a9d6c8 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -243,6 +243,7 @@ 
 #define SDHCI_QUIRK_WAIT_SEND_CMD	(1 << 6)
 #define SDHCI_QUIRK_USE_WIDE8		(1 << 8)
 #define SDHCI_QUIRK_NO_1_8_V		(1 << 9)
+#define SDHCI_QUIRK_BROKEN_SDMA		(1 << 10)
 
 /* to make gcc happy */
 struct sdhci_host;