devices-common.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. /*
  2. * Copyright (C) 2009-2010 Pengutronix
  3. * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it under
  6. * the terms of the GNU General Public License version 2 as published by the
  7. * Free Software Foundation.
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_data/dma-imx-sdma.h>
  13. extern struct device mxc_aips_bus;
  14. extern struct device mxc_ahb_bus;
  15. static inline struct platform_device *imx_add_platform_device_dmamask(
  16. const char *name, int id,
  17. const struct resource *res, unsigned int num_resources,
  18. const void *data, size_t size_data, u64 dmamask)
  19. {
  20. struct platform_device_info pdevinfo = {
  21. .name = name,
  22. .id = id,
  23. .res = res,
  24. .num_res = num_resources,
  25. .data = data,
  26. .size_data = size_data,
  27. .dma_mask = dmamask,
  28. };
  29. return platform_device_register_full(&pdevinfo);
  30. }
  31. static inline struct platform_device *imx_add_platform_device(
  32. const char *name, int id,
  33. const struct resource *res, unsigned int num_resources,
  34. const void *data, size_t size_data)
  35. {
  36. return imx_add_platform_device_dmamask(
  37. name, id, res, num_resources, data, size_data, 0);
  38. }
  39. #include <linux/fec.h>
  40. struct imx_fec_data {
  41. const char *devid;
  42. resource_size_t iobase;
  43. resource_size_t irq;
  44. };
  45. struct platform_device *__init imx_add_fec(
  46. const struct imx_fec_data *data,
  47. const struct fec_platform_data *pdata);
  48. struct imx_flexcan_data {
  49. int id;
  50. resource_size_t iobase;
  51. resource_size_t iosize;
  52. resource_size_t irq;
  53. };
  54. struct platform_device *__init imx_add_flexcan(
  55. const struct imx_flexcan_data *data);
  56. #include <linux/fsl_devices.h>
  57. struct imx_fsl_usb2_udc_data {
  58. const char *devid;
  59. resource_size_t iobase;
  60. resource_size_t irq;
  61. };
  62. struct platform_device *__init imx_add_fsl_usb2_udc(
  63. const struct imx_fsl_usb2_udc_data *data,
  64. const struct fsl_usb2_platform_data *pdata);
  65. #include <linux/gpio_keys.h>
  66. struct platform_device *__init imx_add_gpio_keys(
  67. const struct gpio_keys_platform_data *pdata);
  68. #include <linux/platform_data/usb-mx2.h>
  69. struct imx_imx21_hcd_data {
  70. resource_size_t iobase;
  71. resource_size_t irq;
  72. };
  73. struct platform_device *__init imx_add_imx21_hcd(
  74. const struct imx_imx21_hcd_data *data,
  75. const struct mx21_usbh_platform_data *pdata);
  76. struct imx_imx27_coda_data {
  77. resource_size_t iobase;
  78. resource_size_t iosize;
  79. resource_size_t irq;
  80. };
  81. struct platform_device *__init imx_add_imx27_coda(
  82. const struct imx_imx27_coda_data *data);
  83. struct imx_imx2_wdt_data {
  84. int id;
  85. resource_size_t iobase;
  86. resource_size_t iosize;
  87. };
  88. struct platform_device *__init imx_add_imx2_wdt(
  89. const struct imx_imx2_wdt_data *data);
  90. struct imx_imxdi_rtc_data {
  91. resource_size_t iobase;
  92. resource_size_t irq;
  93. };
  94. struct platform_device *__init imx_add_imxdi_rtc(
  95. const struct imx_imxdi_rtc_data *data);
  96. #include <linux/platform_data/video-imxfb.h>
  97. struct imx_imx_fb_data {
  98. const char *devid;
  99. resource_size_t iobase;
  100. resource_size_t iosize;
  101. resource_size_t irq;
  102. };
  103. struct platform_device *__init imx_add_imx_fb(
  104. const struct imx_imx_fb_data *data,
  105. const struct imx_fb_platform_data *pdata);
  106. #include <linux/platform_data/i2c-imx.h>
  107. struct imx_imx_i2c_data {
  108. const char *devid;
  109. int id;
  110. resource_size_t iobase;
  111. resource_size_t iosize;
  112. resource_size_t irq;
  113. };
  114. struct platform_device *__init imx_add_imx_i2c(
  115. const struct imx_imx_i2c_data *data,
  116. const struct imxi2c_platform_data *pdata);
  117. #include <linux/input/matrix_keypad.h>
  118. struct imx_imx_keypad_data {
  119. resource_size_t iobase;
  120. resource_size_t iosize;
  121. resource_size_t irq;
  122. };
  123. struct platform_device *__init imx_add_imx_keypad(
  124. const struct imx_imx_keypad_data *data,
  125. const struct matrix_keymap_data *pdata);
  126. #include <linux/platform_data/asoc-imx-ssi.h>
  127. struct imx_imx_ssi_data {
  128. int id;
  129. resource_size_t iobase;
  130. resource_size_t iosize;
  131. resource_size_t irq;
  132. resource_size_t dmatx0;
  133. resource_size_t dmarx0;
  134. resource_size_t dmatx1;
  135. resource_size_t dmarx1;
  136. };
  137. struct platform_device *__init imx_add_imx_ssi(
  138. const struct imx_imx_ssi_data *data,
  139. const struct imx_ssi_platform_data *pdata);
  140. #include <linux/platform_data/serial-imx.h>
  141. struct imx_imx_uart_1irq_data {
  142. int id;
  143. resource_size_t iobase;
  144. resource_size_t iosize;
  145. resource_size_t irq;
  146. };
  147. struct platform_device *__init imx_add_imx_uart_1irq(
  148. const struct imx_imx_uart_1irq_data *data,
  149. const struct imxuart_platform_data *pdata);
  150. #include <linux/platform_data/video-mx3fb.h>
  151. #include <linux/platform_data/media/camera-mx3.h>
  152. struct imx_ipu_core_data {
  153. resource_size_t iobase;
  154. resource_size_t synirq;
  155. resource_size_t errirq;
  156. };
  157. struct platform_device *__init imx_add_ipu_core(
  158. const struct imx_ipu_core_data *data);
  159. struct platform_device *__init imx_alloc_mx3_camera(
  160. const struct imx_ipu_core_data *data,
  161. const struct mx3_camera_pdata *pdata);
  162. struct platform_device *__init imx_add_mx3_sdc_fb(
  163. const struct imx_ipu_core_data *data,
  164. struct mx3fb_platform_data *pdata);
  165. #include <linux/platform_data/media/camera-mx2.h>
  166. struct imx_mx2_camera_data {
  167. const char *devid;
  168. resource_size_t iobasecsi;
  169. resource_size_t iosizecsi;
  170. resource_size_t irqcsi;
  171. resource_size_t iobaseemmaprp;
  172. resource_size_t iosizeemmaprp;
  173. resource_size_t irqemmaprp;
  174. };
  175. struct platform_device *__init imx_add_mx2_camera(
  176. const struct imx_mx2_camera_data *data,
  177. const struct mx2_camera_platform_data *pdata);
  178. struct imx_mx2_emma_data {
  179. resource_size_t iobase;
  180. resource_size_t iosize;
  181. resource_size_t irq;
  182. };
  183. struct platform_device *__init imx_add_mx2_emmaprp(
  184. const struct imx_mx2_emma_data *data);
  185. #include <linux/platform_data/usb-ehci-mxc.h>
  186. struct imx_mxc_ehci_data {
  187. int id;
  188. resource_size_t iobase;
  189. resource_size_t irq;
  190. };
  191. struct platform_device *__init imx_add_mxc_ehci(
  192. const struct imx_mxc_ehci_data *data,
  193. const struct mxc_usbh_platform_data *pdata);
  194. #include <linux/platform_data/mmc-mxcmmc.h>
  195. struct imx_mxc_mmc_data {
  196. const char *devid;
  197. int id;
  198. resource_size_t iobase;
  199. resource_size_t iosize;
  200. resource_size_t irq;
  201. resource_size_t dmareq;
  202. };
  203. struct platform_device *__init imx_add_mxc_mmc(
  204. const struct imx_mxc_mmc_data *data,
  205. const struct imxmmc_platform_data *pdata);
  206. #include <linux/platform_data/mtd-mxc_nand.h>
  207. struct imx_mxc_nand_data {
  208. const char *devid;
  209. /*
  210. * id is traditionally 0, but -1 is more appropriate. We use -1 for new
  211. * machines but don't change existing devices as the nand device usually
  212. * appears in the kernel command line to pass its partitioning.
  213. */
  214. int id;
  215. resource_size_t iobase;
  216. resource_size_t iosize;
  217. resource_size_t axibase;
  218. resource_size_t irq;
  219. };
  220. struct platform_device *__init imx_add_mxc_nand(
  221. const struct imx_mxc_nand_data *data,
  222. const struct mxc_nand_platform_data *pdata);
  223. struct imx_pata_imx_data {
  224. resource_size_t iobase;
  225. resource_size_t iosize;
  226. resource_size_t irq;
  227. };
  228. struct platform_device *__init imx_add_pata_imx(
  229. const struct imx_pata_imx_data *data);
  230. /* mxc_rtc */
  231. struct imx_mxc_rtc_data {
  232. const char *devid;
  233. resource_size_t iobase;
  234. resource_size_t irq;
  235. };
  236. struct platform_device *__init imx_add_mxc_rtc(
  237. const struct imx_mxc_rtc_data *data);
  238. /* mxc_w1 */
  239. struct imx_mxc_w1_data {
  240. resource_size_t iobase;
  241. };
  242. struct platform_device *__init imx_add_mxc_w1(
  243. const struct imx_mxc_w1_data *data);
  244. #include <linux/platform_data/mmc-esdhc-imx.h>
  245. struct imx_sdhci_esdhc_imx_data {
  246. const char *devid;
  247. int id;
  248. resource_size_t iobase;
  249. resource_size_t irq;
  250. };
  251. struct platform_device *__init imx_add_sdhci_esdhc_imx(
  252. const struct imx_sdhci_esdhc_imx_data *data,
  253. const struct esdhc_platform_data *pdata);
  254. #include <linux/platform_data/spi-imx.h>
  255. struct imx_spi_imx_data {
  256. const char *devid;
  257. int id;
  258. resource_size_t iobase;
  259. resource_size_t iosize;
  260. int irq;
  261. };
  262. struct platform_device *__init imx_add_spi_imx(
  263. const struct imx_spi_imx_data *data,
  264. const struct spi_imx_master *pdata);
  265. struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
  266. int irq, int irq_err);
  267. struct platform_device *imx_add_imx_sdma(char *name,
  268. resource_size_t iobase, int irq, struct sdma_platform_data *pdata);