aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.h
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2006-12-30 18:11:32 -0500
committerPierre Ossman <drzeus@drzeus.cx>2007-05-01 07:41:06 -0400
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 @@
15 15
16#define MMC_CMD_RETRIES 3 16#define MMC_CMD_RETRIES 3
17 17
18struct mmc_bus_ops {
19 void (*remove)(struct mmc_host *);
20 void (*detect)(struct mmc_host *);
21};
22
23void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
24void mmc_detach_bus(struct mmc_host *host);
25
26void __mmc_release_bus(struct mmc_host *host);
27
28static inline void mmc_bus_get(struct mmc_host *host)
29{
30 unsigned long flags;
31
32 spin_lock_irqsave(&host->lock, flags);
33 host->bus_refs++;
34 spin_unlock_irqrestore(&host->lock, flags);
35}
36
37static inline void mmc_bus_put(struct mmc_host *host)
38{
39 unsigned long flags;
40
41 spin_lock_irqsave(&host->lock, flags);
42 host->bus_refs--;
43 if ((host->bus_refs == 0) && host->bus_ops)
44 __mmc_release_bus(host);
45 spin_unlock_irqrestore(&host->lock, flags);
46}
47
18void mmc_set_chip_select(struct mmc_host *host, int mode); 48void mmc_set_chip_select(struct mmc_host *host, int mode);
49void mmc_set_clock(struct mmc_host *host, unsigned int hz);
50void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
51void mmc_set_bus_width(struct mmc_host *host, unsigned int width);
52u32 mmc_select_voltage(struct mmc_host *host, u32 ocr);
53void mmc_set_timing(struct mmc_host *host, unsigned int timing);
54
55struct mmc_card *mmc_alloc_card(struct mmc_host *host);
19 56
20static inline void mmc_delay(unsigned int ms) 57static inline void mmc_delay(unsigned int ms)
21{ 58{