Skip to contentSkip to conversation

Fixes for SDIO interrupts for dw_mmc

PATCH In review Doug Anderson 5 participants 18 messages Dec 2, 2014 – Jan 3, 2015

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

v5 cover Fixes for SDIO interrupts for dw_mmc

Bing Zhao at Marvell found a problem with dw_mmc where interrupts weren't firing sometimes. He tracked it down to a read-modify-write problem with the INTMASK. These patches fix the problem.

Note: I've picked up a > 1-year old series here to make another attempt at landing it upstream. These patches have been in shipping Chromebooks for the last year. Note that v3 to v4 has no changes other than a rebase and a small commit message update.

The first two patches extend the "init_card()" mechanism of MMC core to actually be called for all card types, not just SDIO. That could be applied any time and should fix at least one longstanding bug (untested).

The third patch is a cleanup patch to use init_card() to move things around a bit so we don't need to handle SDIO cards in such a strange place. On earlier versions of this patch Seungwon brought up a few points which I have _not_ addressed. See
<https://patchwork.kernel.org/patch/3049071/>. Other than talk of cards with out of band interrupts maybe being able to gate their clocks, he wanted to use MMC_QUIRK_BROKEN_CLK_GATING. I didn't do that because of the ordering of init_card() and when the quirks are set. Some users of init_card() like pandora_wl1251_init_card() rely on it being called very early in the process. pandora_wl1251_init_card() hardcodes a vendor and device and thus need to be called super early. On the other hand the code that adds quirks _reads_ the vendor and device. It can't possibly move before init_card(). If folks are willing to take an additional host op of init_card_late() I can certainly go that way, though.

The fourth patch is (I think) reviewed and ready to go assuming the other two land.

Changes in v5:
- Split fixup to pandora_wl1251_init_card() into its own patch.

Changes in v3:
- Add fixup to pandora_wl1251_init_card().

Changes in v2:
- mmc core change new for this version.
- Fixed "|" to "&".
- intmask_lock renamed to irq_lock

Doug Anderson (4):
ARM: OMAP2+: Make sure pandora_wl1251_init_card() applies to SDIO only
mmc: core: Support the optional init_card() callback for MMC and SD
mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts
mmc: dw_mmc: Protect read-modify-write of INTMASK with a lock

 arch/arm/mach-omap2/board-omap3pandora.c | 14 +++---
 drivers/mmc/core/mmc.c                   |  6 +++
 drivers/mmc/core/sd.c                    |  7 ++-
 drivers/mmc/host/dw_mmc.c                | 80 +++++++++++++++++++-------------
 drivers/mmc/host/dw_mmc.h                |  1 +
 include/linux/mmc/dw_mmc.h               |  6 +++
 6 files changed, 74 insertions(+), 40 deletions(-)
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#1 lore raw

PATCH v5 1/4 ARM: OMAP2+: Make sure pandora_wl1251_init_card() applies to SDIO only

In preparation for having init_card() called for all card types (not just SDIO), change pandora_wl1251_init_card() so it checks whether the card type is SDIO.

---
Changes in v5:
- Split fixup to pandora_wl1251_init_card() into its own patch.

Changes in v3: None
Changes in v2: None

 arch/arm/mach-omap2/board-omap3pandora.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +8 -6
index 7f17087..969e100 100644
@@ -254,12 +254,14 @@ static void pandora_wl1251_init_card(struct mmc_card *card)
 	 * We have TI wl1251 attached to MMC3. Pass this information to
 	 * SDIO core because it can't be probed by normal methods.
 	 */
-	card->quirks |= MMC_QUIRK_NONSTD_SDIO;
-	card->cccr.wide_bus = 1;
-	card->cis.vendor = 0x104c;
-	card->cis.device = 0x9066;
-	card->cis.blksize = 512;
-	card->cis.max_dtr = 20000000;
+	if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) {
+		card->quirks |= MMC_QUIRK_NONSTD_SDIO;
+		card->cccr.wide_bus = 1;
+		card->cis.vendor = 0x104c;
+		card->cis.device = 0x9066;
+		card->cis.blksize = 512;
+		card->cis.max_dtr = 20000000;
+	}
 }
 
 static struct omap2_hsmmc_info omap3pandora_mmc[] = {
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#3 lore raw

PATCH v5 2/4 mmc: core: Support the optional init_card() callback for MMC and SD

In reply to Doug Anderson

In (3fcb027 ARM: MXC: mxcmmc: work around a bug in the SDHC busy line handling) the optional init_card() callback was added. According to the original change it was "for now only called from mmc_sdio_init_card()".

This callback really ought to be called from the SD and MMC init functions as well. One current user of this callback (mxcmci_init_card) will not work as expected if you insert an SDIO card, then eject it and put a normal SD card in. Specifically the normal SD card will not get to run with 4-bit data.

I'd like to use the init_card() callback to handle a similar quirk on dw_mmc when using SDIO Interrupts (the "low power" feature of the card needs to be disabled), so that will add a second user of the function.

---
Changes in v5:
- Split fixup to pandora_wl1251_init_card() into its own patch.

Changes in v3:
- Add fixup to pandora_wl1251_init_card().

Changes in v2:
- mmc core change new for this version.

 drivers/mmc/core/mmc.c | 6 ++++++
 drivers/mmc/core/sd.c  | 7 ++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/mmc/core/mmc.c +6 -0
index 02ad792..4a21d66 100644
@@ -1297,6 +1297,12 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	}
 
 	/*
+	 * Call the optional HC's init_card function to handle quirks.
+	 */
+	if (host->ops->init_card)
+		host->ops->init_card(host, card);
+
+	/*
 	 * For native busses:  set card RCA and quit open drain mode.
 	 */
 	if (!mmc_host_is_spi(host)) {
drivers/mmc/core/sd.c +6 -1
index d90a6de..29fccdc 100644
@@ -933,6 +933,12 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
 	}
 
 	/*
+	 * Call the optional HC's init_card function to handle quirks.
+	 */
+	if (host->ops->init_card)
+		host->ops->init_card(host, card);
+
+	/*
 	 * For native busses:  get card RCA and quit open drain mode.
 	 */
 	if (!mmc_host_is_spi(host)) {
@@ -1271,4 +1277,3 @@ err:
 
 	return err;
 }
-
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#4 lore raw

PATCH v5 3/4 mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts

In reply to Doug Anderson

In the patch (9623b5b mmc: dw_mmc: Disable low power mode if SDIO interrupts are used) I added code that disabled the low power mode of dw_mmc when SDIO interrupts are used. That code worked but always felt a little hacky because we ended up disabling low power as a side effect of the first enable_sdio_irq() call. That wouldn't be so bad except that disabling low power involves a complicated process of writing to the CMD/CMDARG registers and that extra process makes it difficult to cleanly the read-modify-write race in dw_mci_enable_sdio_irq() (see future patch in the series).

Change the code to take advantage of the init_card() callback of the mmc core to do this right at bootup.

