Merge tag 'power-exynos' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux...
[deliverable/linux.git] / arch / arm / plat-samsung / include / plat / sdhci.h
1 /* linux/arch/arm/plat-samsung/include/plat/sdhci.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Copyright 2008 Openmoko, Inc.
7 * Copyright 2008 Simtec Electronics
8 * http://armlinux.simtec.co.uk/
9 * Ben Dooks <ben@simtec.co.uk>
10 *
11 * S3C Platform - SDHCI (HSMMC) platform data definitions
12 *
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.
16 */
17
18 #ifndef __PLAT_S3C_SDHCI_H
19 #define __PLAT_S3C_SDHCI_H __FILE__
20
21 #include <linux/platform_data/mmc-sdhci-s3c.h>
22 #include <plat/devs.h>
23
24 /* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
25 * @pd: The default platform data for this device.
26 * @set: Pointer to the platform data to fill in.
27 */
28 extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
29 struct s3c_sdhci_platdata *set);
30
31 /**
32 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
33 * @pd: Platform data to register to device.
34 *
35 * Register the given platform data for use withe S3C SDHCI device.
36 * The call will copy the platform data, so the board definitions can
37 * make the structure itself __initdata.
38 */
39 extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
40 extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
41 extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
42 extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
43
44 /* Default platform data, exported so that per-cpu initialisation can
45 * set the correct one when there are more than one cpu type selected.
46 */
47
48 extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
49 extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
50 extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
51 extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
52
53 /* Helper function availability */
54
55 extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
56 extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
57 extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
58 extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
59 extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
60 extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
61 extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
62 extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
63 extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
64 extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
65 extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
66 extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
67 extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
68
69 /* S3C2416 SDHCI setup */
70
71 #ifdef CONFIG_S3C2416_SETUP_SDHCI
72 static inline void s3c2416_default_sdhci0(void)
73 {
74 #ifdef CONFIG_S3C_DEV_HSMMC
75 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
76 #endif /* CONFIG_S3C_DEV_HSMMC */
77 }
78
79 static inline void s3c2416_default_sdhci1(void)
80 {
81 #ifdef CONFIG_S3C_DEV_HSMMC1
82 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
83 #endif /* CONFIG_S3C_DEV_HSMMC1 */
84 }
85
86 #else
87 static inline void s3c2416_default_sdhci0(void) { }
88 static inline void s3c2416_default_sdhci1(void) { }
89
90 #endif /* CONFIG_S3C2416_SETUP_SDHCI */
91
92 /* S3C64XX SDHCI setup */
93
94 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
95 static inline void s3c6400_default_sdhci0(void)
96 {
97 #ifdef CONFIG_S3C_DEV_HSMMC
98 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
99 #endif
100 }
101
102 static inline void s3c6400_default_sdhci1(void)
103 {
104 #ifdef CONFIG_S3C_DEV_HSMMC1
105 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
106 #endif
107 }
108
109 static inline void s3c6400_default_sdhci2(void)
110 {
111 #ifdef CONFIG_S3C_DEV_HSMMC2
112 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
113 #endif
114 }
115
116 static inline void s3c6410_default_sdhci0(void)
117 {
118 #ifdef CONFIG_S3C_DEV_HSMMC
119 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
120 #endif
121 }
122
123 static inline void s3c6410_default_sdhci1(void)
124 {
125 #ifdef CONFIG_S3C_DEV_HSMMC1
126 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
127 #endif
128 }
129
130 static inline void s3c6410_default_sdhci2(void)
131 {
132 #ifdef CONFIG_S3C_DEV_HSMMC2
133 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
134 #endif
135 }
136
137 #else
138 static inline void s3c6410_default_sdhci0(void) { }
139 static inline void s3c6410_default_sdhci1(void) { }
140 static inline void s3c6410_default_sdhci2(void) { }
141 static inline void s3c6400_default_sdhci0(void) { }
142 static inline void s3c6400_default_sdhci1(void) { }
143 static inline void s3c6400_default_sdhci2(void) { }
144
145 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
146
147 /* S5PV210 SDHCI setup */
148
149 #ifdef CONFIG_S5PV210_SETUP_SDHCI
150 static inline void s5pv210_default_sdhci0(void)
151 {
152 #ifdef CONFIG_S3C_DEV_HSMMC
153 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
154 #endif
155 }
156
157 static inline void s5pv210_default_sdhci1(void)
158 {
159 #ifdef CONFIG_S3C_DEV_HSMMC1
160 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
161 #endif
162 }
163
164 static inline void s5pv210_default_sdhci2(void)
165 {
166 #ifdef CONFIG_S3C_DEV_HSMMC2
167 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
168 #endif
169 }
170
171 static inline void s5pv210_default_sdhci3(void)
172 {
173 #ifdef CONFIG_S3C_DEV_HSMMC3
174 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
175 #endif
176 }
177
178 #else
179 static inline void s5pv210_default_sdhci0(void) { }
180 static inline void s5pv210_default_sdhci1(void) { }
181 static inline void s5pv210_default_sdhci2(void) { }
182 static inline void s5pv210_default_sdhci3(void) { }
183
184 #endif /* CONFIG_S5PV210_SETUP_SDHCI */
185
186 static inline void s3c_sdhci_setname(int id, char *name)
187 {
188 switch (id) {
189 #ifdef CONFIG_S3C_DEV_HSMMC
190 case 0:
191 s3c_device_hsmmc0.name = name;
192 break;
193 #endif
194 #ifdef CONFIG_S3C_DEV_HSMMC1
195 case 1:
196 s3c_device_hsmmc1.name = name;
197 break;
198 #endif
199 #ifdef CONFIG_S3C_DEV_HSMMC2
200 case 2:
201 s3c_device_hsmmc2.name = name;
202 break;
203 #endif
204 #ifdef CONFIG_S3C_DEV_HSMMC3
205 case 3:
206 s3c_device_hsmmc3.name = name;
207 break;
208 #endif
209 default:
210 break;
211 }
212 }
213 #endif /* __PLAT_S3C_SDHCI_H */
This page took 0.03414 seconds and 5 git commands to generate.