linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes
@ 2014-09-22  9:12 Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 1/8] mmc: sdhci-esdhc-imx: remove duplicated lines Dong Aisheng
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

Change since v1:
  Add patch 6 which resolves a checkpatch warning like below in v1:
0005-mmc-sdhci-do-not-enable-card-cd-wakeup-for-gpio-case.patch has no obvious style problems and is ready for submission.
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

Dong Aisheng (8):
  mmc: sdhci-esdhc-imx: remove duplicated lines
  mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt
    issue
  mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix
  mmc: sdhci: do not enable card detect interrupt for gpio cd type
  mmc: sdhci: do not enable card cd wakeup for gpio case
  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 ++++++++++++++++----
 drivers/mmc/host/sdhci.c                           |    8 +++-
 3 files changed, 49 insertions(+), 12 deletions(-)

-- 
1.7.8

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

* [PATCH v2 1/8] mmc: sdhci-esdhc-imx: remove duplicated lines
  2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
@ 2014-09-22  9:12 ` Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 2/8] mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue Dong Aisheng
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

There is already the same register check above, no need the later one.
Move them into one place and delete the later one.

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

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 587ee0e..256c901 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -315,6 +315,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)
@@ -335,13 +340,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.7.8

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

* [PATCH v2 2/8] mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue
  2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 1/8] mmc: sdhci-esdhc-imx: remove duplicated lines Dong Aisheng
@ 2014-09-22  9:12 ` Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 3/8] mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix Dong Aisheng
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

The usdhc does not have missing card interrupt issue, so execute the
workaround conditionally.

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

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 256c901..9594bf8 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -300,7 +300,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.7.8

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

* [PATCH v2 3/8] mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix
  2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 1/8] mmc: sdhci-esdhc-imx: remove duplicated lines Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 2/8] mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue Dong Aisheng
@ 2014-09-22  9:12 ` Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type Dong Aisheng
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 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 <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 9594bf8..dc0e384 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -114,6 +114,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;
@@ -141,7 +147,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 {
@@ -1050,6 +1056,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)
@@ -1061,6 +1074,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, boarddata) < 0) {
 		if (!host->mmc->parent->platform_data) {
-- 
1.7.8

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

* [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type
  2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
                   ` (2 preceding siblings ...)
  2014-09-22  9:12 ` [PATCH v2 3/8] mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix Dong Aisheng
@ 2014-09-22  9:12 ` Dong Aisheng
  2014-09-23  7:27   ` Ulf Hansson
  2014-09-22  9:12 ` [PATCH v2 5/8] mmc: sdhci: do not enable card cd wakeup for gpio case Dong Aisheng
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE,
we also do not need to handle controller native card detect interrupt
for gpio as card detect case.
If we wrong enabled the card detect interrupt for gpio case,
it will cause a lot of unexpected card detect interrupts during data transfer
which should not happen.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7481bd8..85cbf45 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -136,9 +136,10 @@ static void sdhci_dumpregs(struct sdhci_host *host)
 static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
 {
 	u32 present;
+	int gpio_cd = mmc_gpio_get_cd(host->mmc);
 
 	if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
-	    (host->mmc->caps & MMC_CAP_NONREMOVABLE))
+	    (host->mmc->caps & MMC_CAP_NONREMOVABLE) || !IS_ERR_VALUE(gpio_cd))
 		return;
 
 	if (enable) {
-- 
1.7.8

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

* [PATCH v2 5/8] mmc: sdhci: do not enable card cd wakeup for gpio case
  2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
                   ` (3 preceding siblings ...)
  2014-09-22  9:12 ` [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type Dong Aisheng
@ 2014-09-22  9:12 ` Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 6/8] mmc: sdhci-esdhc-imx: using specific compatible string in binding doc Dong Aisheng
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

Do not need to enable the controller card cd interrupt wakeup
if using GPIO as card detect since it's meaningless.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 85cbf45..2b5bba1 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2561,13 +2561,16 @@ static irqreturn_t sdhci_thread_irq(int irq, void *dev_id)
 void sdhci_enable_irq_wakeups(struct sdhci_host *host)
 {
 	u8 val;
+	int gpio_cd = mmc_gpio_get_cd(host->mmc);
+
 	u8 mask = SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE
 			| SDHCI_WAKE_ON_INT;
 
 	val = sdhci_readb(host, SDHCI_WAKE_UP_CONTROL);
 	val |= mask ;
 	/* Avoid fake wake up */
-	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)
+	if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION ||
+	    !IS_ERR_VALUE(gpio_cd))
 		val &= ~(SDHCI_WAKE_ON_INSERT | SDHCI_WAKE_ON_REMOVE);
 	sdhci_writeb(host, val, SDHCI_WAKE_UP_CONTROL);
 }
-- 
1.7.8

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

* [PATCH v2 6/8] mmc: sdhci-esdhc-imx: using specific compatible string in binding doc
  2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
                   ` (4 preceding siblings ...)
  2014-09-22  9:12 ` [PATCH v2 5/8] mmc: sdhci: do not enable card cd wakeup for gpio case Dong Aisheng
@ 2014-09-22  9:12 ` Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 7/8] mmc: sdhci-esdhc-imx: add imx6sx support Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 8/8] mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl Dong Aisheng
  7 siblings, 0 replies; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

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:
0005-mmc-sdhci-do-not-enable-card-cd-wakeup-for-gpio-case.patch has no obvious style problems and is ready for submission.
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>
---
 .../devicetree/bindings/mmc/fsl-imx-esdhc.txt      |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt
