diff options
author | Bing Zhao <bzhao@marvell.com> | 2013-11-26 18:39:20 -0500 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2014-01-17 22:55:01 -0500 |
commit | e5624054c1726a16c13a89c08b2792aba3df06eb (patch) | |
tree | 2f54f5abf6337ed1571e6dd872a2e32164382f70 | |
parent | 2b35bd83467df6f8284b9148d6f768148c3a5e5f (diff) |
mmc: sdio: add a quirk for broken SDIO_CCCR_INTx polling
Polling SDIO_CCCR_INTx could create a fake interrupt with Marvell
SD8797 card. Add a quirk to handle this case. The fixup here is
to issue a dummy CMD52 read to function 0 register 0xff, and this
dummy read must be right after SDIO_CCCR_INTx is read.
Patch has been verified on a dw_mmc controller (Samsung Chromebook)
with MMC_CAP_SDIO_IRQ disabled.
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
-rw-r--r-- | drivers/mmc/core/quirks.c | 8 | ||||
-rw-r--r-- | drivers/mmc/core/sdio_irq.c | 11 | ||||
-rw-r--r-- | include/linux/mmc/card.h | 8 |
3 files changed, 26 insertions, 1 deletions
diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c index 06ee1aeaacec..6c36fccaa1ec 100644 --- a/drivers/mmc/core/quirks.c +++ b/drivers/mmc/core/quirks.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/export.h> | 14 | #include <linux/export.h> |
15 | #include <linux/mmc/card.h> | 15 | #include <linux/mmc/card.h> |
16 | #include <linux/mmc/sdio_ids.h> | ||
16 | 17 | ||
17 | #ifndef SDIO_VENDOR_ID_TI | 18 | #ifndef SDIO_VENDOR_ID_TI |
18 | #define SDIO_VENDOR_ID_TI 0x0097 | 19 | #define SDIO_VENDOR_ID_TI 0x0097 |
@@ -30,6 +31,10 @@ | |||
30 | #define SDIO_DEVICE_ID_STE_CW1200 0x2280 | 31 | #define SDIO_DEVICE_ID_STE_CW1200 0x2280 |
31 | #endif | 32 | #endif |
32 | 33 | ||
34 | #ifndef SDIO_DEVICE_ID_MARVELL_8797_F0 | ||
35 | #define SDIO_DEVICE_ID_MARVELL_8797_F0 0x9128 | ||
36 | #endif | ||
37 | |||
33 | /* | 38 | /* |
34 | * This hook just adds a quirk for all sdio devices | 39 | * This hook just adds a quirk for all sdio devices |
35 | */ | 40 | */ |
@@ -58,6 +63,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { | |||
58 | SDIO_FIXUP(SDIO_VENDOR_ID_STE, SDIO_DEVICE_ID_STE_CW1200, | 63 | SDIO_FIXUP(SDIO_VENDOR_ID_STE, SDIO_DEVICE_ID_STE_CW1200, |
59 | add_quirk, MMC_QUIRK_BROKEN_BYTE_MODE_512), | 64 | add_quirk, MMC_QUIRK_BROKEN_BYTE_MODE_512), |
60 | 65 | ||
66 | SDIO_FIXUP(SDIO_VENDOR_ID_MARVELL, SDIO_DEVICE_ID_MARVELL_8797_F0, | ||
67 | add_quirk, MMC_QUIRK_BROKEN_IRQ_POLLING), | ||
68 | |||
61 | END_FIXUP | 69 | END_FIXUP |
62 | }; | 70 | }; |
63 | 71 | ||
diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index 3d8ceb4084de..aaa90460ed23 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c | |||
@@ -53,6 +53,17 @@ static int process_sdio_pending_irqs(struct mmc_host *host) | |||
53 | return ret; | 53 | return ret; |
54 | } | 54 | } |
55 | 55 | ||
56 | if (pending && mmc_card_broken_irq_polling(card) && | ||
57 | !(host->caps & MMC_CAP_SDIO_IRQ)) { | ||
58 | unsigned char dummy; | ||
59 | |||
60 | /* A fake interrupt could be created when we poll SDIO_CCCR_INTx | ||
61 | * register with a Marvell SD8797 card. A dummy CMD52 read to | ||
62 | * function 0 register 0xff can avoid this. | ||
63 | */ | ||
64 | mmc_io_rw_direct(card, 0, 0, 0xff, 0, &dummy); | ||
65 | } | ||
66 | |||
56 | count = 0; | 67 | count = 0; |
57 | for (i = 1; i <= 7; i++) { | 68 | for (i = 1; i <= 7; i++) { |
58 | if (pending & (1 << i)) { | 69 | if (pending & (1 << i)) { |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 176fdf824b14..b73027298b3a 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -271,9 +271,10 @@ struct mmc_card { | |||
271 | #define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ | 271 | #define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ |
272 | #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ | 272 | #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ |
273 | #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ | 273 | #define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */ |
274 | /* byte mode */ | ||
274 | #define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */ | 275 | #define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */ |
275 | #define MMC_QUIRK_SEC_ERASE_TRIM_BROKEN (1<<10) /* Skip secure for erase/trim */ | 276 | #define MMC_QUIRK_SEC_ERASE_TRIM_BROKEN (1<<10) /* Skip secure for erase/trim */ |
276 | /* byte mode */ | 277 | #define MMC_QUIRK_BROKEN_IRQ_POLLING (1<<11) /* Polling SDIO_CCCR_INTx could create a fake interrupt */ |
277 | 278 | ||
278 | unsigned int erase_size; /* erase size in sectors */ | 279 | unsigned int erase_size; /* erase size in sectors */ |
279 | unsigned int erase_shift; /* if erase unit is power 2 */ | 280 | unsigned int erase_shift; /* if erase unit is power 2 */ |
@@ -505,6 +506,11 @@ static inline int mmc_card_long_read_time(const struct mmc_card *c) | |||
505 | return c->quirks & MMC_QUIRK_LONG_READ_TIME; | 506 | return c->quirks & MMC_QUIRK_LONG_READ_TIME; |
506 | } | 507 | } |
507 | 508 | ||
509 | static inline int mmc_card_broken_irq_polling(const struct mmc_card *c) | ||
510 | { | ||
511 | return c->quirks & MMC_QUIRK_BROKEN_IRQ_POLLING; | ||
512 | } | ||
513 | |||
508 | #define mmc_card_name(c) ((c)->cid.prod_name) | 514 | #define mmc_card_name(c) ((c)->cid.prod_name) |
509 | #define mmc_card_id(c) (dev_name(&(c)->dev)) | 515 | #define mmc_card_id(c) (dev_name(&(c)->dev)) |
510 | 516 | ||