sdhci.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. /* Default platform data, exported so that per-cpu initialisation can
  56. * set the correct one when there are more than one cpu type selected.
  57. */
  58. extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata;
  59. extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata;
  60. extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata;
  61. /* Helper function availablity */
  62. extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  63. extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  64. extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
  65. extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
  66. extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  67. extern void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
  68. /* S3C6400 SDHCI setup */
  69. #ifdef CONFIG_S3C6400_SETUP_SDHCI
  70. extern char *s3c6400_hsmmc_clksrcs[4];
  71. #ifdef CONFIG_S3C_DEV_HSMMC
  72. extern void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev,
  73. void __iomem *r,
  74. struct mmc_ios *ios,
  75. struct mmc_card *card);
  76. static inline void s3c6400_default_sdhci0(void)
  77. {
  78. s3c_hsmmc0_def_platdata.clocks = s3c6400_hsmmc_clksrcs;
  79. s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
  80. s3c_hsmmc0_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
  81. }
  82. #else
  83. static inline void s3c6400_default_sdhci0(void) { }
  84. #endif /* CONFIG_S3C_DEV_HSMMC */
  85. #ifdef CONFIG_S3C_DEV_HSMMC1
  86. static inline void s3c6400_default_sdhci1(void)
  87. {
  88. s3c_hsmmc1_def_platdata.clocks = s3c6400_hsmmc_clksrcs;
  89. s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
  90. s3c_hsmmc1_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
  91. }
  92. #else
  93. static inline void s3c6400_default_sdhci1(void) { }
  94. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  95. #ifdef CONFIG_S3C_DEV_HSMMC2
  96. static inline void s3c6400_default_sdhci2(void)
  97. {
  98. s3c_hsmmc2_def_platdata.clocks = s3c6400_hsmmc_clksrcs;
  99. s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
  100. s3c_hsmmc2_def_platdata.cfg_card = s3c6400_setup_sdhci_cfg_card;
  101. }
  102. #else
  103. static inline void s3c6400_default_sdhci2(void) { }
  104. #endif /* CONFIG_S3C_DEV_HSMMC2 */
  105. #else
  106. static inline void s3c6400_default_sdhci0(void) { }
  107. static inline void s3c6400_default_sdhci1(void) { }
  108. #endif /* CONFIG_S3C6400_SETUP_SDHCI */
  109. /* S3C6410 SDHCI setup */
  110. #ifdef CONFIG_S3C6410_SETUP_SDHCI
  111. extern char *s3c6410_hsmmc_clksrcs[4];
  112. extern void s3c6410_setup_sdhci0_cfg_card(struct platform_device *dev,
  113. void __iomem *r,
  114. struct mmc_ios *ios,
  115. struct mmc_card *card);
  116. #ifdef CONFIG_S3C_DEV_HSMMC
  117. static inline void s3c6410_default_sdhci0(void)
  118. {
  119. s3c_hsmmc0_def_platdata.clocks = s3c6410_hsmmc_clksrcs;
  120. s3c_hsmmc0_def_platdata.cfg_gpio = s3c64xx_setup_sdhci0_cfg_gpio;
  121. s3c_hsmmc0_def_platdata.cfg_card = s3c6410_setup_sdhci0_cfg_card;
  122. }
  123. #else
  124. static inline void s3c6410_default_sdhci0(void) { }
  125. #endif /* CONFIG_S3C_DEV_HSMMC */
  126. #ifdef CONFIG_S3C_DEV_HSMMC1
  127. static inline void s3c6410_default_sdhci1(void)
  128. {
  129. s3c_hsmmc1_def_platdata.clocks = s3c6410_hsmmc_clksrcs;
  130. s3c_hsmmc1_def_platdata.cfg_gpio = s3c64xx_setup_sdhci1_cfg_gpio;
  131. s3c_hsmmc1_def_platdata.cfg_card = s3c6410_setup_sdhci0_cfg_card;
  132. }
  133. #else
  134. static inline void s3c6410_default_sdhci1(void) { }
  135. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  136. #ifdef CONFIG_S3C_DEV_HSMMC2
  137. static inline void s3c6410_default_sdhci2(void)
  138. {
  139. s3c_hsmmc2_def_platdata.clocks = s3c6410_hsmmc_clksrcs;
  140. s3c_hsmmc2_def_platdata.cfg_gpio = s3c64xx_setup_sdhci2_cfg_gpio;
  141. s3c_hsmmc2_def_platdata.cfg_card = s3c6410_setup_sdhci0_cfg_card;
  142. }
  143. #else
  144. static inline void s3c6410_default_sdhci2(void) { }
  145. #endif /* CONFIG_S3C_DEV_HSMMC2 */
  146. #else
  147. static inline void s3c6410_default_sdhci0(void) { }
  148. static inline void s3c6410_default_sdhci1(void) { }
  149. #endif /* CONFIG_S3C6410_SETUP_SDHCI */
  150. /* S5PC100 SDHCI setup */
  151. #ifdef CONFIG_S5PC100_SETUP_SDHCI
  152. extern char *s5pc100_hsmmc_clksrcs[4];
  153. extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev,
  154. void __iomem *r,
  155. struct mmc_ios *ios,
  156. struct mmc_card *card);
  157. #ifdef CONFIG_S3C_DEV_HSMMC
  158. static inline void s5pc100_default_sdhci0(void)
  159. {
  160. s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
  161. s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio;
  162. s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
  163. }
  164. #else
  165. static inline void s5pc100_default_sdhci0(void) { }
  166. #endif /* CONFIG_S3C_DEV_HSMMC */
  167. #ifdef CONFIG_S3C_DEV_HSMMC1
  168. static inline void s5pc100_default_sdhci1(void)
  169. {
  170. s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
  171. s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio;
  172. s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
  173. }
  174. #else
  175. static inline void s5pc100_default_sdhci1(void) { }
  176. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  177. #ifdef CONFIG_S3C_DEV_HSMMC2
  178. static inline void s5pc100_default_sdhci2(void)
  179. {
  180. s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs;
  181. s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio;
  182. s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card;
  183. }
  184. #else
  185. static inline void s5pc100_default_sdhci2(void) { }
  186. #endif /* CONFIG_S3C_DEV_HSMMC1 */
  187. #else
  188. static inline void s5pc100_default_sdhci0(void) { }
  189. static inline void s5pc100_default_sdhci1(void) { }
  190. static inline void s5pc100_default_sdhci2(void) { }
  191. #endif /* CONFIG_S5PC100_SETUP_SDHCI */
  192. #endif /* __PLAT_S3C_SDHCI_H */