RE: [PATCH 1/2] mmc: dw_mmc: Cleanup disable of low power mode w/ SDIOinterrupts

From: Seungwon Jeon
Date: Fri Oct 25 2013 - 05:29:17 EST

On Thu, October 24, 2013, Doug Anderson wrote:
> Seungwon,
> On Wed, Oct 23, 2013 at 12:25 PM, Seungwon Jeon <tgih.jun@xxxxxxxxxxx> wrote:
> >> >> + if (card->type == MMC_TYPE_SDIO ||
> >> >> + card->type == MMC_TYPE_SD_COMBO) {
> > && card->quirks & MMC_QUIRK_BROKEN_CLK_GATING
> > How about considering MMC_QUIRK_BROKEN_CLK_GATING?
> > Some sdio device can work with gating clock.
> > For this, mmc_fixup_device() should be called prior to init_card() in core(sdio.c).
> > I guess you found that.
> By SDIO devices, are you referring to actual SDIO cards or some
> implementations of dw_mmc?
> As far as I understand in the CLKENA description in the generic
> documentation from Synopsys it say that for SDIO cards you must not
> stop the clock if interrupts must be detected. To me, that means that
> all dw_mmc implementations require this change if they support SDIO
> interrupts (hence checking for MMC_CAP_SDIO_IRQ).

CLKENA description in manual means that host controller can't detect the SDIO interrupt signal
or wifi device can't generate the interrupt without clock?
Host controller based on Synopsys supports asynchronous interrupts. It seems to depend on wifi Device.
If host can do and wifi device can also work with clock gating, we may enable low-power mode.

For MMC_QUIRK_BROKEN_CLK_GATING, I referred the code in 'mmc/core/quirks.c'
In addition, although host can support MMC_CAP_SDIO_IRQ, some wifi drivers use
OOB(Out-of-band) interrupt. That means host can apply clock gating to reduce
power consumption.

Seungwon Jeon

> I guess I did make the assumption in this change that all (reasonable)
> SDIO cards would be using SDIO interrupts if they are available. If
> we could find out ahead of time if a given SDIO driver was planning to
> use interrupts we could do better. The old solution did better in
> this way and we could probably make it work (and still fix the
> read-modify-write race) if we thought this was really important. The
> code gets a little more twisted to try to avoid holding the IRQ-safe
> spinlock while updating the clock, but I could attempt it...
> NOTE: We've recently found that there are still occasions when we lose
> SDIO interrupts with dw_mmc and our Marvell WiFi driver, especially
> when those interrupts happen back-to-back. That problem appears
> unrelated to this one (it's what Bing was investigating when he found
> the original race). Anyone that has any thoughts, please let me
> know...
> -Doug
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at