sdhci.h 9.2 KB
Newer Older
K
Kukjin Kim 已提交
1 2 3 4
/* linux/arch/arm/plat-samsung/include/plat/sdhci.h
 *
 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 * Copyright 2008 Openmoko, Inc.
 * Copyright 2008 Simtec Electronics
 *	http://armlinux.simtec.co.uk/
 *	Ben Dooks <ben@simtec.co.uk>
 *
 * S3C Platform - SDHCI (HSMMC) platform data definitions
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
*/

#ifndef __PLAT_S3C_SDHCI_H
#define __PLAT_S3C_SDHCI_H __FILE__

21
#include <linux/platform_data/mmc-sdhci-s3c.h>
22 23
#include <plat/devs.h>

24 25 26 27 28 29 30
/* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
 * @pd: The default platform data for this device.
 * @set: Pointer to the platform data to fill in.
 */
extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
				    struct s3c_sdhci_platdata *set);

31 32 33 34 35 36 37 38 39
/**
 * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
 * @pd: Platform data to register to device.
 *
 * Register the given platform data for use withe S3C SDHCI device.
 * The call will copy the platform data, so the board definitions can
 * make the structure itself __initdata.
 */
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 45 46 47

/* Default platform data, exported so that per-cpu initialisation can
 * set the correct one when there are more than one cpu type selected.
*/

48 49
extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
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

L
Lucas De Marchi 已提交
53
/* Helper function availability */
54

55 56
extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
57 58
extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
59 60 61
extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
62
extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
63 64 65
extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
66
extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
K
Kukjin Kim 已提交
67 68 69 70
extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
71 72 73 74
extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
75

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
/* S3C2416 SDHCI setup */

#ifdef CONFIG_S3C2416_SETUP_SDHCI
static inline void s3c2416_default_sdhci0(void)
{
#ifdef CONFIG_S3C_DEV_HSMMC
	s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
#endif /* CONFIG_S3C_DEV_HSMMC */
}

static inline void s3c2416_default_sdhci1(void)
{
#ifdef CONFIG_S3C_DEV_HSMMC1
	s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
#endif /* CONFIG_S3C_DEV_HSMMC1 */
}

#else
static inline void s3c2416_default_sdhci0(void) { }
static inline void s3c2416_default_sdhci1(void) { }

#endif /* CONFIG_S3C2416_SETUP_SDHCI */
98

99
/* S3C64XX SDHCI setup */
100

101
#ifdef CONFIG_S3C64XX_SETUP_SDHCI
102 103
static inline void s3c6400_default_sdhci0(void)
{
104
#ifdef CONFIG_S3C_DEV_HSMMC
105
	s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
106
#endif
107 108 109 110
}

static inline void s3c6400_default_sdhci1(void)
{
111
#ifdef CONFIG_S3C_DEV_HSMMC1
112
	s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
113
#endif
114 115
}

116 117
static inline void s3c6400_default_sdhci2(void)
{
118
#ifdef CONFIG_S3C_DEV_HSMMC2
119
	s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
120
#endif
121
}
122

123 124
static inline void s3c6410_default_sdhci0(void)
{
125
#ifdef CONFIG_S3C_DEV_HSMMC
126
	s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
127
#endif
128
}
129 130 131

static inline void s3c6410_default_sdhci1(void)
{
132
#ifdef CONFIG_S3C_DEV_HSMMC1
133
	s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
134
#endif
135
}
B
Ben Dooks 已提交
136

137 138
static inline void s3c6410_default_sdhci2(void)
{
139
#ifdef CONFIG_S3C_DEV_HSMMC2
140
	s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
141
#endif
142 143
}

144 145
#else
static inline void s3c6410_default_sdhci0(void) { }
146
static inline void s3c6410_default_sdhci1(void) { }
147
static inline void s3c6410_default_sdhci2(void) { }
148 149
static inline void s3c6400_default_sdhci0(void) { }
static inline void s3c6400_default_sdhci1(void) { }
150
static inline void s3c6400_default_sdhci2(void) { }
151 152

#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
153

154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
/* S5P64X0 SDHCI setup */

#ifdef CONFIG_S5P64X0_SETUP_SDHCI
static inline void s5p64x0_default_sdhci0(void)
{
#ifdef CONFIG_S3C_DEV_HSMMC
	s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
#endif
}

static inline void s5p64x0_default_sdhci1(void)
{
#ifdef CONFIG_S3C_DEV_HSMMC1
	s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
#endif
}

static inline void s5p6440_default_sdhci2(void)
{
#ifdef CONFIG_S3C_DEV_HSMMC2
	s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
#endif
}

static inline void s5p6450_default_sdhci2(void)
{
#ifdef CONFIG_S3C_DEV_HSMMC2
	s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
#endif
}

#else
static inline void s5p64x0_default_sdhci0(void) { }
static inline void s5p64x0_default_sdhci1(void) { }
static inline void s5p6440_default_sdhci2(void) { }
static inline void s5p6450_default_sdhci2(void) { }

#endif /* CONFIG_S5P64X0_SETUP_SDHCI */

193 194 195 196 197
/* S5PC100 SDHCI setup */

