From: Pierre Tardy <tardyp@gmail.com>
To: Linus Walleij <linus.ml.walleij@gmail.com>,
"Gao, Yunpeng" <yunpeng.gao@intel.com>,
Pierre Tardy <tardyp@gmail.com>,
"Yuan, Hang" <hang.yuan@intel.com>,
"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Chris Ball <cjb@laptop.org>,
Andrew Morton <akpm@linux-foundation.org>,
Alan Cox <alan@linux.intel.com>, Takashi Iwai <tiwai@suse.de>,
Maxim Levitsky <maximlevitsky@gmail.com>,
Ohad Ben-Cohen <ohad@wizery.com>
Cc: Pierre Tardy <tardyp@gmail.com>
Subject: [PATCH] mmc: add MMC_QUIRK_BROKEN_CLK_GATING
Date: Sun, 2 Jan 2011 22:08:30 +0100 [thread overview]
Message-ID: <1294002510-2324-1-git-send-email-tardyp@gmail.com> (raw)
In-Reply-To: <AANLkTin7OYXzCYty8pDxyzE_Bg83=+L8jmcaoEMSf4QM@mail.gmail.com>
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@gmail.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
next prev parent reply other threads:[~2011-01-02 21:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-22 13:13 [RFC] sdhci: use ios->clock to know when sdhci is idle Pierre Tardy
2010-12-23 7:02 ` Yuan, Hang
2010-12-27 11:51 ` Pierre Tardy
2010-12-29 6:45 ` Gao, Yunpeng
2010-12-29 9:31 ` Linus Walleij
2010-12-30 10:37 ` Gao, Yunpeng
2011-01-02 19:45 ` Pierre Tardy
2011-01-02 21:08 ` Pierre Tardy
2011-01-02 21:08 ` Pierre Tardy [this message]
2011-01-02 22:23 ` [PATCH] mmc: add MMC_QUIRK_BROKEN_CLK_GATING Philip Rakity
2011-01-03 10:10 ` Pierre Tardy
2011-01-04 23:52 ` Linus Walleij
2011-01-05 7:05 ` Ohad Ben-Cohen
2011-01-04 8:19 ` [RFC] sdhci: use ios->clock to know when sdhci is idle Dong, Chuanxiao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1294002510-2324-1-git-send-email-tardyp@gmail.com \
--to=tardyp@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alan@linux.intel.com \
--cc=cjb@laptop.org \
--cc=hang.yuan@intel.com \
--cc=linus.ml.walleij@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
--cc=ohad@wizery.com \
--cc=tiwai@suse.de \
--cc=yunpeng.gao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®