Commit | Line | Data |
---|---|---|
3db3ae5e KK |
1 | /* linux/arch/arm/plat-samsung/include/plat/sdhci.h |
2 | * | |
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | |
4 | * http://www.samsung.com | |
5cc7fd88 BD |
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 | ||
cc014f3e | 21 | #include <linux/platform_data/mmc-sdhci-s3c.h> |
8482c81c TA |
22 | #include <plat/devs.h> |
23 | ||
5e8e0a10 BG |
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 | ||
5cc7fd88 BD |
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); | |
a2205cd2 | 40 | extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd); |
86cd4f5f | 41 | extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd); |
b3c674bc | 42 | extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd); |
5cc7fd88 BD |
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 | ||
a2205cd2 BD |
48 | extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; |
49 | extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata; | |
86cd4f5f | 50 | extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata; |
b3c674bc | 51 | extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata; |
5cc7fd88 | 52 | |
25985edc | 53 | /* Helper function availability */ |
5cc7fd88 | 54 | |
c29cfa6d YK |
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); | |
4faf6867 BD |
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); | |
92b118f6 | 59 | extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w); |
4faf6867 | 60 | |
c29cfa6d YK |
61 | /* S3C2416 SDHCI setup */ |
62 | ||
63 | #ifdef CONFIG_S3C2416_SETUP_SDHCI | |
c29cfa6d YK |
64 | static inline void s3c2416_default_sdhci0(void) |
65 | { | |
66 | #ifdef CONFIG_S3C_DEV_HSMMC | |
c29cfa6d | 67 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio; |
c29cfa6d YK |
68 | #endif /* CONFIG_S3C_DEV_HSMMC */ |
69 | } | |
70 | ||
71 | static inline void s3c2416_default_sdhci1(void) | |
72 | { | |
73 | #ifdef CONFIG_S3C_DEV_HSMMC1 | |
c29cfa6d | 74 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio; |
c29cfa6d YK |
75 | #endif /* CONFIG_S3C_DEV_HSMMC1 */ |
76 | } | |
77 | ||
78 | #else | |
79 | static inline void s3c2416_default_sdhci0(void) { } | |
80 | static inline void s3c2416_default_sdhci1(void) { } | |
81 | ||
82 | #endif /* CONFIG_S3C2416_SETUP_SDHCI */ | |
ebc433c2 | 83 | |
88eb7156 | 84 | /* S3C64XX SDHCI setup */ |
4faf6867 | 85 | |
2f6c2ac1 | 86 | #ifdef CONFIG_S3C64XX_SETUP_SDHCI |
4faf6867 BD |
87 | static inline void s3c6400_default_sdhci0(void) |
88 | { | |
88eb7156 | 89 | #ifdef CONFIG_S3C_DEV_HSMMC |
4faf6867 | 90 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; |
88eb7156 | 91 | #endif |
4faf6867 BD |
92 | } |
93 | ||
4faf6867 BD |
94 | static inline void s3c6400_default_sdhci1(void) |
95 | { | |
88eb7156 | 96 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
4faf6867 | 97 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; |
88eb7156 | 98 | #endif |
4faf6867 | 99 | } |
4faf6867 | 100 | |
92b118f6 MC |
101 | static inline void s3c6400_default_sdhci2(void) |
102 | { | |
88eb7156 | 103 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
92b118f6 | 104 | s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; |
88eb7156 | 105 | #endif |
92b118f6 | 106 | } |
4faf6867 | 107 | |
5cc7fd88 BD |
108 | static inline void s3c6410_default_sdhci0(void) |
109 | { | |
88eb7156 | 110 | #ifdef CONFIG_S3C_DEV_HSMMC |
4faf6867 | 111 | s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio; |
88eb7156 | 112 | #endif |
5cc7fd88 | 113 | } |
a2205cd2 BD |
114 | |
115 | static inline void s3c6410_default_sdhci1(void) | |
116 | { | |
88eb7156 | 117 | #ifdef CONFIG_S3C_DEV_HSMMC1 |
4faf6867 | 118 | s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio; |
88eb7156 | 119 | #endif |
a2205cd2 | 120 | } |
713e9ded | 121 | |
92b118f6 MC |
122 | static inline void s3c6410_default_sdhci2(void) |
123 | { | |
88eb7156 | 124 | #ifdef CONFIG_S3C_DEV_HSMMC2 |
92b118f6 | 125 | s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio; |
88eb7156 | 126 | #endif |
92b118f6 | 127 | } |
92b118f6 | 128 | |
5cc7fd88 BD |
129 | #else |
130 | static inline void s3c6410_default_sdhci0(void) { } | |
a2205cd2 | 131 | static inline void s3c6410_default_sdhci1(void) { } |
6b34f498 | 132 | static inline void s3c6410_default_sdhci2(void) { } |
2f6c2ac1 BD |
133 | static inline void s3c6400_default_sdhci0(void) { } |
134 | static inline void s3c6400_default_sdhci1(void) { } | |
6b34f498 | 135 | static inline void s3c6400_default_sdhci2(void) { } |
2f6c2ac1 BD |
136 | |
137 | #endif /* CONFIG_S3C64XX_SETUP_SDHCI */ | |
5cc7fd88 | 138 | |
8482c81c TA |
139 | static inline void s3c_sdhci_setname(int id, char *name) |
140 | { | |
141 | switch (id) { | |
142 | #ifdef CONFIG_S3C_DEV_HSMMC | |
143 | case 0: | |
144 | s3c_device_hsmmc0.name = name; | |
145 | break; | |
146 | #endif | |
147 | #ifdef CONFIG_S3C_DEV_HSMMC1 | |
148 | case 1: | |
149 | s3c_device_hsmmc1.name = name; | |
150 | break; | |
151 | #endif | |
152 | #ifdef CONFIG_S3C_DEV_HSMMC2 | |
153 | case 2: | |
154 | s3c_device_hsmmc2.name = name; | |
155 | break; | |
156 | #endif | |
157 | #ifdef CONFIG_S3C_DEV_HSMMC3 | |
158 | case 3: | |
159 | s3c_device_hsmmc3.name = name; | |
160 | break; | |
161 | #endif | |
8d67ec86 SK |
162 | default: |
163 | break; | |
8482c81c TA |
164 | } |
165 | } | |
5cc7fd88 | 166 | #endif /* __PLAT_S3C_SDHCI_H */ |