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