[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1294002510-2324-1-git-send-email-tardyp@gmail.com>
Date: Sun, 2 Jan 2011 22:08:30 +0100
From: Pierre Tardy <tardyp@...il.com>
To: Linus Walleij <linus.ml.walleij@...il.com>,
"Gao, Yunpeng" <yunpeng.gao@...el.com>,
Pierre Tardy <tardyp@...il.com>,
"Yuan, Hang" <hang.yuan@...el.com>,
"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Chris Ball <cjb@...top.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alan Cox <alan@...ux.intel.com>, Takashi Iwai <tiwai@...e.de>,
Maxim Levitsky <maximlevitsky@...il.com>,
Ohad Ben-Cohen <ohad@...ery.com>
Cc: Pierre Tardy <tardyp@...il.com>
Subject: [PATCH] mmc: add MMC_QUIRK_BROKEN_CLK_GATING
Some sdio card are not following sdio standard, and does 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 verified that their
supported card works with clock gating.
Signed-off-by: Pierre Tardy <tardyp@...il.com>
---
drivers/mmc/core/host.c | 5 +----
drivers/mmc/core/sdio.c | 6 ++++++
include/linux/mmc/card.h | 1 +
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 92e3370..54cc461 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -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);
}
/**
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 82f4b90..6df1ead 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -785,6 +785,12 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr)
mmc_release_host(host);
+ /*
+ * see comments in mmc_host_may_gate_card()
+ * this can be overidden by function drivers if they know that
+ * their sdio card works with clock gating
+ */
+ card->quirks |= MMC_QUIRK_BROKEN_CLK_GATING;
/*
* First add the card to the driver model...
*/
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 8ce0827..5071eb1 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -121,6 +121,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 */
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists