0ad9385
From d11469e272ed1c28030d2f36ad6ac5a364a633d8 Mon Sep 17 00:00:00 2001
0ad9385
From: Scott Branden <scott.branden@broadcom.com>
0ad9385
Date: Tue, 1 Nov 2016 09:37:57 -0700
0ad9385
Subject: [PATCH 1/3] mmc: sdhci-iproc: support standard byte register accesses
0ad9385
0ad9385
Add bytewise register accesses support for newer versions of IPROC
0ad9385
SDHCI controllers.
0ad9385
Previous sdhci-iproc versions of SDIO controllers
0ad9385
(such as Raspberry Pi and Cygnus) only allowed for 32-bit register
0ad9385
accesses.
0ad9385
0ad9385
Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
0ad9385
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
0ad9385
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
0ad9385
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
0ad9385
---
0ad9385
 drivers/mmc/host/sdhci-iproc.c | 35 +++++++++++++++++++++++++++++++++--
0ad9385
 1 file changed, 33 insertions(+), 2 deletions(-)
0ad9385
0ad9385
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
0ad9385
index 7262466..d7046d6 100644
0ad9385
--- a/drivers/mmc/host/sdhci-iproc.c
0ad9385
+++ b/drivers/mmc/host/sdhci-iproc.c
0ad9385
@@ -143,6 +143,14 @@ static void sdhci_iproc_writeb(struct sdhci_host *host, u8 val, int reg)
0ad9385
 }
0ad9385
 
