blob: 6277baf1b7be74496c4f000867bc9a899d7a7adb [file] [log] [blame]
Uwe Kleine-König253ff1f2010-06-15 11:31:02 +02001/*
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>
Arnd Bergmann82906b12012-08-24 15:14:29 +020012#include <linux/platform_data/dma-imx-sdma.h>
Uwe Kleine-König253ff1f2010-06-15 11:31:02 +020013
Shawn Guob78d8e52011-06-06 00:07:55 +080014extern struct device mxc_aips_bus;
Shawn Guo36223602011-06-22 22:41:30 +080015extern struct device mxc_ahb_bus;
Shawn Guob78d8e52011-06-06 00:07:55 +080016
Uwe Kleine-König0e392412011-08-25 11:16:01 +020017static inline struct platform_device *imx_add_platform_device_dmamask(
Uwe Kleine-König6332c102010-11-02 11:56:54 +010018 const char *name, int id,
Uwe Kleine-König253ff1f2010-06-15 11:31:02 +020019 const struct resource *res, unsigned int num_resources,
Uwe Kleine-König0e392412011-08-25 11:16:01 +020020 const void *data, size_t size_data, u64 dmamask)
21{
22 struct platform_device_info pdevinfo = {
23 .name = name,
24 .id = id,
25 .res = res,
26 .num_res = num_resources,
27 .data = data,
28 .size_data = size_data,
29 .dma_mask = dmamask,
30 };
31 return platform_device_register_full(&pdevinfo);
32}
Uwe Kleine-König6332c102010-11-02 11:56:54 +010033
34static inline struct platform_device *imx_add_platform_device(
35 const char *name, int id,
36 const struct resource *res, unsigned int num_resources,
37 const void *data, size_t size_data)
38{
39 return imx_add_platform_device_dmamask(
40 name, id, res, num_resources, data, size_data, 0);
41}
Uwe Kleine-König66384ee2010-06-15 18:14:19 +020042
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020043#include <linux/fec.h>
44struct imx_fec_data {
Shawn Guo0ca1e292011-07-01 18:11:22 +080045 const char *devid;
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020046 resource_size_t iobase;
47 resource_size_t irq;
48};
49struct platform_device *__init imx_add_fec(
50 const struct imx_fec_data *data,
51 const struct fec_platform_data *pdata);
52
Marc Kleine-Budde61c68502010-07-22 11:45:34 +020053#include <linux/can/platform/flexcan.h>
Uwe Kleine-Königfc40d012010-11-04 12:02:35 +010054struct imx_flexcan_data {
55 int id;
56 resource_size_t iobase;
57 resource_size_t iosize;
58 resource_size_t irq;
59};
60struct platform_device *__init imx_add_flexcan(
61 const struct imx_flexcan_data *data,
Marc Kleine-Budde61c68502010-07-22 11:45:34 +020062 const struct flexcan_platform_data *pdata);
Marc Kleine-Budde61c68502010-07-22 11:45:34 +020063
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010064#include <linux/fsl_devices.h>
65struct imx_fsl_usb2_udc_data {
66 resource_size_t iobase;
67 resource_size_t irq;
68};
69struct platform_device *__init imx_add_fsl_usb2_udc(
70 const struct imx_fsl_usb2_udc_data *data,
71 const struct fsl_usb2_platform_data *pdata);
72
Dinh Nguyen47c53822010-10-23 09:12:46 -050073#include <linux/gpio_keys.h>
74struct platform_device *__init imx_add_gpio_keys(
75 const struct gpio_keys_platform_data *pdata);
76
Arnd Bergmann82906b12012-08-24 15:14:29 +020077#include <linux/platform_data/usb-mx2.h>
Uwe Kleine-König9f8714692010-11-10 10:11:23 +010078struct imx_imx21_hcd_data {
79 resource_size_t iobase;
80 resource_size_t irq;
81};
82struct platform_device *__init imx_add_imx21_hcd(
83 const struct imx_imx21_hcd_data *data,
84 const struct mx21_usbh_platform_data *pdata);
85
Javier Martin6d8c4522012-07-26 05:45:32 -030086struct imx_imx27_coda_data {
87 resource_size_t iobase;
88 resource_size_t iosize;
89 resource_size_t irq;
90};
91struct platform_device *__init imx_add_imx27_coda(
92 const struct imx_imx27_coda_data *data);
93
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010094struct imx_imx2_wdt_data {
Fabio Estevam8c2efec2010-12-06 16:38:32 -020095 int id;
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010096 resource_size_t iobase;
Uwe Kleine-König00871502010-11-11 16:58:50 +010097 resource_size_t iosize;
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010098};
99struct platform_device *__init imx_add_imx2_wdt(
100 const struct imx_imx2_wdt_data *data);
101
Uwe Kleine-Könige7c74b32010-11-11 11:57:21 +0100102struct imx_imxdi_rtc_data {
103 resource_size_t iobase;
104 resource_size_t irq;
105};
106struct platform_device *__init imx_add_imxdi_rtc(
107 const struct imx_imxdi_rtc_data *data);
108
Arnd Bergmann82906b12012-08-24 15:14:29 +0200109#include <linux/platform_data/video-imxfb.h>
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100110struct imx_imx_fb_data {
Shawn Guoe69dc9a2012-09-16 19:59:53 +0800111 const char *devid;
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100112 resource_size_t iobase;
Uwe Kleine-König194ee8e2010-11-11 15:32:21 +0100113 resource_size_t iosize;
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100114 resource_size_t irq;
115};
116struct platform_device *__init imx_add_imx_fb(
117 const struct imx_imx_fb_data *data,
118 const struct imx_fb_platform_data *pdata);
119
Arnd Bergmann82906b12012-08-24 15:14:29 +0200120#include <linux/platform_data/i2c-imx.h>
Uwe Kleine-König64de5ec2010-09-21 12:13:34 +0200121struct imx_imx_i2c_data {
Shawn Guo5bdfba22012-09-14 15:19:00 +0800122 const char *devid;
Uwe Kleine-König64de5ec2010-09-21 12:13:34 +0200123 int id;
124 resource_size_t iobase;
125 resource_size_t iosize;
126 resource_size_t irq;
127};
128struct platform_device *__init imx_add_imx_i2c(
129 const struct imx_imx_i2c_data *data,
Uwe Kleine-König99a754d2010-06-16 14:37:51 +0200130 const struct imxi2c_platform_data *pdata);
131
Uwe Kleine-König3f880142010-11-10 09:58:56 +0100132#include <linux/input/matrix_keypad.h>
133struct imx_imx_keypad_data {
134 resource_size_t iobase;
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +0100135 resource_size_t iosize;
Uwe Kleine-König3f880142010-11-10 09:58:56 +0100136 resource_size_t irq;
137};
138struct platform_device *__init imx_add_imx_keypad(
139 const struct imx_imx_keypad_data *data,
140 const struct matrix_keymap_data *pdata);
141
Arnd Bergmann82906b12012-08-24 15:14:29 +0200142#include <linux/platform_data/asoc-imx-ssi.h>
Uwe Kleine-König4697bb922010-08-25 17:37:45 +0200143struct imx_imx_ssi_data {
144 int id;
145 resource_size_t iobase;
146 resource_size_t iosize;
147 resource_size_t irq;
148 resource_size_t dmatx0;
149 resource_size_t dmarx0;
150 resource_size_t dmatx1;
151 resource_size_t dmarx1;
152};
153struct platform_device *__init imx_add_imx_ssi(
154 const struct imx_imx_ssi_data *data,
155 const struct imx_ssi_platform_data *pdata);
156
Arnd Bergmann82906b12012-08-24 15:14:29 +0200157#include <linux/platform_data/serial-imx.h>
Uwe Kleine-König5162de02010-08-10 22:57:24 +0200158struct imx_imx_uart_3irq_data {
159 int id;
160 resource_size_t iobase;
161 resource_size_t iosize;
162 resource_size_t irqrx;
163 resource_size_t irqtx;
164 resource_size_t irqrts;
165};
166struct platform_device *__init imx_add_imx_uart_3irq(
167 const struct imx_imx_uart_3irq_data *data,
Uwe Kleine-König2db68232010-06-22 14:49:20 +0200168 const struct imxuart_platform_data *pdata);
Uwe Kleine-König5162de02010-08-10 22:57:24 +0200169
170struct imx_imx_uart_1irq_data {
171 int id;
172 resource_size_t iobase;
173 resource_size_t iosize;
174 resource_size_t irq;
175};
176struct platform_device *__init imx_add_imx_uart_1irq(
177 const struct imx_imx_uart_1irq_data *data,
Uwe Kleine-König2db68232010-06-22 14:49:20 +0200178 const struct imxuart_platform_data *pdata);
179
Arnd Bergmann82906b12012-08-24 15:14:29 +0200180#include <linux/platform_data/usb-imx_udc.h>
Uwe Kleine-Könige0830002010-11-02 10:03:51 +0100181struct imx_imx_udc_data {
182 resource_size_t iobase;
183 resource_size_t iosize;
184 resource_size_t irq0;
185 resource_size_t irq1;
186 resource_size_t irq2;
187 resource_size_t irq3;
188 resource_size_t irq4;
189 resource_size_t irq5;
190 resource_size_t irq6;
191};
192struct platform_device *__init imx_add_imx_udc(
193 const struct imx_imx_udc_data *data,
194 const struct imxusb_platform_data *pdata);
195
Arnd Bergmann82906b12012-08-24 15:14:29 +0200196#include <linux/platform_data/video-mx3fb.h>
197#include <linux/platform_data/camera-mx3.h>
Uwe Kleine-Königafa77ef2011-03-03 21:32:02 +0100198struct imx_ipu_core_data {
199 resource_size_t iobase;
200 resource_size_t synirq;
201 resource_size_t errirq;
202};
203struct platform_device *__init imx_add_ipu_core(
Shawn Guo88289c82012-06-13 14:07:31 +0800204 const struct imx_ipu_core_data *data);
Uwe Kleine-Königafa77ef2011-03-03 21:32:02 +0100205struct platform_device *__init imx_alloc_mx3_camera(
206 const struct imx_ipu_core_data *data,
207 const struct mx3_camera_pdata *pdata);
208struct platform_device *__init imx_add_mx3_sdc_fb(
209 const struct imx_ipu_core_data *data,
210 struct mx3fb_platform_data *pdata);
211
Arnd Bergmann82906b12012-08-24 15:14:29 +0200212#include <linux/platform_data/camera-mx1.h>
Uwe Kleine-König9bb39b32010-11-02 11:59:08 +0100213struct imx_mx1_camera_data {
214 resource_size_t iobase;
215 resource_size_t iosize;
216 resource_size_t irq;
217};
218struct platform_device *__init imx_add_mx1_camera(
219 const struct imx_mx1_camera_data *data,
220 const struct mx1_camera_pdata *pdata);
221
Arnd Bergmann82906b12012-08-24 15:14:29 +0200222#include <linux/platform_data/camera-mx2.h>
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100223struct imx_mx2_camera_data {
Shawn Guo27b76482012-09-16 16:26:20 +0800224 const char *devid;
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100225 resource_size_t iobasecsi;
226 resource_size_t iosizecsi;
227 resource_size_t irqcsi;
228 resource_size_t iobaseemmaprp;
229 resource_size_t iosizeemmaprp;
230 resource_size_t irqemmaprp;
231};
232struct platform_device *__init imx_add_mx2_camera(
233 const struct imx_mx2_camera_data *data,
234 const struct mx2_camera_platform_data *pdata);
Gaëtan Carlier3ab3a352012-09-05 13:06:15 +0200235
236
237struct imx_mx2_emma_data {
238 resource_size_t iobase;
239 resource_size_t iosize;
240 resource_size_t irq;
241};
Javier Martin52f1a842012-01-13 06:31:57 -0300242struct platform_device *__init imx_add_mx2_emmaprp(
Gaëtan Carlier3ab3a352012-09-05 13:06:15 +0200243 const struct imx_mx2_emma_data *data);
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100244
Arnd Bergmann82906b12012-08-24 15:14:29 +0200245#include <linux/platform_data/usb-ehci-mxc.h>
Uwe Kleine-König2eb42d52010-11-05 18:52:09 +0100246struct imx_mxc_ehci_data {
247 int id;
248 resource_size_t iobase;
249 resource_size_t irq;
250};
251struct platform_device *__init imx_add_mxc_ehci(
252 const struct imx_mxc_ehci_data *data,
253 const struct mxc_usbh_platform_data *pdata);
254
Arnd Bergmann82906b12012-08-24 15:14:29 +0200255#include <linux/platform_data/mmc-mxcmmc.h>
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100256struct imx_mxc_mmc_data {
Shawn Guo7f917a82012-09-16 16:54:30 +0800257 const char *devid;
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100258 int id;
259 resource_size_t iobase;
Uwe Kleine-König6a697e32010-11-12 11:10:55 +0100260 resource_size_t iosize;
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100261 resource_size_t irq;
262 resource_size_t dmareq;
263};
264struct platform_device *__init imx_add_mxc_mmc(
265 const struct imx_mxc_mmc_data *data,
266 const struct imxmmc_platform_data *pdata);
267
Arnd Bergmann82906b12012-08-24 15:14:29 +0200268#include <linux/platform_data/mtd-mxc_nand.h>
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200269struct imx_mxc_nand_data {
Shawn Guo4d624352012-09-15 13:34:09 +0800270 const char *devid;
Sascha Hauer63a7c6d2010-08-03 11:59:46 +0200271 /*
272 * id is traditionally 0, but -1 is more appropriate. We use -1 for new
273 * machines but don't change existing devices as the nand device usually
274 * appears in the kernel command line to pass its partitioning.
275 */
276 int id;
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200277 resource_size_t iobase;
278 resource_size_t iosize;
Sascha Hauer63a7c6d2010-08-03 11:59:46 +0200279 resource_size_t axibase;
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200280 resource_size_t irq;
281};
282struct platform_device *__init imx_add_mxc_nand(
283 const struct imx_mxc_nand_data *data,
284 const struct mxc_nand_platform_data *pdata);
Uwe Kleine-König02870732010-06-21 18:02:55 +0200285
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +0200286struct imx_pata_imx_data {
287 resource_size_t iobase;
Fabio Estevam236c4e82011-08-23 17:18:06 -0300288 resource_size_t iosize;
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +0200289 resource_size_t irq;
290};
291struct platform_device *__init imx_add_pata_imx(
292 const struct imx_pata_imx_data *data);
293
Uwe Kleine-Königbf182bc2010-11-05 15:01:16 +0100294struct imx_mxc_pwm_data {
Uwe Kleine-König5f3d1092010-11-10 22:15:45 +0100295 int id;
Uwe Kleine-Königbf182bc2010-11-05 15:01:16 +0100296 resource_size_t iobase;
Uwe Kleine-König5f3d1092010-11-10 22:15:45 +0100297 resource_size_t iosize;
Uwe Kleine-Königbf182bc2010-11-05 15:01:16 +0100298 resource_size_t irq;
299};
300struct platform_device *__init imx_add_mxc_pwm(
301 const struct imx_mxc_pwm_data *data);
302
Uwe Kleine-König83422672011-03-01 11:04:34 +0100303/* mxc_rtc */
304struct imx_mxc_rtc_data {
Shawn Guobb1d34a2012-09-15 14:26:14 +0800305 const char *devid;
Uwe Kleine-König83422672011-03-01 11:04:34 +0100306 resource_size_t iobase;
307 resource_size_t irq;
308};
309struct platform_device *__init imx_add_mxc_rtc(
310 const struct imx_mxc_rtc_data *data);
311
312/* mxc_w1 */
Uwe Kleine-Königae71a562010-10-29 10:56:07 +0200313struct imx_mxc_w1_data {
314 resource_size_t iobase;
315};
316struct platform_device *__init imx_add_mxc_w1(
317 const struct imx_mxc_w1_data *data);
318
Arnd Bergmann82906b12012-08-24 15:14:29 +0200319#include <linux/platform_data/mmc-esdhc-imx.h>
Uwe Kleine-König124bf942010-11-19 21:03:33 +0100320struct imx_sdhci_esdhc_imx_data {
Shawn Guo57ed3312011-06-30 09:24:26 +0800321 const char *devid;
Uwe Kleine-König124bf942010-11-19 21:03:33 +0100322 int id;
323 resource_size_t iobase;
324 resource_size_t irq;
325};
326struct platform_device *__init imx_add_sdhci_esdhc_imx(
327 const struct imx_sdhci_esdhc_imx_data *data,
328 const struct esdhc_platform_data *pdata);
329
Arnd Bergmann82906b12012-08-24 15:14:29 +0200330#include <linux/platform_data/spi-imx.h>
Uwe Kleine-König35bab052010-09-09 21:02:02 +0200331struct imx_spi_imx_data {
Uwe Kleine-Königab560502010-09-09 21:02:02 +0200332 const char *devid;
Uwe Kleine-König35bab052010-09-09 21:02:02 +0200333 int id;
334 resource_size_t iobase;
335 resource_size_t iosize;
336 int irq;
337};
338struct platform_device *__init imx_add_spi_imx(
339 const struct imx_spi_imx_data *data,
Uwe Kleine-König02870732010-06-21 18:02:55 +0200340 const struct spi_imx_master *pdata);
Shawn Guo36223602011-06-22 22:41:30 +0800341
Shawn Guoe51d0f02012-09-15 21:11:28 +0800342struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
Shawn Guo73930eb2012-09-15 15:57:00 +0800343 int irq, int irq_err);
Shawn Guo62550cd2011-07-13 21:33:17 +0800344struct platform_device *imx_add_imx_sdma(char *name,
Shawn Guo36223602011-06-22 22:41:30 +0800345 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
Richard Zhu97915bd2011-09-28 15:41:53 +0800346
347#include <linux/ahci_platform.h>
348struct imx_ahci_imx_data {
349 const char *devid;
350 resource_size_t iobase;
351 resource_size_t irq;
352};
353struct platform_device *__init imx_add_ahci_imx(
354 const struct imx_ahci_imx_data *data,
355 const struct ahci_platform_data *pdata);