Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / arch / arm / plat-samsung / include / plat / sdhci.h
1 /* linux/arch/arm/plat-s3c/include/plat/sdhci.h
2  *
3  * Copyright 2008 Openmoko, Inc.
4  * Copyright 2008 Simtec Electronics
5  *      http://armlinux.simtec.co.uk/
6  *      Ben Dooks <ben@simtec.co.uk>
7  *
8  * S3C Platform - SDHCI (HSMMC) platform data definitions
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13 */
14
15 #ifndef __PLAT_S3C_SDHCI_H
16 #define __PLAT_S3C_SDHCI_H __FILE__
17
18 struct platform_device;
19 struct mmc_host;
20 struct mmc_card;
21 struct mmc_ios;
22
23 /**
24  * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
25  * @max_width: The maximum number of data bits supported.
26  * @host_caps: Standard MMC host capabilities bit field.
27  * @cfg_gpio: Configure the GPIO for a specific card bit-width
28  * @cfg_card: Configure the interface for a specific card and speed. This
29  *            is necessary the controllers and/or GPIO blocks require the
30  *            changing of driver-strength and other controls dependant on
31  *            the card and speed of operation.
32  *
33  * Initialisation data specific to either the machine or the platform
34  * for the device driver to use or call-back when configuring gpio or
35  * card speed information.
36 */
37 struct s3c_sdhci_platdata {
38         unsigned int    max_width;
39         unsigned int    host_caps;
40
41         char            **clocks;       /* set of clock sources */
42
43         void    (*cfg_gpio)(struct platform_device *dev, int width);
44         void    (*cfg_card)(struct platform_device *dev,
45                             void __iomem *regbase,
46                             struct mmc_ios *ios,
47                             struct mmc_card *card);
48 };
49
50 /**
51  * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
52  * @pd: Platform data to register to device.
53  *
54  * Register the given platform data for use withe S3C SDHCI device.
55  * The call will copy the platform data, so the board definitions can
56  * make the structure itself __initdata.
57  */
58 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
59 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
60 extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
61
62 /* Default platform data, exported so that per-cpu initialisation can
63  * set the correct one when there are more than one cpu type selected.
64 */
65
66 extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
67 extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
68 extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
69
70 /* Helper function availablity */
71
72 extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
73 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
74 extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
75 extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
76 extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
77 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
78 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
79 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
80 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
81
82 /* S3C6400 SDHCI setup */
83
84 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
85 extern char *s3c64xx_hsmmc_clksrcs[4];
86
87 #ifdef CONFIG_S3C_DEV_HSMMC
88 extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
89                                          void __iomem *r,
90                                          struct mmc_ios *ios,
91                                          struct mmc_card *card);
92
93 static inline void s3c6400_default_sdhci0(void)
94 {
95         s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
96         s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
97         s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
98 }
99
100 #else
101 static inline void s3c6400_default_sdhci0(void) { }
102 #endif  /* CONFIG_S3C_DEV_HSMMC */
103
104 #ifdef CONFIG_S3C_DEV_HSMMC1
105 static inline void s3c6400_default_sdhci1(void)
106 {
107         s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
108         s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
109         s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
110 }
111 #else
112 static inline void s3c6400_default_sdhci1(void) { }
113 #endif /* CONFIG_S3C_DEV_HSMMC1 */
114
115 #ifdef CONFIG_S3C_DEV_HSMMC2
116 static inline void s3c6400_default_sdhci2(void)
117 {
118         s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
119         s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
120         s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
121 }
122 #else
123 static inline void s3c6400_default_sdhci2(void) { }
124 #endif /* CONFIG_S3C_DEV_HSMMC2 */
125
126 /* S3C6410 SDHCI setup */
127
128 extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
129                                          void __iomem *r,
130                                          struct mmc_ios *ios,
131                                          struct mmc_card *card);
132
133 #ifdef CONFIG_S3C_DEV_HSMMC
134 static inline void s3c6410_default_sdhci0(void)
135 {
136         s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
137         s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
138         s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
139 }
140 #else
141 static inline void s3c6410_default_sdhci0(void) { }
142 #endif /* CONFIG_S3C_DEV_HSMMC */
143
144 #ifdef CONFIG_S3C_DEV_HSMMC1
145 static inline void s3c6410_default_sdhci1(void)
146 {
147         s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
148         s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
149         s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
150 }
151 #else
152 static inline void s3c6410_default_sdhci1(void) { }
153 #endif /* CONFIG_S3C_DEV_HSMMC1 */
154
155 #ifdef CONFIG_S3C_DEV_HSMMC2
156 static inline void s3c6410_default_sdhci2(void)
157 {
158         s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
159         s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
160         s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
161 }
162 #else
163 static inline void s3c6410_default_sdhci2(void) { }
164 #endif /* CONFIG_S3C_DEV_HSMMC2 */
165
166 #else
167 static inline void s3c6410_default_sdhci0(void) { }
168 static inline void s3c6410_default_sdhci1(void) { }
169 static inline void s3c6400_default_sdhci0(void) { }
170 static inline void s3c6400_default_sdhci1(void) { }
171
172 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
173
174 /* S5PC100 SDHCI setup */
175
176 #ifdef CONFIG_S5PC100_SETUP_SDHCI
177 extern char *s5pc100_hsmmc_clksrcs[4];
178
179 extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
180                                            void __iomem *r,
181                                            struct mmc_ios *ios,
182                                            struct mmc_card *card);
183
184 #ifdef CONFIG_S3C_DEV_HSMMC
185 static inline void s5pc100_default_sdhci0(void)
186 {
187         s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
188         s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
189         s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
190 }
191 #else
192 static inline void s5pc100_default_sdhci0(void) { }
193 #endif /* CONFIG_S3C_DEV_HSMMC */
194
195 #ifdef CONFIG_S3C_DEV_HSMMC1
196 static inline void s5pc100_default_sdhci1(void)
197 {
198         s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
199         s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
200         s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
201 }
202 #else
203 static inline void s5pc100_default_sdhci1(void) { }
204 #endif /* CONFIG_S3C_DEV_HSMMC1 */
205
206 #ifdef CONFIG_S3C_DEV_HSMMC2
207 static inline void s5pc100_default_sdhci2(void)
208 {
209         s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
210         s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
211         s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
212 }
213 #else
214 static inline void s5pc100_default_sdhci2(void) { }
215 #endif /* CONFIG_S3C_DEV_HSMMC1 */
216
217
218 #else
219 static inline void s5pc100_default_sdhci0(void) { }
220 static inline void s5pc100_default_sdhci1(void) { }
221 static inline void s5pc100_default_sdhci2(void) { }
222 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
223
224
225 /* S5PC110 SDHCI setup */
226 #ifdef CONFIG_S5PV210_SETUP_SDHCI
227 extern char *s5pv210_hsmmc_clksrcs[4];
228
229 extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
230                                            void __iomem *r,
231                                            struct mmc_ios *ios,
232                                            struct mmc_card *card);
233
234 #ifdef CONFIG_S3C_DEV_HSMMC
235 static inline void s5pv210_default_sdhci0(void)
236 {
237         s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
238         s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
239         s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
240 }
241 #else
242 static inline void s5pc100_default_sdhci0(void) { }
243 #endif /* CONFIG_S3C_DEV_HSMMC */
244
245 #ifdef CONFIG_S3C_DEV_HSMMC1
246 static inline void s5pv210_default_sdhci1(void)
247 {
248         s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
249         s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
250         s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
251 }
252 #else
253 static inline void s5pv210_default_sdhci1(void) { }
254 #endif /* CONFIG_S3C_DEV_HSMMC1 */
255
256 #ifdef CONFIG_S3C_DEV_HSMMC2
257 static inline void s5pv210_default_sdhci2(void)
258 {
259         s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
260         s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
261         s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
262 }
263 #else
264 static inline void s5pv210_default_sdhci2(void) { }
265 #endif /* CONFIG_S3C_DEV_HSMMC2 */
266
267 #else
268 static inline void s5pv210_default_sdhci0(void) { }
269 static inline void s5pv210_default_sdhci1(void) { }
270 static inline void s5pv210_default_sdhci2(void) { }
271 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
272
273
274
275
276 #endif /* __PLAT_S3C_SDHCI_H */