sdhci.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. /* linux/arch/arm/plat-s3c/include/plat/sdhci.h
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * http://armlinux.simtec.co.uk/
  6. * Ben Dooks <ben@simtec.co.uk>
  7. *
  8. * S3C Platform - SDHCI (HSMMC) platform data definitions
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef __PLAT_S3C_SDHCI_H
  15. #define __PLAT_S3C_SDHCI_H __FILE__
  16. struct platform_device;
  17. struct mmc_host;
  18. struct mmc_card;
  19. struct mmc_ios;
  20. /**
  21. * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
  22. * @max_width: The maximum number of data bits supported.
  23. * @host_caps: Standard MMC host capabilities bit field.
  24. * @cfg_gpio: Configure the GPIO for a specific card bit-width
  25. * @cfg_card: Configure the interface for a specific card and speed. This
  26. * is necessary the controllers and/or GPIO blocks require the
  27. * changing of driver-strength and other controls dependant on
  28. * the card and speed of operation.
  29. *
  30. * Initialisation data specific to either the machine or the platform
  31. * for the device driver to use or call-back when configuring gpio or
  32. * card speed information.
  33. */
  34. struct s3c_sdhci_platdata {
  35. unsigned int max_width;
  36. unsigned int host_caps;
  37. char **clocks; /* set of clock sources */
  38. void (*cfg_gpio)(struct platform_device *dev, int width);
  39. void (*cfg_card)(struct platform_device *dev,
  40. void __iomem *regbase,
  41. struct mmc_ios *ios,
  42. struct mmc_card *card);
  43. };
  44. /**
  45. * s3c_sdhci0_set_platdata - Set platform data for S3C SDHCI device.
  46. * @pd: Platform data to register to device.
  47. *
  48. * Register the given platform data for use withe S3C SDHCI device.
  49. * The call will copy the platform data, so the board definitions can
  50. * make the structure itself __initdata.
  51. */
  52. extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd);
  53. extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd);
  54. extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd);
  55. extern void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd);
  56. /* Default platform data, exported so that per-cpu initialisation can
  57. * set the correct one when there are more than one cpu type selected.
  58. */
  59. extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
  60. extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
  61. extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
  62. extern struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata;
  63. /* Helper function availablity */
  64. extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  65. extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  66. extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  67. extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  68. extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  69. extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  70. extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  71. extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  72. extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  73. /* S3C6400 SDHCI setup */
  74. #ifdef CONFIG_S3C64XX_SETUP_SDHCI
  75. extern char *s3c64xx_hsmmc_clksrcs[4];
  76. #ifdef CONFIG_S3C_DEV_HSMMC
  77. extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
  78. void __iomem *r,
  79. struct mmc_ios *ios,
  80. struct mmc_card *card);
  81. static inline void s3c6400_default_sdhci0(void)
  82. {
  83. s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
  84. s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
  85. s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
  86. }
  87. #else
  88. static inline void s3c6400_default_sdhci0(void) { }
  89. #endif /* CONFIG_S3C_DEV_HSMMC */
  90. #ifdef CONFIG_S3C_DEV_HSMMC1
  91. static inline void s3c6400_default_sdhci1(void)
  92. {
  93. s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
  94. s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
  95. s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
  96. }
  97. #else
  98. static inline void s3c6400_default_sdhci1(void) { }
  99. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  100. #ifdef CONFIG_S3C_DEV_HSMMC2
  101. static inline void s3c6400_default_sdhci2(void)
  102. {
  103. s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
  104. s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
  105. s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
  106. }
  107. #else
  108. static inline void s3c6400_default_sdhci2(void) { }
  109. #endif /* CONFIG_S3C_DEV_HSMMC2 */
  110. /* S3C6410 SDHCI setup */
  111. extern void s3c6410_setup_sdhci_cfg_card(struct platform_device *dev,
  112. void __iomem *r,
  113. struct mmc_ios *ios,
  114. struct mmc_card *card);
  115. #ifdef CONFIG_S3C_DEV_HSMMC
  116. static inline void s3c6410_default_sdhci0(void)
  117. {
  118. s3c_hsmmc0_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
  119. s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
  120. s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
  121. }
  122. #else
  123. static inline void s3c6410_default_sdhci0(void) { }
  124. #endif /* CONFIG_S3C_DEV_HSMMC */
  125. #ifdef CONFIG_S3C_DEV_HSMMC1
  126. static inline void s3c6410_default_sdhci1(void)
  127. {
  128. s3c_hsmmc1_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
  129. s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
  130. s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
  131. }
  132. #else
  133. static inline void s3c6410_default_sdhci1(void) { }
  134. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  135. #ifdef CONFIG_S3C_DEV_HSMMC2
  136. static inline void s3c6410_default_sdhci2(void)
  137. {
  138. s3c_hsmmc2_def_platdata.clocks = s3c64xx_hsmmc_clksrcs;
  139. s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
  140. s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci_cfg_card;
  141. }
  142. #else
  143. static inline void s3c6410_default_sdhci2(void) { }
  144. #endif /* CONFIG_S3C_DEV_HSMMC2 */
  145. #else
  146. static inline void s3c6410_default_sdhci0(void) { }
  147. static inline void s3c6410_default_sdhci1(void) { }
  148. static inline void s3c6410_default_sdhci2(void) { }
  149. static inline void s3c6400_default_sdhci0(void) { }
  150. static inline void s3c6400_default_sdhci1(void) { }
  151. static inline void s3c6400_default_sdhci2(void) { }
  152. #endif /* CONFIG_S3C64XX_SETUP_SDHCI */
  153. /* S5PC100 SDHCI setup */
  154. #ifdef CONFIG_S5PC100_SETUP_SDHCI
  155. extern char *s5pc100_hsmmc_clksrcs[4];
  156. extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
  157. void __iomem *r,
  158. struct mmc_ios *ios,
  159. struct mmc_card *card);
  160. #ifdef CONFIG_S3C_DEV_HSMMC
  161. static inline void s5pc100_default_sdhci0(void)
  162. {
  163. s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
  164. s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
  165. s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
  166. }
  167. #else
  168. static inline void s5pc100_default_sdhci0(void) { }
  169. #endif /* CONFIG_S3C_DEV_HSMMC */
  170. #ifdef CONFIG_S3C_DEV_HSMMC1
  171. static inline void s5pc100_default_sdhci1(void)
  172. {
  173. s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
  174. s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
  175. s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
  176. }
  177. #else
  178. static inline void s5pc100_default_sdhci1(void) { }
  179. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  180. #ifdef CONFIG_S3C_DEV_HSMMC2
  181. static inline void s5pc100_default_sdhci2(void)
  182. {
  183. s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
  184. s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
  185. s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
  186. }
  187. #else
  188. static inline void s5pc100_default_sdhci2(void) { }
  189. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  190. #else
  191. static inline void s5pc100_default_sdhci0(void) { }
  192. static inline void s5pc100_default_sdhci1(void) { }
  193. static inline void s5pc100_default_sdhci2(void) { }
  194. #endif /* CONFIG_S5PC100_SETUP_SDHCI */
  195. /* S5PC110 SDHCI setup */
  196. #ifdef CONFIG_S5PV210_SETUP_SDHCI
  197. extern char *s5pv210_hsmmc_clksrcs[4];
  198. extern void s5pv210_setup_sdhci_cfg_card(struct platform_device *dev,
  199. void __iomem *r,
  200. struct mmc_ios *ios,
  201. struct mmc_card *card);
  202. #ifdef CONFIG_S3C_DEV_HSMMC
  203. static inline void s5pv210_default_sdhci0(void)
  204. {
  205. s3c_hsmmc0_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
  206. s3c_hsmmc0_def_platdata.cfg_gpio = s5pv210_setup_sdhci0_cfg_gpio;
  207. s3c_hsmmc0_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
  208. }
  209. #else
  210. static inline void s5pv210_default_sdhci0(void) { }
  211. #endif /* CONFIG_S3C_DEV_HSMMC */
  212. #ifdef CONFIG_S3C_DEV_HSMMC1
  213. static inline void s5pv210_default_sdhci1(void)
  214. {
  215. s3c_hsmmc1_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
  216. s3c_hsmmc1_def_platdata.cfg_gpio = s5pv210_setup_sdhci1_cfg_gpio;
  217. s3c_hsmmc1_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
  218. }
  219. #else
  220. static inline void s5pv210_default_sdhci1(void) { }
  221. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  222. #ifdef CONFIG_S3C_DEV_HSMMC2
  223. static inline void s5pv210_default_sdhci2(void)
  224. {
  225. s3c_hsmmc2_def_platdata.clocks = s5pv210_hsmmc_clksrcs;
  226. s3c_hsmmc2_def_platdata.cfg_gpio = s5pv210_setup_sdhci2_cfg_gpio;
  227. s3c_hsmmc2_def_platdata.cfg_card = s5pv210_setup_sdhci_cfg_card;
  228. }
  229. #else
  230. static inline void s5pv210_default_sdhci2(void) { }
  231. #endif /* CONFIG_S3C_DEV_HSMMC2 */
  232. #else
  233. static inline void s5pv210_default_sdhci0(void) { }
  234. static inline void s5pv210_default_sdhci1(void) { }
  235. static inline void s5pv210_default_sdhci2(void) { }
  236. #endif /* CONFIG_S5PC100_SETUP_SDHCI */
  237. #endif /* __PLAT_S3C_SDHCI_H */