---
Changes in v5: None
Changes in v3: None
Changes in v2:
- Fixed "|" to "&".

 drivers/mmc/host/dw_mmc.c | 69 ++++++++++++++++++++++++-----------------------
 drivers/mmc/host/dw_mmc.h |  1 +
 2 files changed, 36 insertions(+), 34 deletions(-)
drivers/mmc/host/dw_mmc.c +35 -34
index 67c0451..ae10a02 100644
@@ -27,6 +27,7 @@
 #include <linux/stat.h>
 #include <linux/delay.h>
 #include <linux/irq.h>
+#include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/sd.h>
@@ -926,7 +927,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
 
 		/* enable clock; only low power if no SDIO */
 		clk_en_a = SDMMC_CLKEN_ENABLE << slot->id;
-		if (!(mci_readl(host, INTMASK) & SDMMC_INT_SDIO(slot->sdio_id)))
+		if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags))
 			clk_en_a |= SDMMC_CLKEN_LOW_PWR << slot->id;
 		mci_writel(host, CLKENA, clk_en_a);
 
@@ -1245,27 +1246,37 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
 	return present;
 }
 
-/*
- * Disable lower power mode.
- *
- * Low power mode will stop the card clock when idle.  According to the
- * description of the CLKENA register we should disable low power mode
- * for SDIO cards if we need SDIO interrupts to work.
- *
- * This function is fast if low power mode is already disabled.
- */
-static void dw_mci_disable_low_power(struct dw_mci_slot *slot)
+static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
 {
+	struct dw_mci_slot *slot = mmc_priv(mmc);
 	struct dw_mci *host = slot->host;
-	u32 clk_en_a;
-	const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
 
-	clk_en_a = mci_readl(host, CLKENA);
+	/*
+	 * Low power mode will stop the card clock when idle.  According to the
+	 * description of the CLKENA register we should disable low power mode
+	 * for SDIO cards if we need SDIO interrupts to work.
+	 */
+	if (mmc->caps & MMC_CAP_SDIO_IRQ) {
+		const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
+		u32 clk_en_a_old;
+		u32 clk_en_a;
 
-	if (clk_en_a & clken_low_pwr) {
-		mci_writel(host, CLKENA, clk_en_a & ~clken_low_pwr);
-		mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
-			     SDMMC_CMD_PRV_DAT_WAIT, 0);
+		clk_en_a_old = mci_readl(host, CLKENA);
+
+		if (card->type == MMC_TYPE_SDIO ||
+		    card->type == MMC_TYPE_SD_COMBO) {
+			set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
+			clk_en_a = clk_en_a_old & ~clken_low_pwr;
+		} else {
+			clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
+			clk_en_a = clk_en_a_old | clken_low_pwr;
+		}
+
+		if (clk_en_a != clk_en_a_old) {
+			mci_writel(host, CLKENA, clk_en_a);
+			mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
+				     SDMMC_CMD_PRV_DAT_WAIT, 0);
+		}
 	}
 }
 
@@ -1277,21 +1288,11 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
 
 	/* Enable/disable Slot Specific SDIO interrupt */
 	int_mask = mci_readl(host, INTMASK);
-	if (enb) {
-		/*
-		 * Turn off low power mode if it was enabled.  This is a bit of
-		 * a heavy operation and we disable / enable IRQs a lot, so
-		 * we'll leave low power mode disabled and it will get
-		 * re-enabled again in dw_mci_setup_bus().
-		 */
-		dw_mci_disable_low_power(slot);
-
-		mci_writel(host, INTMASK,
-			   (int_mask | SDMMC_INT_SDIO(slot->sdio_id)));
-	} else {
-		mci_writel(host, INTMASK,
-			   (int_mask & ~SDMMC_INT_SDIO(slot->sdio_id)));
-	}
+	if (enb)
+		int_mask |= SDMMC_INT_SDIO(slot->sdio_id);
+	else
+		int_mask &= ~SDMMC_INT_SDIO(slot->sdio_id);
+	mci_writel(host, INTMASK, int_mask);
 }
 
 static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode)
@@ -1337,7 +1338,7 @@ static const struct mmc_host_ops dw_mci_ops = {
 	.execute_tuning		= dw_mci_execute_tuning,
 	.card_busy		= dw_mci_card_busy,
 	.start_signal_voltage_switch = dw_mci_switch_voltage,
-
+	.init_card		= dw_mci_init_card,
 };
 
 static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
drivers/mmc/host/dw_mmc.h +1 -0
index 0d0f7a2..d27d4c0 100644
@@ -244,6 +244,7 @@ struct dw_mci_slot {
 	unsigned long		flags;
 #define DW_MMC_CARD_PRESENT	0
 #define DW_MMC_CARD_NEED_INIT	1
+#define DW_MMC_CARD_NO_LOW_PWR	2
 	int			id;
 	int			sdio_id;
 };
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#10 lore raw

PATCH v5 4/4 mmc: dw_mmc: Protect read-modify-write of INTMASK with a lock

In reply to Doug Anderson

We're running into cases where our enabling of the SDIO interrupt in dw_mmc doesn't actually take effect. Specifically, adding patch like this:

