Skip to contentSkip to conversation

adding write_protect and card_detect for mx25/35

PATCH New Wolfram Sang 2 participants 5 messages Feb 26, 2011 – Feb 28, 2011

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v4 cover adding write_protect and card_detect for mx25/35

Last tests showed some problems with MX51, especially with card_detect. While the approach in general will suffice for i.MX5x, it seems there are a few details missing right now. Because I do not have the resources (both time and hardware) to deal with these issues, I propose a step by step approach. Let's add the functionality for mx25/35 first and make sure there is no difference in behaviour for mx5x. (Note that the i.MX5x can route the pins directly to the controller, so a properly designed board should not need these gpio-additions.) That is what this patch series does: The main change is that mx5x won't notice any difference. For mx25/35, it is the same as it has been tested by Eric and Marc.

Thanks to all involved in providing feedback, I hope it can go in now. If you want to add support for it to your board, please CC me.

Have a nice weekend,

Wolfram

Wolfram Sang (3):
mmc: sdhci-esdhc-imx: add support for write protect on custom GPIO on

    mx25/35

mmc: sdhci-esdhc: broken card detection is not a default quirk
mmc: sdhci-esdhc-imx: add card detect on custom GPIO for mx25/35

 arch/arm/plat-mxc/include/mach/esdhc.h |   12 +++-
 drivers/mmc/host/sdhci-esdhc-imx.c     |  134 +++++++++++++++++++++++++++++---
 drivers/mmc/host/sdhci-esdhc.h         |    1 -
 drivers/mmc/host/sdhci-of-esdhc.c      |    3 +-
 4 files changed, 135 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH v4 1/3 mmc: sdhci-esdhc-imx: add support for write protect on custom GPIO on mx25/35

---

change since last version:

* none

 arch/arm/plat-mxc/include/mach/esdhc.h |   10 +++++-
 drivers/mmc/host/sdhci-esdhc-imx.c     |   52 +++++++++++++++++++++++++-------
 2 files changed, 50 insertions(+), 12 deletions(-)
arch/arm/plat-mxc/include/mach/esdhc.h +9 -1
index a48a9aa..47da109 100644
@@ -10,7 +10,15 @@
 #ifndef __ASM_ARCH_IMX_ESDHC_H
 #define __ASM_ARCH_IMX_ESDHC_H
 
+/**
+ * struct esdhc_platform_data - optional platform data for esdhc on i.MX
+ *
+ * strongly recommended for i.MX25/35, not needed for other variants
+ *
+ * @wp_gpio:	gpio for write_protect (-EINVAL if unused)
+ */
+
 struct esdhc_platform_data {
-	unsigned int wp_gpio;	/* write protect pin */
+	unsigned int wp_gpio;
 };
 #endif /* __ASM_ARCH_IMX_ESDHC_H */
drivers/mmc/host/sdhci-esdhc-imx.c +41 -11

89 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#2 lore raw

PATCH v4 2/3 mmc: sdhci-esdhc: broken card detection is not a default quirk

In reply to Wolfram Sang

It can be worked around using a GPIO which will be done for i.MX later.

---

change since last version:

* none

 drivers/mmc/host/sdhci-esdhc-imx.c |    3 ++-
 drivers/mmc/host/sdhci-esdhc.h     |    1 -
 drivers/mmc/host/sdhci-of-esdhc.c  |    3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci-esdhc-imx.c +2 -1
index 65df00b..49c9801 100644
@@ -171,7 +171,8 @@ static void esdhc_pltfm_exit(struct sdhci_host *host)
 }
 
 struct sdhci_pltfm_data sdhci_esdhc_imx_pdata = {
-	.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_ADMA,
+	.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_ADMA
+			| SDHCI_QUIRK_BROKEN_CARD_DETECTION,
 	/* ADMA has issues. Might be fixable */
 	.ops = &sdhci_esdhc_ops,
 	.init = esdhc_pltfm_init,
drivers/mmc/host/sdhci-esdhc.h +0 -1
index afaf1bc..c55aae8 100644
@@ -19,7 +19,6 @@
  */
 
 #define ESDHC_DEFAULT_QUIRKS	(SDHCI_QUIRK_FORCE_BLK_SZ_2048 | \
-				SDHCI_QUIRK_BROKEN_CARD_DETECTION | \
 				SDHCI_QUIRK_NO_BUSY_IRQ | \
 				SDHCI_QUIRK_NONSTANDARD_CLOCK | \
 				SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK | \
drivers/mmc/host/sdhci-of-esdhc.c +2 -1
index fcd0e1f..08161f6 100644
@@ -73,7 +73,8 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
 }
 
 struct sdhci_of_data sdhci_esdhc = {
-	.quirks = ESDHC_DEFAULT_QUIRKS,
+	/* card detection could be handled via GPIO */
+	.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_CARD_DETECTION,
 	.ops = {
 		.read_l = sdhci_be32bs_readl,
 		.read_w = esdhc_readw,
Signature · 1 line
1.7.2.3
#3 lore raw

PATCH v4 3/3 mmc: sdhci-esdhc-imx: add card detect on custom GPIO for mx25/35

In reply to Wolfram Sang

---

change since last version:

* BROKEN_CARD is default again for now
* i.MX5x won't apply the custom IRQ
-> same behaviour for i.MX5x as before

 arch/arm/plat-mxc/include/mach/esdhc.h |    2 +
 drivers/mmc/host/sdhci-esdhc-imx.c     |   79 ++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 0 deletions(-)
arch/arm/plat-mxc/include/mach/esdhc.h +2 -0
index 47da109..86003f4 100644
@@ -16,9 +16,11 @@
  * strongly recommended for i.MX25/35, not needed for other variants
  *
  * @wp_gpio:	gpio for write_protect (-EINVAL if unused)
+ * @cd_gpio:	gpio for card_detect interrupt (-EINVAL if unused)
  */
 
 struct esdhc_platform_data {
 	unsigned int wp_gpio;
+	unsigned int cd_gpio;
 };
 #endif /* __ASM_ARCH_IMX_ESDHC_H */
drivers/mmc/host/sdhci-esdhc-imx.c +79 -0

106 lines not on this page · raw message

Signature · 1 line
1.7.2.3
#4 lore raw

v4 cover adding write_protect and card_detect for mx25/35

In reply to Wolfram Sang

Hi Wolfram,

Quoted 11 lines · Wolfram Sang

Last tests showed some problems with MX51, especially with card_detect. While the approach in general will suffice for i.MX5x, it seems there are a few details missing right now. Because I do not have the resources (both time and hardware) to deal with these issues, I propose a step by step approach. Let's add the functionality for mx25/35 first and make sure there is no difference in behaviour for mx5x. (Note that the i.MX5x can route the pins directly to the controller, so a properly designed board should not need these gpio-additions.) That is what this patch series does: The main change is that mx5x won't notice any difference. For mx25/35, it is the same as it has been tested by Eric and Marc.

Quoted 2 lines

Thanks to all involved in providing feedback, I hope it can go in now. If you want to add support for it to your board, please CC me.

Thanks, pushed to mmc-next for .39 now.

- Chris.

Signature · 2 lines
Chris Ball   <[email protected]>
One Laptop Per Child