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 s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
111 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
112 extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
113 extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
114 extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
115 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
116 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
117 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
118 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
119 extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
120 extern void s5pv310_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
121 extern void s5pv310_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
122 extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
123 extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
125 /* S3C64XX SDHCI setup */
127 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
128 extern char *s3c64xx_hsmmc_clksrcs[4];
130 extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
133 struct mmc_card *card);
135 static inline void s3c6400_default_sdhci0(void)
137 #ifdef CONFIG_S3C_DEV_HSMMC
138 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
139 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
140 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
144 static inline void s3c6400_default_sdhci1(void)
146 #ifdef CONFIG_S3C_DEV_HSMMC1
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 = s3c6400_setup_sdhci_cfg_card;
153 static inline void s3c6400_default_sdhci2(void)
155 #ifdef CONFIG_S3C_DEV_HSMMC2
156 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
157 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
158 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
162 extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
165 struct mmc_card *card);
167 static inline void s3c6410_default_sdhci0(void)
169 #ifdef CONFIG_S3C_DEV_HSMMC
170 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
171 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
172 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
176 static inline void s3c6410_default_sdhci1(void)
178 #ifdef CONFIG_S3C_DEV_HSMMC1
179 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
180 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
181 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
185 static inline void s3c6410_default_sdhci2(void)
187 #ifdef CONFIG_S3C_DEV_HSMMC2
188 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
189 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
190 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
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) { }
202 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
204 /* S5PC100 SDHCI setup */
206 #ifdef CONFIG_S5PC100_SETUP_SDHCI
207 extern char *s5pc100_hsmmc_clksrcs[4];
209 extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
212 struct mmc_card *card);
214 static inline void s5pc100_default_sdhci0(void)
216 #ifdef CONFIG_S3C_DEV_HSMMC
217 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
218 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
219 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
223 static inline void s5pc100_default_sdhci1(void)
225 #ifdef CONFIG_S3C_DEV_HSMMC1
226 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
227 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
228 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
232 static inline void s5pc100_default_sdhci2(void)
234 #ifdef CONFIG_S3C_DEV_HSMMC2
235 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
236 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
237 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
242 static inline void s5pc100_default_sdhci0(void) { }
243 static inline void s5pc100_default_sdhci1(void) { }
244 static inline void s5pc100_default_sdhci2(void) { }
246 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
248 /* S5PV210 SDHCI setup */
250 #ifdef CONFIG_S5PV210_SETUP_SDHCI
251 extern char *s5pv210_hsmmc_clksrcs[4];
253 extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
256 struct mmc_card *card);
258 static inline void s5pv210_default_sdhci0(void)
260 #ifdef CONFIG_S3C_DEV_HSMMC
261 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
262 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
263 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
267 static inline void s5pv210_default_sdhci1(void)
269 #ifdef CONFIG_S3C_DEV_HSMMC1
270 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
271 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
272 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
276 static inline void s5pv210_default_sdhci2(void)
278 #ifdef CONFIG_S3C_DEV_HSMMC2
279 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
280 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
281 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
285 static inline void s5pv210_default_sdhci3(void)
287 #ifdef CONFIG_S3C_DEV_HSMMC3
288 s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
289 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
290 s3c_hsmmc3_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
295 static inline void s5pv210_default_sdhci0(void) { }
296 static inline void s5pv210_default_sdhci1(void) { }
297 static inline void s5pv210_default_sdhci2(void) { }
298 static inline void s5pv210_default_sdhci3(void) { }
300 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
302 /* S5PV310 SDHCI setup */
303 #ifdef CONFIG_S5PV310_SETUP_SDHCI
304 extern char *s5pv310_hsmmc_clksrcs[4];
306 extern void s5pv310_setup_sdhci_cfg_card(struct platform_device *dev,
309 struct mmc_card *card);
311 static inline void s5pv310_default_sdhci0(void)
313 #ifdef CONFIG_S3C_DEV_HSMMC
314 s3c_hsmmc0_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
315 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv310_setup_sdhci0_cfg_gpio;
316 s3c_hsmmc0_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
320 static inline void s5pv310_default_sdhci1(void)
322 #ifdef CONFIG_S3C_DEV_HSMMC1
323 s3c_hsmmc1_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
324 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv310_setup_sdhci1_cfg_gpio;
325 s3c_hsmmc1_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
329 static inline void s5pv310_default_sdhci2(void)
331 #ifdef CONFIG_S3C_DEV_HSMMC2
332 s3c_hsmmc2_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
333 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv310_setup_sdhci2_cfg_gpio;
334 s3c_hsmmc2_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
338 static inline void s5pv310_default_sdhci3(void)
340 #ifdef CONFIG_S3C_DEV_HSMMC3
341 s3c_hsmmc3_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
342 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv310_setup_sdhci3_cfg_gpio;
343 s3c_hsmmc3_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
348 static inline void s5pv310_default_sdhci0(void) { }
349 static inline void s5pv310_default_sdhci1(void) { }
350 static inline void s5pv310_default_sdhci2(void) { }
351 static inline void s5pv310_default_sdhci3(void) { }
353 #endif /* CONFIG_S5PV310_SETUP_SDHCI */
355 #endif /* __PLAT_S3C_SDHCI_H */