From: Barry Song <21cnbao@gmail.com>
To: cjb@laptop.org, linux-mmc@vger.kernel.org
Cc: bin.shi@csr.com, Binghua.Duan@csr.com
Subject: [PATCH] sdhci: add quirk to support shared bus controller
Date: Thu, 21 Apr 2011 01:51:03 -0700 [thread overview]
Message-ID: <BANLkTi=7h_gBQ1CGqYgUUhZabcwVuoRhCw@mail.gmail.com> (raw)
From: Bin Shi <bin.shi@csr.com>
some controllers share data bus or other pins between
multi-controllers and need to switch the functions of shared pins
runtime
this patch requested those shared pins before actual hardware access
and release them after access
Signed-off-by: Bin Shi <bin.shi@csr.com>
Cc: Binghua Duan <binghua.duan@csr.com>
Signed-off-by: Barry Song <21cnbao@gmail.com>
---
drivers/mmc/host/sdhci.c | 13 +++++++++++++
drivers/mmc/host/sdhci.h | 2 ++
include/linux/mmc/sdhci.h | 2 ++
3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f31077d..7b07152 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1379,6 +1379,13 @@ static void sdhci_tasklet_finish(unsigned long param)
sdhci_reset(host, SDHCI_RESET_DATA);
}
+ /*
+ * some controllers share data bus or other pins between multi-controller
+ * and need to switch the function of pins runtime
+ */
+ if (host->quirks & SDHCI_QUIRK_SHARED_PINS)
+ host->ops->get_shared_pins(host);
+
host->mrq = NULL;
host->cmd = NULL;
host->data = NULL;
@@ -1391,6 +1398,12 @@ static void sdhci_tasklet_finish(unsigned long param)
spin_unlock_irqrestore(&host->lock, flags);
mmc_request_done(host->mmc, mrq);
+
+ /*
+ * release shared pins so that other controllers can use them
+ */
+ if (host->quirks & SDHCI_QUIRK_SHARED_PINS)
+ host->ops->get_shared_pins(host);
}
static void sdhci_timeout_timer(unsigned long data)
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 85750a9..9d918a5 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -229,6 +229,8 @@ struct sdhci_ops {
void (*platform_send_init_74_clocks)(struct sdhci_host *host,
u8 power_mode);
unsigned int (*get_ro)(struct sdhci_host *host);
+ unsigned int (*get_shared_pins)(struct sdhci_host *host);
+ unsigned int (*put_shared_pins)(struct sdhci_host *host);
};
#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 83bd9f7..32ab422 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -85,6 +85,8 @@ struct sdhci_host {
#define SDHCI_QUIRK_NO_HISPD_BIT (1<<29)
/* Controller treats ADMA descriptors with length 0000h incorrectly */
#define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30)
+/* Controller shared data bus or other pins with other controllers */
+#define SDHCI_QUIRK_SHARED_PINS (1<<31)
int irq; /* Device IRQ */
void __iomem *ioaddr; /* Mapped address */
--
1.7.1
next reply other threads:[~2011-04-21 8:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-21 8:51 Barry Song [this message]
2011-04-21 9:05 ` [PATCH] sdhci: add quirk to support shared bus controller Andrei Warkentin
2011-04-25 1:27 ` Barry Song
2011-04-25 15:49 ` Barry Song
2011-04-25 18:18 ` Philip Rakity
2011-04-25 21:43 ` Chris Ball
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='BANLkTi=7h_gBQ1CGqYgUUhZabcwVuoRhCw@mail.gmail.com' \
--to=21cnbao@gmail.com \
--cc=Binghua.Duan@csr.com \
--cc=bin.shi@csr.com \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.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).