linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6]  mmc: imx: a few clean up and fixes
@ 2015-05-27 10:13 Dong Aisheng
  2015-05-27 10:13 ` [PATCH 1/6] mmc: sdhci-esdhc-imx: merge the same register check into one place Dong Aisheng
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Dong Aisheng @ 2015-05-27 10:13 UTC (permalink / raw)
  To: linux-arm-kernel

Patch 1 is a small clean up.
Patch 2-4 and 6 are small fixes.
Patch 5 add mx6sx support.

Dong Aisheng (6):
  mmc: sdhci-esdhc-imx: merge the same register check into one place
  mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue
  mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix
  mmc: sdhci-esdhc-imx: using specific compatible string in binding doc
  mmc: sdhci-esdhc-imx: add imx6sx support
  mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl

 .../devicetree/bindings/mmc/fsl-imx-esdhc.txt      |  9 ++++-
 drivers/mmc/host/sdhci-esdhc-imx.c                 | 44 +++++++++++++++++-----
 2 files changed, 43 insertions(+), 10 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] mmc: sdhci-esdhc-imx: merge the same register check into one place
  2015-05-27 10:13 [PATCH 0/6] mmc: imx: a few clean up and fixes Dong Aisheng
@ 2015-05-27 10:13 ` Dong Aisheng
  2015-05-27 10:13 ` [PATCH 2/6] mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue Dong Aisheng
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Dong Aisheng @ 2015-05-27 10:13 UTC (permalink / raw)
  To: linux-arm-kernel

In esdhc_writel_le() function, there's duplicated checking of the same
register as follows:
"if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE))".
Merge them into one and remove the duplicated one.

Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index ef290a5..0c89293 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -313,6 +313,11 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 			data |= ESDHC_CTRL_D3CD;
 			writel(data, host->ioaddr + SDHCI_HOST_CONTROL);
 		}
+
+		if (val & SDHCI_INT_ADMA_ERROR) {
+			val &= ~SDHCI_INT_ADMA_ERROR;
+			val |= ESDHC_INT_VENDOR_SPEC_DMA_ERR;
+		}
 	}
 
 	if (unlikely((imx_data->socdata->flags & ESDHC_FLAG_MULTIBLK_NO_INT)
@@ -333,13 +338,6 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 			}
 	}
 
-	if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
-		if (val & SDHCI_INT_ADMA_ERROR) {
-			val &= ~SDHCI_INT_ADMA_ERROR;
-			val |= ESDHC_INT_VENDOR_SPEC_DMA_ERR;
-		}
-	}
-
 	writel(val, host->ioaddr + reg);
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue
  2015-05-27 10:13 [PATCH 0/6] mmc: imx: a few clean up and fixes Dong Aisheng
  2015-05-27 10:13 ` [PATCH 1/6] mmc: sdhci-esdhc-imx: merge the same register check into one place Dong Aisheng
@ 2015-05-27 10:13 ` Dong Aisheng
  2015-05-27 10:13 ` [PATCH 3/6] mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix Dong Aisheng
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Dong Aisheng @ 2015-05-27 10:13 UTC (permalink / raw)
  To: linux-arm-kernel

