mmc: add MMC_QUIRK_BROKEN_CLK_GATING
authorPierre Tardy <tardyp@gmail.com>
Sun, 6 Feb 2011 18:03:47 +0000 (19:03 +0100)
committerChris Ball <cjb@laptop.org>
Tue, 15 Mar 2011 17:48:35 +0000 (13:48 -0400)
Some sdio card are not following sdio standard, and do not work
when the sdio bus's clock is gated.

To keep functionnality for all legacy driver, we turn this quirk on
for every sdio card.
Drivers needs to disable the quirk manually when someone verifies that
their supported card works with clock gating.

Signed-off-by: Pierre Tardy <tardyp@gmail.com>
Acked-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/host.c
drivers/mmc/core/quirks.c
include/linux/mmc/card.h

index b3ac6c5bc5c6289b39299e715d0feb01170b22bb..461e6a17fb90e8526d96054f2ec90f44a85e70c3 100644 (file)
@@ -160,10 +160,7 @@ static bool mmc_host_may_gate_card(struct mmc_card *card)
         * gate the clock, because there is somebody out there that may still
         * be using it.
         */
-       if (mmc_card_sdio(card))
-               return false;
-
-       return true;
+       return !(card->quirks & MMC_QUIRK_BROKEN_CLK_GATING);
 }
 
 /**
index e18cb49c12b179a27603b2db5e968f58fa2d4904..890843129e3b3229b249c04488269e4b1631d94d 100644 (file)
@@ -40,7 +40,20 @@ static void __maybe_unused remove_quirk(struct mmc_card *card, int data)
        card->quirks &= ~data;
 }
 
+/*
+ * This hook just adds a quirk for all sdio devices
+ */
+static void add_quirk_for_sdio_devices(struct mmc_card *card, int data)
+{
+       if (mmc_card_sdio(card))
+               card->quirks |= data;
+}
+
 static const struct mmc_fixup mmc_fixup_methods[] = {
+       /* by default sdio devices are considered CLK_GATING broken */
+       /* good cards will be whitelisted as they are tested */
+       { SDIO_ANY_ID, SDIO_ANY_ID,
+               add_quirk_for_sdio_devices, MMC_QUIRK_BROKEN_CLK_GATING }
        { 0 }
 };
 
index ad7413854f79f07db5f54489fd4e6df5532be698..adb4888248be9a06219f71f39dceb06c60edd15d 100644 (file)
@@ -124,6 +124,7 @@ struct mmc_card {
                                                /* for byte mode */
 #define MMC_QUIRK_NONSTD_SDIO  (1<<2)          /* non-standard SDIO card attached */
                                                /* (missing CIA registers) */
+#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3)     /* clock gating the sdio bus will make card fail */
 
        unsigned int            erase_size;     /* erase size in sectors */
        unsigned int            erase_shift;    /* if erase unit is power 2 */
This page took 0.027394 seconds and 5 git commands to generate.