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 s3c6400_default_sdhci0(void) { }
170 static inline void s3c6400_default_sdhci1(void) { }
172 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
174 /* S5PC100 SDHCI setup */
176 #ifdef CONFIG_S5PC100_SETUP_SDHCI
177 extern char *s5pc100_hsmmc_clksrcs[4];
179 extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
182 struct mmc_card *card);
184 #ifdef CONFIG_S3C_DEV_HSMMC
185 static inline void s5pc100_default_sdhci0(void)
187 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
188 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
189 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
192 static inline void s5pc100_default_sdhci0(void) { }
193 #endif /* CONFIG_S3C_DEV_HSMMC */
195 #ifdef CONFIG_S3C_DEV_HSMMC1
196 static inline void s5pc100_default_sdhci1(void)
198 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
199 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
200 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
203 static inline void s5pc100_default_sdhci1(void) { }
204 #endif /* CONFIG_S3C_DEV_HSMMC1 */
206 #ifdef CONFIG_S3C_DEV_HSMMC2
207 static inline void s5pc100_default_sdhci2(void)
209 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
210 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
211 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
214 static inline void s5pc100_default_sdhci2(void) { }
215 #endif /* CONFIG_S3C_DEV_HSMMC1 */
219 static inline void s5pc100_default_sdhci0(void) { }
220 static inline void s5pc100_default_sdhci1(void) { }
221 static inline void s5pc100_default_sdhci2(void) { }
222 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
225 /* S5PC110 SDHCI setup */
226 #ifdef CONFIG_S5PV210_SETUP_SDHCI
227 extern char *s5pv210_hsmmc_clksrcs[4];
229 extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
232 struct mmc_card *card);
234 #ifdef CONFIG_S3C_DEV_HSMMC
235 static inline void s5pv210_default_sdhci0(void)
237 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
238 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
239 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
242 static inline void s5pc100_default_sdhci0(void) { }
243 #endif /* CONFIG_S3C_DEV_HSMMC */
245 #ifdef CONFIG_S3C_DEV_HSMMC1
246 static inline void s5pv210_default_sdhci1(void)
248 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
249 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
250 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
253 static inline void s5pv210_default_sdhci1(void) { }
254 #endif /* CONFIG_S3C_DEV_HSMMC1 */
256 #ifdef CONFIG_S3C_DEV_HSMMC2
257 static inline void s5pv210_default_sdhci2(void)
259 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
260 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
261 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
264 static inline void s5pv210_default_sdhci2(void) { }
265 #endif /* CONFIG_S3C_DEV_HSMMC2 */
268 static inline void s5pv210_default_sdhci0(void) { }
269 static inline void s5pv210_default_sdhci1(void) { }
270 static inline void s5pv210_default_sdhci2(void) { }
271 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
276 #endif /* __PLAT_S3C_SDHCI_H */