• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
61 /* S3C2416 SDHCI setup */
62 
63 #ifdef CONFIG_S3C2416_SETUP_SDHCI
s3c2416_default_sdhci0(void)64 static inline void s3c2416_default_sdhci0(void)
65 {
66 #ifdef CONFIG_S3C_DEV_HSMMC
67 	s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
68 #endif /* CONFIG_S3C_DEV_HSMMC */
69 }
70 
s3c2416_default_sdhci1(void)71 static inline void s3c2416_default_sdhci1(void)
72 {
73 #ifdef CONFIG_S3C_DEV_HSMMC1
74 	s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
75 #endif /* CONFIG_S3C_DEV_HSMMC1 */
76 }
77 
78 #else
s3c2416_default_sdhci0(void)79 static inline void s3c2416_default_sdhci0(void) { }
s3c2416_default_sdhci1(void)80 static inline void s3c2416_default_sdhci1(void) { }
81 
82 #endif /* CONFIG_S3C2416_SETUP_SDHCI */
83 
84 /* S3C64XX SDHCI setup */
85 
86 #ifdef CONFIG_S3C64XX_SETUP_SDHCI
s3c6400_default_sdhci0(void)87 static inline void s3c6400_default_sdhci0(void)
88 {
89 #ifdef CONFIG_S3C_DEV_HSMMC
90 	s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
91 #endif
92 }
93 
s3c6400_default_sdhci1(void)94 static inline void s3c6400_default_sdhci1(void)
95 {
96 #ifdef CONFIG_S3C_DEV_HSMMC1
97 	s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
98 #endif
99 }
100 
s3c6400_default_sdhci2(void)101 static inline void s3c6400_default_sdhci2(void)
102 {
103 #ifdef CONFIG_S3C_DEV_HSMMC2
104 	s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
105 #endif
106 }
107 
s3c6410_default_sdhci0(void)108 static inline void s3c6410_default_sdhci0(void)
109 {
110 #ifdef CONFIG_S3C_DEV_HSMMC
111 	s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
112 #endif
113 }
114 
s3c6410_default_sdhci1(void)115 static inline void s3c6410_default_sdhci1(void)
116 {
117 #ifdef CONFIG_S3C_DEV_HSMMC1
118 	s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
119 #endif
120 }
121 
s3c6410_default_sdhci2(void)122 static inline void s3c6410_default_sdhci2(void)
123 {
124 #ifdef CONFIG_S3C_DEV_HSMMC2
125 	s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
126 #endif
127 }
128 
129 #else
s3c6410_default_sdhci0(void)130 static inline void s3c6410_default_sdhci0(void) { }
s3c6410_default_sdhci1(void)131 static inline void s3c6410_default_sdhci1(void) { }
s3c6410_default_sdhci2(void)132 static inline void s3c6410_default_sdhci2(void) { }
s3c6400_default_sdhci0(void)133 static inline void s3c6400_default_sdhci0(void) { }
s3c6400_default_sdhci1(void)134 static inline void s3c6400_default_sdhci1(void) { }
s3c6400_default_sdhci2(void)135 static inline void s3c6400_default_sdhci2(void) { }
136 
137 #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
138 
s3c_sdhci_setname(int id,char * name)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
162 	default:
163 		break;
164 	}
165 }
166 #endif /* __PLAT_S3C_SDHCI_H */
167