The usdhc does not have missing card interrupt issue, so don't execute
workaround for usdhc.

Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 0c89293..fda07eb 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -298,7 +298,7 @@ static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg)
 	u32 data;
 
 	if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE)) {
-		if (val & SDHCI_INT_CARD_INT) {
+		if ((val & SDHCI_INT_CARD_INT) && !esdhc_is_usdhc(imx_data)) {
 			/*
 			 * Clear and then set D3CD bit to avoid missing the
 			 * card interrupt.  This is a eSDHC controller problem
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix
  2015-05-27 10:13 [PATCH 0/6] mmc: imx: a few clean up and fixes Dong Aisheng
  2015-05-27 10:13 ` [PATCH 1/6] mmc: sdhci-esdhc-imx: merge the same register check into one place Dong Aisheng
  2015-05-27 10:13 ` [PATCH 2/6] mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue Dong Aisheng
@ 2015-05-27 10:13 ` Dong Aisheng
  2015-05-27 10:13 ` [PATCH 4/6] mmc: sdhci-esdhc-imx: using specific compatible string in binding doc Dong Aisheng
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Dong Aisheng @ 2015-05-27 10:13 UTC (permalink / raw)
  To: linux-arm-kernel

The uSDHC has an ADMA Length Mismatch errata ERR004536 which may
cause ADMA work abnormally. The errata has already been fixed for
i.MX6Q TO1.2 and i.MX6DL TO1.1 by enable the bit 7 in 0x6c register.
Unfortunately this fix is not included in i.MX6SL.
So we disable ADMA for i.MX6SL and use SDMA instead.

Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index fda07eb..a3b82d1 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -112,6 +112,12 @@
 #define ESDHC_FLAG_STD_TUNING		BIT(5)
 /* The IP has SDHCI_CAPABILITIES_1 register */
 #define ESDHC_FLAG_HAVE_CAP1		BIT(6)
+/*
+ * The IP has errata ERR004536
+ * uSDHC: ADMA Length Mismatch Error occurs if the AHB read access is slow,
+ * when reading data from the card
+ */
+#define ESDHC_FLAG_ERR004536		BIT(7)
 
 struct esdhc_soc_data {
 	u32 flags;
@@ -139,7 +145,7 @@ static struct esdhc_soc_data usdhc_imx6q_data = {
 
 static struct esdhc_soc_data usdhc_imx6sl_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
-			| ESDHC_FLAG_HAVE_CAP1,
+			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_ERR004536,
 };
 
 struct pltfm_imx_data {
@@ -991,6 +997,13 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		writel(0x08100810, host->ioaddr + ESDHC_WTMK_LVL);
 		host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN;
 		host->mmc->caps |= MMC_CAP_1_8V_DDR;
+
+		/*
+		* errata ESDHC_FLAG_ERR004536 fix for MX6Q TO1.2 and MX6DL
+		* TO1.1, it's harmless for MX6SL
+		*/
+		writel(readl(host->ioaddr + 0x6c) | BIT(7),
+			host->ioaddr + 0x6c);
 	}
 
 	if (imx_data->socdata->flags & ESDHC_FLAG_MAN_TUNING)
@@ -1002,6 +1015,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 			ESDHC_STD_TUNING_EN | ESDHC_TUNING_START_TAP,
 			host->ioaddr + ESDHC_TUNING_CTRL);
 
+	if (imx_data->socdata->flags & ESDHC_FLAG_ERR004536)
+		host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;
+
 	boarddata = &imx_data->boarddata;
 	if (sdhci_esdhc_imx_probe_dt(pdev, host, boarddata) < 0) {
 		if (!host->mmc->parent->platform_data) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] mmc: sdhci-esdhc-imx: using specific compatible string in binding doc
  2015-05-27 10:13 [PATCH 0/6] mmc: imx: a few clean up and fixes Dong Aisheng
                   ` (2 preceding siblings ...)
  2015-05-27 10:13 ` [PATCH 3/6] mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix Dong Aisheng
@ 2015-05-27 10:13 ` Dong Aisheng
  2015-05-27 10:13 ` [PATCH 5/6] mmc: sdhci-esdhc-imx: add imx6sx support Dong Aisheng
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Dong Aisheng @ 2015-05-27 10:13 UTC (permalink / raw)
  To: linux-arm-kernel

From: Dong Aisheng <b29396@freescale.com>

Using specific compatible string in binding doc to make the binding
more clear.
It's also used to avoid checkpatch warning in the future like follows:
WARNING: DT compatible string "fsl,imx6sx-usdhc" appears un-documented --
check ./Documentation/devicetree/bindings/
+       { .compatible = "fsl,imx6sx-usdhc", .data = &usdhc_imx6sx_data, },

total: 0 errors, 1 warnings, 18 lines checked

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
index 415c557..5d0376b 100644
--- a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
+++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
@@ -7,7 +7,14 @@ This file documents differences between the core properties described
 by mmc.txt and the properties used by the sdhci-esdhc-imx driver.
 
 Required properties:
-- compatible : Should be "fsl,<chip>-esdhc"
+- compatible : Should be "fsl,<chip>-esdhc", the supported chips include
+	       "fsl,imx25-esdhc"
+	       "fsl,imx35-esdhc"
+	       "fsl,imx51-esdhc"
+	       "fsl,imx53-esdhc"
+	       "fsl,imx6q-usdhc"
+	       "fsl,imx6sl-usdhc"
+	       "fsl,imx6sx-usdhc"
 
 Optional properties:
 - fsl,cd-controller : Indicate to use controller internal card detection
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] mmc: sdhci-esdhc-imx: add imx6sx support
  2015-05-27 10:13 [PATCH 0/6] mmc: imx: a few clean up and fixes Dong Aisheng
                   ` (3 preceding siblings ...)
  2015-05-27 10:13 ` [PATCH 4/6] mmc: sdhci-esdhc-imx: using specific compatible string in binding doc Dong Aisheng
@ 2015-05-27 10:13 ` Dong Aisheng
  2015-05-27 10:13 ` [PATCH 6/6] mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl Dong Aisheng
  2015-05-28  8:36 ` [PATCH 0/6] mmc: imx: a few clean up and fixes Ulf Hansson
  6 siblings, 0 replies; 8+ messages in thread
From: Dong Aisheng @ 2015-05-27 10:13 UTC (permalink / raw)
  To: linux-arm-kernel

From: Dong Aisheng <b29396@freescale.com>

The imx6sx usdhc is derived from imx6sl, the difference is minor.
imx6sx have the errata ESDHC_FLAG_ERR004536 fixed.
So introduce a new compatible string for imx6sx to distinguish them.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index a3b82d1..bcb5673 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -148,6 +148,11 @@ static struct esdhc_soc_data usdhc_imx6sl_data = {
 			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_ERR004536,
 };
 
+static struct esdhc_soc_data usdhc_imx6sx_data = {
+	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
+			| ESDHC_FLAG_HAVE_CAP1,
+};
+
 struct pltfm_imx_data {
 	u32 scratchpad;
 	struct pinctrl *pinctrl;
@@ -188,6 +193,7 @@ static const struct of_device_id imx_esdhc_dt_ids[] = {
 	{ .compatible = "fsl,imx35-esdhc", .data = &esdhc_imx35_data, },
 	{ .compatible = "fsl,imx51-esdhc", .data = &esdhc_imx51_data, },
 	{ .compatible = "fsl,imx53-esdhc", .data = &esdhc_imx53_data, },
+	{ .compatible = "fsl,imx6sx-usdhc", .data = &usdhc_imx6sx_data, },
 	{ .compatible = "fsl,imx6sl-usdhc", .data = &usdhc_imx6sl_data, },
 	{ .compatible = "fsl,imx6q-usdhc", .data = &usdhc_imx6q_data, },
 	{ /* sentinel */ }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl
  2015-05-27 10:13 [PATCH 0/6] mmc: imx: a few clean up and fixes Dong Aisheng
                   ` (4 preceding siblings ...)
  2015-05-27 10:13 ` [PATCH 5/6] mmc: sdhci-esdhc-imx: add imx6sx support Dong Aisheng
@ 2015-05-27 10:13 ` Dong Aisheng
  2015-05-28  8:36 ` [PATCH 0/6] mmc: imx: a few clean up and fixes Ulf Hansson
  6 siblings, 0 replies; 8+ messages in thread
From: Dong Aisheng @ 2015-05-27 10:13 UTC (permalink / raw)
  To: linux-arm-kernel

The iMX6Q/DL can not support HS200 mode while iMX6SL and iMX6SX can,
so introduce a new flag to distinguish them.

Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index bcb5673..faf0cb9 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -118,6 +118,8 @@
  * when reading data from the card
  */
 #define ESDHC_FLAG_ERR004536		BIT(7)
+/* The IP supports HS200 mode */
+#define ESDHC_FLAG_HS200		BIT(8)
 
 struct esdhc_soc_data {
 	u32 flags;
@@ -145,12 +147,13 @@ static struct esdhc_soc_data usdhc_imx6q_data = {
 
 static struct esdhc_soc_data usdhc_imx6sl_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
-			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_ERR004536,
+			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_ERR004536
+			| ESDHC_FLAG_HS200,
 };
 
 static struct esdhc_soc_data usdhc_imx6sx_data = {
 	.flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
-			| ESDHC_FLAG_HAVE_CAP1,
+			| ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200,
 };
 
 struct pltfm_imx_data {
@@ -1004,6 +1007,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN;
 		host->mmc->caps |= MMC_CAP_1_8V_DDR;
 
+		if (!(imx_data->socdata->flags & ESDHC_FLAG_HS200))
+			host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
+
 		/*
 		* errata ESDHC_FLAG_ERR004536 fix for MX6Q TO1.2 and MX6DL
 		* TO1.1, it's harmless for MX6SL
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 0/6] mmc: imx: a few clean up and fixes
  2015-05-27 10:13 [PATCH 0/6] mmc: imx: a few clean up and fixes Dong Aisheng
                   ` (5 preceding siblings ...)
  2015-05-27 10:13 ` [PATCH 6/6] mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl Dong Aisheng
@ 2015-05-28  8:36 ` Ulf Hansson
  6 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2015-05-28  8:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 27 May 2015 at 12:13, Dong Aisheng <aisheng.dong@freescale.com> wrote:
> Patch 1 is a small clean up.
> Patch 2-4 and 6 are small fixes.
> Patch 5 add mx6sx support.
>
> Dong Aisheng (6):
>   mmc: sdhci-esdhc-imx: merge the same register check into one place
>   mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue
>   mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix
>   mmc: sdhci-esdhc-imx: using specific compatible string in binding doc
>   mmc: sdhci-esdhc-imx: add imx6sx support
>   mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl
>
>  .../devicetree/bindings/mmc/fsl-imx-esdhc.txt      |  9 ++++-
>  drivers/mmc/host/sdhci-esdhc-imx.c                 | 44 +++++++++++++++++-----
>  2 files changed, 43 insertions(+), 10 deletions(-)
>
> --
> 1.9.1
>

Thanks! Applied for next.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-05-28  8:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27 10:13 [PATCH 0/6] mmc: imx: a few clean up and fixes Dong Aisheng
2015-05-27 10:13 ` [PATCH 1/6] mmc: sdhci-esdhc-imx: merge the same register check into one place Dong Aisheng
2015-05-27 10:13 ` [PATCH 2/6] mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue Dong Aisheng
2015-05-27 10:13 ` [PATCH 3/6] mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix Dong Aisheng
2015-05-27 10:13 ` [PATCH 4/6] mmc: sdhci-esdhc-imx: using specific compatible string in binding doc Dong Aisheng
2015-05-27 10:13 ` [PATCH 5/6] mmc: sdhci-esdhc-imx: add imx6sx support Dong Aisheng
2015-05-27 10:13 ` [PATCH 6/6] mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl Dong Aisheng
2015-05-28  8:36 ` [PATCH 0/6] mmc: imx: a few clean up and fixes Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).