+++ b/drivers/mmc/host/dw_mmc.c
@@ -1076,6 +1076,9 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)

      mci_writel(host, INTMASK,
           (int_mask | SDMMC_INT_SDIO(slot->id)));
 +    int_mask = mci_readl(host, INTMASK);
 +    if (!(int_mask & SDMMC_INT_SDIO(slot->id)))
 +      dev_err(&mmc->class_dev, "failed to enable sdio irq\n");
    } else {

...actually triggers the error message. That's because the dw_mci_enable_sdio_irq() unsafely does a read-modify-write of the INTMASK register.

We can't just use the standard host->lock since that lock is not irq safe and mmc_signal_sdio_irq() (called from interrupt context) calls dw_mci_enable_sdio_irq(). Add a new irq-safe lock to protect INTMASK.

An alternate solution to this is to punt mmc_signal_sdio_irq() to the tasklet and then protect INTMASK modifications by the standard host lock. This seemed like a bit more of a high-latency change.

---
Changes in v5: None
Changes in v3: None
Changes in v2:
- intmask_lock renamed to irq_lock

 drivers/mmc/host/dw_mmc.c  | 13 +++++++++++++
 include/linux/mmc/dw_mmc.h |  6 ++++++
 2 files changed, 19 insertions(+)
drivers/mmc/host/dw_mmc.c +13 -0
index ae10a02..64ea042 100644
@@ -759,6 +759,7 @@ disable:
 
 static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
 {
+	unsigned long irqflags;
 	int sg_len;
 	u32 temp;
 
@@ -795,9 +796,11 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
 	mci_writel(host, CTRL, temp);
 
 	/* Disable RX/TX IRQs, let DMA handle it */
+	spin_lock_irqsave(&host->irq_lock, irqflags);
 	temp = mci_readl(host, INTMASK);
 	temp  &= ~(SDMMC_INT_RXDR | SDMMC_INT_TXDR);
 	mci_writel(host, INTMASK, temp);
+	spin_unlock_irqrestore(&host->irq_lock, irqflags);
 
 	host->dma_ops->start(host, sg_len);
 
@@ -806,6 +809,7 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
 
 static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
 {
+	unsigned long irqflags;
 	u32 temp;
 
 	data->error = -EINPROGRESS;
@@ -834,9 +838,12 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
 		host->part_buf_count = 0;
 
 		mci_writel(host, RINTSTS, SDMMC_INT_TXDR | SDMMC_INT_RXDR);
+
+		spin_lock_irqsave(&host->irq_lock, irqflags);
 		temp = mci_readl(host, INTMASK);
 		temp |= SDMMC_INT_TXDR | SDMMC_INT_RXDR;
 		mci_writel(host, INTMASK, temp);
+		spin_unlock_irqrestore(&host->irq_lock, irqflags);
 
 		temp = mci_readl(host, CTRL);
 		temp &= ~SDMMC_CTRL_DMA_ENABLE;
@@ -1284,8 +1291,11 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
 {
 	struct dw_mci_slot *slot = mmc_priv(mmc);
 	struct dw_mci *host = slot->host;
+	unsigned long irqflags;
 	u32 int_mask;
 
+	spin_lock_irqsave(&host->irq_lock, irqflags);
+
 	/* Enable/disable Slot Specific SDIO interrupt */
 	int_mask = mci_readl(host, INTMASK);
 	if (enb)
@@ -1293,6 +1303,8 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
 	else
 		int_mask &= ~SDMMC_INT_SDIO(slot->sdio_id);
 	mci_writel(host, INTMASK, int_mask);
+
+	spin_unlock_irqrestore(&host->irq_lock, irqflags);
 }
 
 static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode)
@@ -2661,6 +2673,7 @@ int dw_mci_probe(struct dw_mci *host)
 	host->quirks = host->pdata->quirks;
 
 	spin_lock_init(&host->lock);
+	spin_lock_init(&host->irq_lock);
 	INIT_LIST_HEAD(&host->queue);
 
 	/*
include/linux/mmc/dw_mmc.h +6 -0
index 42b724e..471fb31 100644
@@ -106,6 +106,11 @@ struct mmc_data;
  * @cur_slot, @mrq and @state. These must always be updated
  * at the same time while holding @lock.
  *
+ * @irq_lock is an irq-safe spinlock protecting the INTMASK register
+ * to allow the interrupt handler to modify it directly.  Held for only long
+ * enough to read-modify-write INTMASK and no other locks are grabbed when
+ * holding this one.
+ *
  * The @mrq field of struct dw_mci_slot is also protected by @lock,
  * and must always be written at the same time as the slot is added to
  * @queue.
@@ -125,6 +130,7 @@ struct mmc_data;
  */
 struct dw_mci {
 	spinlock_t		lock;
+	spinlock_t		irq_lock;
 	void __iomem		*regs;
 
 	struct scatterlist	*sg;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
maintainer
#5 lore raw

Re: [PATCH v5 3/4] mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts

In reply to Doug Anderson

Hi, Doug.

Quoted 78 lines · Doug Anderson

In the patch (9623b5b mmc: dw_mmc: Disable low power mode if SDIO interrupts are used) I added code that disabled the low power mode of dw_mmc when SDIO interrupts are used. That code worked but always felt a little hacky because we ended up disabling low power as a side effect of the first enable_sdio_irq() call. That wouldn't be so bad except that disabling low power involves a complicated process of writing to the CMD/CMDARG registers and that extra process makes it difficult to cleanly the read-modify-write race in dw_mci_enable_sdio_irq() (see future patch in the series).

Change the code to take advantage of the init_card() callback of the mmc core to do this right at bootup.

---
Changes in v5: None
Changes in v3: None
Changes in v2:
- Fixed "|" to "&".

 drivers/mmc/host/dw_mmc.c | 69 ++++++++++++++++++++++++-----------------------
 drivers/mmc/host/dw_mmc.h |  1 +
 2 files changed, 36 insertions(+), 34 deletions(-)
drivers/mmc/host/dw_mmc.c +13 -15
index 67c0451..ae10a02 100644
@@ -27,6 +27,7 @@
 #include <linux/stat.h>
 #include <linux/delay.h>
 #include <linux/irq.h>
+#include <linux/mmc/card.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/sd.h>
@@ -926,7 +927,7 @@ static void dw_mci_setup_bus(struct dw_mci_slot *slot, bool force_clkinit)
 
 		/* enable clock; only low power if no SDIO */
 		clk_en_a = SDMMC_CLKEN_ENABLE << slot->id;
-		if (!(mci_readl(host, INTMASK) & SDMMC_INT_SDIO(slot->sdio_id)))
+		if (!test_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags))
 			clk_en_a |= SDMMC_CLKEN_LOW_PWR << slot->id;
 		mci_writel(host, CLKENA, clk_en_a);
 
@@ -1245,27 +1246,37 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
 	return present;
 }
 
-/*
- * Disable lower power mode.
- *
- * Low power mode will stop the card clock when idle.  According to the
- * description of the CLKENA register we should disable low power mode
- * for SDIO cards if we need SDIO interrupts to work.
- *
- * This function is fast if low power mode is already disabled.
- */
-static void dw_mci_disable_low_power(struct dw_mci_slot *slot)
+static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
 {
+	struct dw_mci_slot *slot = mmc_priv(mmc);
 	struct dw_mci *host = slot->host;
-	u32 clk_en_a;
-	const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
 
-	clk_en_a = mci_readl(host, CLKENA);
+	/*
+	 * Low power mode will stop the card clock when idle.  According to the
+	 * description of the CLKENA register we should disable low power mode
+	 * for SDIO cards if we need SDIO interrupts to work.
+	 */
+	if (mmc->caps & MMC_CAP_SDIO_IRQ) {
+		const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
+		u32 clk_en_a_old;
+		u32 clk_en_a;
 
-	if (clk_en_a & clken_low_pwr) {

drivers/mmc/host/dw_mmc.c static int dw_mci_get_cd(struct mmc_host *mmc) · line 1270

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +7 -3
-		mci_writel(host, CLKENA, clk_en_a & ~clken_low_pwr);
-		mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
-			     SDMMC_CMD_PRV_DAT_WAIT, 0);
+		clk_en_a_old = mci_readl(host, CLKENA);
+
+		if (card->type == MMC_TYPE_SDIO ||
+		    card->type == MMC_TYPE_SD_COMBO) {
+			set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
+			clk_en_a = clk_en_a_old & ~clken_low_pwr;
+		} else {

I wonder this point. When entered at this point?

MMC_CAP_SDIO_IRQ is sdio capability. and card->type is also related with SDIO, isn't?

Best Regards,
Jaehoon Chung

Quoted 61 lines
drivers/mmc/host/dw_mmc.c +15 -16
+			clear_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
+			clk_en_a = clk_en_a_old | clken_low_pwr;
+		}
+
+		if (clk_en_a != clk_en_a_old) {
+			mci_writel(host, CLKENA, clk_en_a);
+			mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
+				     SDMMC_CMD_PRV_DAT_WAIT, 0);
+		}
 	}
 }
 
