Skip to contentSkip to conversation

tmio_mmc: SDHI hotplug and random fixes

PATCH In review Magnus Damm 2 participants 9 messages Feb 17, 2010 – Feb 28, 2010

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

cover tmio_mmc: SDHI hotplug and random fixes

tmio_mmc: SDHI hotplug and random fixes

[PATCH 01/05] tmio_mmc: Keep card-detect interrupts enabled [PATCH 02/05] tmio_mmc: Add MMC_CAP_MMC_HIGHSPEED support V2 [PATCH 03/05] tmio_mmc: Use 100ms mmc_detect_change() delay [PATCH 04/05] tmio_mmc: Remove const from platform data V3 [PATCH 05/05] tmio_mmc: Balance cell enable()/disable() calls

These patches are a collection of fixes for SDHI hotplug and other minor improvements for the tmio_mmc driver.

The first and the third patch contain tmio-mmc specific fixes for SDHI hotplug. Hot insertion and eject have been tested using the sh-2.6 tree with the two SDHI blocks provided by the sh7724 processor using Ecovec24 and ms7724se boards. The single SDHI block included in sh7722 has been tested on Migo-R.

The second patch is the ground work to allow the SDHI mfd driver to enable MMC_CAP_MMC_HIGHSPEED.

The last two patches are just random improvements and fixes for the tmio_mmc driver.

---

 drivers/mmc/host/tmio_mmc.c |   13 ++++++++++---
 drivers/mmc/host/tmio_mmc.h |    6 ++----
 include/linux/mfd/tmio.h    |    3 ++-
 3 files changed, 14 insertions(+), 8 deletions(-)
#1 lore raw

PATCH 1/5 tmio_mmc: Keep card-detect interrupts enabled

From: Guennadi Liakhovetski <[email protected]>

On SuperH platforms the SDHI controller does not produce any command IRQs after a completed IO. This leads to card-detect interrupts staying disabled. Do not disable card-detect interrupts on DATA IRQs.

---

Previously posted by Guennadi to linux-mmc 20100216 as "[PATCH] tmio_mmc: keep card-detect interrupts enabled"

 drivers/mmc/host/tmio_mmc.h |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/mmc/host/tmio_mmc.h +2 -4
index 692dc23..dafecfb 100644
@@ -55,10 +55,8 @@
 /* Define some IRQ masks */
 /* This is the mask used at reset by the chip */
 #define TMIO_MASK_ALL           0x837f031d
-#define TMIO_MASK_READOP  (TMIO_STAT_RXRDY | TMIO_STAT_DATAEND | \
-		TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT)
-#define TMIO_MASK_WRITEOP (TMIO_STAT_TXRQ | TMIO_STAT_DATAEND | \
-		TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT)
+#define TMIO_MASK_READOP  (TMIO_STAT_RXRDY | TMIO_STAT_DATAEND)
+#define TMIO_MASK_WRITEOP (TMIO_STAT_TXRQ | TMIO_STAT_DATAEND)
 #define TMIO_MASK_CMD     (TMIO_STAT_CMDRESPEND | TMIO_STAT_CMDTIMEOUT | \
 		TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT)
 #define TMIO_MASK_IRQ     (TMIO_MASK_READOP | TMIO_MASK_WRITEOP | TMIO_MASK_CMD)
Signature · 3 lines
1.6.2.4

--
#2 lore raw

PATCH 2/5 tmio_mmc: Add MMC_CAP_MMC_HIGHSPEED support V2

In reply to Magnus Damm

From: Yusuke Goda <[email protected]>

Enable MMC_CAP_XX support in the tmio_mmc driver if pdata->capabilities is set.

---

Previously posted by Goda-san to linux-mmc 20100216 as "[PATCH v2] tmio_mmc: Add MMC_CAP_MMC_HIGHSPEED support"

 drivers/mmc/host/tmio_mmc.c |    1 +
 include/linux/mfd/tmio.h    |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
drivers/mmc/host/tmio_mmc.c +1 -0
index e22c3fa..e2c0cc9 100644
@@ -550,6 +550,7 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
 
 	mmc->ops = &tmio_mmc_ops;
 	mmc->caps = MMC_CAP_4_BIT_DATA;