index 9046ba06..c415d34 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.7.8

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

* [PATCH v2 7/8] mmc: sdhci-esdhc-imx: add imx6sx support
  2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
                   ` (5 preceding siblings ...)
  2014-09-22  9:12 ` [PATCH v2 6/8] mmc: sdhci-esdhc-imx: using specific compatible string in binding doc Dong Aisheng
@ 2014-09-22  9:12 ` Dong Aisheng
  2014-09-22  9:12 ` [PATCH v2 8/8] mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl Dong Aisheng
  7 siblings, 0 replies; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 UTC (permalink / raw)
  To: linux-arm-kernel

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 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index dc0e384..87179c4 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -150,6 +150,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;
@@ -190,6 +195,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.7.8

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

* [PATCH v2 8/8] mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl
  2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
                   ` (6 preceding siblings ...)
  2014-09-22  9:12 ` [PATCH v2 7/8] mmc: sdhci-esdhc-imx: add imx6sx support Dong Aisheng
@ 2014-09-22  9:12 ` Dong Aisheng
  7 siblings, 0 replies; 12+ messages in thread
From: Dong Aisheng @ 2014-09-22  9:12 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 <b29396@freescale.com>
---
 drivers/mmc/host/sdhci-esdhc-imx.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 87179c4..16eff00 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -120,6 +120,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;
@@ -147,12 +149,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 {
@@ -1063,6 +1066,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.7.8

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

* [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type
  2014-09-23  7:27   ` Ulf Hansson
@ 2014-09-23  7:10     ` Dong Aisheng
  2014-09-23  8:17       ` Ulf Hansson
  0 siblings, 1 reply; 12+ messages in thread
From: Dong Aisheng @ 2014-09-23  7:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Sep 23, 2014 at 09:27:49AM +0200, Ulf Hansson wrote:
> On 22 September 2014 11:12, Dong Aisheng <b29396@freescale.com> wrote:
> > Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE,
> > we also do not need to handle controller native card detect interrupt
> > for gpio as card detect case.
> > If we wrong enabled the card detect interrupt for gpio case,
> > it will cause a lot of unexpected card detect interrupts during data transfer
> > which should not happen.
> >
> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
> > ---
> >  drivers/mmc/host/sdhci.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> > index 7481bd8..85cbf45 100644
> > --- a/drivers/mmc/host/sdhci.c
> > +++ b/drivers/mmc/host/sdhci.c
> > @@ -136,9 +136,10 @@ static void sdhci_dumpregs(struct sdhci_host *host)
> >  static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
> >  {
> >         u32 present;
> > +       int gpio_cd = mmc_gpio_get_cd(host->mmc);
> >
> >         if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
> > -           (host->mmc->caps & MMC_CAP_NONREMOVABLE))
> > +           (host->mmc->caps & MMC_CAP_NONREMOVABLE) || !IS_ERR_VALUE(gpio_cd))
> 
> If you have a properly working gpio_cd, then why does you also have
> SDHCI_QUIRK_BROKEN_CARD_DETECTION set? Isn't that the actual problem?
> 

SDHCI_QUIRK_BROKEN_CARD_DETECTION seems only for controller CD function.
Thus even we're using gpio_cd, we still have this quirk set for controller
to avoid enable controller cd interrupts.
Does it make sense?

Regards
Dong Aisheng

