aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung/include/plat/sdhci.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-samsung/include/plat/sdhci.h')
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h127
1 files changed, 70 insertions, 57 deletions
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 016674fa20dd..30844c263d03 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -20,10 +20,31 @@ struct mmc_host;
20struct mmc_card; 20struct mmc_card;
21struct mmc_ios; 21struct mmc_ios;
22 22
23enum cd_types {
24 S3C_SDHCI_CD_INTERNAL, /* use mmc internal CD line */
25 S3C_SDHCI_CD_EXTERNAL, /* use external callback */
26 S3C_SDHCI_CD_GPIO, /* use external gpio pin for CD line */
27 S3C_SDHCI_CD_NONE, /* no CD line, use polling to detect card */
28 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
29};
30
23/** 31/**
24 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI 32 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
25 * @max_width: The maximum number of data bits supported. 33 * @max_width: The maximum number of data bits supported.
26 * @host_caps: Standard MMC host capabilities bit field. 34 * @host_caps: Standard MMC host capabilities bit field.
35 * @cd_type: Type of Card Detection method (see cd_types enum above)
36 * @ext_cd_init: Initialize external card detect subsystem. Called on
37 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
38 * notify_func argument is a callback to the sdhci-s3c driver
39 * that triggers the card detection event. Callback arguments:
40 * dev is pointer to platform device of the host controller,
41 * state is new state of the card (0 - removed, 1 - inserted).
42 * @ext_cd_cleanup: Cleanup external card detect subsystem. Called on
43 * sdhci-s3c driver remove when cd_type == S3C_SDHCI_CD_EXTERNAL.
44 * notify_func argument is the same callback as for ext_cd_init.
45 * @ext_cd_gpio: gpio pin used for external CD line, valid only if
46 * cd_type == S3C_SDHCI_CD_GPIO
47 * @ext_cd_gpio_invert: invert values for external CD gpio line
27 * @cfg_gpio: Configure the GPIO for a specific card bit-width 48 * @cfg_gpio: Configure the GPIO for a specific card bit-width
28 * @cfg_card: Configure the interface for a specific card and speed. This 49 * @cfg_card: Configure the interface for a specific card and speed. This
29 * is necessary the controllers and/or GPIO blocks require the 50 * is necessary the controllers and/or GPIO blocks require the
@@ -37,9 +58,17 @@ struct mmc_ios;
37struct s3c_sdhci_platdata { 58struct s3c_sdhci_platdata {
38 unsigned int max_width; 59 unsigned int max_width;
39 unsigned int host_caps; 60 unsigned int host_caps;
61 enum cd_types cd_type;
40 62
41 char **clocks; /* set of clock sources */ 63 char **clocks; /* set of clock sources */
42 64
65 int ext_cd_gpio;
66 bool ext_cd_gpio_invert;
67 int (*ext_cd_init)(void (*notify_func)(struct platform_device *,
68 int state));
69 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,
70 int state));
71
43 void (*cfg_gpio)(struct platform_device *dev, int width); 72 void (*cfg_gpio)(struct platform_device *dev, int width);
44 void (*cfg_card)(struct platform_device *dev, 73 void (*cfg_card)(struct platform_device *dev,
45 void __iomem *regbase, 74 void __iomem *regbase,
@@ -58,6 +87,7 @@ struct s3c_sdhci_platdata {
58extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd); 87extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
59extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd); 88extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
60extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd); 89extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
90extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
61 91
62/* Default platform data, exported so that per-cpu initialisation can 92/* Default platform data, exported so that per-cpu initialisation can
63 * set the correct one when there are more than one cpu type selected. 93 * set the correct one when there are more than one cpu type selected.
@@ -66,6 +96,7 @@ extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
66extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; 96extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
67extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata; 97extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
68extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata; 98extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
99extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
69 100
70/* Helper function availablity */ 101/* Helper function availablity */
71 102
@@ -78,13 +109,13 @@ extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
78extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w); 109extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
79extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 110extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
80extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 111extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
112extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
81 113
82/* S3C6400 SDHCI setup */ 114/* S3C64XX SDHCI setup */
83 115
84#ifdef CONFIG_S3C64XX_SETUP_SDHCI 116#ifdef CONFIG_S3C64XX_SETUP_SDHCI
85extern char *s3c64xx_hsmmc_clksrcs[4]; 117extern char *s3c64xx_hsmmc_clksrcs[4];
86 118
87#ifdef CONFIG_S3C_DEV_HSMMC
88extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev, 119extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
89 void __iomem *r, 120 void __iomem *r,
90 struct mmc_ios *ios, 121 struct mmc_ios *ios,
@@ -92,76 +123,62 @@ extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
92 123
93static inline void s3c6400_default_sdhci0(void) 124static inline void s3c6400_default_sdhci0(void)
94{ 125{
126#ifdef CONFIG_S3C_DEV_HSMMC
95 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; 127 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
96 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; 128 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
97 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card; 129 s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
130#endif
98} 131}
99 132
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) 133static inline void s3c6400_default_sdhci1(void)
106{ 134{
135#ifdef CONFIG_S3C_DEV_HSMMC1
107 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; 136 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
108 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; 137 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
109 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card; 138 s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
139#endif
110} 140}
111#else
112static inline void s3c6400_default_sdhci1(void) { }
113#endif /* CONFIG_S3C_DEV_HSMMC1 */
114 141
115#ifdef CONFIG_S3C_DEV_HSMMC2
116static inline void s3c6400_default_sdhci2(void) 142static inline void s3c6400_default_sdhci2(void)
117{ 143{
144#ifdef CONFIG_S3C_DEV_HSMMC2
118 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; 145 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
119 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; 146 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
120 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card; 147 s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
148#endif
121} 149}
122#else
123static inline void s3c6400_default_sdhci2(void) { }
124#endif /* CONFIG_S3C_DEV_HSMMC2 */
125
126/* S3C6410 SDHCI setup */
127 150
128extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev, 151extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
129 void __iomem *r, 152 void __iomem *r,
130 struct mmc_ios *ios, 153 struct mmc_ios *ios,
131 struct mmc_card *card); 154 struct mmc_card *card);
132 155
133#ifdef CONFIG_S3C_DEV_HSMMC
134static inline void s3c6410_default_sdhci0(void) 156static inline void s3c6410_default_sdhci0(void)
135{ 157{
158#ifdef CONFIG_S3C_DEV_HSMMC
136 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; 159 s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
137 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; 160 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
138 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card; 161 s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
162#endif
139} 163}
140#else
141static inline void s3c6410_default_sdhci0(void) { }
142#endif /* CONFIG_S3C_DEV_HSMMC */
143 164
144#ifdef CONFIG_S3C_DEV_HSMMC1
145static inline void s3c6410_default_sdhci1(void) 165static inline void s3c6410_default_sdhci1(void)
146{ 166{
167#ifdef CONFIG_S3C_DEV_HSMMC1
147 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; 168 s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
148 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; 169 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
149 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card; 170 s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
171#endif
150} 172}
151#else
152static inline void s3c6410_default_sdhci1(void) { }
153#endif /* CONFIG_S3C_DEV_HSMMC1 */
154 173
155#ifdef CONFIG_S3C_DEV_HSMMC2
156static inline void s3c6410_default_sdhci2(void) 174static inline void s3c6410_default_sdhci2(void)
157{ 175{
176#ifdef CONFIG_S3C_DEV_HSMMC2
158 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs; 177 s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
159 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; 178 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
160 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card; 179 s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
180#endif
161} 181}
162#else
163static inline void s3c6410_default_sdhci2(void) { }
164#endif /* CONFIG_S3C_DEV_HSMMC2 */
165 182
166#else 183#else
167static inline void s3c6410_default_sdhci0(void) { } 184static inline void s3c6410_default_sdhci0(void) { }
@@ -183,48 +200,42 @@ extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
183 struct mmc_ios *ios, 200 struct mmc_ios *ios,
184 struct mmc_card *card); 201 struct mmc_card *card);
185 202
186#ifdef CONFIG_S3C_DEV_HSMMC
187static inline void s5pc100_default_sdhci0(void) 203static inline void s5pc100_default_sdhci0(void)
188{ 204{
205#ifdef CONFIG_S3C_DEV_HSMMC
189 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs; 206 s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
190 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio; 207 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
191 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; 208 s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
209#endif
192} 210}
193#else
194static inline void s5pc100_default_sdhci0(void) { }
195#endif /* CONFIG_S3C_DEV_HSMMC */
196 211
197#ifdef CONFIG_S3C_DEV_HSMMC1
198static inline void s5pc100_default_sdhci1(void) 212static inline void s5pc100_default_sdhci1(void)
199{ 213{
214#ifdef CONFIG_S3C_DEV_HSMMC1
200 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs; 215 s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
201 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio; 216 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
202 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; 217 s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
218#endif
203} 219}
204#else
205static inline void s5pc100_default_sdhci1(void) { }
206#endif /* CONFIG_S3C_DEV_HSMMC1 */
207 220
208#ifdef CONFIG_S3C_DEV_HSMMC2
209static inline void s5pc100_default_sdhci2(void) 221static inline void s5pc100_default_sdhci2(void)
210{ 222{
223#ifdef CONFIG_S3C_DEV_HSMMC2
211 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs; 224 s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
212 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio; 225 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
213 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; 226 s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
227#endif
214} 228}
215#else
216static inline void s5pc100_default_sdhci2(void) { }
217#endif /* CONFIG_S3C_DEV_HSMMC1 */
218
219 229
220#else 230#else
221static inline void s5pc100_default_sdhci0(void) { } 231static inline void s5pc100_default_sdhci0(void) { }
222static inline void s5pc100_default_sdhci1(void) { } 232static inline void s5pc100_default_sdhci1(void) { }
223static inline void s5pc100_default_sdhci2(void) { } 233static inline void s5pc100_default_sdhci2(void) { }
234
224#endif /* CONFIG_S5PC100_SETUP_SDHCI */ 235#endif /* CONFIG_S5PC100_SETUP_SDHCI */
225 236
237/* S5PV210 SDHCI setup */
226 238
227/* S5PC110 SDHCI setup */
228#ifdef CONFIG_S5PV210_SETUP_SDHCI 239#ifdef CONFIG_S5PV210_SETUP_SDHCI
229extern char *s5pv210_hsmmc_clksrcs[4]; 240extern char *s5pv210_hsmmc_clksrcs[4];
230 241
@@ -233,46 +244,48 @@ extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
233 struct mmc_ios *ios, 244 struct mmc_ios *ios,
234 struct mmc_card *card); 245 struct mmc_card *card);
235 246
236#ifdef CONFIG_S3C_DEV_HSMMC
237static inline void s5pv210_default_sdhci0(void) 247static inline void s5pv210_default_sdhci0(void)
238{ 248{
249#ifdef CONFIG_S3C_DEV_HSMMC
239 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs; 250 s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
240 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio; 251 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
241 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card; 252 s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
253#endif
242} 254}
243#else
244static inline void s5pv210_default_sdhci0(void) { }
245#endif /* CONFIG_S3C_DEV_HSMMC */
246 255
247#ifdef CONFIG_S3C_DEV_HSMMC1
248static inline void s5pv210_default_sdhci1(void) 256static inline void s5pv210_default_sdhci1(void)
249{ 257{
258#ifdef CONFIG_S3C_DEV_HSMMC1
250 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs; 259 s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
251 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio; 260 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
252 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card; 261 s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
262#endif
253} 263}
254#else
255static inline void s5pv210_default_sdhci1(void) { }
256#endif /* CONFIG_S3C_DEV_HSMMC1 */
257 264
258#ifdef CONFIG_S3C_DEV_HSMMC2
259static inline void s5pv210_default_sdhci2(void) 265static inline void s5pv210_default_sdhci2(void)
260{ 266{
267#ifdef CONFIG_S3C_DEV_HSMMC2
261 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs; 268 s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
262 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio; 269 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
263 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card; 270 s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
271#endif
272}
273
274static inline void s5pv210_default_sdhci3(void)
275{
276#ifdef CONFIG_S3C_DEV_HSMMC3
277 s3c_hsmmc3_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
278 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
279 s3c_hsmmc3_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
280#endif
264} 281}
265#else
266static inline void s5pv210_default_sdhci2(void) { }
267#endif /* CONFIG_S3C_DEV_HSMMC2 */
268 282
269#else 283#else
270static inline void s5pv210_default_sdhci0(void) { } 284static inline void s5pv210_default_sdhci0(void) { }
271static inline void s5pv210_default_sdhci1(void) { } 285static inline void s5pv210_default_sdhci1(void) { }
272static inline void s5pv210_default_sdhci2(void) { } 286static inline void s5pv210_default_sdhci2(void) { }
273#endif /* CONFIG_S5PC100_SETUP_SDHCI */ 287static inline void s5pv210_default_sdhci3(void) { }
274
275
276 288
289#endif /* CONFIG_S5PV210_SETUP_SDHCI */
277 290
278#endif /* __PLAT_S3C_SDHCI_H */ 291#endif /* __PLAT_S3C_SDHCI_H */