Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / arm / plat-samsung / include / plat / sdhci.h
blobbf650218b40eeb72bfc81778b4843a520329dda5
1 /* linux/arch/arm/plat-samsung/include/plat/sdhci.h
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * Copyright 2008 Openmoko, Inc.
7 * Copyright 2008 Simtec Electronics
8 * http://armlinux.simtec.co.uk/
9 * Ben Dooks <ben@simtec.co.uk>
11 * S3C Platform - SDHCI (HSMMC) platform data definitions
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.
18 #ifndef __PLAT_S3C_SDHCI_H
19 #define __PLAT_S3C_SDHCI_H __FILE__
21 #include <linux/platform_data/mmc-sdhci-s3c.h>
22 #include <plat/devs.h>
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.
28 extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
29 struct s3c_sdhci_platdata *set);
31 /**
32 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
33 * @pd: Platform data to register to device.
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.
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);
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.
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;
53 /* Helper function availability */
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);
76 /* S3C2416 SDHCI setup */
78 #ifdef CONFIG_S3C2416_SETUP_SDHCI
79 static inline void s3c2416_default_sdhci0(void)
81 #ifdef CONFIG_S3C_DEV_HSMMC
82 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
83 #endif /* CONFIG_S3C_DEV_HSMMC */
86 static inline void s3c2416_default_sdhci1(void)
88 #ifdef CONFIG_S3C_DEV_HSMMC1
89 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
90 #endif /* CONFIG_S3C_DEV_HSMMC1 */
93 #else
94 static inline void s3c2416_default_sdhci0(void) { }
95 static inline void s3c2416_default_sdhci1(void) { }
97 #endif /* CONFIG_S3C2416_SETUP_SDHCI */
99 /* S3C64XX SDHCI setup */
101 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
102 static inline void s3c6400_default_sdhci0(void)
104 #ifdef CONFIG_S3C_DEV_HSMMC
105 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
106 #endif
109 static inline void s3c6400_default_sdhci1(void)
111 #ifdef CONFIG_S3C_DEV_HSMMC1
112 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
113 #endif
116 static inline void s3c6400_default_sdhci2(void)
118 #ifdef CONFIG_S3C_DEV_HSMMC2
119 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
120 #endif
123 static inline void s3c6410_default_sdhci0(void)
125 #ifdef CONFIG_S3C_DEV_HSMMC
126 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
127 #endif
130 static inline void s3c6410_default_sdhci1(void)
132 #ifdef CONFIG_S3C_DEV_HSMMC1
133 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
134 #endif
137 static inline void s3c6410_default_sdhci2(void)
139 #ifdef CONFIG_S3C_DEV_HSMMC2
140 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
141 #endif
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) { }
152 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
154 /* S5P64X0 SDHCI setup */
156 #ifdef CONFIG_S5P64X0_SETUP_SDHCI_GPIO
157 static inline void s5p64x0_default_sdhci0(void)
159 #ifdef CONFIG_S3C_DEV_HSMMC
160 s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
161 #endif
164 static inline void s5p64x0_default_sdhci1(void)
166 #ifdef CONFIG_S3C_DEV_HSMMC1
167 s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
168 #endif
171 static inline void s5p6440_default_sdhci2(void)
173 #ifdef CONFIG_S3C_DEV_HSMMC2
174 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
175 #endif
178 static inline void s5p6450_default_sdhci2(void)
180 #ifdef CONFIG_S3C_DEV_HSMMC2
181 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
182 #endif
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) { }
191 #endif /* CONFIG_S5P64X0_SETUP_SDHCI_GPIO */
193 /* S5PC100 SDHCI setup */
195 #ifdef CONFIG_S5PC100_SETUP_SDHCI
196 static inline void s5pc100_default_sdhci0(void)
198 #ifdef CONFIG_S3C_DEV_HSMMC
199 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
200 #endif
203 static inline void s5pc100_default_sdhci1(void)
205 #ifdef CONFIG_S3C_DEV_HSMMC1
206 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
207 #endif
210 static inline void s5pc100_default_sdhci2(void)
212 #ifdef CONFIG_S3C_DEV_HSMMC2
213 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
214 #endif
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) { }
222 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
224 /* S5PV210 SDHCI setup */
226 #ifdef CONFIG_S5PV210_SETUP_SDHCI
227 static inline void s5pv210_default_sdhci0(void)
229 #ifdef CONFIG_S3C_DEV_HSMMC
230 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
231 #endif
234 static inline void s5pv210_default_sdhci1(void)
236 #ifdef CONFIG_S3C_DEV_HSMMC1
237 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
238 #endif
241 static inline void s5pv210_default_sdhci2(void)
243 #ifdef CONFIG_S3C_DEV_HSMMC2
244 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
245 #endif
248 static inline void s5pv210_default_sdhci3(void)
250 #ifdef CONFIG_S3C_DEV_HSMMC3
251 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
252 #endif
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) { }
261 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
263 static inline void s3c_sdhci_setname(int id, char *name)
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;
290 #endif /* __PLAT_S3C_SDHCI_H */