#ifdef CONFIG_S5PC100_SETUP_SDHCI
static inline void s5pc100_default_sdhci0(void)
{
198
#ifdef CONFIG_S3C_DEV_HSMMC
199
	s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
200
#endif
201 202 203 204
}

static inline void s5pc100_default_sdhci1(void)
{
205
#ifdef CONFIG_S3C_DEV_HSMMC1
206
	s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
207
#endif
208 209 210 211
}

static inline void s5pc100_default_sdhci2(void)
{
212
#ifdef CONFIG_S3C_DEV_HSMMC2
213
	s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
214
#endif
215 216 217 218 219 220
}

#else
static inline void s5pc100_default_sdhci0(void) { }
static inline void s5pc100_default_sdhci1(void) { }
static inline void s5pc100_default_sdhci2(void) { }
221

222 223
#endif /* CONFIG_S5PC100_SETUP_SDHCI */

224
/* S5PV210 SDHCI setup */
225 226 227 228

#ifdef CONFIG_S5PV210_SETUP_SDHCI
static inline void s5pv210_default_sdhci0(void)
{
229
#ifdef CONFIG_S3C_DEV_HSMMC
230
	s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
231
#endif
232 233 234 235
}

static inline void s5pv210_default_sdhci1(void)
{
236
#ifdef CONFIG_S3C_DEV_HSMMC1
237
	s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
238
#endif
239 240 241 242
}

static inline void s5pv210_default_sdhci2(void)
{
243
#ifdef CONFIG_S3C_DEV_HSMMC2
244
	s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
245
#endif
246 247
}

248 249
static inline void s5pv210_default_sdhci3(void)
{
250
#ifdef CONFIG_S3C_DEV_HSMMC3
251
	s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
252
#endif
253 254
}

255 256 257 258
#else
static inline void s5pv210_default_sdhci0(void) { }
static inline void s5pv210_default_sdhci1(void) { }
static inline void s5pv210_default_sdhci2(void) { }
259
static inline void s5pv210_default_sdhci3(void) { }
260

261
#endif /* CONFIG_S5PV210_SETUP_SDHCI */
262

K
Kukjin Kim 已提交
263 264 265
/* EXYNOS4 SDHCI setup */
#ifdef CONFIG_EXYNOS4_SETUP_SDHCI
static inline void exynos4_default_sdhci0(void)
H
Hyuk Lee 已提交
266 267
{
#ifdef CONFIG_S3C_DEV_HSMMC
K
Kukjin Kim 已提交
268
	s3c_hsmmc0_def_platdata.cfg_gpio = exynos4_setup_sdhci0_cfg_gpio;
H
Hyuk Lee 已提交
269 270 271
#endif
}

K
Kukjin Kim 已提交
272
static inline void exynos4_default_sdhci1(void)
H
Hyuk Lee 已提交
273 274
{
#ifdef CONFIG_S3C_DEV_HSMMC1
K
Kukjin Kim 已提交
275
	s3c_hsmmc1_def_platdata.cfg_gpio = exynos4_setup_sdhci1_cfg_gpio;
H
Hyuk Lee 已提交
276 277 278
#endif
}

K
Kukjin Kim 已提交
279
static inline void exynos4_default_sdhci2(void)
H
Hyuk Lee 已提交
280 281
{
#ifdef CONFIG_S3C_DEV_HSMMC2
K
Kukjin Kim 已提交
282
	s3c_hsmmc2_def_platdata.cfg_gpio = exynos4_setup_sdhci2_cfg_gpio;
H
Hyuk Lee 已提交
283 284 285
#endif
}

K
Kukjin Kim 已提交
286
static inline void exynos4_default_sdhci3(void)
H
Hyuk Lee 已提交
287 288
{
#ifdef CONFIG_S3C_DEV_HSMMC3
K
Kukjin Kim 已提交
289
	s3c_hsmmc3_def_platdata.cfg_gpio = exynos4_setup_sdhci3_cfg_gpio;
H
Hyuk Lee 已提交
290 291 292 293
#endif
}

#else
K
Kukjin Kim 已提交
294 295 296 297
static inline void exynos4_default_sdhci0(void) { }
static inline void exynos4_default_sdhci1(void) { }
static inline void exynos4_default_sdhci2(void) { }
static inline void exynos4_default_sdhci3(void) { }
H
Hyuk Lee 已提交
298

K
Kukjin Kim 已提交
299
#endif /* CONFIG_EXYNOS4_SETUP_SDHCI */
H
Hyuk Lee 已提交
300

301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
static inline void s3c_sdhci_setname(int id, char *name)
{
	switch (id) {
#ifdef CONFIG_S3C_DEV_HSMMC
	case 0:
		s3c_device_hsmmc0.name = name;
		break;
#endif
#ifdef CONFIG_S3C_DEV_HSMMC1
	case 1:
		s3c_device_hsmmc1.name = name;
		break;
#endif
#ifdef CONFIG_S3C_DEV_HSMMC2
	case 2:
		s3c_device_hsmmc2.name = name;
		break;
#endif
#ifdef CONFIG_S3C_DEV_HSMMC3
	case 3:
		s3c_device_hsmmc3.name = name;
		break;
#endif
324 325
	default:
		break;
326 327
	}
}
328
#endif /* __PLAT_S3C_SDHCI_H */