ARM: Merge for-2635-4/s5pv210-boards
[deliverable/linux.git] / arch / arm / plat-samsung / include / plat / sdhci.h
CommitLineData
5cc7fd88
BD
1/* linux/arch/arm/plat-s3c/include/plat/sdhci.h
2 *
3 * Copyright 2008 Openmoko, Inc.
4 * Copyright 2008 Simtec Electronics
5 * http://armlinux.simtec.co.uk/
6 * Ben Dooks <ben@simtec.co.uk>
7 *
8 * S3C Platform - SDHCI (HSMMC) platform data definitions
9 *
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.
13*/
14
15#ifndef __PLAT_S3C_SDHCI_H
16#define __PLAT_S3C_SDHCI_H __FILE__
17
18struct platform_device;
19struct mmc_host;
20struct mmc_card;
21struct mmc_ios;
22
23/**
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.
32 *
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.
36*/
37struct s3c_sdhci_platdata {
38 unsigned int max_width;
39 unsigned int host_caps;
40
41 char **clocks; /* set of clock sources */
42
43 void (*cfg_gpio)(struct platform_device *dev, int width);
44 void (*cfg_card)(struct platform_device *dev,
45 void __iomem *regbase,
46 struct mmc_ios *ios,
47 struct mmc_card *card);
48};
49
50/**
51 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
52 * @pd: Platform data to register to device.
53 *
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.
57 */
58extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
a2205cd2 59extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
86cd4f5f 60extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
5cc7fd88
BD
61
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.
64*/
65
a2205cd2
BD
66extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
67extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
86cd4f5f 68extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
5cc7fd88
BD
69
70/* Helper function availablity */
71
4faf6867
BD
72extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
73extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
86cd4f5f
KP
74extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
75extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
76extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
92b118f6 77extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
e6f66a9f
MS
78extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
79extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
80extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
4faf6867
BD
81
82/* S3C6400 SDHCI setup */
83
2f6c2ac1
BD
84#ifdef CONFIG_S3C64XX_SETUP_SDHCI
85extern char *s3c64xx_hsmmc_clksrcs[4];
4faf6867
BD
86
87#ifdef CONFIG_S3C_DEV_HSMMC
88extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
89 void __iomem *r,
90 struct mmc_ios *ios,
91 struct mmc_card *card);
92
93static inline void s3c6400_default_sdhci0(void)
94{
2f6c2ac1 95 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
4faf6867
BD
96 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
97 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
98}
99
100#else
101static inline void s3c6400_default_sdhci0(void) { }
102#endif /* CONFIG_S3C_DEV_HSMMC */
103
104#ifdef CONFIG_S3C_DEV_HSMMC1
105static inline void s3c6400_default_sdhci1(void)
106{
2f6c2ac1 107 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
4faf6867
BD
108 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
109 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
110}
111#else
112static inline void s3c6400_default_sdhci1(void) { }
113#endif /* CONFIG_S3C_DEV_HSMMC1 */
114
92b118f6
MC
115#ifdef CONFIG_S3C_DEV_HSMMC2
116static inline void s3c6400_default_sdhci2(void)
117{
2f6c2ac1 118 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
92b118f6
MC
119 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
120 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
121}
122#else
123static inline void s3c6400_default_sdhci2(void) { }
124#endif /* CONFIG_S3C_DEV_HSMMC2 */
125
4faf6867
BD
126/* S3C6410 SDHCI setup */
127
2f6c2ac1
BD
128extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
129 void __iomem *r,
130 struct mmc_ios *ios,
131 struct mmc_card *card);
5cc7fd88 132
713e9ded 133#ifdef CONFIG_S3C_DEV_HSMMC
5cc7fd88
BD
134static inline void s3c6410_default_sdhci0(void)
135{
2f6c2ac1 136 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
4faf6867 137 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
2f6c2ac1 138 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
5cc7fd88 139}
713e9ded
BD
140#else
141static inline void s3c6410_default_sdhci0(void) { }
142#endif /* CONFIG_S3C_DEV_HSMMC */
a2205cd2 143
713e9ded 144#ifdef CONFIG_S3C_DEV_HSMMC1
a2205cd2
BD
145static inline void s3c6410_default_sdhci1(void)
146{
2f6c2ac1 147 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
4faf6867 148 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
2f6c2ac1 149 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
a2205cd2 150}
713e9ded
BD
151#else
152static inline void s3c6410_default_sdhci1(void) { }
153#endif /* CONFIG_S3C_DEV_HSMMC1 */
154
92b118f6
MC
155#ifdef CONFIG_S3C_DEV_HSMMC2
156static inline void s3c6410_default_sdhci2(void)
157{
2f6c2ac1 158 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
92b118f6 159 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
2f6c2ac1 160 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
92b118f6
MC
161}
162#else
163static inline void s3c6410_default_sdhci2(void) { }
164#endif /* CONFIG_S3C_DEV_HSMMC2 */
165
5cc7fd88
BD
166#else
167static inline void s3c6410_default_sdhci0(void) { }
a2205cd2 168static inline void s3c6410_default_sdhci1(void) { }
2f6c2ac1
BD
169static inline void s3c6400_default_sdhci0(void) { }
170static inline void s3c6400_default_sdhci1(void) { }
171
172#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
5cc7fd88 173
86cd4f5f
KP
174/* S5PC100 SDHCI setup */
175
176#ifdef CONFIG_S5PC100_SETUP_SDHCI
177extern char *s5pc100_hsmmc_clksrcs[4];
178
179extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
180 void __iomem *r,
181 struct mmc_ios *ios,
182 struct mmc_card *card);
183
184#ifdef CONFIG_S3C_DEV_HSMMC
185static inline void s5pc100_default_sdhci0(void)
186{
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;
190}
191#else
192static inline void s5pc100_default_sdhci0(void) { }
193#endif /* CONFIG_S3C_DEV_HSMMC */
194
195#ifdef CONFIG_S3C_DEV_HSMMC1
196static inline void s5pc100_default_sdhci1(void)
197{
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;
201}
202#else
203static inline void s5pc100_default_sdhci1(void) { }
204#endif /* CONFIG_S3C_DEV_HSMMC1 */
205
206#ifdef CONFIG_S3C_DEV_HSMMC2
207static inline void s5pc100_default_sdhci2(void)
208{
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;
212}
213#else
214static inline void s5pc100_default_sdhci2(void) { }
215#endif /* CONFIG_S3C_DEV_HSMMC1 */
216
217
218#else
219static inline void s5pc100_default_sdhci0(void) { }
220static inline void s5pc100_default_sdhci1(void) { }
221static inline void s5pc100_default_sdhci2(void) { }
222#endif /* CONFIG_S5PC100_SETUP_SDHCI */
223
e6f66a9f
MS
224
225/* S5PC110 SDHCI setup */
226#ifdef CONFIG_S5PV210_SETUP_SDHCI
227extern char *s5pv210_hsmmc_clksrcs[4];
228
229extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
230 void __iomem *r,
231 struct mmc_ios *ios,
232 struct mmc_card *card);
233
234#ifdef CONFIG_S3C_DEV_HSMMC
235static inline void s5pv210_default_sdhci0(void)
236{
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;
240}
241#else
242static inline void s5pc100_default_sdhci0(void) { }
243#endif /* CONFIG_S3C_DEV_HSMMC */
244
245#ifdef CONFIG_S3C_DEV_HSMMC1
246static inline void s5pv210_default_sdhci1(void)
247{
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;
251}
252#else
253static inline void s5pv210_default_sdhci1(void) { }
254#endif /* CONFIG_S3C_DEV_HSMMC1 */
255
256#ifdef CONFIG_S3C_DEV_HSMMC2
257static inline void s5pv210_default_sdhci2(void)
258{
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;
262}
263#else
264static inline void s5pv210_default_sdhci2(void) { }
265#endif /* CONFIG_S3C_DEV_HSMMC2 */
266
267#else
268static inline void s5pv210_default_sdhci0(void) { }
269static inline void s5pv210_default_sdhci1(void) { }
270static inline void s5pv210_default_sdhci2(void) { }
271#endif /* CONFIG_S5PC100_SETUP_SDHCI */
272
273
274
275
5cc7fd88 276#endif /* __PLAT_S3C_SDHCI_H */
This page took 0.115172 seconds and 5 git commands to generate.