]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/plat-omap/include/mach/mmc.h
ARM: OMAP: Clean-up MMC device init
[linux-2.6-omap-h63xx.git] / arch / arm / plat-omap / include / mach / mmc.h
1 /*
2  * MMC definitions for OMAP2
3  *
4  * Copyright (C) 2006 Nokia Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #ifndef __OMAP2_MMC_H
12 #define __OMAP2_MMC_H
13
14 #include <linux/types.h>
15 #include <linux/device.h>
16 #include <linux/mmc/host.h>
17
18 #include <mach/board.h>
19
20 #define OMAP_MMC_MAX_SLOTS      2
21
22 struct omap_mmc_platform_data {
23
24         /* number of slots on board */
25         unsigned nr_slots:2;
26
27         /* set if your board has components or wiring that limits the
28          * maximum frequency on the MMC bus */
29         unsigned int max_freq;
30
31         /* switch the bus to a new slot */
32         int (* switch_slot)(struct device *dev, int slot);
33         /* initialize board-specific MMC functionality, can be NULL if
34          * not supported */
35         int (* init)(struct device *dev);
36         void (* cleanup)(struct device *dev);
37         void (* shutdown)(struct device *dev);
38
39         /* To handle board related suspend/resume functionality for MMC */
40         int (*suspend)(struct device *dev, int slot);
41         int (*resume)(struct device *dev, int slot);
42
43         struct omap_mmc_slot_data {
44
45                 unsigned enabled:1;
46
47                 /*
48                  * nomux means "standard" muxing is wrong on this board, and
49                  * that board-specific code handled it before common init logic.
50                  */
51                 unsigned nomux:1;
52
53                 /* switch pin can be for card detect (default) or card cover */
54                 unsigned cover:1;
55
56                 /* 4 wire signaling is optional, and is only used for SD/SDIO */
57                 unsigned wire4:1;
58
59                 /* use the internal clock */
60                 unsigned internal_clock:1;
61                 s16 power_pin;
62                 s16 switch_pin;
63                 s16 wp_pin;
64
65                 int (* set_bus_mode)(struct device *dev, int slot, int bus_mode);
66                 int (* set_power)(struct device *dev, int slot, int power_on, int vdd);
67                 int (* get_ro)(struct device *dev, int slot);
68
69                 /* return MMC cover switch state, can be NULL if not supported.
70                  *
71                  * possible return values:
72                  *   0 - open
73                  *   1 - closed
74                  */
75                 int (* get_cover_state)(struct device *dev, int slot);
76
77                 const char *name;
78                 u32 ocr_mask;
79
80                 /* Card detection IRQs */
81                 int card_detect_irq;
82                 int (* card_detect)(int irq);
83
84                 unsigned int ban_openended:1;
85
86         } slots[OMAP_MMC_MAX_SLOTS];
87 };
88
89 /* called from board-specific card detection service routine */
90 extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed);
91
92 #if     defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
93         defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
94 void omap1_init_mmc(struct omap_mmc_platform_data *info);
95 void omap2_init_mmc(struct omap_mmc_platform_data *info);
96 void omap_init_mmc(struct omap_mmc_platform_data *info,
97                 struct platform_device *pdev1, struct platform_device *pdev2);
98 #else
99 static inline void omap1_init_mmc(struct omap_mmc_platform_data *info)
100 {
101 }
102 static inline void omap2_init_mmc(struct omap_mmc_platform_data *info)
103 {
104 }
105 static inline void omap_init_mmc(struct omap_mmc_platform_data *info,
106                 struct platform_device *pdev1, struct platform_device *pdev2)
107 {
108 }
109 #endif
110
111 #if defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
112 void __init hsmmc_init(void);
113 #endif
114
115 #endif