1
2
3
4
5
6
7
8
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 <plat/board.h>
19
20#define OMAP15XX_NR_MMC 1
21#define OMAP16XX_NR_MMC 2
22#define OMAP1_MMC_SIZE 0x080
23#define OMAP1_MMC1_BASE 0xfffb7800
24#define OMAP1_MMC2_BASE 0xfffb7c00
25
26#define OMAP24XX_NR_MMC 2
27#define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
28#define OMAP2_MMC1_BASE 0x4809c000
29
30#define OMAP4_MMC_REG_OFFSET 0x100
31
32#define OMAP_MMC_MAX_SLOTS 2
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50#define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
51#define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
52
53struct omap_mmc_dev_attr {
54 u8 flags;
55};
56
57struct omap_mmc_platform_data {
58
59 struct device *dev;
60
61
62 unsigned nr_slots:2;
63
64
65
66 unsigned int max_freq;
67
68
69 int (*switch_slot)(struct device *dev, int slot);
70
71
72 int (*init)(struct device *dev);
73 void (*cleanup)(struct device *dev);
74 void (*shutdown)(struct device *dev);
75
76
77 int (*suspend)(struct device *dev, int slot);
78 int (*resume)(struct device *dev, int slot);
79
80
81 int (*get_context_loss_count)(struct device *dev);
82
83 u64 dma_mask;
84
85
86 u8 controller_flags;
87
88
89 u16 reg_offset;
90
91 struct omap_mmc_slot_data {
92
93
94
95
96
97 u8 wires;
98 u32 caps;
99 u32 pm_caps;
100
101
102
103
104
105 unsigned nomux:1;
106
107
108 unsigned cover:1;
109
110
111 unsigned internal_clock:1;
112
113
114 unsigned nonremovable:1;
115
116
117 unsigned power_saving:1;
118
119
120 unsigned no_off:1;
121
122
123 unsigned no_regulator_off_init:1;
124
125
126 unsigned vcc_aux_disable_is_sleep:1;
127
128
129#define HSMMC_HAS_PBIAS (1 << 0)
130#define HSMMC_HAS_UPDATED_RESET (1 << 1)
131 unsigned features;
132
133 int switch_pin;
134 int gpio_wp;
135
136 int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
137 int (*set_power)(struct device *dev, int slot,
138 int power_on, int vdd);
139 int (*get_ro)(struct device *dev, int slot);
140 int (*set_sleep)(struct device *dev, int slot, int sleep,
141 int vdd, int cardsleep);
142 void (*remux)(struct device *dev, int slot, int power_on);
143
144 void (*before_set_reg)(struct device *dev, int slot,
145 int power_on, int vdd);
146
147 void (*after_set_reg)(struct device *dev, int slot,
148 int power_on, int vdd);
149
150 void (*init_card)(struct mmc_card *card);
151
152
153
154
155
156
157
158 int (*get_cover_state)(struct device *dev, int slot);
159
160 const char *name;
161 u32 ocr_mask;
162
163
164 int card_detect_irq;
165 int (*card_detect)(struct device *dev, int slot);
166
167 unsigned int ban_openended:1;
168
169 } slots[OMAP_MMC_MAX_SLOTS];
170};
171
172
173extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
174 int is_closed);
175
176#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
177 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
178void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
179 int nr_controllers);
180void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
181int omap_mmc_add(const char *name, int id, unsigned long base,
182 unsigned long size, unsigned int irq,
183 struct omap_mmc_platform_data *data);
184#else
185static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
186 int nr_controllers)
187{
188}
189static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
190{
191}
192static inline int omap_mmc_add(const char *name, int id, unsigned long base,
193 unsigned long size, unsigned int irq,
194 struct omap_mmc_platform_data *data)
195{
196 return 0;
197}
198
199#endif
200#endif
201