From: Bin Shi <bin....@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....@csr.com>
Cc: Binghua Duan <binghua.d...@csr.com>
Cc: Andrei Warkentin <andr...@motorola.com>
Cc: Philip Rakity <prak...@marvell.com>
Signed-off-by: Barry Song <21cn...@gmail.com>
---
 drivers/mmc/host/sdhci.c |   13 +++++++++++++
 drivers/mmc/host/sdhci.h |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index f70e21e..92ae9f7 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1143,6 +1143,13 @@ static void sdhci_request(struct mmc_host *mmc,
struct mmc_request *mrq)

       host = mmc_priv(mmc);

+       /*
+        * some controllers share data bus or other pins between
multi-controller
+        * and need to switch the function of pins runtime
+        */
+       if (host->ops->get_shared_pins)
+               host->ops->get_shared_pins(host);
+
       spin_lock_irqsave(&host->lock, flags);

       WARN_ON(host->mrq != NULL);
@@ -1417,6 +1424,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->ops->put_shared_pins)
+               host->ops->put_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 c6e25a7..5a26cfe 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -231,6 +231,8 @@ struct sdhci_ops {
       unsigned int    (*get_ro)(struct sdhci_host *host);
       void    (*platform_reset_enter)(struct sdhci_host *host, u8 mask);
       void    (*platform_reset_exit)(struct sdhci_host *host, u8 mask);
+       unsigned int    (*get_shared_pins)(struct sdhci_host *host);
+       unsigned int    (*put_shared_pins)(struct sdhci_host *host);
 };

 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to