> Kind regards
> Uffe
> 
> >                 return;
> >
> >         if (enable) {
> > --
> > 1.7.8
> >

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

* [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type
  2014-09-22  9:12 ` [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type Dong Aisheng
@ 2014-09-23  7:27   ` Ulf Hansson
  2014-09-23  7:10     ` Dong Aisheng
  0 siblings, 1 reply; 12+ messages in thread
From: Ulf Hansson @ 2014-09-23  7:27 UTC (permalink / raw)
  To: linux-arm-kernel

On 22 September 2014 11:12, Dong Aisheng <b29396@freescale.com> wrote:
> Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE,
> we also do not need to handle controller native card detect interrupt
> for gpio as card detect case.
> If we wrong enabled the card detect interrupt for gpio case,
> it will cause a lot of unexpected card detect interrupts during data transfer
> which should not happen.
>
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 7481bd8..85cbf45 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -136,9 +136,10 @@ static void sdhci_dumpregs(struct sdhci_host *host)
>  static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
>  {
>         u32 present;
> +       int gpio_cd = mmc_gpio_get_cd(host->mmc);
>
>         if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
> -           (host->mmc->caps & MMC_CAP_NONREMOVABLE))
> +           (host->mmc->caps & MMC_CAP_NONREMOVABLE) || !IS_ERR_VALUE(gpio_cd))

If you have a properly working gpio_cd, then why does you also have
SDHCI_QUIRK_BROKEN_CARD_DETECTION set? Isn't that the actual problem?

Kind regards
Uffe

>                 return;
>
>         if (enable) {
> --
> 1.7.8
>

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

* [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type
  2014-09-23  7:10     ` Dong Aisheng
@ 2014-09-23  8:17       ` Ulf Hansson
  0 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2014-09-23  8:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 23 September 2014 09:10, Dong Aisheng <b29396@freescale.com> wrote:
> On Tue, Sep 23, 2014 at 09:27:49AM +0200, Ulf Hansson wrote:
>> On 22 September 2014 11:12, Dong Aisheng <b29396@freescale.com> wrote:
>> > Except SDHCI_QUIRK_BROKEN_CARD_DETECTION and MMC_CAP_NONREMOVABLE,
>> > we also do not need to handle controller native card detect interrupt
>> > for gpio as card detect case.
>> > If we wrong enabled the card detect interrupt for gpio case,
>> > it will cause a lot of unexpected card detect interrupts during data transfer
>> > which should not happen.

I see. But shouldn't you then check for MMC_CAP_NEEDS_POLL instead of
reading the current state of the gpio_cd pin?

Kind regards
Uffe

>> >
>> > Signed-off-by: Dong Aisheng <b29396@freescale.com>
>> > ---
>> >  drivers/mmc/host/sdhci.c |    3 ++-
>> >  1 files changed, 2 insertions(+), 1 deletions(-)
>> >
>> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> > index 7481bd8..85cbf45 100644
>> > --- a/drivers/mmc/host/sdhci.c
>> > +++ b/drivers/mmc/host/sdhci.c
>> > @@ -136,9 +136,10 @@ static void sdhci_dumpregs(struct sdhci_host *host)
>> >  static void sdhci_set_card_detection(struct sdhci_host *host, bool enable)
>> >  {
>> >         u32 present;
>> > +       int gpio_cd = mmc_gpio_get_cd(host->mmc);
>> >
>> >         if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) ||
>> > -           (host->mmc->caps & MMC_CAP_NONREMOVABLE))
>> > +           (host->mmc->caps & MMC_CAP_NONREMOVABLE) || !IS_ERR_VALUE(gpio_cd))
>>
>> If you have a properly working gpio_cd, then why does you also have
>> SDHCI_QUIRK_BROKEN_CARD_DETECTION set? Isn't that the actual problem?
>>
>
> SDHCI_QUIRK_BROKEN_CARD_DETECTION seems only for controller CD function.
> Thus even we're using gpio_cd, we still have this quirk set for controller
> to avoid enable controller cd interrupts.
> Does it make sense?
>
> Regards
> Dong Aisheng
>
>> Kind regards
>> Uffe
>>
>> >                 return;
>> >
>> >         if (enable) {
>> > --
>> > 1.7.8
>> >

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

end of thread, other threads:[~2014-09-23  8:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-22  9:12 [PATCH v2 0/8] mmc: sdhci/imx: a few clean up and fixes Dong Aisheng
2014-09-22  9:12 ` [PATCH v2 1/8] mmc: sdhci-esdhc-imx: remove duplicated lines Dong Aisheng
2014-09-22  9:12 ` [PATCH v2 2/8] mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue Dong Aisheng
2014-09-22  9:12 ` [PATCH v2 3/8] mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix Dong Aisheng
2014-09-22  9:12 ` [PATCH v2 4/8] mmc: sdhci: do not enable card detect interrupt for gpio cd type Dong Aisheng
2014-09-23  7:27   ` Ulf Hansson
2014-09-23  7:10     ` Dong Aisheng
2014-09-23  8:17       ` Ulf Hansson
2014-09-22  9:12 ` [PATCH v2 5/8] mmc: sdhci: do not enable card cd wakeup for gpio case Dong Aisheng
2014-09-22  9:12 ` [PATCH v2 6/8] mmc: sdhci-esdhc-imx: using specific compatible string in binding doc Dong Aisheng
2014-09-22  9:12 ` [PATCH v2 7/8] mmc: sdhci-esdhc-imx: add imx6sx support Dong Aisheng
2014-09-22  9:12 ` [PATCH v2 8/8] mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl Dong Aisheng

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).