Merge remote-tracking branch 'regulator/fix/da9063' into regulator-linus
[deliverable/linux.git] / arch / arm / plat-samsung / include / plat / sdhci.h
1 /* linux/arch/arm/plat-samsung/include/plat/sdhci.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright 2008 Openmoko, Inc.
7 * Copyright 2008 Simtec Electronics
8 * http://armlinux.simtec.co.uk/
9 * Ben Dooks <ben@simtec.co.uk>
10 *
11 * S3C Platform - SDHCI (HSMMC) platform data definitions
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18 #ifndef __PLAT_S3C_SDHCI_H
19 #define __PLAT_S3C_SDHCI_H __FILE__
20
21 #include <linux/platform_data/mmc-sdhci-s3c.h>
22 #include <plat/devs.h>
23
24 /* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
25 * @pd: The default platform data for this device.
26 * @set: Pointer to the platform data to fill in.
27 */
28 extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
29 struct s3c_sdhci_platdata *set);
30
31 /**
32 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
33 * @pd: Platform data to register to device.
34 *
35 * Register the given platform data for use withe S3C SDHCI device.
36 * The call will copy the platform data, so the board definitions can
37 * make the structure itself __initdata.
38 */
39 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
40 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
41 extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
42 extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
43
44 /* Default platform data, exported so that per-cpu initialisation can
45 * set the correct one when there are more than one cpu type selected.
46 */
47
48 extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
49 extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
50 extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
51 extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
52
53 /* Helper function availability */
54
55 extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
56 extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
57 extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
58 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
59 extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
60 extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
61 extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
62 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
63 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
64 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
65 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
66 extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
67 extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
68 extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
69 extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
70 extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
71 extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
72 extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
73 extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
74 extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
75
76 /* S3C2416 SDHCI setup */
77
78 #ifdef CONFIG_S3C2416_SETUP_SDHCI
79 static inline void s3c2416_default_sdhci0(void)
80 {
81 #ifdef CONFIG_S3C_DEV_HSMMC
82 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
83 #endif /* CONFIG_S3C_DEV_HSMMC */
84 }
85
86 static inline void s3c2416_default_sdhci1(void)
87 {
88 #ifdef CONFIG_S3C_DEV_HSMMC1
89 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
90 #endif /* CONFIG_S3C_DEV_HSMMC1 */
91 }
92
93 #else
94 static inline void s3c2416_default_sdhci0(void) { }
95 static inline void s3c2416_default_sdhci1(void) { }
96
97 #endif /* CONFIG_S3C2416_SETUP_SDHCI */
98
99 /* S3C64XX SDHCI setup */
100
101 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
102 static inline void s3c6400_default_sdhci0(void)
103 {
104 #ifdef CONFIG_S3C_DEV_HSMMC
105 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
106 #endif
107 }
108
109 static inline void s3c6400_default_sdhci1(void)
110 {
111 #ifdef CONFIG_S3C_DEV_HSMMC1
112 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
113 #endif
114 }
115
116 static inline void s3c6400_default_sdhci2(void)
117 {
118 #ifdef CONFIG_S3C_DEV_HSMMC2
119 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
120 #endif
121 }
122
123 static inline void s3c6410_default_sdhci0(void)
124 {
125 #ifdef CONFIG_S3C_DEV_HSMMC
126 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
127 #endif
128 }
129
130 static inline void s3c6410_default_sdhci1(void)
131 {
132 #ifdef CONFIG_S3C_DEV_HSMMC1
133 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
134 #endif
135 }
136
137 static inline void s3c6410_default_sdhci2(void)
138 {
139 #ifdef CONFIG_S3C_DEV_HSMMC2
140 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
141 #endif
142 }
143
144 #else
145 static inline void s3c6410_default_sdhci0(void) { }
146 static inline void s3c6410_default_sdhci1(void) { }
147 static inline void s3c6410_default_sdhci2(void) { }
148 static inline void s3c6400_default_sdhci0(void) { }
149 static inline void s3c6400_default_sdhci1(void) { }
150 static inline void s3c6400_default_sdhci2(void) { }
151
152 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
153
154 /* S5P64X0 SDHCI setup */
155
156 #ifdef CONFIG_S5P64X0_SETUP_SDHCI_GPIO
157 static inline void s5p64x0_default_sdhci0(void)
158 {
159 #ifdef CONFIG_S3C_DEV_HSMMC
160 s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
161 #endif
162 }
163
164 static inline void s5p64x0_default_sdhci1(void)
165 {
166 #ifdef CONFIG_S3C_DEV_HSMMC1
167 s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
168 #endif
169 }
170
171 static inline void s5p6440_default_sdhci2(void)
172 {
173 #ifdef CONFIG_S3C_DEV_HSMMC2
174 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
175 #endif
176 }
177
178 static inline void s5p6450_default_sdhci2(void)
179 {
180 #ifdef CONFIG_S3C_DEV_HSMMC2
181 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
182 #endif
183 }
184
185 #else
186 static inline void s5p64x0_default_sdhci0(void) { }
187 static inline void s5p64x0_default_sdhci1(void) { }
188 static inline void s5p6440_default_sdhci2(void) { }
189 static inline void s5p6450_default_sdhci2(void) { }
190
191 #endif /* CONFIG_S5P64X0_SETUP_SDHCI_GPIO */
192
193 /* S5PC100 SDHCI setup */
194
195 #ifdef CONFIG_S5PC100_SETUP_SDHCI
196 static inline void s5pc100_default_sdhci0(void)
197 {
198 #ifdef CONFIG_S3C_DEV_HSMMC
199 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
200 #endif
201 }
202
203 static inline void s5pc100_default_sdhci1(void)
204 {
205 #ifdef CONFIG_S3C_DEV_HSMMC1
206 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
207 #endif
208 }
209
210 static inline void s5pc100_default_sdhci2(void)
211 {
212 #ifdef CONFIG_S3C_DEV_HSMMC2
213 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
214 #endif
215 }
216
217 #else
218 static inline void s5pc100_default_sdhci0(void) { }
219 static inline void s5pc100_default_sdhci1(void) { }
220 static inline void s5pc100_default_sdhci2(void) { }
221
222 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
223
224 /* S5PV210 SDHCI setup */
225
226 #ifdef CONFIG_S5PV210_SETUP_SDHCI
227 static inline void s5pv210_default_sdhci0(void)
228 {
229 #ifdef CONFIG_S3C_DEV_HSMMC
230 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
231 #endif
232 }
233
234 static inline void s5pv210_default_sdhci1(void)
235 {
236 #ifdef CONFIG_S3C_DEV_HSMMC1
237 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
238 #endif
239 }
240
241 static inline void s5pv210_default_sdhci2(void)
242 {
243 #ifdef CONFIG_S3C_DEV_HSMMC2
244 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
245 #endif
246 }
247
248 static inline void s5pv210_default_sdhci3(void)
249 {
250 #ifdef CONFIG_S3C_DEV_HSMMC3
251 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
252 #endif
253 }
254
255 #else
256 static inline void s5pv210_default_sdhci0(void) { }
257 static inline void s5pv210_default_sdhci1(void) { }
258 static inline void s5pv210_default_sdhci2(void) { }
259 static inline void s5pv210_default_sdhci3(void) { }
260
261 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
262
263 static inline void s3c_sdhci_setname(int id, char *name)
264 {
265 switch (id) {
266 #ifdef CONFIG_S3C_DEV_HSMMC
267 case 0:
268 s3c_device_hsmmc0.name = name;
269 break;
270 #endif
271 #ifdef CONFIG_S3C_DEV_HSMMC1
272 case 1:
273 s3c_device_hsmmc1.name = name;
274 break;
275 #endif
276 #ifdef CONFIG_S3C_DEV_HSMMC2
277 case 2:
278 s3c_device_hsmmc2.name = name;
279 break;
280 #endif
281 #ifdef CONFIG_S3C_DEV_HSMMC3
282 case 3:
283 s3c_device_hsmmc3.name = name;
284 break;
285 #endif
286 default:
287 break;
288 }
289 }
290 #endif /* __PLAT_S3C_SDHCI_H */
This page took 0.038885 seconds and 6 git commands to generate.