@@ -1277,21 +1288,11 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb)
 
 	/* Enable/disable Slot Specific SDIO interrupt */
 	int_mask = mci_readl(host, INTMASK);
-	if (enb) {
-		/*
-		 * Turn off low power mode if it was enabled.  This is a bit of
-		 * a heavy operation and we disable / enable IRQs a lot, so
-		 * we'll leave low power mode disabled and it will get
-		 * re-enabled again in dw_mci_setup_bus().
-		 */
-		dw_mci_disable_low_power(slot);
-
-		mci_writel(host, INTMASK,
-			   (int_mask | SDMMC_INT_SDIO(slot->sdio_id)));
-	} else {
-		mci_writel(host, INTMASK,
-			   (int_mask & ~SDMMC_INT_SDIO(slot->sdio_id)));
-	}
+	if (enb)
+		int_mask |= SDMMC_INT_SDIO(slot->sdio_id);
+	else
+		int_mask &= ~SDMMC_INT_SDIO(slot->sdio_id);
+	mci_writel(host, INTMASK, int_mask);
 }
 
 static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode)
@@ -1337,7 +1338,7 @@ static const struct mmc_host_ops dw_mci_ops = {
 	.execute_tuning		= dw_mci_execute_tuning,
 	.card_busy		= dw_mci_card_busy,
 	.start_signal_voltage_switch = dw_mci_switch_voltage,
-
+	.init_card		= dw_mci_init_card,
 };
 
 static void dw_mci_request_end(struct dw_mci *host, struct mmc_request *mrq)
drivers/mmc/host/dw_mmc.h +1 -0
index 0d0f7a2..d27d4c0 100644
@@ -244,6 +244,7 @@ struct dw_mci_slot {
 	unsigned long		flags;
 #define DW_MMC_CARD_PRESENT	0
 #define DW_MMC_CARD_NEED_INIT	1
+#define DW_MMC_CARD_NO_LOW_PWR	2
 	int			id;
 	int			sdio_id;
 };
#6 lore raw

Re: [PATCH v5 3/4] mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts

Jaehoon,

Quoted 46 lines · Jaehoon Chung
Quoted 33 lines
drivers/mmc/host/dw_mmc.c +11 -14
@@ -1245,27 +1246,37 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
      return present;
 }
 
