android_kernel_msm-6.1_noth.../include/linux/mmc
Doug Anderson f8c58c1136 mmc: dw_mmc: Protect read-modify-write of INTMASK with a lock
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.

Reported-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2015-01-19 09:56:05 +01:00
..
boot.h
card.h mmc: core: Report firmware version for eMMC 5.0 devices. 2014-11-10 12:40:36 +01:00
core.h mmc: core: Let mmc_send_tuning() to take struct mmc_host* as parameter 2014-12-08 09:11:04 +01:00
dw_mmc.h mmc: dw_mmc: Protect read-modify-write of INTMASK with a lock 2015-01-19 09:56:05 +01:00
host.h mmc: sdhci: Clear also HS400 1.2V capability if 1.2V is not supported 2014-11-26 14:30:51 +01:00
mmc.h mmc: core: Report firmware version for eMMC 5.0 devices. 2014-11-10 12:40:36 +01:00
pm.h
sd.h
sdhci-pci-data.h
sdhci-spear.h mmc: sdhci-spear: remove support for power gpio 2014-03-04 16:28:44 -05:00
sdhci.h mmc: sdhci: Disable re-tuning for HS400 2015-01-12 10:14:56 +01:00
sdio.h
sdio_func.h mmc: core: Don't export the to_sdio_driver macro 2014-11-10 12:40:32 +01:00
sdio_ids.h brcmfmac: add BCM4354 SDIO interface support 2014-03-17 13:44:14 -04:00
sh_mmcif.h mmc: sh_mmcif: revision-specific CLK_CTRL2 handling 2013-08-25 00:10:18 -04:00
sh_mobile_sdhi.h mmc: sh_mobile_sdhi: Remove .set_pwr() callback from platform data 2013-08-24 23:58:10 -04:00
slot-gpio.h mmc: core: restore detect line inversion semantics 2014-10-02 11:51:26 +02:00
tmio.h mmc: SDHI: add SoC specific workaround via HW version 2014-01-13 12:48:24 -05:00