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 SD Host controller for clock div */
33 S3C_SDHCI_CLK_DIV_EXTERNAL, /* Use CMU controller for 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 * @ext_cd_init: Initialize external card detect subsystem. Called on
42 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
43 * notify_func argument is a callback to the sdhci-s3c driver
44 * that triggers the card detection event. Callback arguments:
45 * dev is pointer to platform device of the host controller,
46 * state is new state of the card (0 - removed, 1 - inserted).
47 * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
48 * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
49 * notify_func argument is the same callback as for ext_cd_init.
50 * @ext_cd_gpio: gpio pin used for external CD line, valid only if
51 * cd_type == S3C_SDHCI_CD_GPIO
52 * @ext_cd_gpio_invert: invert values for external CD gpio line
53 * @cfg_gpio: Configure the GPIO for a specific card bit-width
54 * @cfg_card: Configure the interface for a specific card and speed. This
55 * is necessary the controllers and/or GPIO blocks require the
56 * changing of driver-strength and other controls dependant on
57 * the card and speed of operation.
59 * Initialisation data specific to either the machine or the platform
60 * for the device driver to use or call-back when configuring gpio or
61 * card speed information.
63 struct s3c_sdhci_platdata {
64 unsigned int max_width;
65 unsigned int host_caps;
67 enum cd_types cd_type;
68 enum clk_type clk_type;
70 char **clocks; /* set of clock sources */
73 bool ext_cd_gpio_invert;
75 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
77 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
80 void (*cfg_gpio)(struct platform_device *dev, int width);
81 void (*cfg_card)(struct platform_device *dev,
82 void __iomem *regbase,
84 struct mmc_card *card);
88 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
89 * @pd: Platform data to register to device.
91 * Register the given platform data for use withe S3C SDHCI device.
92 * The call will copy the platform data, so the board definitions can
93 * make the structure itself __initdata.
95 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
96 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
97 extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
98 extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
100 /* Default platform data, exported so that per-cpu initialisation can
101 * set the correct one when there are more than one cpu type selected.
104 extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
105 extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
106 extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
107 extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
109 /* Helper function availablity */
111 extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
112 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
113 extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
114 extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
115 extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
116 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
117 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
118 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
119 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
120 extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
121 extern void s5pv310_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
122 extern void s5pv310_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
123 extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
124 extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
126 /* S3C64XX SDHCI setup */
128 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
129 extern char *s3c64xx_hsmmc_clksrcs[4];
131 extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
134 struct mmc_card *card);
136 static inline void s3c6400_default_sdhci0(void)
138 #ifdef CONFIG_S3C_DEV_HSMMC
139 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
140 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
141 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
145 static inline void s3c6400_default_sdhci1(void)
147 #ifdef CONFIG_S3C_DEV_HSMMC1
148 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
149 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
150 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
154 static inline void s3c6400_default_sdhci2(void)
156 #ifdef CONFIG_S3C_DEV_HSMMC2
157 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
158 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
159 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
163 extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
166 struct mmc_card *card);
168 static inline void s3c6410_default_sdhci0(void)
170 #ifdef CONFIG_S3C_DEV_HSMMC
171 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
172 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
173 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
177 static inline void s3c6410_default_sdhci1(void)
179 #ifdef CONFIG_S3C_DEV_HSMMC1
180 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
181 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
182 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
186 static inline void s3c6410_default_sdhci2(void)
188 #ifdef CONFIG_S3C_DEV_HSMMC2
189 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
190 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
191 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
196 static inline void s3c6410_default_sdhci0(void) { }
197 static inline void s3c6410_default_sdhci1(void) { }
198 static inline void s3c6410_default_sdhci2(void) { }
199 static inline void s3c6400_default_sdhci0(void) { }
200 static inline void s3c6400_default_sdhci1(void) { }
201 static inline void s3c6400_default_sdhci2(void) { }
203 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
205 /* S5PC100 SDHCI setup */
207 #ifdef CONFIG_S5PC100_SETUP_SDHCI
208 extern char *s5pc100_hsmmc_clksrcs[4];
210 extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
213 struct mmc_card *card);
215 static inline void s5pc100_default_sdhci0(void)
217 #ifdef CONFIG_S3C_DEV_HSMMC
218 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
219 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
220 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
224 static inline void s5pc100_default_sdhci1(void)
226 #ifdef CONFIG_S3C_DEV_HSMMC1
227 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
228 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
229 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
233 static inline void s5pc100_default_sdhci2(void)
235 #ifdef CONFIG_S3C_DEV_HSMMC2
236 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
237 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
238 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
243 static inline void s5pc100_default_sdhci0(void) { }
244 static inline void s5pc100_default_sdhci1(void) { }
245 static inline void s5pc100_default_sdhci2(void) { }
247 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
249 /* S5PV210 SDHCI setup */
251 #ifdef CONFIG_S5PV210_SETUP_SDHCI
252 extern char *s5pv210_hsmmc_clksrcs[4];
254 extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
257 struct mmc_card *card);
259 static inline void s5pv210_default_sdhci0(void)
261 #ifdef CONFIG_S3C_DEV_HSMMC
262 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
263 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
264 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
268 static inline void s5pv210_default_sdhci1(void)
270 #ifdef CONFIG_S3C_DEV_HSMMC1
271 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
272 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
273 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
277 static inline void s5pv210_default_sdhci2(void)
279 #ifdef CONFIG_S3C_DEV_HSMMC2
280 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
281 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
282 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
286 static inline void s5pv210_default_sdhci3(void)
288 #ifdef CONFIG_S3C_DEV_HSMMC3
289 s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
290 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
291 s3c_hsmmc3_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
296 static inline void s5pv210_default_sdhci0(void) { }
297 static inline void s5pv210_default_sdhci1(void) { }
298 static inline void s5pv210_default_sdhci2(void) { }
299 static inline void s5pv210_default_sdhci3(void) { }
301 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
303 /* S5PV310 SDHCI setup */
304 #ifdef CONFIG_S5PV310_SETUP_SDHCI
305 extern char *s5pv310_hsmmc_clksrcs[4];
307 extern void s5pv310_setup_sdhci_cfg_card(struct platform_device *dev,
310 struct mmc_card *card);
312 static inline void s5pv310_default_sdhci0(void)
314 #ifdef CONFIG_S3C_DEV_HSMMC
315 s3c_hsmmc0_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
316 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv310_setup_sdhci0_cfg_gpio;
317 s3c_hsmmc0_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
318 #endif /* CONFIG_S3C_DEV_HSMMC */
321 static inline void s5pv310_default_sdhci1(void)
323 #ifdef CONFIG_S3C_DEV_HSMMC1
324 s3c_hsmmc1_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
325 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv310_setup_sdhci1_cfg_gpio;
326 s3c_hsmmc1_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
327 #endif /* CONFIG_S3C_DEV_HSMMC1 */
330 static inline void s5pv310_default_sdhci2(void)
332 #ifdef CONFIG_S3C_DEV_HSMMC2
333 s3c_hsmmc2_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
334 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv310_setup_sdhci2_cfg_gpio;
335 s3c_hsmmc2_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
336 #endif /* CONFIG_S3C_DEV_HSMMC2 */
339 static inline void s5pv310_default_sdhci3(void)
341 #ifdef CONFIG_S3C_DEV_HSMMC3
342 s3c_hsmmc3_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
343 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv310_setup_sdhci3_cfg_gpio;
344 s3c_hsmmc3_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
345 #endif /* CONFIG_S3C_DEV_HSMMC3 */
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) { }
352 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
354 #endif /* __PLAT_S3C_SDHCI_H */