blob: bf650218b40eeb72bfc81778b4843a520329dda5 [file] [log] [blame]
Kukjin Kim3db3ae52011-02-14 16:22:36 +09001/* linux/arch/arm/plat-samsung/include/plat/sdhci.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
Ben Dooks5cc7fd82008-10-31 16:14:38 +00005 *
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
Arnd Bergmanncc014f32013-03-04 18:28:21 +010021#include <linux/platform_data/mmc-sdhci-s3c.h>
Thomas Abraham8482c812012-04-14 08:04:46 -070022#include <plat/devs.h>
23
Banajit Goswami5e8e0a12011-08-18 20:32:01 +090024/* 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 */
28extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
29 struct s3c_sdhci_platdata *set);
30
Ben Dooks5cc7fd82008-10-31 16:14:38 +000031/**
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 */
39extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
Ben Dooksa2205cd2008-10-31 16:14:39 +000040extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
Kyungmin Park86cd4f52009-11-17 08:41:23 +010041extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
Hyuk Leeb3c674b2010-06-10 15:22:16 +090042extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
Ben Dooks5cc7fd82008-10-31 16:14:38 +000043
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
Ben Dooksa2205cd2008-10-31 16:14:39 +000048extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
49extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
Kyungmin Park86cd4f52009-11-17 08:41:23 +010050extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
Hyuk Leeb3c674b2010-06-10 15:22:16 +090051extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
Ben Dooks5cc7fd82008-10-31 16:14:38 +000052
Lucas De Marchi25985ed2011-03-30 22:57:33 -030053/* Helper function availability */
Ben Dooks5cc7fd82008-10-31 16:14:38 +000054
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090055extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
56extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
Ben Dooks4faf68672009-03-25 11:01:24 +000057extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
58extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
Kyungmin Park86cd4f52009-11-17 08:41:23 +010059extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
60extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
61extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +010062extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
Marek Szyprowskie6f66a92010-05-20 08:13:07 +020063extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
64extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
65extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
Hyuk Lee976a62f2010-06-14 10:18:56 +090066extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
Kukjin Kim3db3ae52011-02-14 16:22:36 +090067extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
68extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
69extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
70extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
Rajeshwari Shindeebc433c2011-12-26 16:28:54 +090071extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
72extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
73extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
74extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
Ben Dooks4faf68672009-03-25 11:01:24 +000075
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090076/* S3C2416 SDHCI setup */
77
78#ifdef CONFIG_S3C2416_SETUP_SDHCI
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090079static inline void s3c2416_default_sdhci0(void)
80{
81#ifdef CONFIG_S3C_DEV_HSMMC
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090082 s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090083#endif /* CONFIG_S3C_DEV_HSMMC */
84}
85
86static inline void s3c2416_default_sdhci1(void)
87{
88#ifdef CONFIG_S3C_DEV_HSMMC1
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090089 s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
Yauhen Kharuzhyc29cfa62010-12-17 14:42:09 +090090#endif /* CONFIG_S3C_DEV_HSMMC1 */
91}
92
93#else
94static inline void s3c2416_default_sdhci0(void) { }
95static inline void s3c2416_default_sdhci1(void) { }
96
97#endif /* CONFIG_S3C2416_SETUP_SDHCI */
Rajeshwari Shindeebc433c2011-12-26 16:28:54 +090098
Kukjin Kim88eb7152010-07-29 22:18:45 +090099/* S3C64XX SDHCI setup */
Ben Dooks4faf68672009-03-25 11:01:24 +0000100
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900101#ifdef CONFIG_S3C64XX_SETUP_SDHCI
Ben Dooks4faf68672009-03-25 11:01:24 +0000102static inline void s3c6400_default_sdhci0(void)
103{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900104#ifdef CONFIG_S3C_DEV_HSMMC
Ben Dooks4faf68672009-03-25 11:01:24 +0000105 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900106#endif
Ben Dooks4faf68672009-03-25 11:01:24 +0000107}
108
Ben Dooks4faf68672009-03-25 11:01:24 +0000109static inline void s3c6400_default_sdhci1(void)
110{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900111#ifdef CONFIG_S3C_DEV_HSMMC1
Ben Dooks4faf68672009-03-25 11:01:24 +0000112 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900113#endif
Ben Dooks4faf68672009-03-25 11:01:24 +0000114}
Ben Dooks4faf68672009-03-25 11:01:24 +0000115
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100116static inline void s3c6400_default_sdhci2(void)
117{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900118#ifdef CONFIG_S3C_DEV_HSMMC2
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100119 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900120#endif
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100121}
Ben Dooks4faf68672009-03-25 11:01:24 +0000122
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000123static inline void s3c6410_default_sdhci0(void)
124{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900125#ifdef CONFIG_S3C_DEV_HSMMC
Ben Dooks4faf68672009-03-25 11:01:24 +0000126 s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900127#endif
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000128}
Ben Dooksa2205cd2008-10-31 16:14:39 +0000129
130static inline void s3c6410_default_sdhci1(void)
131{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900132#ifdef CONFIG_S3C_DEV_HSMMC1
Ben Dooks4faf68672009-03-25 11:01:24 +0000133 s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900134#endif
Ben Dooksa2205cd2008-10-31 16:14:39 +0000135}
Ben Dooks713e9de2008-10-31 16:29:19 +0000136
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100137static inline void s3c6410_default_sdhci2(void)
138{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900139#ifdef CONFIG_S3C_DEV_HSMMC2
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100140 s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900141#endif
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100142}
Maurus Cuelenaere92b118f2009-11-23 13:34:46 +0100143
Ben Dooks713e9de2008-10-31 16:29:19 +0000144#else
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000145static inline void s3c6410_default_sdhci0(void) { }
Ben Dooksa2205cd2008-10-31 16:14:39 +0000146static inline void s3c6410_default_sdhci1(void) { }
Marek Szyprowski6b34f492010-06-22 15:45:26 +0900147static inline void s3c6410_default_sdhci2(void) { }
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900148static inline void s3c6400_default_sdhci0(void) { }
149static inline void s3c6400_default_sdhci1(void) { }
Marek Szyprowski6b34f492010-06-22 15:45:26 +0900150static inline void s3c6400_default_sdhci2(void) { }
Ben Dooks2f6c2ac2010-01-26 10:38:52 +0900151
152#endif /* CONFIG_S3C64XX_SETUP_SDHCI */
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000153
Rajeshwari Shindeebc433c2011-12-26 16:28:54 +0900154/* S5P64X0 SDHCI setup */
155
Paul Bolle22944502013-04-04 08:48:17 +0900156#ifdef CONFIG_S5P64X0_SETUP_SDHCI_GPIO
Rajeshwari Shindeebc433c2011-12-26 16:28:54 +0900157static inline void s5p64x0_default_sdhci0(void)
158{
159#ifdef CONFIG_S3C_DEV_HSMMC
160 s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
161#endif
162}
163
164static inline void s5p64x0_default_sdhci1(void)
165{
166#ifdef CONFIG_S3C_DEV_HSMMC1
167 s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
168#endif
169}
170
171static inline void s5p6440_default_sdhci2(void)
172{
173#ifdef CONFIG_S3C_DEV_HSMMC2
174 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
175#endif
176}
177
178static inline void s5p6450_default_sdhci2(void)
179{
180#ifdef CONFIG_S3C_DEV_HSMMC2
181 s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
182#endif
183}
184
185#else
186static inline void s5p64x0_default_sdhci0(void) { }
187static inline void s5p64x0_default_sdhci1(void) { }
188static inline void s5p6440_default_sdhci2(void) { }
189static inline void s5p6450_default_sdhci2(void) { }
190
Paul Bolle22944502013-04-04 08:48:17 +0900191#endif /* CONFIG_S5P64X0_SETUP_SDHCI_GPIO */
Rajeshwari Shindeebc433c2011-12-26 16:28:54 +0900192
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100193/* S5PC100 SDHCI setup */
194
195#ifdef CONFIG_S5PC100_SETUP_SDHCI
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100196static inline void s5pc100_default_sdhci0(void)
197{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900198#ifdef CONFIG_S3C_DEV_HSMMC
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100199 s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900200#endif
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100201}
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100202
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100203static inline void s5pc100_default_sdhci1(void)
204{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900205#ifdef CONFIG_S3C_DEV_HSMMC1
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100206 s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900207#endif
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100208}
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100209
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100210static inline void s5pc100_default_sdhci2(void)
211{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900212#ifdef CONFIG_S3C_DEV_HSMMC2
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100213 s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900214#endif
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100215}
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100216
217#else
218static inline void s5pc100_default_sdhci0(void) { }
219static inline void s5pc100_default_sdhci1(void) { }
220static inline void s5pc100_default_sdhci2(void) { }
Kukjin Kim88eb7152010-07-29 22:18:45 +0900221
Kyungmin Park86cd4f52009-11-17 08:41:23 +0100222#endif /* CONFIG_S5PC100_SETUP_SDHCI */
223
Kukjin Kim88eb7152010-07-29 22:18:45 +0900224/* S5PV210 SDHCI setup */
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200225
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200226#ifdef CONFIG_S5PV210_SETUP_SDHCI
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200227static inline void s5pv210_default_sdhci0(void)
228{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900229#ifdef CONFIG_S3C_DEV_HSMMC
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200230 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900231#endif
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200232}
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200233
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200234static inline void s5pv210_default_sdhci1(void)
235{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900236#ifdef CONFIG_S3C_DEV_HSMMC1
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200237 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900238#endif
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200239}
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200240
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200241static inline void s5pv210_default_sdhci2(void)
242{
Kukjin Kim88eb7152010-07-29 22:18:45 +0900243#ifdef CONFIG_S3C_DEV_HSMMC2
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200244 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
Kukjin Kim88eb7152010-07-29 22:18:45 +0900245#endif
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200246}
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200247
Hyuk Lee976a62f2010-06-14 10:18:56 +0900248static inline void s5pv210_default_sdhci3(void)
249{
Kukjin Kimd61bd772010-08-06 21:49:18 +0900250#ifdef CONFIG_S3C_DEV_HSMMC3
Hyuk Lee976a62f2010-06-14 10:18:56 +0900251 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
Kukjin Kimd61bd772010-08-06 21:49:18 +0900252#endif
Hyuk Lee976a62f2010-06-14 10:18:56 +0900253}
Hyuk Lee976a62f2010-06-14 10:18:56 +0900254
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200255#else
256static inline void s5pv210_default_sdhci0(void) { }
257static inline void s5pv210_default_sdhci1(void) { }
258static inline void s5pv210_default_sdhci2(void) { }
Hyuk Lee976a62f2010-06-14 10:18:56 +0900259static inline void s5pv210_default_sdhci3(void) { }
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200260
Kukjin Kim88eb7152010-07-29 22:18:45 +0900261#endif /* CONFIG_S5PV210_SETUP_SDHCI */
Marek Szyprowskie6f66a92010-05-20 08:13:07 +0200262
Thomas Abraham8482c812012-04-14 08:04:46 -0700263static inline void s3c_sdhci_setname(int id, char *name)
264{
265 switch (id) {
266#ifdef CONFIG_S3C_DEV_HSMMC
267 case 0:
268 s3c_device_hsmmc0.name = name;
269 break;
270#endif
271#ifdef CONFIG_S3C_DEV_HSMMC1
272 case 1:
273 s3c_device_hsmmc1.name = name;
274 break;
275#endif
276#ifdef CONFIG_S3C_DEV_HSMMC2
277 case 2:
278 s3c_device_hsmmc2.name = name;
279 break;
280#endif
281#ifdef CONFIG_S3C_DEV_HSMMC3
282 case 3:
283 s3c_device_hsmmc3.name = name;
284 break;
285#endif
Sachin Kamat8d67ec82013-02-12 10:27:52 -0800286 default:
287 break;
Thomas Abraham8482c812012-04-14 08:04:46 -0700288 }
289}
Ben Dooks5cc7fd82008-10-31 16:14:38 +0000290#endif /* __PLAT_S3C_SDHCI_H */