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 * 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.
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.
37 struct s3c_sdhci_platdata {
38 unsigned int max_width;
39 unsigned int host_caps;
41 char **clocks; /* set of clock sources */
43 void (*cfg_gpio)(struct platform_device *dev, int width);
44 void (*cfg_card)(struct platform_device *dev,
45 void __iomem *regbase,
47 struct mmc_card *card);
51 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
52 * @pd: Platform data to register to device.
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.
58 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
59 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
60 extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
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.
66 extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
67 extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
68 extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
70 /* Helper function availablity */
72 extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
73 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
74 extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
75 extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
76 extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
77 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
78 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
79 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
80 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
82 /* S3C6400 SDHCI setup */
84 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
85 extern char *s3c64xx_hsmmc_clksrcs[4];
87 #ifdef CONFIG_S3C_DEV_HSMMC
88 extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
91 struct mmc_card *card);
93 static inline void s3c6400_default_sdhci0(void)
95 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
96 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
97 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
101 static inline void s3c6400_default_sdhci0(void) { }
102 #endif /* CONFIG_S3C_DEV_HSMMC */
104 #ifdef CONFIG_S3C_DEV_HSMMC1
105 static inline void s3c6400_default_sdhci1(void)
107 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
108 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
109 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
112 static inline void s3c6400_default_sdhci1(void) { }
113 #endif /* CONFIG_S3C_DEV_HSMMC1 */
115 #ifdef CONFIG_S3C_DEV_HSMMC2
116 static inline void s3c6400_default_sdhci2(void)
118 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
119 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
120 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
123 static inline void s3c6400_default_sdhci2(void) { }
124 #endif /* CONFIG_S3C_DEV_HSMMC2 */
126 /* S3C6410 SDHCI setup */
128 extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
131 struct mmc_card *card);
133 #ifdef CONFIG_S3C_DEV_HSMMC
134 static inline void s3c6410_default_sdhci0(void)
136 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
137 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
138 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
141 static inline void s3c6410_default_sdhci0(void) { }
142 #endif /* CONFIG_S3C_DEV_HSMMC */
144 #ifdef CONFIG_S3C_DEV_HSMMC1
145 static inline void s3c6410_default_sdhci1(void)
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 = s3c6410_setup_sdhci_cfg_card;
152 static inline void s3c6410_default_sdhci1(void) { }
153 #endif /* CONFIG_S3C_DEV_HSMMC1 */
155 #ifdef CONFIG_S3C_DEV_HSMMC2
156 static inline void s3c6410_default_sdhci2(void)
158 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
159 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
160 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
163 static inline void s3c6410_default_sdhci2(void) { }
164 #endif /* CONFIG_S3C_DEV_HSMMC2 */
167 static inline void s3c6410_default_sdhci0(void) { }
168 static inline void s3c6410_default_sdhci1(void) { }
169 static inline void s3c6410_default_sdhci2(void) { }
170 static inline void s3c6400_default_sdhci0(void) { }
171 static inline void s3c6400_default_sdhci1(void) { }
172 static inline void s3c6400_default_sdhci2(void) { }
174 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
176 /* S5PC100 SDHCI setup */
178 #ifdef CONFIG_S5PC100_SETUP_SDHCI
179 extern char *s5pc100_hsmmc_clksrcs[4];
181 extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
184 struct mmc_card *card);
186 #ifdef CONFIG_S3C_DEV_HSMMC
187 static inline void s5pc100_default_sdhci0(void)
189 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
190 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
191 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
194 static inline void s5pc100_default_sdhci0(void) { }
195 #endif /* CONFIG_S3C_DEV_HSMMC */
197 #ifdef CONFIG_S3C_DEV_HSMMC1
198 static inline void s5pc100_default_sdhci1(void)
200 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
201 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
202 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
205 static inline void s5pc100_default_sdhci1(void) { }
206 #endif /* CONFIG_S3C_DEV_HSMMC1 */
208 #ifdef CONFIG_S3C_DEV_HSMMC2
209 static inline void s5pc100_default_sdhci2(void)
211 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
212 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
213 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
216 static inline void s5pc100_default_sdhci2(void) { }
217 #endif /* CONFIG_S3C_DEV_HSMMC1 */
221 static inline void s5pc100_default_sdhci0(void) { }
222 static inline void s5pc100_default_sdhci1(void) { }
223 static inline void s5pc100_default_sdhci2(void) { }
224 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
227 /* S5PC110 SDHCI setup */
228 #ifdef CONFIG_S5PV210_SETUP_SDHCI
229 extern char *s5pv210_hsmmc_clksrcs[4];
231 extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
234 struct mmc_card *card);
236 #ifdef CONFIG_S3C_DEV_HSMMC
237 static inline void s5pv210_default_sdhci0(void)
239 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
240 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
241 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
244 static inline void s5pv210_default_sdhci0(void) { }
245 #endif /* CONFIG_S3C_DEV_HSMMC */
247 #ifdef CONFIG_S3C_DEV_HSMMC1
248 static inline void s5pv210_default_sdhci1(void)
250 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
251 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
252 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
255 static inline void s5pv210_default_sdhci1(void) { }
256 #endif /* CONFIG_S3C_DEV_HSMMC1 */
258 #ifdef CONFIG_S3C_DEV_HSMMC2
259 static inline void s5pv210_default_sdhci2(void)
261 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
262 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
263 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
266 static inline void s5pv210_default_sdhci2(void) { }
267 #endif /* CONFIG_S3C_DEV_HSMMC2 */
270 static inline void s5pv210_default_sdhci0(void) { }
271 static inline void s5pv210_default_sdhci1(void) { }
272 static inline void s5pv210_default_sdhci2(void) { }
273 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
278 #endif /* __PLAT_S3C_SDHCI_H */