[PATCH] mmc:sdhci:add support to request/free pins for controllers sharing hardware bus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bin Shi <bin.shi@xxxxxxx>

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@xxxxxxx>
Cc: Binghua Duan <binghua.duan@xxxxxxx>
Cc: Andrei Warkentin <andreiw@xxxxxxxxxxxx>
Cc: Philip Rakity <prakity@xxxxxxxxxxx>
Signed-off-by: Barry Song <21cnbao@xxxxxxxxx>
---
Â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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux