aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/core/core.h
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2006-12-31 00:11:32 +0100
committerPierre Ossman <drzeus@drzeus.cx>2007-05-01 13:41:06 +0200
commit7ea239d9e6d6993469a6a8ca83ff23834dfc3fce (patch)
tree40629c00e317ca8f4ce0a6394dcb4b7535e7b7ab /drivers/mmc/core/core.h
parentb2670b1c6ddd54be4a0f72f853122510ea5ef285 (diff)
mmc: add bus handler
Delegate protocol handling to "bus handlers". This allows the core to just handle the task of arbitrating the bus. Initialisation and pampering of cards is now done by the different bus handlers. This design also allows MMC and SD (and later SDIO) to be more cleanly separated, allowing easier maintenance. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/core/core.h')
-rw-r--r--drivers/mmc/core/core.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 1c1066342fb..fad8edc3809 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -15,7 +15,44 @@
#define MMC_CMD_RETRIES 3
+struct mmc_bus_ops {
+ void (*remove)(struct mmc_host *);
+ void (*detect)(struct mmc_host *);
+};
+
+void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
+void mmc_detach_bus(struct mmc_host *host);
+
+void __mmc_release_bus(struct mmc_host *host);
+
+static inline void mmc_bus_get(struct mmc_host *host)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&host->lock, flags);
+ host->bus_refs++;
+ spin_unlock_irqrestore(&host->lock, flags);
+}
+
+static inline void mmc_bus_put(struct mmc_host *host)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&host->lock, flags);
+ host->bus_refs--;
+ if ((host->bus_refs == 0) && host->bus_ops)
+ __mmc_release_bus(host);
+ spin_unlock_irqrestore(&host->lock, flags);
+}
+
void mmc_set_chip_select(struct mmc_host *host, int mode);
+void mmc_set_clock(struct mmc_host *host, unsigned int hz);
+void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
+void mmc_set_bus_width(struct mmc_host *host, unsigned int width);
+u32 mmc_select_voltage(struct mmc_host *host, u32 ocr);
+void mmc_set_timing(struct mmc_host *host, unsigned int timing);
+
+struct mmc_card *mmc_alloc_card(struct mmc_host *host);
static inline void mmc_delay(unsigned int ms)
{