0ad9385
 static const struct sdhci_ops sdhci_iproc_ops = {
0ad9385
+	.set_clock = sdhci_set_clock,
0ad9385
+	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
0ad9385
+	.set_bus_width = sdhci_set_bus_width,
0ad9385
+	.reset = sdhci_reset,
0ad9385
+	.set_uhs_signaling = sdhci_set_uhs_signaling,
0ad9385
+};
0ad9385
+
0ad9385
+static const struct sdhci_ops sdhci_iproc_32only_ops = {
0ad9385
 	.read_l = sdhci_iproc_readl,
0ad9385
 	.read_w = sdhci_iproc_readw,
0ad9385
 	.read_b = sdhci_iproc_readb,
0ad9385
@@ -156,6 +164,28 @@ static const struct sdhci_ops sdhci_iproc_ops = {
0ad9385
 	.set_uhs_signaling = sdhci_set_uhs_signaling,
0ad9385
 };
0ad9385
 
0ad9385
+static const struct sdhci_pltfm_data sdhci_iproc_cygnus_pltfm_data = {
0ad9385
+	.quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK,
0ad9385
+	.quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN,
0ad9385
+	.ops = &sdhci_iproc_32only_ops,
0ad9385
+};
0ad9385
+
0ad9385
+static const struct sdhci_iproc_data iproc_cygnus_data = {
0ad9385
+	.pdata = &sdhci_iproc_cygnus_pltfm_data,
0ad9385
+	.caps = ((0x1 << SDHCI_MAX_BLOCK_SHIFT)
0ad9385
+			& SDHCI_MAX_BLOCK_MASK) |
0ad9385
+		SDHCI_CAN_VDD_330 |
0ad9385
+		SDHCI_CAN_VDD_180 |
0ad9385
+		SDHCI_CAN_DO_SUSPEND |
0ad9385
+		SDHCI_CAN_DO_HISPD |
0ad9385
+		SDHCI_CAN_DO_ADMA2 |
0ad9385
+		SDHCI_CAN_DO_SDMA,
0ad9385
+	.caps1 = SDHCI_DRIVER_TYPE_C |
0ad9385
+		 SDHCI_DRIVER_TYPE_D |
0ad9385
+		 SDHCI_SUPPORT_DDR50,
0ad9385
+	.mmc_caps = MMC_CAP_1_8V_DDR,
0ad9385
+};
0ad9385
+
0ad9385
 static const struct sdhci_pltfm_data sdhci_iproc_pltfm_data = {
0ad9385
 	.quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK,
0ad9385
 	.quirks2 = SDHCI_QUIRK2_ACMD23_BROKEN,
0ad9385
@@ -182,7 +212,7 @@ static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = {
0ad9385
 	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
0ad9385
 		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
0ad9385
 		  SDHCI_QUIRK_MISSING_CAPS,
0ad9385
-	.ops = &sdhci_iproc_ops,
0ad9385
+	.ops = &sdhci_iproc_32only_ops,
0ad9385
 };
0ad9385
 
0ad9385
 static const struct sdhci_iproc_data bcm2835_data = {
0ad9385
@@ -194,7 +224,8 @@ static const struct sdhci_iproc_data bcm2835_data = {
0ad9385
 
0ad9385
 static const struct of_device_id sdhci_iproc_of_match[] = {
0ad9385
 	{ .compatible = "brcm,bcm2835-sdhci", .data = &bcm2835_data },
0ad9385
-	{ .compatible = "brcm,sdhci-iproc-cygnus", .data = &iproc_data },
0ad9385
+	{ .compatible = "brcm,sdhci-iproc-cygnus", .data = &iproc_cygnus_data},
0ad9385
+	{ .compatible = "brcm,sdhci-iproc", .data = &iproc_data },
0ad9385
 	{ }
0ad9385
 };
0ad9385
 MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
0ad9385
-- 
0ad9385
2.9.3
0ad9385
0ad9385
From 3dcb11900d7cde1fd378f154137272f99253a60c Mon Sep 17 00:00:00 2001
0ad9385
From: Stefan Wahren <stefan.wahren@i2se.com>
0ad9385
Date: Fri, 30 Dec 2016 15:24:32 +0000
0ad9385
Subject: [PATCH 2/3] mmc: sdhci-iproc: Apply caps from bcm2835-mmc driver
0ad9385
0ad9385
Since the mmc module on bcm2835 neither provide a capabilities register nor
0ad9385
free documentation we must rely on the downstream implementation [1].
0ad9385
0ad9385
So enable the following capabilities for bcm2835:
0ad9385
0ad9385
MMC_CAP_MMC_HIGHSPEED
0ad9385
MMC_CAP_SD_HIGHSPEED
0ad9385
MMC_CAP_DRIVER_TYPE_A
0ad9385
MMC_CAP_DRIVER_TYPE_C
0ad9385
0ad9385
[1] - https://github.com/raspberrypi/linux/blob/rpi-4.4.y/drivers/mmc/host/bcm2835-mmc.c
0ad9385
0ad9385
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
0ad9385
Reviewed-by: Eric Anholt <eric@anholt.net>
0ad9385
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
0ad9385
---
0ad9385
 drivers/mmc/host/sdhci-iproc.c | 9 ++++++---
0ad9385
 1 file changed, 6 insertions(+), 3 deletions(-)
0ad9385
0ad9385
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
0ad9385
index d7046d6..30b3fdf 100644
0ad9385
--- a/drivers/mmc/host/sdhci-iproc.c
0ad9385
+++ b/drivers/mmc/host/sdhci-iproc.c
0ad9385
@@ -211,14 +211,17 @@ static const struct sdhci_iproc_data iproc_data = {
0ad9385
 static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = {
0ad9385
 	.quirks = SDHCI_QUIRK_BROKEN_CARD_DETECTION |
0ad9385
 		  SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
0ad9385
-		  SDHCI_QUIRK_MISSING_CAPS,
0ad9385
+		  SDHCI_QUIRK_MISSING_CAPS |
0ad9385
+		  SDHCI_QUIRK_NO_HISPD_BIT,
0ad9385
 	.ops = &sdhci_iproc_32only_ops,
0ad9385
 };
0ad9385
 
0ad9385
 static const struct sdhci_iproc_data bcm2835_data = {
0ad9385
 	.pdata = &sdhci_bcm2835_pltfm_data,
0ad9385
-	.caps = SDHCI_CAN_VDD_330,
0ad9385
-	.caps1 = 0x00000000,
0ad9385
+	.caps = SDHCI_CAN_VDD_330 |
0ad9385
+		SDHCI_CAN_DO_HISPD,
0ad9385
+	.caps1 = SDHCI_DRIVER_TYPE_A |
0ad9385
+		 SDHCI_DRIVER_TYPE_C,
0ad9385
 	.mmc_caps = 0x00000000,
0ad9385
 };
0ad9385
 
0ad9385
-- 
0ad9385
2.9.3
0ad9385
0ad9385
From c43d8ee65e20df0672bd27238b11475dc3e8d447 Mon Sep 17 00:00:00 2001
0ad9385
From: Stefan Wahren <stefan.wahren@i2se.com>
0ad9385
Date: Fri, 30 Dec 2016 15:24:33 +0000
0ad9385
Subject: [PATCH 3/3] mmc: sdhci-iproc: Increase max_blk_size for bcm2835
0ad9385
0ad9385
According to the BCM2835 datasheet the maximum block size for the
0ad9385
eMMC module is restricted to the internal data FIFO which is 1024 byte.
0ad9385
But this is still an improvement to the default of 512 byte.
0ad9385
0ad9385
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
0ad9385
Reviewed-by: Eric Anholt <eric@anholt.net>
0ad9385
Acked-by: Scott Branden <scott.branden@broadcom.com>
0ad9385
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
0ad9385
---
0ad9385
 drivers/mmc/host/sdhci-iproc.c | 4 +++-
0ad9385
 1 file changed, 3 insertions(+), 1 deletion(-)
0ad9385
0ad9385
diff --git a/drivers/mmc/host/sdhci-iproc.c b/drivers/mmc/host/sdhci-iproc.c
0ad9385
index 30b3fdf..3275d49 100644
0ad9385
--- a/drivers/mmc/host/sdhci-iproc.c
0ad9385
+++ b/drivers/mmc/host/sdhci-iproc.c
0ad9385
@@ -218,7 +218,9 @@ static const struct sdhci_pltfm_data sdhci_bcm2835_pltfm_data = {
0ad9385
 
0ad9385
 static const struct sdhci_iproc_data bcm2835_data = {
0ad9385
 	.pdata = &sdhci_bcm2835_pltfm_data,
0ad9385
-	.caps = SDHCI_CAN_VDD_330 |
0ad9385
+	.caps = ((0x1 << SDHCI_MAX_BLOCK_SHIFT)
0ad9385
+			& SDHCI_MAX_BLOCK_MASK) |
0ad9385
+		SDHCI_CAN_VDD_330 |
0ad9385
 		SDHCI_CAN_DO_HISPD,
0ad9385
 	.caps1 = SDHCI_DRIVER_TYPE_A |
0ad9385
 		 SDHCI_DRIVER_TYPE_C,
0ad9385
-- 
0ad9385
2.9.3
0ad9385