sdhci.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  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. #ifndef __PLAT_S3C_SDHCI_H
  18. #define __PLAT_S3C_SDHCI_H __FILE__
  19. #include <linux/platform_data/mmc-sdhci-s3c.h>
  20. #include <plat/devs.h>
  21. /* s3c_sdhci_set_platdata() - common helper for setting SDHCI platform data
  22. * @pd: The default platform data for this device.
  23. * @set: Pointer to the platform data to fill in.
  24. */
  25. extern void s3c_sdhci_set_platdata(struct s3c_sdhci_platdata *pd,
  26. struct s3c_sdhci_platdata *set);
  27. /**
  28. * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
  29. * @pd: Platform data to register to device.
  30. *
  31. * Register the given platform data for use withe S3C SDHCI device.
  32. * The call will copy the platform data, so the board definitions can
  33. * make the structure itself __initdata.
  34. */
  35. extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
  36. extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
  37. extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
  38. extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
  39. /* Default platform data, exported so that per-cpu initialisation can
  40. * set the correct one when there are more than one cpu type selected.
  41. */
  42. extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
  43. extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
  44. extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
  45. extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
  46. /* Helper function availability */
  47. extern void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  48. extern void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  49. extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  50. extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  51. extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  52. extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  53. extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  54. extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  55. extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  56. extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  57. extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  58. extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
  59. extern void exynos4_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  60. extern void exynos4_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  61. extern void exynos4_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  62. extern void exynos4_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
  63. extern void s5p64x0_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  64. extern void s5p64x0_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  65. extern void s5p6440_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  66. extern void s5p6450_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  67. /* S3C2416 SDHCI setup */
  68. #ifdef CONFIG_S3C2416_SETUP_SDHCI
  69. static inline void s3c2416_default_sdhci0(void)
  70. {
  71. #ifdef CONFIG_S3C_DEV_HSMMC
  72. s3c_hsmmc0_def_platdata.cfg_gpio = s3c2416_setup_sdhci0_cfg_gpio;
  73. #endif /* CONFIG_S3C_DEV_HSMMC */
  74. }
  75. static inline void s3c2416_default_sdhci1(void)
  76. {
  77. #ifdef CONFIG_S3C_DEV_HSMMC1
  78. s3c_hsmmc1_def_platdata.cfg_gpio = s3c2416_setup_sdhci1_cfg_gpio;
  79. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  80. }
  81. #else
  82. static inline void s3c2416_default_sdhci0(void) { }
  83. static inline void s3c2416_default_sdhci1(void) { }
  84. #endif /* CONFIG_S3C2416_SETUP_SDHCI */
  85. /* S3C64XX SDHCI setup */
  86. #ifdef CONFIG_S3C64XX_SETUP_SDHCI
  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. static inline void s3c6400_default_sdhci1(void)
  94. {
  95. #ifdef CONFIG_S3C_DEV_HSMMC1
  96. s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
  97. #endif
  98. }
  99. static inline void s3c6400_default_sdhci2(void)
  100. {
  101. #ifdef CONFIG_S3C_DEV_HSMMC2
  102. s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
  103. #endif
  104. }
  105. static inline void s3c6410_default_sdhci0(void)
  106. {
  107. #ifdef CONFIG_S3C_DEV_HSMMC
  108. s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
  109. #endif
  110. }
  111. static inline void s3c6410_default_sdhci1(void)
  112. {
  113. #ifdef CONFIG_S3C_DEV_HSMMC1
  114. s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
  115. #endif
  116. }
  117. static inline void s3c6410_default_sdhci2(void)
  118. {
  119. #ifdef CONFIG_S3C_DEV_HSMMC2
  120. s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
  121. #endif
  122. }
  123. #else
  124. static inline void s3c6410_default_sdhci0(void) { }
  125. static inline void s3c6410_default_sdhci1(void) { }
  126. static inline void s3c6410_default_sdhci2(void) { }
  127. static inline void s3c6400_default_sdhci0(void) { }
  128. static inline void s3c6400_default_sdhci1(void) { }
  129. static inline void s3c6400_default_sdhci2(void) { }
  130. #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
  131. /* S5P64X0 SDHCI setup */
  132. #ifdef CONFIG_S5P64X0_SETUP_SDHCI
  133. static inline void s5p64x0_default_sdhci0(void)
  134. {
  135. #ifdef CONFIG_S3C_DEV_HSMMC
  136. s3c_hsmmc0_def_platdata.cfg_gpio = s5p64x0_setup_sdhci0_cfg_gpio;
  137. #endif
  138. }
  139. static inline void s5p64x0_default_sdhci1(void)
  140. {
  141. #ifdef CONFIG_S3C_DEV_HSMMC1
  142. s3c_hsmmc1_def_platdata.cfg_gpio = s5p64x0_setup_sdhci1_cfg_gpio;
  143. #endif
  144. }
  145. static inline void s5p6440_default_sdhci2(void)
  146. {
  147. #ifdef CONFIG_S3C_DEV_HSMMC2
  148. s3c_hsmmc2_def_platdata.cfg_gpio = s5p6440_setup_sdhci2_cfg_gpio;
  149. #endif
  150. }
  151. static inline void s5p6450_default_sdhci2(void)
  152. {
  153. #ifdef CONFIG_S3C_DEV_HSMMC2
  154. s3c_hsmmc2_def_platdata.cfg_gpio = s5p6450_setup_sdhci2_cfg_gpio;
  155. #endif
  156. }
  157. #else
  158. static inline void s5p64x0_default_sdhci0(void) { }
  159. static inline void s5p64x0_default_sdhci1(void) { }
  160. static inline void s5p6440_default_sdhci2(void) { }
  161. static inline void s5p6450_default_sdhci2(void) { }
  162. #endif /* CONFIG_S5P64X0_SETUP_SDHCI */
  163. /* S5PC100 SDHCI setup */
  164. #ifdef CONFIG_S5PC100_SETUP_SDHCI
  165. static inline void s5pc100_default_sdhci0(void)
  166. {
  167. #ifdef CONFIG_S3C_DEV_HSMMC
  168. s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
  169. #endif
  170. }
  171. static inline void s5pc100_default_sdhci1(void)
  172. {
  173. #ifdef CONFIG_S3C_DEV_HSMMC1
  174. s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
  175. #endif
  176. }
  177. static inline void s5pc100_default_sdhci2(void)
  178. {
  179. #ifdef CONFIG_S3C_DEV_HSMMC2
  180. s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
  181. #endif
  182. }
  183. #else
  184. static inline void s5pc100_default_sdhci0(void) { }
  185. static inline void s5pc100_default_sdhci1(void) { }
  186. static inline void s5pc100_default_sdhci2(void) { }
  187. #endif /* CONFIG_S5PC100_SETUP_SDHCI */
  188. /* S5PV210 SDHCI setup */
  189. #ifdef CONFIG_S5PV210_SETUP_SDHCI
  190. static inline void s5pv210_default_sdhci0(void)
  191. {
  192. #ifdef CONFIG_S3C_DEV_HSMMC
  193. s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
  194. #endif
  195. }
  196. static inline void s5pv210_default_sdhci1(void)
  197. {
  198. #ifdef CONFIG_S3C_DEV_HSMMC1
  199. s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
  200. #endif
  201. }
  202. static inline void s5pv210_default_sdhci2(void)
  203. {
  204. #ifdef CONFIG_S3C_DEV_HSMMC2
  205. s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
  206. #endif
  207. }
  208. static inline void s5pv210_default_sdhci3(void)
  209. {
  210. #ifdef CONFIG_S3C_DEV_HSMMC3
  211. s3c_hsmmc3_def_platdata.cfg_gpio = s5pv210_setup_sdhci3_cfg_gpio;
  212. #endif
  213. }
  214. #else
  215. static inline void s5pv210_default_sdhci0(void) { }
  216. static inline void s5pv210_default_sdhci1(void) { }
  217. static inline void s5pv210_default_sdhci2(void) { }
  218. static inline void s5pv210_default_sdhci3(void) { }
  219. #endif /* CONFIG_S5PV210_SETUP_SDHCI */
  220. /* EXYNOS4 SDHCI setup */
  221. #ifdef CONFIG_EXYNOS4_SETUP_SDHCI
  222. static inline void exynos4_default_sdhci0(void)
  223. {
  224. #ifdef CONFIG_S3C_DEV_HSMMC
  225. s3c_hsmmc0_def_platdata.cfg_gpio = exynos4_setup_sdhci0_cfg_gpio;
  226. #endif
  227. }
  228. static inline void exynos4_default_sdhci1(void)
  229. {
  230. #ifdef CONFIG_S3C_DEV_HSMMC1
  231. s3c_hsmmc1_def_platdata.cfg_gpio = exynos4_setup_sdhci1_cfg_gpio;
  232. #endif
  233. }
  234. static inline void exynos4_default_sdhci2(void)
  235. {
  236. #ifdef CONFIG_S3C_DEV_HSMMC2
  237. s3c_hsmmc2_def_platdata.cfg_gpio = exynos4_setup_sdhci2_cfg_gpio;
  238. #endif
  239. }
  240. static inline void exynos4_default_sdhci3(void)
  241. {
  242. #ifdef CONFIG_S3C_DEV_HSMMC3
  243. s3c_hsmmc3_def_platdata.cfg_gpio = exynos4_setup_sdhci3_cfg_gpio;
  244. #endif
  245. }
  246. #else
  247. static inline void exynos4_default_sdhci0(void) { }
  248. static inline void exynos4_default_sdhci1(void) { }
  249. static inline void exynos4_default_sdhci2(void) { }
  250. static inline void exynos4_default_sdhci3(void) { }
  251. #endif /* CONFIG_EXYNOS4_SETUP_SDHCI */
  252. static inline void s3c_sdhci_setname(int id, char *name)
  253. {
  254. switch (id) {
  255. #ifdef CONFIG_S3C_DEV_HSMMC
  256. case 0:
  257. s3c_device_hsmmc0.name = name;
  258. break;
  259. #endif
  260. #ifdef CONFIG_S3C_DEV_HSMMC1
  261. case 1:
  262. s3c_device_hsmmc1.name = name;
  263. break;
  264. #endif
  265. #ifdef CONFIG_S3C_DEV_HSMMC2
  266. case 2:
  267. s3c_device_hsmmc2.name = name;
  268. break;
  269. #endif
  270. #ifdef CONFIG_S3C_DEV_HSMMC3
  271. case 3:
  272. s3c_device_hsmmc3.name = name;
  273. break;
  274. #endif
  275. default:
  276. break;
  277. }
  278. }
  279. #endif /* __PLAT_S3C_SDHCI_H */