ARM: 7409/1: Do not call flush_cache_user_range with mmap_sem held
[linux/fpc-iii.git] / arch / arm / plat-samsung / include / plat / sdhci.h
blob058e09654fe80bbc8112e4d47901aa273aae38fb
1 /* linux/arch/arm/plat-samsung/include/plat/sdhci.h
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * Copyright 2008 Openmoko, Inc.
7 * Copyright 2008 Simtec Electronics
8 * http://armlinux.simtec.co.uk/
9 * Ben Dooks <ben@simtec.co.uk>
11 * S3C Platform - SDHCI (HSMMC) platform data definitions
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
18 #ifndef __PLAT_S3C_SDHCI_H
19 #define __PLAT_S3C_SDHCI_H __FILE__
21 struct platform_device;
22 struct mmc_host;
23 struct mmc_card;
24 struct mmc_ios;
26 enum cd_types {
27 S3C_SDHCI_CD_INTERNAL, /* use mmc internal CD line */
28 S3C_SDHCI_CD_EXTERNAL, /* use external callback */
29 S3C_SDHCI_CD_GPIO, /* use external gpio pin for CD line */
30 S3C_SDHCI_CD_NONE, /* no CD line, use polling to detect card */
31 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
34 enum clk_types {
35 S3C_SDHCI_CLK_DIV_INTERNAL, /* use mmc internal clock divider */
36 S3C_SDHCI_CLK_DIV_EXTERNAL, /* use external clock divider */
39 /**
40 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
41 * @max_width: The maximum number of data bits supported.
42 * @host_caps: Standard MMC host capabilities bit field.
43 * @cd_type: Type of Card Detection method (see cd_types enum above)
44 * @clk_type: Type of clock divider method (see clk_types enum above)
45 * @ext_cd_init: Initialize external card detect subsystem. Called on
46 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
47 * notify_func argument is a callback to the sdhci-s3c driver
48 * that triggers the card detection event. Callback arguments:
49 * dev is pointer to platform device of the host controller,
50 * state is new state of the card (0 - removed, 1 - inserted).
51 * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
52 * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
53 * notify_func argument is the same callback as for ext_cd_init.
54 * @ext_cd_gpio: gpio pin used for external CD line, valid only if
55 * cd_type == S3C_SDHCI_CD_GPIO
56 * @ext_cd_gpio_invert: invert values for external CD gpio line
57 * @cfg_gpio: Configure the GPIO for a specific card bit-width
58 * @cfg_card: Configure the interface for a specific card and speed. This
59 * is necessary the controllers and/or GPIO blocks require the
60 * changing of driver-strength and other controls dependent on
61 * the card and speed of operation.
63 * Initialisation data specific to either the machine or the platform
64 * for the device driver to use or call-back when configuring gpio or
65 * card speed information.
67 struct s3c_sdhci_platdata {
68 unsigned int max_width;
69 unsigned int host_caps;
70 enum cd_types cd_type;
71 enum clk_types clk_type;
73 char **clocks; /* set of clock sources */
75 int ext_cd_gpio;
76 bool ext_cd_gpio_invert;
77 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
78 int state));
79 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
80 int state));
82 void (*cfg_gpio)(struct platform_device *dev, int width);
83 void (*cfg_card)(struct platform_device *dev,
84 void __iomem *regbase,
85 struct mmc_ios *ios,
86 struct mmc_card *card);
89 /**
90 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
91 * @pd: Platform data to register to device.
93 * Register the given platform data for use withe S3C SDHCI device.
94 * The call will copy the platform data, so the board definitions can
95 * make the structure itself __initdata.
97 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
98 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
99 extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
100 extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
102 /* Default platform data, exported so that per-cpu initialisation can
103 * set the correct one when there are more than one cpu type selected.
106 extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
107 extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
108 extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
109 extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
111 /* Helper function availability */
113 extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
114 extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
115 extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
116 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
117 extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
118 extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
119 extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
120 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
121 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
122 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
123 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
124 extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
125 extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
126 extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
127 extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
128 extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
130 /* S3C2416 SDHCI setup */
132 #ifdef CONFIG_S3C2416_SETUP_SDHCI
133 extern char *s3c2416_hsmmc_clksrcs[4];
135 extern void s3c2416_setup_sdhci_cfg_card(struct platform_device *dev,
136 void __iomem *r,
137 struct mmc_ios *ios,
138 struct mmc_card *card);
140 static inline void s3c2416_default_sdhci0(void)
142 #ifdef CONFIG_S3C_DEV_HSMMC
143 s3c_hsmmc0_def_platdata.clocks = s3c2416_hsmmc_clksrcs;
144 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
145 s3c_hsmmc0_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card;
146 #endif /* CONFIG_S3C_DEV_HSMMC */
149 static inline void s3c2416_default_sdhci1(void)
151 #ifdef CONFIG_S3C_DEV_HSMMC1
152 s3c_hsmmc1_def_platdata.clocks = s3c2416_hsmmc_clksrcs;
153 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
154 s3c_hsmmc1_def_platdata.cfg_card = s3c2416_setup_sdhci_cfg_card;
155 #endif /* CONFIG_S3C_DEV_HSMMC1 */
158 #else
159 static inline void s3c2416_default_sdhci0(void) { }
160 static inline void s3c2416_default_sdhci1(void) { }
162 #endif /* CONFIG_S3C2416_SETUP_SDHCI */
163 /* S3C64XX SDHCI setup */
165 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
166 extern char *s3c64xx_hsmmc_clksrcs[4];
168 extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
169 void __iomem *r,
170 struct mmc_ios *ios,
171 struct mmc_card *card);
173 static inline void s3c6400_default_sdhci0(void)
175 #ifdef CONFIG_S3C_DEV_HSMMC
176 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
177 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
178 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
179 #endif
182 static inline void s3c6400_default_sdhci1(void)
184 #ifdef CONFIG_S3C_DEV_HSMMC1
185 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
186 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
187 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
188 #endif
191 static inline void s3c6400_default_sdhci2(void)
193 #ifdef CONFIG_S3C_DEV_HSMMC2
194 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
195 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
196 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
197 #endif
200 extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
201 void __iomem *r,
202 struct mmc_ios *ios,
203 struct mmc_card *card);
205 static inline void s3c6410_default_sdhci0(void)
207 #ifdef CONFIG_S3C_DEV_HSMMC
208 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
209 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
210 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
211 #endif
214 static inline void s3c6410_default_sdhci1(void)
216 #ifdef CONFIG_S3C_DEV_HSMMC1
217 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
218 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
219 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
220 #endif
223 static inline void s3c6410_default_sdhci2(void)
225 #ifdef CONFIG_S3C_DEV_HSMMC2
226 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
227 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
228 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
229 #endif
232 #else
233 static inline void s3c6410_default_sdhci0(void) { }
234 static inline void s3c6410_default_sdhci1(void) { }
235 static inline void s3c6410_default_sdhci2(void) { }
236 static inline void s3c6400_default_sdhci0(void) { }
237 static inline void s3c6400_default_sdhci1(void) { }
238 static inline void s3c6400_default_sdhci2(void) { }
240 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
242 /* S5PC100 SDHCI setup */
244 #ifdef CONFIG_S5PC100_SETUP_SDHCI
245 extern char *s5pc100_hsmmc_clksrcs[4];
247 extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
248 void __iomem *r,
249 struct mmc_ios *ios,
250 struct mmc_card *card);
252 static inline void s5pc100_default_sdhci0(void)
254 #ifdef CONFIG_S3C_DEV_HSMMC
255 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
256 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
257 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
258 #endif
261 static inline void s5pc100_default_sdhci1(void)
263 #ifdef CONFIG_S3C_DEV_HSMMC1
264 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
265 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
266 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
267 #endif
270 static inline void s5pc100_default_sdhci2(void)
272 #ifdef CONFIG_S3C_DEV_HSMMC2
273 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
274 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
275 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
276 #endif
279 #else
280 static inline void s5pc100_default_sdhci0(void) { }
281 static inline void s5pc100_default_sdhci1(void) { }
282 static inline void s5pc100_default_sdhci2(void) { }
284 #endif /* CONFIG_S5PC100_SETUP_SDHCI */
286 /* S5PV210 SDHCI setup */
288 #ifdef CONFIG_S5PV210_SETUP_SDHCI
289 extern char *s5pv210_hsmmc_clksrcs[4];
291 extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
292 void __iomem *r,
293 struct mmc_ios *ios,
294 struct mmc_card *card);
296 static inline void s5pv210_default_sdhci0(void)
298 #ifdef CONFIG_S3C_DEV_HSMMC
299 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
300 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
301 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
302 #endif
305 static inline void s5pv210_default_sdhci1(void)
307 #ifdef CONFIG_S3C_DEV_HSMMC1
308 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
309 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
310 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
311 #endif
314 static inline void s5pv210_default_sdhci2(void)
316 #ifdef CONFIG_S3C_DEV_HSMMC2
317 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
318 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
319 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
320 #endif
323 static inline void s5pv210_default_sdhci3(void)
325 #ifdef CONFIG_S3C_DEV_HSMMC3
326 s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
327 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
328 s3c_hsmmc3_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
329 #endif
332 #else
333 static inline void s5pv210_default_sdhci0(void) { }
334 static inline void s5pv210_default_sdhci1(void) { }
335 static inline void s5pv210_default_sdhci2(void) { }
336 static inline void s5pv210_default_sdhci3(void) { }
338 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
340 /* EXYNOS4 SDHCI setup */
341 #ifdef CONFIG_EXYNOS4_SETUP_SDHCI
342 extern char *exynos4_hsmmc_clksrcs[4];
344 extern void exynos4_setup_sdhci_cfg_card(struct platform_device *dev,
345 void __iomem *r,
346 struct mmc_ios *ios,
347 struct mmc_card *card);
349 static inline void exynos4_default_sdhci0(void)
351 #ifdef CONFIG_S3C_DEV_HSMMC
352 s3c_hsmmc0_def_platdata.clocks = exynos4_hsmmc_clksrcs;
353 s3c_hsmmc0_def_platdata.cfg_gpio = exynos4_setup_sdhci0_cfg_gpio;
354 s3c_hsmmc0_def_platdata.cfg_card = exynos4_setup_sdhci_cfg_card;
355 #endif
358 static inline void exynos4_default_sdhci1(void)
360 #ifdef CONFIG_S3C_DEV_HSMMC1
361 s3c_hsmmc1_def_platdata.clocks = exynos4_hsmmc_clksrcs;
362 s3c_hsmmc1_def_platdata.cfg_gpio = exynos4_setup_sdhci1_cfg_gpio;
363 s3c_hsmmc1_def_platdata.cfg_card = exynos4_setup_sdhci_cfg_card;
364 #endif
367 static inline void exynos4_default_sdhci2(void)
369 #ifdef CONFIG_S3C_DEV_HSMMC2
370 s3c_hsmmc2_def_platdata.clocks = exynos4_hsmmc_clksrcs;
371 s3c_hsmmc2_def_platdata.cfg_gpio = exynos4_setup_sdhci2_cfg_gpio;
372 s3c_hsmmc2_def_platdata.cfg_card = exynos4_setup_sdhci_cfg_card;
373 #endif
376 static inline void exynos4_default_sdhci3(void)
378 #ifdef CONFIG_S3C_DEV_HSMMC3
379 s3c_hsmmc3_def_platdata.clocks = exynos4_hsmmc_clksrcs;
380 s3c_hsmmc3_def_platdata.cfg_gpio = exynos4_setup_sdhci3_cfg_gpio;
381 s3c_hsmmc3_def_platdata.cfg_card = exynos4_setup_sdhci_cfg_card;
382 #endif
385 #else
386 static inline void exynos4_default_sdhci0(void) { }
387 static inline void exynos4_default_sdhci1(void) { }
388 static inline void exynos4_default_sdhci2(void) { }
389 static inline void exynos4_default_sdhci3(void) { }
391 #endif /* CONFIG_EXYNOS4_SETUP_SDHCI */
393 #endif /* __PLAT_S3C_SDHCI_H */