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 S3C_SDHCI_CLK_DIV_INTERNAL, /* use mmc internal clock divider */
33 S3C_SDHCI_CLK_DIV_EXTERNAL, /* use external clock divider */
37 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
38 * @max_width: The maximum number of data bits supported.
39 * @host_caps: Standard MMC host capabilities bit field.
40 * @cd_type: Type of Card Detection method (see cd_types enum above)
41 * @clk_type: Type of clock divider method (see clk_types enum above)
42 * @ext_cd_init: Initialize external card detect subsystem. Called on
43 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
44 * notify_func argument is a callback to the sdhci-s3c driver
45 * that triggers the card detection event. Callback arguments:
46 * dev is pointer to platform device of the host controller,
47 * state is new state of the card (0 - removed, 1 - inserted).
48 * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
49 * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
50 * notify_func argument is the same callback as for ext_cd_init.
51 * @ext_cd_gpio: gpio pin used for external CD line, valid only if
52 * cd_type == S3C_SDHCI_CD_GPIO
53 * @ext_cd_gpio_invert: invert values for external CD gpio line
54 * @cfg_gpio: Configure the GPIO for a specific card bit-width
55 * @cfg_card: Configure the interface for a specific card and speed. This
56 * is necessary the controllers and/or GPIO blocks require the
57 * changing of driver-strength and other controls dependant on
58 * the card and speed of operation.
60 * Initialisation data specific to either the machine or the platform
61 * for the device driver to use or call-back when configuring gpio or
62 * card speed information.
64 struct s3c_sdhci_platdata {
65 unsigned int max_width;
66 unsigned int host_caps;
67 enum cd_types cd_type;
68 enum clk_types clk_type;
70 char **clocks; /* set of clock sources */
73 bool ext_cd_gpio_invert;
74 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
76 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
79 void (*cfg_gpio)(struct platform_device *dev, int width);
80 void (*cfg_card)(struct platform_device *dev,
81 void __iomem *regbase,
83 struct mmc_card *card);
87 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
88 * @pd: Platform data to register to device.
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.
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);
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.
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;
108 /* Helper function availablity */
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 s5pv310_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
123 extern void s5pv310_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
124 extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
125 extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
127 /* S3C2416 SDHCI setup */
129 #ifdef CONFIG_S3C2416_SETUP_SDHCI
130 extern char *s3c2416_hsmmc_clksrcs[4];
132 extern void s3c2416_setup_sdhci_cfg_card(struct platform_device *dev,
135 struct mmc_card *card);
137 static inline void s3c2416_default_sdhci0(void)
139 #ifdef CONFIG_S3C_DEV_HSMMC
140 s3c_hsmmc0_def_platdata.clocks = s3c2416_hsmmc_clksrcs;
141 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
142 s3c_hsmmc0_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card;
143 #endif /* CONFIG_S3C_DEV_HSMMC */
146 static inline void s3c2416_default_sdhci1(void)
148 #ifdef CONFIG_S3C_DEV_HSMMC1
149 s3c_hsmmc1_def_platdata.clocks = s3c2416_hsmmc_clksrcs;
150 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
151 s3c_hsmmc1_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card;
152 #endif /* CONFIG_S3C_DEV_HSMMC1 */
156 static inline void s3c2416_default_sdhci0(void) { }
157 static inline void s3c2416_default_sdhci1(void) { }
159 #endif /* CONFIG_S3C2416_SETUP_SDHCI */
160 /* S3C64XX SDHCI setup */
162 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
163 extern char *s3c64xx_hsmmc_clksrcs[4];
165 extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
168 struct mmc_card *card);
170 static inline void s3c6400_default_sdhci0(void)
172 #ifdef CONFIG_S3C_DEV_HSMMC
173 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
174 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
175 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
179 static inline void s3c6400_default_sdhci1(void)
181 #ifdef CONFIG_S3C_DEV_HSMMC1
182 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
183 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
184 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
188 static inline void s3c6400_default_sdhci2(void)
190 #ifdef CONFIG_S3C_DEV_HSMMC2
191 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
192 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
193 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
197 extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
200 struct mmc_card *card);
202 static inline void s3c6410_default_sdhci0(void)
204 #ifdef CONFIG_S3C_DEV_HSMMC
205 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
206 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
207 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
211 static inline void s3c6410_default_sdhci1(void)
213 #ifdef CONFIG_S3C_DEV_HSMMC1
214 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
215 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
216 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
220 static inline void s3c6410_default_sdhci2(void)
222 #ifdef CONFIG_S3C_DEV_HSMMC2
223 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
224 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
225 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
230 static inline void s3c6410_default_sdhci0(void) { }
231 static inline void s3c6410_default_sdhci1(void) { }
232 static inline void s3c6410_default_sdhci2(void) { }
233 static inline void s3c6400_default_sdhci0(void) { }
234 static inline void s3c6400_default_sdhci1(void) { }
235 static inline void s3c6400_default_sdhci2(void) { }
237 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
239 /* S5PC100 SDHCI setup */
241 #ifdef CONFIG_S5PC100_SETUP_SDHCI
242 extern char *s5pc100_hsmmc_clksrcs[4];
244 extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
247 struct mmc_card *card);
249 static inline void s5pc100_default_sdhci0(void)
251 #ifdef CONFIG_S3C_DEV_HSMMC
252 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
253 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
254 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
258 static inline void s5pc100_default_sdhci1(void)
260 #ifdef CONFIG_S3C_DEV_HSMMC1
261 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
262 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
263 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
267 static inline void s5pc100_default_sdhci2(void)
269 #ifdef CONFIG_S3C_DEV_HSMMC2
270 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
271 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
272 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
277 static inline void s5pc100_default_sdhci0(void) { }
278 static inline void s5pc100_default_sdhci1(void) { }
279 static inline void s5pc100_default_sdhci2(void) { }
281 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
283 /* S5PV210 SDHCI setup */
285 #ifdef CONFIG_S5PV210_SETUP_SDHCI
286 extern char *s5pv210_hsmmc_clksrcs[4];
288 extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
291 struct mmc_card *card);
293 static inline void s5pv210_default_sdhci0(void)
295 #ifdef CONFIG_S3C_DEV_HSMMC
296 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
297 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
298 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
302 static inline void s5pv210_default_sdhci1(void)
304 #ifdef CONFIG_S3C_DEV_HSMMC1
305 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
306 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
307 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
311 static inline void s5pv210_default_sdhci2(void)
313 #ifdef CONFIG_S3C_DEV_HSMMC2
314 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
315 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
316 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
320 static inline void s5pv210_default_sdhci3(void)
322 #ifdef CONFIG_S3C_DEV_HSMMC3
323 s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
324 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
325 s3c_hsmmc3_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
330 static inline void s5pv210_default_sdhci0(void) { }
331 static inline void s5pv210_default_sdhci1(void) { }
332 static inline void s5pv210_default_sdhci2(void) { }
333 static inline void s5pv210_default_sdhci3(void) { }
335 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
337 /* S5PV310 SDHCI setup */
338 #ifdef CONFIG_S5PV310_SETUP_SDHCI
339 extern char *s5pv310_hsmmc_clksrcs[4];
341 extern void s5pv310_setup_sdhci_cfg_card(struct platform_device *dev,
344 struct mmc_card *card);
346 static inline void s5pv310_default_sdhci0(void)
348 #ifdef CONFIG_S3C_DEV_HSMMC
349 s3c_hsmmc0_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
350 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv310_setup_sdhci0_cfg_gpio;
351 s3c_hsmmc0_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
355 static inline void s5pv310_default_sdhci1(void)
357 #ifdef CONFIG_S3C_DEV_HSMMC1
358 s3c_hsmmc1_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
359 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv310_setup_sdhci1_cfg_gpio;
360 s3c_hsmmc1_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
364 static inline void s5pv310_default_sdhci2(void)
366 #ifdef CONFIG_S3C_DEV_HSMMC2
367 s3c_hsmmc2_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
368 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv310_setup_sdhci2_cfg_gpio;
369 s3c_hsmmc2_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
373 static inline void s5pv310_default_sdhci3(void)
375 #ifdef CONFIG_S3C_DEV_HSMMC3
376 s3c_hsmmc3_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
377 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv310_setup_sdhci3_cfg_gpio;
378 s3c_hsmmc3_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
383 static inline void s5pv310_default_sdhci0(void) { }
384 static inline void s5pv310_default_sdhci1(void) { }
385 static inline void s5pv310_default_sdhci2(void) { }
386 static inline void s5pv310_default_sdhci3(void) { }
388 #endif /* CONFIG_S5PV310_SETUP_SDHCI */
390 #endif /* __PLAT_S3C_SDHCI_H */