From: r65037@freescale.com (Richard Zhu)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/9] sdhci-3:add the NONSTANDARD_HOST_CTL quirk to support FSl eSDHC
Date: Wed, 1 Sep 2010 17:47:47 +0800 [thread overview]
Message-ID: <1283334467-12602-1-git-send-email-r65037@freescale.com> (raw)
Add NONSTANDARD_HOST_CTL quirk flags, because that FSL's eSDHC
don't have the standard HOST CTL register, add this quirk to
configure the bus_width and DMA properly.
Signed-off-by: Richard Zhu <r65037@freescale.com>
---
drivers/mmc/host/sdhci.c | 45 ++++++++++++++++++++++++++++++---------------
drivers/mmc/host/sdhci.h | 3 +++
2 files changed, 33 insertions(+), 15 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index e7e2611..2bfe738 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -777,7 +777,13 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
* (e.g. JMicron) can't do PIO properly when the selection
* is ADMA.
*/
- if (host->version >= SDHCI_SPEC_200) {
+ if (host->quirks & SDHCI_QUIRK_NONSTANDARD_HOST_CTL) {
+ if (host->ops->enable_dma)
+ host->ops->enable_dma(host);
+ else
+ printk(KERN_ERR "%s: Failed to enable DMA!\n",
+ mmc_hostname(host->mmc));
+ } else if (host->version >= SDHCI_SPEC_200) {
ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
ctrl &= ~SDHCI_CTRL_DMA_MASK;
if ((host->flags & SDHCI_REQ_USE_DMA) &&
@@ -1173,24 +1179,33 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
else
sdhci_set_power(host, ios->vdd);
- ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
- if (ios->bus_width == MMC_BUS_WIDTH_8)
- ctrl |= SDHCI_CTRL_8BITBUS;
- else
- ctrl &= ~SDHCI_CTRL_8BITBUS;
+ if (host->quirks & SDHCI_QUIRK_NONSTANDARD_HOST_CTL) {
- if (ios->bus_width == MMC_BUS_WIDTH_4)
- ctrl |= SDHCI_CTRL_4BITBUS;
- else
- ctrl &= ~SDHCI_CTRL_4BITBUS;
+ if (host->ops->set_bus)
+ host->ops->set_bus(host, ios->bus_width);
+ else
+ printk(KERN_ERR "Invalided BUS configurations!\n");
+ } else {
+ ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
- if (ios->timing == MMC_TIMING_SD_HS)
- ctrl |= SDHCI_CTRL_HISPD;
- else
- ctrl &= ~SDHCI_CTRL_HISPD;
+ if (ios->bus_width == MMC_BUS_WIDTH_8)
+ ctrl |= SDHCI_CTRL_8BITBUS;
+ else
+ ctrl &= ~SDHCI_CTRL_8BITBUS;
- sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
+ if (ios->bus_width == MMC_BUS_WIDTH_4)
+ ctrl |= SDHCI_CTRL_4BITBUS;
+ else
+ ctrl &= ~SDHCI_CTRL_4BITBUS;
+
+ if (ios->timing == MMC_TIMING_SD_HS)
+ ctrl |= SDHCI_CTRL_HISPD;
+ else
+ ctrl &= ~SDHCI_CTRL_HISPD;
+
+ sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
+ }
/*
* Some (ENE) controllers go apeshit on some ios operation,
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index a4db2cc..029ab0e 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -245,6 +245,8 @@ struct sdhci_host {
#define SDHCI_QUIRK_MISSING_CAPS (1<<27)
/* Controller uses Auto CMD12 command to stop the transfer */
#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28)
+/* Controller doesn't have the standard Host Control registor */
+#define SDHCI_QUIRK_NONSTANDARD_HOST_CTL (1<<29)
int irq; /* Device IRQ */
void __iomem * ioaddr; /* Mapped address */
@@ -317,6 +319,7 @@ struct sdhci_ops {
void (*set_clock)(struct sdhci_host *host, unsigned int clock);
void (*set_power)(struct sdhci_host *host, unsigned int power);
+ void (*set_bus)(struct sdhci_host *host, unsigned int bus);
int (*enable_dma)(struct sdhci_host *host);
unsigned int (*get_max_clock)(struct sdhci_host *host);
--
1.7.0
reply other threads:[~2010-09-01 9:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1283334467-12602-1-git-send-email-r65037@freescale.com \
--to=r65037@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).