-/*
- * Disable lower power mode.
- *
- * Low power mode will stop the card clock when idle.  According to the
- * description of the CLKENA register we should disable low power mode
- * for SDIO cards if we need SDIO interrupts to work.
- *
- * This function is fast if low power mode is already disabled.
- */
-static void dw_mci_disable_low_power(struct dw_mci_slot *slot)
+static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
 {
+     struct dw_mci_slot *slot = mmc_priv(mmc);
      struct dw_mci *host = slot->host;
-     u32 clk_en_a;
-     const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
 
-     clk_en_a = mci_readl(host, CLKENA);
+     /*
+      * Low power mode will stop the card clock when idle.  According to the
+      * description of the CLKENA register we should disable low power mode
+      * for SDIO cards if we need SDIO interrupts to work.
+      */
+     if (mmc->caps & MMC_CAP_SDIO_IRQ) {
+             const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
+             u32 clk_en_a_old;
+             u32 clk_en_a;
 
-     if (clk_en_a & clken_low_pwr) {

drivers/mmc/host/dw_mmc.c static int dw_mci_get_cd(struct mmc_host *mmc) · line 1270

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +7 -3
-             mci_writel(host, CLKENA, clk_en_a & ~clken_low_pwr);
-             mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
-                          SDMMC_CMD_PRV_DAT_WAIT, 0);
+             clk_en_a_old = mci_readl(host, CLKENA);
+
+             if (card->type == MMC_TYPE_SDIO ||
+                 card->type == MMC_TYPE_SD_COMBO) {
+                     set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
+                     clk_en_a = clk_en_a_old & ~clken_low_pwr;
+             } else {

I wonder this point. When entered at this point?

Quoted 1 line

MMC_CAP_SDIO_IRQ is sdio capability. and card->type is also related with SDIO, isn't?

Right. As I understand it:

* You can certainly add MMC_CAP_SDIO_IRQ to an external card slot that might have an MMC card, and SD card, or an SDIO card. You still want the LOW_PWR mode for MMC/SD cards but don't want it for SDIO cards in that case.

* If you don't set MMC_CAP_SDIO_IRQ then presumably you've got some problem where the SDIO interrupt is broken on your board. That means you're using polling mode to find interrupts. As I understand it that would allow you to use LOW_PWR since you don't need to detect SDIO interrupts. I know on Marvell WiFi modules I tested this seemed to work OK, but I doubt anyone is really running a production device in this way.

Basically I was trying to mirror the functionality of the old code as closely as possible. In the old code if you were using polling mode then dw_mci_enable_sdio_irq() should never be called and you'd never go out of low power mode.

-Doug

maintainer
#7 lore raw

Re: [PATCH v5 3/4] mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts

Hi Doug

Quoted 49 lines · Doug Anderson

Jaehoon,

Quoted 46 lines · Jaehoon Chung
Quoted 33 lines
drivers/mmc/host/dw_mmc.c +11 -14
@@ -1245,27 +1246,37 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
      return present;
 }
 
-/*
- * Disable lower power mode.
- *
- * Low power mode will stop the card clock when idle.  According to the
- * description of the CLKENA register we should disable low power mode
- * for SDIO cards if we need SDIO interrupts to work.
- *
- * This function is fast if low power mode is already disabled.
- */
-static void dw_mci_disable_low_power(struct dw_mci_slot *slot)
+static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
 {
+     struct dw_mci_slot *slot = mmc_priv(mmc);
      struct dw_mci *host = slot->host;
-     u32 clk_en_a;
-     const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
 
-     clk_en_a = mci_readl(host, CLKENA);
+     /*
+      * Low power mode will stop the card clock when idle.  According to the
+      * description of the CLKENA register we should disable low power mode
+      * for SDIO cards if we need SDIO interrupts to work.
+      */
+     if (mmc->caps & MMC_CAP_SDIO_IRQ) {
+             const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
+             u32 clk_en_a_old;
+             u32 clk_en_a;
 
-     if (clk_en_a & clken_low_pwr) {

drivers/mmc/host/dw_mmc.c static int dw_mci_get_cd(struct mmc_host *mmc) · line 1270

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +7 -3
-             mci_writel(host, CLKENA, clk_en_a & ~clken_low_pwr);
-             mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
-                          SDMMC_CMD_PRV_DAT_WAIT, 0);
+             clk_en_a_old = mci_readl(host, CLKENA);
+
+             if (card->type == MMC_TYPE_SDIO ||
+                 card->type == MMC_TYPE_SD_COMBO) {
+                     set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
+                     clk_en_a = clk_en_a_old & ~clken_low_pwr;
+             } else {

I wonder this point. When entered at this point?

Quoted 8 lines
Quoted 1 line

MMC_CAP_SDIO_IRQ is sdio capability. and card->type is also related with SDIO, isn't?

Right. As I understand it:

* You can certainly add MMC_CAP_SDIO_IRQ to an external card slot that might have an MMC card, and SD card, or an SDIO card. You still want the LOW_PWR mode for MMC/SD cards but don't want it for SDIO cards in that case.

Ok, I understood your purpose.
Your mean is MMC_CAP_SIDO_IRQ can be set to MMC or SD...not only SDIO card.
It's reasonable.
But i think it doesn't need to set LOW_PWR_mode for SD/eMMC at here. it should be already set to Low-power mode. And SDIO case should not enter at here.

Quoted 8 lines

* If you don't set MMC_CAP_SDIO_IRQ then presumably you've got some problem where the SDIO interrupt is broken on your board. That means you're using polling mode to find interrupts. As I understand it that would allow you to use LOW_PWR since you don't need to detect SDIO interrupts. I know on Marvell WiFi modules I tested this seemed to work OK, but I doubt anyone is really running a production device in this way.

No, we needs to set MMC_CAP_SDIO_IRQ, if i didn't set to it, i will also see the problem. Since I knew which slot is used as SDIO card, i thought MMC_CAP_SDIO_IRQ is set for only sdio card. Then it would be check the twice whether card is SDIO or not.

Actually, i didn't test WiFi module with this patch. but concept is not problem.

Best Regards,
Jaehoon Chung

Quoted 9 lines

Basically I was trying to mirror the functionality of the old code as closely as possible. In the old code if you were using polling mode then dw_mci_enable_sdio_irq() should never be called and you'd never go out of low power mode.

-Doug

#8 lore raw

Re: [PATCH v5 3/4] mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts

Jaehoon,

Quoted 61 lines · Jaehoon Chung

Hi Doug

Quoted 49 lines · Doug Anderson

Jaehoon,

Quoted 46 lines · Jaehoon Chung
Quoted 33 lines
drivers/mmc/host/dw_mmc.c +11 -14
@@ -1245,27 +1246,37 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
      return present;
 }
 
-/*
- * Disable lower power mode.
- *
- * Low power mode will stop the card clock when idle.  According to the
- * description of the CLKENA register we should disable low power mode
- * for SDIO cards if we need SDIO interrupts to work.
- *
- * This function is fast if low power mode is already disabled.
- */
-static void dw_mci_disable_low_power(struct dw_mci_slot *slot)
+static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
 {
+     struct dw_mci_slot *slot = mmc_priv(mmc);
      struct dw_mci *host = slot->host;
-     u32 clk_en_a;
-     const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
 
-     clk_en_a = mci_readl(host, CLKENA);
+     /*
+      * Low power mode will stop the card clock when idle.  According to the
+      * description of the CLKENA register we should disable low power mode
+      * for SDIO cards if we need SDIO interrupts to work.
+      */
+     if (mmc->caps & MMC_CAP_SDIO_IRQ) {
+             const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
+             u32 clk_en_a_old;
+             u32 clk_en_a;
 
-     if (clk_en_a & clken_low_pwr) {

drivers/mmc/host/dw_mmc.c static int dw_mci_get_cd(struct mmc_host *mmc) · line 1270

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +7 -3
-             mci_writel(host, CLKENA, clk_en_a & ~clken_low_pwr);
-             mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
-                          SDMMC_CMD_PRV_DAT_WAIT, 0);
+             clk_en_a_old = mci_readl(host, CLKENA);
+
+             if (card->type == MMC_TYPE_SDIO ||
+                 card->type == MMC_TYPE_SD_COMBO) {
+                     set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
+                     clk_en_a = clk_en_a_old & ~clken_low_pwr;
+             } else {

I wonder this point. When entered at this point?

Quoted 8 lines
Quoted 1 line

MMC_CAP_SDIO_IRQ is sdio capability. and card->type is also related with SDIO, isn't?

Right. As I understand it:

* You can certainly add MMC_CAP_SDIO_IRQ to an external card slot that might have an MMC card, and SD card, or an SDIO card. You still want the LOW_PWR mode for MMC/SD cards but don't want it for SDIO cards in that case.

Quoted 5 lines

Ok, I understood your purpose.
Your mean is MMC_CAP_SIDO_IRQ can be set to MMC or SD...not only SDIO card.
It's reasonable.
But i think it doesn't need to set LOW_PWR_mode for SD/eMMC at here. it should be already set to Low-power mode. And SDIO case should not enter at here.

Are you sure? What about if you plug in an SDIO card, then unplug it, then plug in an SD card?

Quoted 8 lines
Quoted 7 lines

* If you don't set MMC_CAP_SDIO_IRQ then presumably you've got some problem where the SDIO interrupt is broken on your board. That means you're using polling mode to find interrupts. As I understand it that would allow you to use LOW_PWR since you don't need to detect SDIO interrupts. I know on Marvell WiFi modules I tested this seemed to work OK, but I doubt anyone is really running a production device in this way.

Quoted 5 lines

No, we needs to set MMC_CAP_SDIO_IRQ, if i didn't set to it, i will also see the problem. Since I knew which slot is used as SDIO card, i thought MMC_CAP_SDIO_IRQ is set for only sdio card. Then it would be check the twice whether card is SDIO or not.

Actually, i didn't test WiFi module with this patch. but concept is not problem.

Yup, I think you were only thinking about the embedded case where you know that an SDIO card will be plugged into the slot. In the case where you have an exposed slot it is certainly possible to expect someone might plug in an SD card or an SDIO card. ...or even a combo card!

-Doug

maintainer
#9 lore raw

Re: [PATCH v5 3/4] mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts

Doug.

Quoted 64 lines · Doug Anderson

Jaehoon,

Quoted 61 lines · Jaehoon Chung

Hi Doug

Quoted 57 lines · Doug Anderson

Jaehoon,

Quoted 46 lines · Jaehoon Chung
Quoted 33 lines
drivers/mmc/host/dw_mmc.c +11 -14
@@ -1245,27 +1246,37 @@ static int dw_mci_get_cd(struct mmc_host *mmc)
      return present;
 }
 
-/*
- * Disable lower power mode.
- *
- * Low power mode will stop the card clock when idle.  According to the
- * description of the CLKENA register we should disable low power mode
- * for SDIO cards if we need SDIO interrupts to work.
- *
- * This function is fast if low power mode is already disabled.
- */
-static void dw_mci_disable_low_power(struct dw_mci_slot *slot)
+static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card)
 {
+     struct dw_mci_slot *slot = mmc_priv(mmc);
      struct dw_mci *host = slot->host;
-     u32 clk_en_a;
-     const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
 
-     clk_en_a = mci_readl(host, CLKENA);
+     /*
+      * Low power mode will stop the card clock when idle.  According to the
+      * description of the CLKENA register we should disable low power mode
+      * for SDIO cards if we need SDIO interrupts to work.
+      */
+     if (mmc->caps & MMC_CAP_SDIO_IRQ) {
+             const u32 clken_low_pwr = SDMMC_CLKEN_LOW_PWR << slot->id;
+             u32 clk_en_a_old;
+             u32 clk_en_a;
 
-     if (clk_en_a & clken_low_pwr) {

drivers/mmc/host/dw_mmc.c static int dw_mci_get_cd(struct mmc_host *mmc) · line 1270

Quoted 10 lines
drivers/mmc/host/dw_mmc.c +7 -3
-             mci_writel(host, CLKENA, clk_en_a & ~clken_low_pwr);
-             mci_send_cmd(slot, SDMMC_CMD_UPD_CLK |
-                          SDMMC_CMD_PRV_DAT_WAIT, 0);
+             clk_en_a_old = mci_readl(host, CLKENA);
+
+             if (card->type == MMC_TYPE_SDIO ||
+                 card->type == MMC_TYPE_SD_COMBO) {
+                     set_bit(DW_MMC_CARD_NO_LOW_PWR, &slot->flags);
+                     clk_en_a = clk_en_a_old & ~clken_low_pwr;
+             } else {

I wonder this point. When entered at this point?

Quoted 1 line

MMC_CAP_SDIO_IRQ is sdio capability. and card->type is also related with SDIO, isn't?

Right. As I understand it:

* You can certainly add MMC_CAP_SDIO_IRQ to an external card slot that might have an MMC card, and SD card, or an SDIO card. You still want the LOW_PWR mode for MMC/SD cards but don't want it for SDIO cards in that case.

Quoted 8 lines
Quoted 5 lines

Ok, I understood your purpose.
Your mean is MMC_CAP_SIDO_IRQ can be set to MMC or SD...not only SDIO card.
It's reasonable.
But i think it doesn't need to set LOW_PWR_mode for SD/eMMC at here. it should be already set to Low-power mode. And SDIO case should not enter at here.

Are you sure? What about if you plug in an SDIO card, then unplug it, then plug in an SD card?

Oh.. :) I missed this case. thank you for pointing out. I considered only non-removable case, it's stupid...

Best Regards,
Jaehoon Chung

Quoted 23 lines
Quoted 9 lines
Quoted 8 lines

* If you don't set MMC_CAP_SDIO_IRQ then presumably you've got some problem where the SDIO interrupt is broken on your board. That means you're using polling mode to find interrupts. As I understand it that would allow you to use LOW_PWR since you don't need to detect SDIO interrupts. I know on Marvell WiFi modules I tested this seemed to work OK, but I doubt anyone is really running a production device in this way.

Quoted 5 lines

No, we needs to set MMC_CAP_SDIO_IRQ, if i didn't set to it, i will also see the problem. Since I knew which slot is used as SDIO card, i thought MMC_CAP_SDIO_IRQ is set for only sdio card. Then it would be check the twice whether card is SDIO or not.

Actually, i didn't test WiFi module with this patch. but concept is not problem.

Yup, I think you were only thinking about the embedded case where you know that an SDIO card will be plugged into the slot. In the case where you have an exposed slot it is certainly possible to expect someone might plug in an SD card or an SDIO card. ...or even a combo card!

-Doug

maintainer Acked-by on v5 1/4
#2 lore raw

Re: [PATCH v5 1/4] ARM: OMAP2+: Make sure pandora_wl1251_init_card() applies to SDIO only

In reply to Doug Anderson
Quoted 3 lines · Doug Anderson

In preparation for having init_card() called for all card types (not just SDIO), change pandora_wl1251_init_card() so it checks whether the card type is SDIO.

Seems OK to me and should not conflict with linux-omap patches:

Quoted 39 lines

---
Changes in v5:
- Split fixup to pandora_wl1251_init_card() into its own patch.

Changes in v3: None
Changes in v2: None

 arch/arm/mach-omap2/board-omap3pandora.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/board-omap3pandora.c +8 -6
index 7f17087..969e100 100644
@@ -254,12 +254,14 @@ static void pandora_wl1251_init_card(struct mmc_card *card)
 	 * We have TI wl1251 attached to MMC3. Pass this information to
 	 * SDIO core because it can't be probed by normal methods.
 	 */
-	card->quirks |= MMC_QUIRK_NONSTD_SDIO;
-	card->cccr.wide_bus = 1;
-	card->cis.vendor = 0x104c;
-	card->cis.device = 0x9066;
-	card->cis.blksize = 512;
-	card->cis.max_dtr = 20000000;
+	if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) {
+		card->quirks |= MMC_QUIRK_NONSTD_SDIO;
+		card->cccr.wide_bus = 1;
+		card->cis.vendor = 0x104c;
+		card->cis.device = 0x9066;
+		card->cis.blksize = 512;
+		card->cis.max_dtr = 20000000;
+	}
 }
 
 static struct omap2_hsmmc_info omap3pandora_mmc[] = {
Signature · 1 line
2.2.0.rc0.207.ga3a616c
#11 lore raw
In reply to Doug Anderson
Quoted 30 lines · Doug Anderson

Bing Zhao at Marvell found a problem with dw_mmc where interrupts weren't firing sometimes. He tracked it down to a read-modify-write problem with the INTMASK. These patches fix the problem.

Note: I've picked up a > 1-year old series here to make another attempt at landing it upstream. These patches have been in shipping Chromebooks for the last year. Note that v3 to v4 has no changes other than a rebase and a small commit message update.

The first two patches extend the "init_card()" mechanism of MMC core to actually be called for all card types, not just SDIO. That could be applied any time and should fix at least one longstanding bug (untested).

The third patch is a cleanup patch to use init_card() to move things around a bit so we don't need to handle SDIO cards in such a strange place. On earlier versions of this patch Seungwon brought up a few points which I have _not_ addressed. See
<https://patchwork.kernel.org/patch/3049071/>. Other than talk of cards with out of band interrupts maybe being able to gate their clocks, he wanted to use MMC_QUIRK_BROKEN_CLK_GATING. I didn't do that because of the ordering of init_card() and when the quirks are set. Some users of init_card() like pandora_wl1251_init_card() rely on it being called very early in the process. pandora_wl1251_init_card() hardcodes a vendor and device and thus need to be called super early. On the other hand the code that adds quirks _reads_ the vendor and device. It can't possibly move before init_card(). If folks are willing to take an additional host op of init_card_late() I can certainly go that way, though.

Quoted 2 lines

The fourth patch is (I think) reviewed and ready to go assuming the other two land.

I have queued this up for 3.20. It was a bit hard to follow the updated the revisions, please don't send patches "in-reply-to" for future sets.

In v5, I don't find a patch 1/4. Anyway, I have taken patch 2->4.

Kind regards
Uffe

Quoted 29 lines

Changes in v5:
- Split fixup to pandora_wl1251_init_card() into its own patch.

Changes in v3:
- Add fixup to pandora_wl1251_init_card().

Changes in v2:
- mmc core change new for this version.
- Fixed "|" to "&".
- intmask_lock renamed to irq_lock

Doug Anderson (4):
ARM: OMAP2+: Make sure pandora_wl1251_init_card() applies to SDIO only
mmc: core: Support the optional init_card() callback for MMC and SD
mmc: dw_mmc: Cleanup disable of low power mode w/ SDIO interrupts
mmc: dw_mmc: Protect read-modify-write of INTMASK with a lock

 arch/arm/mach-omap2/board-omap3pandora.c | 14 +++---
 drivers/mmc/core/mmc.c                   |  6 +++
 drivers/mmc/core/sd.c                    |  7 ++-
 drivers/mmc/host/dw_mmc.c                | 80 +++++++++++++++++++-------------
 drivers/mmc/host/dw_mmc.h                |  1 +
 include/linux/mmc/dw_mmc.h               |  6 +++
 6 files changed, 74 insertions(+), 40 deletions(-)

--
2.2.0.rc0.207.ga3a616c

#12 lore raw

Ulf,

Quoted 31 lines · Ulf Hansson
Quoted 30 lines · Doug Anderson

Bing Zhao at Marvell found a problem with dw_mmc where interrupts weren't firing sometimes. He tracked it down to a read-modify-write problem with the INTMASK. These patches fix the problem.

Note: I've picked up a > 1-year old series here to make another attempt at landing it upstream. These patches have been in shipping Chromebooks for the last year. Note that v3 to v4 has no changes other than a rebase and a small commit message update.

The first two patches extend the "init_card()" mechanism of MMC core to actually be called for all card types, not just SDIO. That could be applied any time and should fix at least one longstanding bug (untested).

The third patch is a cleanup patch to use init_card() to move things around a bit so we don't need to handle SDIO cards in such a strange place. On earlier versions of this patch Seungwon brought up a few points which I have _not_ addressed. See
<https://patchwork.kernel.org/patch/3049071/>. Other than talk of cards with out of band interrupts maybe being able to gate their clocks, he wanted to use MMC_QUIRK_BROKEN_CLK_GATING. I didn't do that because of the ordering of init_card() and when the quirks are set. Some users of init_card() like pandora_wl1251_init_card() rely on it being called very early in the process. pandora_wl1251_init_card() hardcodes a vendor and device and thus need to be called super early. On the other hand the code that adds quirks _reads_ the vendor and device. It can't possibly move before init_card(). If folks are willing to take an additional host op of init_card_late() I can certainly go that way, though.

Quoted 4 lines
Quoted 2 lines

The fourth patch is (I think) reviewed and ready to go assuming the other two land.

I have queued this up for 3.20.

Thanks!

Quoted 3 lines

It was a bit hard to follow the
updated the revisions, please don't send patches "in-reply-to" for future sets.

Very strange. I didn't send out anything in-reply-to other than what git-send-email usually does. I believe I had:

[0] - no in reply to.
[1] - in reply to [0]
[2] - in reply to [0]
[3] - in reply to [0]
[4] - in reply to [0]

Is there some other way you'd prefer?

Looking full headers in <https://patchwork.kernel.org/patch/5425241/>,
I confirm it is "in-reply-to" "1417563767-32181-1-git-send-email-dianders at chromium.org". Patchwork doesn't keep cover letters, but you can see at
<http://www.spinics.net/lists/linux-mmc/msg29699.html>) that there is no in-reply-to.

I'm more than happy to adjust my workflow if you can give me some specifics. Thanks! :)

Quoted 1 line

In v5, I don't find a patch 1/4. Anyway, I have taken patch 2->4.

Ah, maybe because it wasn't sent to linux-mmc? I messed that up and will try to do better in the future. Sorry. :( You were in the To line, though. You can see at
<https://patchwork.kernel.org/patch/5425241/>.

Do you want me to repost it and CC linux-mmc with Tony's Ack?

---

Note: patchwork seems to find all my patches:

pwclient list -w dianders at chromium.org -p ""

5425241 New [v5,1/4] ARM: OMAP2+: Make sure
pandora_wl1251_init_card() applies to SDIO only
5425291 New [v5,1/4] ARM: OMAP2+: Make sure
pandora_wl1251_init_card() applies to SDIO only
5425311 New [v5,1/4] ARM: OMAP2+: Make sure
pandora_wl1251_init_card() applies to SDIO only
5425231 New [v5,2/4] mmc: core: Support the optional
init_card() callback for MMC and SD
5425301 New [v5,2/4] mmc: core: Support the optional
init_card() callback for MMC and SD
5425271 New [v5,3/4] mmc: dw_mmc: Cleanup disable of low
power mode w/ SDIO interrupts
5425281 New [v5,3/4] mmc: dw_mmc: Cleanup disable of low
power mode w/ SDIO interrupts
5425251 New [v5,4/4] mmc: dw_mmc: Protect read-modify-write
of INTMASK with a lock
5425261 New [v5,4/4] mmc: dw_mmc: Protect read-modify-write
of INTMASK with a lock

#13 lore raw
Quoted 46 lines · Doug Anderson

Ulf,

Quoted 31 lines · Ulf Hansson
Quoted 30 lines · Doug Anderson

Bing Zhao at Marvell found a problem with dw_mmc where interrupts weren't firing sometimes. He tracked it down to a read-modify-write problem with the INTMASK. These patches fix the problem.

Note: I've picked up a > 1-year old series here to make another attempt at landing it upstream. These patches have been in shipping Chromebooks for the last year. Note that v3 to v4 has no changes other than a rebase and a small commit message update.

The first two patches extend the "init_card()" mechanism of MMC core to actually be called for all card types, not just SDIO. That could be applied any time and should fix at least one longstanding bug (untested).

The third patch is a cleanup patch to use init_card() to move things around a bit so we don't need to handle SDIO cards in such a strange place. On earlier versions of this patch Seungwon brought up a few points which I have _not_ addressed. See
<https://patchwork.kernel.org/patch/3049071/>. Other than talk of cards with out of band interrupts maybe being able to gate their clocks, he wanted to use MMC_QUIRK_BROKEN_CLK_GATING. I didn't do that because of the ordering of init_card() and when the quirks are set. Some users of init_card() like pandora_wl1251_init_card() rely on it being called very early in the process. pandora_wl1251_init_card() hardcodes a vendor and device and thus need to be called super early. On the other hand the code that adds quirks _reads_ the vendor and device. It can't possibly move before init_card(). If folks are willing to take an additional host op of init_card_late() I can certainly go that way, though.

Quoted 4 lines
Quoted 2 lines

The fourth patch is (I think) reviewed and ready to go assuming the other two land.

I have queued this up for 3.20.

Thanks!

Quoted 3 lines

It was a bit hard to follow the
updated the revisions, please don't send patches "in-reply-to" for future sets.

Quoted 8 lines

Very strange. I didn't send out anything in-reply-to other than what git-send-email usually does. I believe I had:

[0] - no in reply to.
[1] - in reply to [0]
[2] - in reply to [0]
[3] - in reply to [0]
[4] - in reply to [0]

That's good. As long as there are no in-reply to previous versions of patches/patchsets.

I am using gmails web-based client so it could very well be that it does some magic, which I am not yet aware of.

Quoted 14 lines

Is there some other way you'd prefer?

Looking full headers in <https://patchwork.kernel.org/patch/5425241/>,
I confirm it is "in-reply-to" "1417563767-32181-1-git-send-email-dianders at chromium.org". Patchwork doesn't keep cover letters, but you can see at
<http://www.spinics.net/lists/linux-mmc/msg29699.html>) that there is no in-reply-to.

I'm more than happy to adjust my workflow if you can give me some specifics. Thanks! :)

Quoted 8 lines
Quoted 1 line

In v5, I don't find a patch 1/4. Anyway, I have taken patch 2->4.

Ah, maybe because it wasn't sent to linux-mmc? I messed that up and will try to do better in the future. Sorry. :( You were in the To line, though. You can see at
<https://patchwork.kernel.org/patch/5425241/>.

Do you want me to repost it and CC linux-mmc with Tony's Ack?

I suggest you have a look at my next branch and to verify that I haven't screwed things up. If so, either I should drop the patches and you make a resend or if it's possible to just send an incremental path on top?

Kind regards
Uffe

Quoted 25 lines

---

Note: patchwork seems to find all my patches:

pwclient list -w dianders at chromium.org -p ""

5425241 New [v5,1/4] ARM: OMAP2+: Make sure
pandora_wl1251_init_card() applies to SDIO only
5425291 New [v5,1/4] ARM: OMAP2+: Make sure
pandora_wl1251_init_card() applies to SDIO only
5425311 New [v5,1/4] ARM: OMAP2+: Make sure
pandora_wl1251_init_card() applies to SDIO only
5425231 New [v5,2/4] mmc: core: Support the optional
init_card() callback for MMC and SD
5425301 New [v5,2/4] mmc: core: Support the optional
init_card() callback for MMC and SD
5425271 New [v5,3/4] mmc: dw_mmc: Cleanup disable of low
power mode w/ SDIO interrupts
5425281 New [v5,3/4] mmc: dw_mmc: Cleanup disable of low
power mode w/ SDIO interrupts
5425251 New [v5,4/4] mmc: dw_mmc: Protect read-modify-write
of INTMASK with a lock
5425261 New [v5,4/4] mmc: dw_mmc: Protect read-modify-write
of INTMASK with a lock

#14 lore raw

Hello Ulf,

Quoted 15 lines · Ulf Hansson
Quoted 5 lines · Doug Anderson
Quoted 4 lines

It was a bit hard to follow the
updated the revisions, please don't send patches "in-reply-to" for future sets.

Quoted 8 lines

Very strange. I didn't send out anything in-reply-to other than what git-send-email usually does. I believe I had:

[0] - no in reply to.
[1] - in reply to [0]
[2] - in reply to [0]
[3] - in reply to [0]
[4] - in reply to [0]

Quoted 6 lines

That's good. As long as there are no in-reply to previous versions of patches/patchsets.

I am using gmails web-based client so it could very well be that it does some magic, which I am not yet aware of.

I think that you were confused because Gmail's "conversation view" groups emails in a thread not by the email subject but by the email body.

So if a new revision of a series is sent and a patch did not change from the previous version, Gmail will add it to the old patch thread since the body is basically the same even when a version is present in the subject (e.g: PATCH v2 foo).

I found that annoying as well so I disabled conversation view going to Gmail's settings -> General -> Conversation view off

Hope it helps.

Best regards,
Javier

#15 lore raw
In reply to Ulf Hansson

Ulf,

Quoted 7 lines · Ulf Hansson
Quoted 7 lines
Quoted 1 line

In v5, I don't find a patch 1/4. Anyway, I have taken patch 2->4.

Ah, maybe because it wasn't sent to linux-mmc? I messed that up and will try to do better in the future. Sorry. :( You were in the To line, though. You can see at
<https://patchwork.kernel.org/patch/5425241/>.

Quoted 6 lines
Quoted 1 line

Do you want me to repost it and CC linux-mmc with Tony's Ack?

I suggest you have a look at my next branch and to verify that I haven't screwed things up. If so, either I should drop the patches and you make a resend or if it's possible to just send an incremental path on top?

The patches that landed look good to me, but I think you might break omap3pandora's WiFi until you land patch #1 in the series. It has Tony's Ack so I think he intends for you to land it in your tree.

[v5,1/4] ARM: OMAP2+: Make sure pandora_wl1251_init_card() applies to SDIO only

-Doug

maintainer
#16 lore raw
Quoted 17 lines · Doug Anderson

Ulf,

Quoted 7 lines · Ulf Hansson
Quoted 7 lines
Quoted 1 line

In v5, I don't find a patch 1/4. Anyway, I have taken patch 2->4.

Ah, maybe because it wasn't sent to linux-mmc? I messed that up and will try to do better in the future. Sorry. :( You were in the To line, though. You can see at
<https://patchwork.kernel.org/patch/5425241/>.

Quoted 6 lines
Quoted 1 line

Do you want me to repost it and CC linux-mmc with Tony's Ack?

I suggest you have a look at my next branch and to verify that I haven't screwed things up. If so, either I should drop the patches and you make a resend or if it's possible to just send an incremental path on top?

Quoted 5 lines

The patches that landed look good to me, but I think you might break omap3pandora's WiFi until you land patch #1 in the series. It has Tony's Ack so I think he intends for you to land it in your tree.

[v5,1/4] ARM: OMAP2+: Make sure pandora_wl1251_init_card() applies to SDIO only

Yes please pick that one up too to avoid breakage. The changes to the mach-omap2/board-*.c files are only minimal fixes, so it should not conflict with anything I'll be applying.

Regards,

Tony

#17 lore raw
Quoted 22 lines · Tony Lindgren
Quoted 21 lines · Doug Anderson

Ulf,

Quoted 7 lines · Ulf Hansson
Quoted 7 lines
Quoted 1 line

In v5, I don't find a patch 1/4. Anyway, I have taken patch 2->4.

Ah, maybe because it wasn't sent to linux-mmc? I messed that up and will try to do better in the future. Sorry. :( You were in the To line, though. You can see at
<https://patchwork.kernel.org/patch/5425241/>.

Quoted 6 lines
Quoted 1 line

Do you want me to repost it and CC linux-mmc with Tony's Ack?

I suggest you have a look at my next branch and to verify that I haven't screwed things up. If so, either I should drop the patches and you make a resend or if it's possible to just send an incremental path on top?

The patches that landed look good to me, but I think you might break omap3pandora's WiFi until you land patch #1 in the series. It has Tony's Ack so I think he intends for you to land it in your tree.

Quoted 5 lines
Quoted 1 line

[v5,1/4] ARM: OMAP2+: Make sure pandora_wl1251_init_card() applies to SDIO only

Yes please pick that one up too to avoid breakage. The changes to the mach-omap2/board-*.c files are only minimal fixes, so it should not conflict with anything I'll be applying.

Tony, Doug,

I have picked it up from the arm patch tracker and applied it for my next branch. I have put it prior the following patch:
"mmc: core: Support the optional init_card() callback for MMC and SD".

Kind regards
Uffe

Quoted 4 lines

Regards,

Tony