]> Pileus Git - ~andy/linux/blob - arch/arm/plat-samsung/include/plat/sdhci.h
ARM: SAMSUNG: Remove SDHCI bus clocks from platform data
[~andy/linux] / 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 struct platform_device;
22 struct mmc_host;
23 struct mmc_card;
24 struct mmc_ios;
25
26 enum cd_types {
27         S3C_SDHCI_CD_INTERNAL,  /* use mmc internal CD line */
28         S3C_SDHCI_CD_EXTERNAL,  /* use external callback */
29         S3C_SDHCI_CD_GPIO,      /* use external gpio pin for CD line */
30         S3C_SDHCI_CD_NONE,      /* no CD line, use polling to detect card */
31         S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
32 };
33
34 enum clk_types {
35         S3C_SDHCI_CLK_DIV_INTERNAL,     /* use mmc internal clock divider */
36         S3C_SDHCI_CLK_DIV_EXTERNAL,     /* use external clock divider */
37 };
38
39 /**
40  * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
41  * @max_width: The maximum number of data bits supported.
42  * @host_caps: Standard MMC host capabilities bit field.
43  * @cd_type: Type of Card Detection method (see cd_types enum above)
44  * @clk_type: Type of clock divider method (see clk_types enum above)
45  * @ext_cd_init: Initialize external card detect subsystem. Called on
46  *               sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
47  *               notify_func argument is a callback to the sdhci-s3c driver
48  *               that triggers the card detection event. Callback arguments:
49  *               dev is pointer to platform device of the host controller,
50  *               state is new state of the card (0 - removed, 1 - inserted).
51  * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
52  *               sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
53  *               notify_func argument is the same callback as for ext_cd_init.
54  * @ext_cd_gpio: gpio pin used for external CD line, valid only if
55  *               cd_type == S3C_SDHCI_CD_GPIO
56  * @ext_cd_gpio_invert: invert values for external CD gpio line
57  * @cfg_gpio: Configure the GPIO for a specific card bit-width
58  *
59  * Initialisation data specific to either the machine or the platform
60  * for the device driver to use or call-back when configuring gpio or
61  * card speed information.
62 */
63 struct s3c_sdhci_platdata {
64         unsigned int    max_width;
65         unsigned int    host_caps;
66         enum cd_types   cd_type;
67         enum clk_types  clk_type;
68
69         int             ext_cd_gpio;
70         bool            ext_cd_gpio_invert;
71         int     (*ext_cd_init)(void (*notify_func)(struct platform_device *,
72                                                    int state));
73         int     (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
74                                                       int state));
75
76         void    (*cfg_gpio)(struct platform_device *dev, int width);
77 };
78
79 /* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
80  * @pd: The default platform data for this device.
81  * @set: Pointer to the platform data to fill in.
82  */
83 extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
84                                     struct s3c_sdhci_platdata *set);
85
86 /**
87  * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
88  * @pd: Platform data to register to device.
89  *
90  * Register the given platform data for use withe S3C SDHCI device.
91  * The call will copy the platform data, so the board definitions can
92  * make the structure itself __initdata.
93  */
94 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
95 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
96 extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
97 extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
98
99 /* Default platform data, exported so that per-cpu initialisation can
100  * set the correct one when there are more than one cpu type selected.
101 */
102
103 extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
104 extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
105 extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
106 extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
107
108 /* Helper function availability */
109
110 extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
111 extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
112 extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
113 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
114 extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
115 extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
116 extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
117 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
118 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
119 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
120 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
121 extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
122 extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
123 extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
124 extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
125 extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
126
127 /* S3C2416 SDHCI setup */
128
129 #ifdef CONFIG_S3C2416_SETUP_SDHCI
130 static inline void s3c2416_default_sdhci0(void)
131 {
132 #ifdef CONFIG_S3C_DEV_HSMMC
133         s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
134 #endif /* CONFIG_S3C_DEV_HSMMC */
135 }
136
137 static inline void s3c2416_default_sdhci1(void)
138 {
139 #ifdef CONFIG_S3C_DEV_HSMMC1
140         s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
141 #endif /* CONFIG_S3C_DEV_HSMMC1 */
142 }
143
144 #else
145 static inline void s3c2416_default_sdhci0(void) { }
146 static inline void s3c2416_default_sdhci1(void) { }
147
148 #endif /* CONFIG_S3C2416_SETUP_SDHCI */
149 /* S3C64XX SDHCI setup */
150
151 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
152 static inline void s3c6400_default_sdhci0(void)
153 {
154 #ifdef CONFIG_S3C_DEV_HSMMC
155         s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
156 #endif
157 }
158
159 static inline void s3c6400_default_sdhci1(void)
160 {
161 #ifdef CONFIG_S3C_DEV_HSMMC1
162         s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
163 #endif
164 }
165
166 static inline void s3c6400_default_sdhci2(void)
167 {
168 #ifdef CONFIG_S3C_DEV_HSMMC2
169         s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
170 #endif
171 }
172
173 static inline void s3c6410_default_sdhci0(void)
174 {
175 #ifdef CONFIG_S3C_DEV_HSMMC
176         s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
177 #endif
178 }
179
180 static inline void s3c6410_default_sdhci1(void)
181 {
182 #ifdef CONFIG_S3C_DEV_HSMMC1
183         s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
184 #endif
185 }
186
187 static inline void s3c6410_default_sdhci2(void)
188 {
189 #ifdef CONFIG_S3C_DEV_HSMMC2
190         s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
191 #endif
192 }
193
194 #else
195 static inline void s3c6410_default_sdhci0(void) { }
196 static inline void s3c6410_default_sdhci1(void) { }
197 static inline void s3c6410_default_sdhci2(void) { }
198 static inline void s3c6400_default_sdhci0(void) { }
199 static inline void s3c6400_default_sdhci1(void) { }
200 static inline void s3c6400_default_sdhci2(void) { }
201
202 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
203
204 /* S5PC100 SDHCI setup */
205
206 #ifdef CONFIG_S5PC100_SETUP_SDHCI
207 static inline void s5pc100_default_sdhci0(void)
208 {
209 #ifdef CONFIG_S3C_DEV_HSMMC
210         s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
211 #endif
212 }
213
214 static inline void s5pc100_default_sdhci1(void)
215 {
216 #ifdef CONFIG_S3C_DEV_HSMMC1
217         s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
218 #endif
219 }
220
221 static inline void s5pc100_default_sdhci2(void)
222 {
223 #ifdef CONFIG_S3C_DEV_HSMMC2
224         s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
225 #endif
226 }
227
228 #else
229 static inline void s5pc100_default_sdhci0(void) { }
230 static inline void s5pc100_default_sdhci1(void) { }
231 static inline void s5pc100_default_sdhci2(void) { }
232
233 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
234
235 /* S5PV210 SDHCI setup */
236
237 #ifdef CONFIG_S5PV210_SETUP_SDHCI
238 static inline void s5pv210_default_sdhci0(void)
239 {
240 #ifdef CONFIG_S3C_DEV_HSMMC
241         s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
242 #endif
243 }
244
245 static inline void s5pv210_default_sdhci1(void)
246 {
247 #ifdef CONFIG_S3C_DEV_HSMMC1
248         s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
249 #endif
250 }
251
252 static inline void s5pv210_default_sdhci2(void)
253 {
254 #ifdef CONFIG_S3C_DEV_HSMMC2
255         s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
256 #endif
257 }
258
259 static inline void s5pv210_default_sdhci3(void)
260 {
261 #ifdef CONFIG_S3C_DEV_HSMMC3
262         s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
263 #endif
264 }
265
266 #else
267 static inline void s5pv210_default_sdhci0(void) { }
268 static inline void s5pv210_default_sdhci1(void) { }
269 static inline void s5pv210_default_sdhci2(void) { }
270 static inline void s5pv210_default_sdhci3(void) { }
271
272 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
273
274 /* EXYNOS4 SDHCI setup */
275 #ifdef CONFIG_EXYNOS4_SETUP_SDHCI
276 static inline void exynos4_default_sdhci0(void)
277 {
278 #ifdef CONFIG_S3C_DEV_HSMMC
279         s3c_hsmmc0_def_platdata.cfg_gpio = exynos4_setup_sdhci0_cfg_gpio;
280 #endif
281 }
282
283 static inline void exynos4_default_sdhci1(void)
284 {
285 #ifdef CONFIG_S3C_DEV_HSMMC1
286         s3c_hsmmc1_def_platdata.cfg_gpio = exynos4_setup_sdhci1_cfg_gpio;
287 #endif
288 }
289
290 static inline void exynos4_default_sdhci2(void)
291 {
292 #ifdef CONFIG_S3C_DEV_HSMMC2
293         s3c_hsmmc2_def_platdata.cfg_gpio = exynos4_setup_sdhci2_cfg_gpio;
294 #endif
295 }
296
297 static inline void exynos4_default_sdhci3(void)
298 {
299 #ifdef CONFIG_S3C_DEV_HSMMC3
300         s3c_hsmmc3_def_platdata.cfg_gpio = exynos4_setup_sdhci3_cfg_gpio;
301 #endif
302 }
303
304 #else
305 static inline void exynos4_default_sdhci0(void) { }
306 static inline void exynos4_default_sdhci1(void) { }
307 static inline void exynos4_default_sdhci2(void) { }
308 static inline void exynos4_default_sdhci3(void) { }
309
310 #endif /* CONFIG_EXYNOS4_SETUP_SDHCI */
311
312 #endif /* __PLAT_S3C_SDHCI_H */