+	mmc->caps |= pdata->capabilities;
 	mmc->f_max = pdata->hclk;
 	mmc->f_min = mmc->f_max / 512;
 	mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
include/linux/mfd/tmio.h +1 -0
index 9cb1834..37d9414 100644
@@ -60,6 +60,7 @@ void tmio_core_mmc_clk_div(void __iomem *cnf, int shift, int state);
  */
 struct tmio_mmc_data {
 	const unsigned int		hclk;
+	unsigned long			capabilities;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
 };
Signature · 1 line
1.6.4.3
#3 lore raw

PATCH 3/5 tmio_mmc: Use 100ms mmc_detect_change() delay

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

This patch changes the tmio_mmc driver to wait 100ms before checking the card detect status. This type of delay is quite common among mmc drivers, it seems that most hardware platforms need to give the hardware some time to settle before checking card availabilty.

Hotplug is half-broken without this patch on the sh7724 Ecovec board. Hot insertion seems ok but eject is never detected without this patch.

---

Previously posted to linux-mmc 20100215 as "[PATCH] tmio_mmc: use 100ms mmc_detect_change() delay"

 drivers/mmc/host/tmio_mmc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/tmio_mmc.c +1 -1
@@ -323,7 +323,7 @@ static irqreturn_t tmio_mmc_irq(int irq,
 		if (ireg & (TMIO_STAT_CARD_INSERT | TMIO_STAT_CARD_REMOVE)) {
 			ack_mmc_irqs(host, TMIO_STAT_CARD_INSERT |
 				TMIO_STAT_CARD_REMOVE);
-			mmc_detect_change(host->mmc, 0);
+			mmc_detect_change(host->mmc, msecs_to_jiffies(100));
 		}
 
 		/* CRC and other errors */
#4 lore raw

PATCH 4/5 tmio_mmc: Remove const from platform data V3

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove const from the tmio-mmc platform data hclk V3. This change makes it possible to remove the type cast from the sh_mobile_sdhi driver which is using the clock framework to get the clock rate.

---

Previously posted V2 to linux-mmc 20091126 as
"[PATCH 02/03] mmc: Remove const from tmio-mmc platform data V2"

Changes from V2:
- rediff to fit on top of capabilities patch

 include/linux/mfd/tmio.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mfd/tmio.h +1 -1
@@ -59,7 +59,7 @@ void tmio_core_mmc_clk_div(void __iomem 
  * data for the MMC controller
  */
 struct tmio_mmc_data {
-	const unsigned int		hclk;
+	unsigned int			hclk;
 	unsigned long			capabilities;
 	void (*set_pwr)(struct platform_device *host, int state);
 	void (*set_clk_div)(struct platform_device *host, int state);
#5 lore raw

PATCH 5/5 tmio_mmc: Balance cell enable()/disable() calls

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

This patch adds cell->disable() calls to the tmio-mmc probe() error handling and the remove() function.

---

Previously posted to linux-mmc 20091126 as
"[PATCH 03/03] mmc: Balance tmio-mmc cell enable()/disable() calls"

 drivers/mmc/host/tmio_mmc.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/mmc/host/tmio_mmc.c +8 -2
@@ -569,14 +569,14 @@ static int __devinit tmio_mmc_probe(stru
 	if (ret >= 0)
 		host->irq = ret;
 	else
-		goto unmap_ctl;
+		goto cell_disable;
 
 	disable_mmc_irqs(host, TMIO_MASK_ALL);
 
 	ret = request_irq(host->irq, tmio_mmc_irq, IRQF_DISABLED |
 		IRQF_TRIGGER_FALLING, dev_name(&dev->dev), host);
 	if (ret)
-		goto unmap_ctl;
+		goto cell_disable;
 
 	mmc_add_host(mmc);
 
@@ -588,6 +588,9 @@ static int __devinit tmio_mmc_probe(stru
 
 	return 0;
 
+cell_disable:
+	if (cell->disable)
+		cell->disable(dev);
 unmap_ctl:
 	iounmap(host->ctl);
 host_free:
@@ -598,6 +601,7 @@ out:
 
 static int __devexit tmio_mmc_remove(struct platform_device *dev)
 {
+	struct mfd_cell	*cell = (struct mfd_cell *)dev->dev.platform_data;
 	struct mmc_host *mmc = platform_get_drvdata(dev);
 
 	platform_set_drvdata(dev, NULL);
@@ -606,6 +610,8 @@ static int __devexit tmio_mmc_remove(str
 		struct tmio_mmc_host *host = mmc_priv(mmc);
 		mmc_remove_host(mmc);
 		free_irq(host->irq, host);
+		if (cell->disable)
+			cell->disable(dev);
 		iounmap(host->ctl);
 		mmc_free_host(mmc);
 	}
#6 lore raw
In reply to Magnus Damm

Hi Magnus,

Quoted 17 lines · Magnus Damm

tmio_mmc: SDHI hotplug and random fixes

[PATCH 01/05] tmio_mmc: Keep card-detect interrupts enabled [PATCH 02/05] tmio_mmc: Add MMC_CAP_MMC_HIGHSPEED support V2 [PATCH 03/05] tmio_mmc: Use 100ms mmc_detect_change() delay [PATCH 04/05] tmio_mmc: Remove const from platform data V3 [PATCH 05/05] tmio_mmc: Balance cell enable()/disable() calls

These patches are a collection of fixes for SDHI hotplug and other minor improvements for the tmio_mmc driver.

The first and the third patch contain tmio-mmc specific fixes for SDHI hotplug. Hot insertion and eject have been tested using the sh-2.6 tree with the two SDHI blocks provided by the sh7724 processor using Ecovec24 and ms7724se boards. The single SDHI block included in sh7722 has been tested on Migo-R.

Quoted 5 lines

The second patch is the ground work to allow the SDHI mfd driver to enable MMC_CAP_MMC_HIGHSPEED.

The last two patches are just random improvements and fixes for the tmio_mmc driver.

Since some of this code depends on the tmio.h changes, I'm taking this patchset. Please let me know if that's fine with you.

Cheers,
Samuel.

Quoted 7 lines

---

 drivers/mmc/host/tmio_mmc.c |   13 ++++++++++---
 drivers/mmc/host/tmio_mmc.h |    6 ++----
 include/linux/mfd/tmio.h    |    3 ++-
 3 files changed, 14 insertions(+), 8 deletions(-)
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/
#7 lore raw

Hi Samuel,

Quoted 11 lines · Samuel Ortiz
Quoted 8 lines · Magnus Damm

tmio_mmc: SDHI hotplug and random fixes

[PATCH 01/05] tmio_mmc: Keep card-detect interrupts enabled [PATCH 02/05] tmio_mmc: Add MMC_CAP_MMC_HIGHSPEED support V2 [PATCH 03/05] tmio_mmc: Use 100ms mmc_detect_change() delay [PATCH 04/05] tmio_mmc: Remove const from platform data V3 [PATCH 05/05] tmio_mmc: Balance cell enable()/disable() calls

Since some of this code depends on the tmio.h changes, I'm taking this patchset. Please let me know if that's fine with you.

Sounds great, thank you! I've just posted two patches for sh_mobile_sdhi, please pick them up as well if possible.

Thanks,

/ magnus

#8 lore raw

Hi Magnus,

Quoted 12 lines · Magnus Damm

Hi Samuel,

Quoted 9 lines · Samuel Ortiz
Quoted 8 lines · Magnus Damm

tmio_mmc: SDHI hotplug and random fixes

[PATCH 01/05] tmio_mmc: Keep card-detect interrupts enabled [PATCH 02/05] tmio_mmc: Add MMC_CAP_MMC_HIGHSPEED support V2 [PATCH 03/05] tmio_mmc: Use 100ms mmc_detect_change() delay [PATCH 04/05] tmio_mmc: Remove const from platform data V3 [PATCH 05/05] tmio_mmc: Balance cell enable()/disable() calls

Quoted 5 lines
Quoted 2 lines

Since some of this code depends on the tmio.h changes, I'm taking this patchset. Please let me know if that's fine with you.

Sounds great, thank you! I've just posted two patches for sh_mobile_sdhi, please pick them up as well if possible.

Done, thanks a lot.

Cheers,
Samuel.

Quoted 3 lines

Thanks,

/ magnus

Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/