blob: 10413728530fe78506fb6e5641e3e0cd2ce81038 [file] [log] [blame]
Ben Dooks5cc7fd82008-10-31 16:14:38 +00001/* 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
18struct platform_device;
19struct mmc_host;
20struct mmc_card;
21struct 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*/
37struct 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 */
58extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
Ben Dooksa2205cd2008-10-31 16:14:39 +000059extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
Kyungmin Park86cd4f52009-11-17 08:41:23 +010060extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
Ben Dooks5cc7fd82008-10-31 16:14:38 +000061
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
Ben Dooksa2205cd2008-10-31 16:14:39 +000066extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
67extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
Kyungmin Park86cd4f52009-11-17 08:41:23 +010068extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
Ben Dooks5cc7fd82008-10-31 16:14:38 +000069
70/* Helper function availablity */
71
Ben Dooks4faf68672009-03-25 11:01:24 +000072extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
73extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
Kyungmin Park86cd4f52009-11-17 08:41:23 +010074extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
75extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
76extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +010077extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
Marek Szyprowskie6f66a92010-05-20 08:13:07 +020078extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
79extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
80extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
Hyuk Lee976a62f2010-06-14 10:18:56 +090081extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
Ben Dooks4faf68672009-03-25 11:01:24 +000082
83/* S3C6400 SDHCI setup */
84
Ben Dooks2f6c2ac2010-01-26 10:38:52 +090085#ifdef CONFIG_S3C64XX_SETUP_SDHCI
86extern char *s3c64xx_hsmmc_clksrcs[4];
Ben Dooks4faf68672009-03-25 11:01:24 +000087
88#ifdef CONFIG_S3C_DEV_HSMMC
89extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
90 void __iomem *r,
91 struct mmc_ios *ios,
92 struct mmc_card *card);
93
94static inline void s3c6400_default_sdhci0(void)
95{
Ben Dooks2f6c2ac2010-01-26 10:38:52 +090096 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
Ben Dooks4faf68672009-03-25 11:01:24 +000097 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
98 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
99}
100
101#else
102static inline void s3c6400_default_sdhci0(void) { }
103#endif /* CONFIG_S3C_DEV_HSMMC */
104
105#ifdef CONFIG_S3C_DEV_HSMMC1
106static inline void s3c6400_default_sdhci1(void)
107{
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900108 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
Ben Dooks4faf68672009-03-25 11:01:24 +0000109 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
110 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
111}
112#else
113static inline void s3c6400_default_sdhci1(void) { }
114#endif /* CONFIG_S3C_DEV_HSMMC1 */
115
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100116#ifdef CONFIG_S3C_DEV_HSMMC2
117static inline void s3c6400_default_sdhci2(void)
118{
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900119 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100120 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
121 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
122}
123#else
124static inline void s3c6400_default_sdhci2(void) { }
125#endif /* CONFIG_S3C_DEV_HSMMC2 */
126
Ben Dooks4faf68672009-03-25 11:01:24 +0000127/* S3C6410 SDHCI setup */
128
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900129extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
130 void __iomem *r,
131 struct mmc_ios *ios,
132 struct mmc_card *card);
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000133
Ben Dooks713e9de2008-10-31 16:29:19 +0000134#ifdef CONFIG_S3C_DEV_HSMMC
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000135static inline void s3c6410_default_sdhci0(void)
136{
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900137 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
Ben Dooks4faf68672009-03-25 11:01:24 +0000138 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900139 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000140}
Ben Dooks713e9de2008-10-31 16:29:19 +0000141#else
142static inline void s3c6410_default_sdhci0(void) { }
143#endif /* CONFIG_S3C_DEV_HSMMC */
Ben Dooksa2205cd2008-10-31 16:14:39 +0000144
Ben Dooks713e9de2008-10-31 16:29:19 +0000145#ifdef CONFIG_S3C_DEV_HSMMC1
Ben Dooksa2205cd2008-10-31 16:14:39 +0000146static inline void s3c6410_default_sdhci1(void)
147{
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900148 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
Ben Dooks4faf68672009-03-25 11:01:24 +0000149 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900150 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
Ben Dooksa2205cd2008-10-31 16:14:39 +0000151}
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000152#else
Ben Dooks713e9de2008-10-31 16:29:19 +0000153static inline void s3c6410_default_sdhci1(void) { }
154#endif /* CONFIG_S3C_DEV_HSMMC1 */
155
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100156#ifdef CONFIG_S3C_DEV_HSMMC2
157static inline void s3c6410_default_sdhci2(void)
158{
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900159 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100160 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900161 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100162}
163#else
164static inline void s3c6410_default_sdhci2(void) { }
165#endif /* CONFIG_S3C_DEV_HSMMC2 */
166
Ben Dooks713e9de2008-10-31 16:29:19 +0000167#else
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000168static inline void s3c6410_default_sdhci0(void) { }
Ben Dooksa2205cd2008-10-31 16:14:39 +0000169static inline void s3c6410_default_sdhci1(void) { }
Marek Szyprowski6b34f492010-06-22 15:45:26 +0900170static inline void s3c6410_default_sdhci2(void) { }
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900171static inline void s3c6400_default_sdhci0(void) { }
172static inline void s3c6400_default_sdhci1(void) { }
Marek Szyprowski6b34f492010-06-22 15:45:26 +0900173static inline void s3c6400_default_sdhci2(void) { }
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900174
175#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000176
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100177/* S5PC100 SDHCI setup */
178
179#ifdef CONFIG_S5PC100_SETUP_SDHCI
180extern char *s5pc100_hsmmc_clksrcs[4];
181
182extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
183 void __iomem *r,
184 struct mmc_ios *ios,
185 struct mmc_card *card);
186
187#ifdef CONFIG_S3C_DEV_HSMMC
188static inline void s5pc100_default_sdhci0(void)
189{
190 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
191 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
192 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
193}
194#else
195static inline void s5pc100_default_sdhci0(void) { }
196#endif /* CONFIG_S3C_DEV_HSMMC */
197
198#ifdef CONFIG_S3C_DEV_HSMMC1
199static inline void s5pc100_default_sdhci1(void)
200{
201 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
202 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
203 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
204}
205#else
206static inline void s5pc100_default_sdhci1(void) { }
207#endif /* CONFIG_S3C_DEV_HSMMC1 */
208
209#ifdef CONFIG_S3C_DEV_HSMMC2
210static inline void s5pc100_default_sdhci2(void)
211{
212 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
213 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
214 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
215}
216#else
217static inline void s5pc100_default_sdhci2(void) { }
218#endif /* CONFIG_S3C_DEV_HSMMC1 */
219
220
221#else
222static inline void s5pc100_default_sdhci0(void) { }
223static inline void s5pc100_default_sdhci1(void) { }
224static inline void s5pc100_default_sdhci2(void) { }
225#endif /* CONFIG_S5PC100_SETUP_SDHCI */
226
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200227
228/* S5PC110 SDHCI setup */
229#ifdef CONFIG_S5PV210_SETUP_SDHCI
230extern char *s5pv210_hsmmc_clksrcs[4];
231
232extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
233 void __iomem *r,
234 struct mmc_ios *ios,
235 struct mmc_card *card);
236
237#ifdef CONFIG_S3C_DEV_HSMMC
238static inline void s5pv210_default_sdhci0(void)
239{
240 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
241 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
242 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
243}
244#else
Hyuk Leef50b8bc2010-06-10 12:40:39 +0900245static inline void s5pv210_default_sdhci0(void) { }
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200246#endif /* CONFIG_S3C_DEV_HSMMC */
247
248#ifdef CONFIG_S3C_DEV_HSMMC1
249static inline void s5pv210_default_sdhci1(void)
250{
251 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
252 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
253 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
254}
255#else
256static inline void s5pv210_default_sdhci1(void) { }
257#endif /* CONFIG_S3C_DEV_HSMMC1 */
258
259#ifdef CONFIG_S3C_DEV_HSMMC2
260static inline void s5pv210_default_sdhci2(void)
261{
262 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
263 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
264 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
265}
266#else
267static inline void s5pv210_default_sdhci2(void) { }
268#endif /* CONFIG_S3C_DEV_HSMMC2 */
269
Hyuk Lee976a62f2010-06-14 10:18:56 +0900270#ifdef CONFIG_S3C_DEV_HSMMC3
271static inline void s5pv210_default_sdhci3(void)
272{
273 s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
274 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
275 s3c_hsmmc3_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
276}
277#else
278static inline void s5pv210_default_sdhci3(void) { }
279#endif /* CONFIG_S3C_DEV_HSMMC3 */
280
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200281#else
282static inline void s5pv210_default_sdhci0(void) { }
283static inline void s5pv210_default_sdhci1(void) { }
284static inline void s5pv210_default_sdhci2(void) { }
Hyuk Lee976a62f2010-06-14 10:18:56 +0900285static inline void s5pv210_default_sdhci3(void) { }
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200286#endif /* CONFIG_S5PC100_SETUP_SDHCI */
287
288
289
290
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000291#endif /* __PLAT_S3C_SDHCI_H */