1 /* linux/arch/arm/plat-s3c/include/plat/sdhci.h
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
8 * S3C Platform - SDHCI (HSMMC) platform data definitions
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.
15 #ifndef __PLAT_S3C_SDHCI_H
16 #define __PLAT_S3C_SDHCI_H __FILE__
18 struct platform_device;
24 S3C_SDHCI_CD_INTERNAL, /* use mmc internal CD line */
25 S3C_SDHCI_CD_EXTERNAL, /* use external callback */
26 S3C_SDHCI_CD_GPIO, /* use external gpio pin for CD line */
27 S3C_SDHCI_CD_NONE, /* no CD line, use polling to detect card */
28 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
32 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
33 * @max_width: The maximum number of data bits supported.
34 * @host_caps: Standard MMC host capabilities bit field.
35 * @cd_type: Type of Card Detection method (see cd_types enum above)
36 * @ext_cd_init: Initialize external card detect subsystem. Called on
37 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
38 * notify_func argument is a callback to the sdhci-s3c driver
39 * that triggers the card detection event. Callback arguments:
40 * dev is pointer to platform device of the host controller,
41 * state is new state of the card (0 - removed, 1 - inserted).
42 * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
43 * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
44 * notify_func argument is the same callback as for ext_cd_init.
45 * @ext_cd_gpio: gpio pin used for external CD line, valid only if
46 * cd_type == S3C_SDHCI_CD_GPIO
47 * @ext_cd_gpio_invert: invert values for external CD gpio line
48 * @cfg_gpio: Configure the GPIO for a specific card bit-width
49 * @cfg_card: Configure the interface for a specific card and speed. This
50 * is necessary the controllers and/or GPIO blocks require the
51 * changing of driver-strength and other controls dependant on
52 * the card and speed of operation.
54 * Initialisation data specific to either the machine or the platform
55 * for the device driver to use or call-back when configuring gpio or
56 * card speed information.
58 struct s3c_sdhci_platdata {
59 unsigned int max_width;
60 unsigned int host_caps;
61 enum cd_types cd_type;
63 char **clocks; /* set of clock sources */
66 bool ext_cd_gpio_invert;
67 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
69 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
72 void (*cfg_gpio)(struct platform_device *dev, int width);
73 void (*cfg_card)(struct platform_device *dev,
74 void __iomem *regbase,
76 struct mmc_card *card);
80 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
81 * @pd: Platform data to register to device.
83 * Register the given platform data for use withe S3C SDHCI device.
84 * The call will copy the platform data, so the board definitions can
85 * make the structure itself __initdata.
87 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
88 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
89 extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
90 extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
92 /* Default platform data, exported so that per-cpu initialisation can
93 * set the correct one when there are more than one cpu type selected.
96 extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
97 extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
98 extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
99 extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
101 /* Helper function availablity */
103 extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
104 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
105 extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
106 extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
107 extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
108 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
109 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
110 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
111 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
112 extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
113 extern void s5pv310_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
114 extern void s5pv310_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
115 extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
116 extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
118 /* S3C64XX SDHCI setup */
120 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
121 extern char *s3c64xx_hsmmc_clksrcs[4];
123 extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
126 struct mmc_card *card);
128 static inline void s3c6400_default_sdhci0(void)
130 #ifdef CONFIG_S3C_DEV_HSMMC
131 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
132 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
133 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
137 static inline void s3c6400_default_sdhci1(void)
139 #ifdef CONFIG_S3C_DEV_HSMMC1
140 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
141 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
142 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
146 static inline void s3c6400_default_sdhci2(void)
148 #ifdef CONFIG_S3C_DEV_HSMMC2
149 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
150 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
151 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
155 extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
158 struct mmc_card *card);
160 static inline void s3c6410_default_sdhci0(void)
162 #ifdef CONFIG_S3C_DEV_HSMMC
163 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
164 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
165 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
169 static inline void s3c6410_default_sdhci1(void)
171 #ifdef CONFIG_S3C_DEV_HSMMC1
172 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
173 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
174 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
178 static inline void s3c6410_default_sdhci2(void)
180 #ifdef CONFIG_S3C_DEV_HSMMC2
181 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
182 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
183 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
188 static inline void s3c6410_default_sdhci0(void) { }
189 static inline void s3c6410_default_sdhci1(void) { }
190 static inline void s3c6410_default_sdhci2(void) { }
191 static inline void s3c6400_default_sdhci0(void) { }
192 static inline void s3c6400_default_sdhci1(void) { }
193 static inline void s3c6400_default_sdhci2(void) { }
195 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
197 /* S5PC100 SDHCI setup */
199 #ifdef CONFIG_S5PC100_SETUP_SDHCI
200 extern char *s5pc100_hsmmc_clksrcs[4];
202 extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
205 struct mmc_card *card);
207 static inline void s5pc100_default_sdhci0(void)
209 #ifdef CONFIG_S3C_DEV_HSMMC
210 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
211 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
212 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
216 static inline void s5pc100_default_sdhci1(void)
218 #ifdef CONFIG_S3C_DEV_HSMMC1
219 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
220 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
221 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
225 static inline void s5pc100_default_sdhci2(void)
227 #ifdef CONFIG_S3C_DEV_HSMMC2
228 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
229 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
230 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
235 static inline void s5pc100_default_sdhci0(void) { }
236 static inline void s5pc100_default_sdhci1(void) { }
237 static inline void s5pc100_default_sdhci2(void) { }
239 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
241 /* S5PV210 SDHCI setup */
243 #ifdef CONFIG_S5PV210_SETUP_SDHCI
244 extern char *s5pv210_hsmmc_clksrcs[4];
246 extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
249 struct mmc_card *card);
251 static inline void s5pv210_default_sdhci0(void)
253 #ifdef CONFIG_S3C_DEV_HSMMC
254 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
255 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
256 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
260 static inline void s5pv210_default_sdhci1(void)
262 #ifdef CONFIG_S3C_DEV_HSMMC1
263 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
264 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
265 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
269 static inline void s5pv210_default_sdhci2(void)
271 #ifdef CONFIG_S3C_DEV_HSMMC2
272 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
273 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
274 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
278 static inline void s5pv210_default_sdhci3(void)
280 #ifdef CONFIG_S3C_DEV_HSMMC3
281 s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
282 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
283 s3c_hsmmc3_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
288 static inline void s5pv210_default_sdhci0(void) { }
289 static inline void s5pv210_default_sdhci1(void) { }
290 static inline void s5pv210_default_sdhci2(void) { }
291 static inline void s5pv210_default_sdhci3(void) { }
293 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
295 /* S5PV310 SDHCI setup */
296 #ifdef CONFIG_S5PV310_SETUP_SDHCI
297 extern char *s5pv310_hsmmc_clksrcs[4];
299 extern void s5pv310_setup_sdhci_cfg_card(struct platform_device *dev,
302 struct mmc_card *card);
304 static inline void s5pv310_default_sdhci0(void)
306 #ifdef CONFIG_S3C_DEV_HSMMC
307 s3c_hsmmc0_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
308 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv310_setup_sdhci0_cfg_gpio;
309 s3c_hsmmc0_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
313 static inline void s5pv310_default_sdhci1(void)
315 #ifdef CONFIG_S3C_DEV_HSMMC1
316 s3c_hsmmc1_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
317 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv310_setup_sdhci1_cfg_gpio;
318 s3c_hsmmc1_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
322 static inline void s5pv310_default_sdhci2(void)
324 #ifdef CONFIG_S3C_DEV_HSMMC2
325 s3c_hsmmc2_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
326 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv310_setup_sdhci2_cfg_gpio;
327 s3c_hsmmc2_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
331 static inline void s5pv310_default_sdhci3(void)
333 #ifdef CONFIG_S3C_DEV_HSMMC3
334 s3c_hsmmc3_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
335 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv310_setup_sdhci3_cfg_gpio;
336 s3c_hsmmc3_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
341 static inline void s5pv310_default_sdhci0(void) { }
342 static inline void s5pv310_default_sdhci1(void) { }
343 static inline void s5pv310_default_sdhci2(void) { }
344 static inline void s5pv310_default_sdhci3(void) { }
346 #endif /* CONFIG_S5PV310_SETUP_SDHCI */
348 #endif /* __PLAT_S3C_SDHCI_H */