1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef __PLAT_S3C_SDHCI_H
19#define __PLAT_S3C_SDHCI_H __FILE__
20
21#include <plat/devs.h>
22
23struct platform_device;
24struct mmc_host;
25struct mmc_card;
26struct mmc_ios;
27
28enum cd_types {
29 S3C_SDHCI_CD_INTERNAL,
30 S3C_SDHCI_CD_EXTERNAL,
31 S3C_SDHCI_CD_GPIO,
32 S3C_SDHCI_CD_NONE,
33 S3C_SDHCI_CD_PERMANENT,
34};
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60struct s3c_sdhci_platdata {
61 unsigned int max_width;
62 unsigned int host_caps;
63 unsigned int host_caps2;
64 unsigned int pm_caps;
65 enum cd_types cd_type;
66
67 int ext_cd_gpio;
68 bool ext_cd_gpio_invert;
69 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
70 int state));
71 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
72 int state));
73
74 void (*cfg_gpio)(struct platform_device *dev, int width);
75};
76
77
78
79
80
81extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
82 struct s3c_sdhci_platdata *set);
83
84
85
86
87
88
89
90
91
92extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
93extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
94extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
95extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
96
97
98
99
100
101extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
102extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
103extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
104extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
105
106
107
108extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
109extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
110extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
111extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
112extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
113extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
114extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
115extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
116extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
117extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
118extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
119extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
120extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
121extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
122extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
123extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
124extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
125extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
126extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
127extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
128
129
130
131#ifdef CONFIG_S3C2416_SETUP_SDHCI
132static inline void s3c2416_default_sdhci0(void)
133{
134#ifdef CONFIG_S3C_DEV_HSMMC
135 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
136#endif
137}
138
139static inline void s3c2416_default_sdhci1(void)
140{
141#ifdef CONFIG_S3C_DEV_HSMMC1
142 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
143#endif
144}
145
146#else
147static inline void s3c2416_default_sdhci0(void) { }
148static inline void s3c2416_default_sdhci1(void) { }
149
150#endif
151
152
153
154#ifdef CONFIG_S3C64XX_SETUP_SDHCI
155static inline void s3c6400_default_sdhci0(void)
156{
157#ifdef CONFIG_S3C_DEV_HSMMC
158 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
159#endif
160}
161
162static inline void s3c6400_default_sdhci1(void)
163{
164#ifdef CONFIG_S3C_DEV_HSMMC1
165 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
166#endif
167}
168
169static inline void s3c6400_default_sdhci2(void)
170{
171#ifdef CONFIG_S3C_DEV_HSMMC2
172 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
173#endif
174}
175
176static inline void s3c6410_default_sdhci0(void)
177{
178#ifdef CONFIG_S3C_DEV_HSMMC
179 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
180#endif
181}
182
183static inline void s3c6410_default_sdhci1(void)
184{
185#ifdef CONFIG_S3C_DEV_HSMMC1
186 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
187#endif
188}
189
190static inline void s3c6410_default_sdhci2(void)
191{
192#ifdef CONFIG_S3C_DEV_HSMMC2
193 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
194#endif
195}
196
197#else
198static inline void s3c6410_default_sdhci0(void) { }
199static inline void s3c6410_default_sdhci1(void) { }
200static inline void s3c6410_default_sdhci2(void) { }
201static inline void s3c6400_default_sdhci0(void) { }
202static inline void s3c6400_default_sdhci1(void) { }
203static inline void s3c6400_default_sdhci2(void) { }
204
205#endif
206
207
208
209#ifdef CONFIG_S5P64X0_SETUP_SDHCI
210static inline void s5p64x0_default_sdhci0(void)
211{
212#ifdef CONFIG_S3C_DEV_HSMMC
213 s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
214#endif
215}
216
217static inline void s5p64x0_default_sdhci1(void)
218{
219#ifdef CONFIG_S3C_DEV_HSMMC1
220 s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
221#endif
222}
223
224static inline void s5p6440_default_sdhci2(void)
225{
226#ifdef CONFIG_S3C_DEV_HSMMC2
227 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
228#endif
229}
230
231static inline void s5p6450_default_sdhci2(void)
232{
233#ifdef CONFIG_S3C_DEV_HSMMC2
234 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
235#endif
236}
237
238#else
239static inline void s5p64x0_default_sdhci0(void) { }
240static inline void s5p64x0_default_sdhci1(void) { }
241static inline void s5p6440_default_sdhci2(void) { }
242static inline void s5p6450_default_sdhci2(void) { }
243
244#endif
245
246
247
248#ifdef CONFIG_S5PC100_SETUP_SDHCI
249static inline void s5pc100_default_sdhci0(void)
250{
251#ifdef CONFIG_S3C_DEV_HSMMC
252 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
253#endif
254}
255
256static inline void s5pc100_default_sdhci1(void)
257{
258#ifdef CONFIG_S3C_DEV_HSMMC1
259 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
260#endif
261}
262
263static inline void s5pc100_default_sdhci2(void)
264{
265#ifdef CONFIG_S3C_DEV_HSMMC2
266 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
267#endif
268}
269
270#else
271static inline void s5pc100_default_sdhci0(void) { }
272static inline void s5pc100_default_sdhci1(void) { }
273static inline void s5pc100_default_sdhci2(void) { }
274
275#endif
276
277
278
279#ifdef CONFIG_S5PV210_SETUP_SDHCI
280static inline void s5pv210_default_sdhci0(void)
281{
282#ifdef CONFIG_S3C_DEV_HSMMC
283 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
284#endif
285}
286
287static inline void s5pv210_default_sdhci1(void)
288{
289#ifdef CONFIG_S3C_DEV_HSMMC1
290 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
291#endif
292}
293
294static inline void s5pv210_default_sdhci2(void)
295{
296#ifdef CONFIG_S3C_DEV_HSMMC2
297 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
298#endif
299}
300
301static inline void s5pv210_default_sdhci3(void)
302{
303#ifdef CONFIG_S3C_DEV_HSMMC3
304 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
305#endif
306}
307
308#else
309static inline void s5pv210_default_sdhci0(void) { }
310static inline void s5pv210_default_sdhci1(void) { }
311static inline void s5pv210_default_sdhci2(void) { }
312static inline void s5pv210_default_sdhci3(void) { }
313
314#endif
315
316
317#ifdef CONFIG_EXYNOS4_SETUP_SDHCI
318static inline void exynos4_default_sdhci0(void)
319{
320#ifdef CONFIG_S3C_DEV_HSMMC
321 s3c_hsmmc0_def_platdata.cfg_gpio = exynos4_setup_sdhci0_cfg_gpio;
322#endif
323}
324
325static inline void exynos4_default_sdhci1(void)
326{
327#ifdef CONFIG_S3C_DEV_HSMMC1
328 s3c_hsmmc1_def_platdata.cfg_gpio = exynos4_setup_sdhci1_cfg_gpio;
329#endif
330}
331
332static inline void exynos4_default_sdhci2(void)
333{
334#ifdef CONFIG_S3C_DEV_HSMMC2
335 s3c_hsmmc2_def_platdata.cfg_gpio = exynos4_setup_sdhci2_cfg_gpio;
336#endif
337}
338
339static inline void exynos4_default_sdhci3(void)
340{
341#ifdef CONFIG_S3C_DEV_HSMMC3
342 s3c_hsmmc3_def_platdata.cfg_gpio = exynos4_setup_sdhci3_cfg_gpio;
343#endif
344}
345
346#else
347static inline void exynos4_default_sdhci0(void) { }
348static inline void exynos4_default_sdhci1(void) { }
349static inline void exynos4_default_sdhci2(void) { }
350static inline void exynos4_default_sdhci3(void) { }
351
352#endif
353
354static inline void s3c_sdhci_setname(int id, char *name)
355{
356 switch (id) {
357#ifdef CONFIG_S3C_DEV_HSMMC
358 case 0:
359 s3c_device_hsmmc0.name = name;
360 break;
361#endif
362#ifdef CONFIG_S3C_DEV_HSMMC1
363 case 1:
364 s3c_device_hsmmc1.name = name;
365 break;
366#endif
367#ifdef CONFIG_S3C_DEV_HSMMC2
368 case 2:
369 s3c_device_hsmmc2.name = name;
370 break;
371#endif
372#ifdef CONFIG_S3C_DEV_HSMMC3
373 case 3:
374 s3c_device_hsmmc3.name = name;
375 break;
376#endif
377 }
378}
379
380#endif
381