blob: 9bd5777ff0e78aee55115a6255925ec0804a6593 [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 {
Peter Chenf0ea8832013-01-17 18:03:15 +080066 const char *devid;
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010067 resource_size_t iobase;
68 resource_size_t irq;
69};
70struct platform_device *__init imx_add_fsl_usb2_udc(
71 const struct imx_fsl_usb2_udc_data *data,
72 const struct fsl_usb2_platform_data *pdata);
73
Dinh Nguyen47c53822010-10-23 09:12:46 -050074#include <linux/gpio_keys.h>
75struct platform_device *__init imx_add_gpio_keys(
76 const struct gpio_keys_platform_data *pdata);
77
Arnd Bergmann82906b12012-08-24 15:14:29 +020078#include <linux/platform_data/usb-mx2.h>
Uwe Kleine-König9f8714692010-11-10 10:11:23 +010079struct imx_imx21_hcd_data {
80 resource_size_t iobase;
81 resource_size_t irq;
82};
83struct platform_device *__init imx_add_imx21_hcd(
84 const struct imx_imx21_hcd_data *data,
85 const struct mx21_usbh_platform_data *pdata);
86
Javier Martin6d8c4522012-07-26 05:45:32 -030087struct imx_imx27_coda_data {
88 resource_size_t iobase;
89 resource_size_t iosize;
90 resource_size_t irq;
91};
92struct platform_device *__init imx_add_imx27_coda(
93 const struct imx_imx27_coda_data *data);
94
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010095struct imx_imx2_wdt_data {
Fabio Estevam8c2efec2010-12-06 16:38:32 -020096 int id;
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010097 resource_size_t iobase;
Uwe Kleine-König00871502010-11-11 16:58:50 +010098 resource_size_t iosize;
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010099};
100struct platform_device *__init imx_add_imx2_wdt(
101 const struct imx_imx2_wdt_data *data);
102
Uwe Kleine-Könige7c74b32010-11-11 11:57:21 +0100103struct imx_imxdi_rtc_data {
104 resource_size_t iobase;
105 resource_size_t irq;
106};
107struct platform_device *__init imx_add_imxdi_rtc(
108 const struct imx_imxdi_rtc_data *data);
109
Arnd Bergmann82906b12012-08-24 15:14:29 +0200110#include <linux/platform_data/video-imxfb.h>
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100111struct imx_imx_fb_data {
Shawn Guoe69dc9a2012-09-16 19:59:53 +0800112 const char *devid;
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100113 resource_size_t iobase;
Uwe Kleine-König194ee8e2010-11-11 15:32:21 +0100114 resource_size_t iosize;
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100115 resource_size_t irq;
116};
117struct platform_device *__init imx_add_imx_fb(
118 const struct imx_imx_fb_data *data,
119 const struct imx_fb_platform_data *pdata);
120
Arnd Bergmann82906b12012-08-24 15:14:29 +0200121#include <linux/platform_data/i2c-imx.h>
Uwe Kleine-König64de5ec2010-09-21 12:13:34 +0200122struct imx_imx_i2c_data {
Shawn Guo5bdfba22012-09-14 15:19:00 +0800123 const char *devid;
Uwe Kleine-König64de5ec2010-09-21 12:13:34 +0200124 int id;
125 resource_size_t iobase;
126 resource_size_t iosize;
127 resource_size_t irq;
128};
129struct platform_device *__init imx_add_imx_i2c(
130 const struct imx_imx_i2c_data *data,
Uwe Kleine-König99a754d2010-06-16 14:37:51 +0200131 const struct imxi2c_platform_data *pdata);
132
Uwe Kleine-König3f880142010-11-10 09:58:56 +0100133#include <linux/input/matrix_keypad.h>
134struct imx_imx_keypad_data {
135 resource_size_t iobase;
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +0100136 resource_size_t iosize;
Uwe Kleine-König3f880142010-11-10 09:58:56 +0100137 resource_size_t irq;
138};
139struct platform_device *__init imx_add_imx_keypad(
140 const struct imx_imx_keypad_data *data,
141 const struct matrix_keymap_data *pdata);
142
Arnd Bergmann82906b12012-08-24 15:14:29 +0200143#include <linux/platform_data/asoc-imx-ssi.h>
Uwe Kleine-König4697bb922010-08-25 17:37:45 +0200144struct imx_imx_ssi_data {
145 int id;
146 resource_size_t iobase;
147 resource_size_t iosize;
148 resource_size_t irq;
149 resource_size_t dmatx0;
150 resource_size_t dmarx0;
151 resource_size_t dmatx1;
152 resource_size_t dmarx1;
153};
154struct platform_device *__init imx_add_imx_ssi(
155 const struct imx_imx_ssi_data *data,
156 const struct imx_ssi_platform_data *pdata);
157
Arnd Bergmann82906b12012-08-24 15:14:29 +0200158#include <linux/platform_data/serial-imx.h>
Uwe Kleine-König5162de02010-08-10 22:57:24 +0200159struct imx_imx_uart_3irq_data {
160 int id;
161 resource_size_t iobase;
162 resource_size_t iosize;
163 resource_size_t irqrx;
164 resource_size_t irqtx;
165 resource_size_t irqrts;
166};
167struct platform_device *__init imx_add_imx_uart_3irq(
168 const struct imx_imx_uart_3irq_data *data,
Uwe Kleine-König2db68232010-06-22 14:49:20 +0200169 const struct imxuart_platform_data *pdata);
Uwe Kleine-König5162de02010-08-10 22:57:24 +0200170
171struct imx_imx_uart_1irq_data {
172 int id;
173 resource_size_t iobase;
174 resource_size_t iosize;
175 resource_size_t irq;
176};
177struct platform_device *__init imx_add_imx_uart_1irq(
178 const struct imx_imx_uart_1irq_data *data,
Uwe Kleine-König2db68232010-06-22 14:49:20 +0200179 const struct imxuart_platform_data *pdata);
180
Arnd Bergmann82906b12012-08-24 15:14:29 +0200181#include <linux/platform_data/usb-imx_udc.h>
Uwe Kleine-Könige0830002010-11-02 10:03:51 +0100182struct imx_imx_udc_data {
183 resource_size_t iobase;
184 resource_size_t iosize;
185 resource_size_t irq0;
186 resource_size_t irq1;
187 resource_size_t irq2;
188 resource_size_t irq3;
189 resource_size_t irq4;
190 resource_size_t irq5;
191 resource_size_t irq6;
192};
193struct platform_device *__init imx_add_imx_udc(
194 const struct imx_imx_udc_data *data,
195 const struct imxusb_platform_data *pdata);
196
Arnd Bergmann82906b12012-08-24 15:14:29 +0200197#include <linux/platform_data/video-mx3fb.h>
198#include <linux/platform_data/camera-mx3.h>
Uwe Kleine-Königafa77ef2011-03-03 21:32:02 +0100199struct imx_ipu_core_data {
200 resource_size_t iobase;
201 resource_size_t synirq;
202 resource_size_t errirq;
203};
204struct platform_device *__init imx_add_ipu_core(
Shawn Guo88289c82012-06-13 14:07:31 +0800205 const struct imx_ipu_core_data *data);
Uwe Kleine-Königafa77ef2011-03-03 21:32:02 +0100206struct platform_device *__init imx_alloc_mx3_camera(
207 const struct imx_ipu_core_data *data,
208 const struct mx3_camera_pdata *pdata);
209struct platform_device *__init imx_add_mx3_sdc_fb(
210 const struct imx_ipu_core_data *data,
211 struct mx3fb_platform_data *pdata);
212
Arnd Bergmann82906b12012-08-24 15:14:29 +0200213#include <linux/platform_data/camera-mx1.h>
Uwe Kleine-König9bb39b32010-11-02 11:59:08 +0100214struct imx_mx1_camera_data {
215 resource_size_t iobase;
216 resource_size_t iosize;
217 resource_size_t irq;
218};
219struct platform_device *__init imx_add_mx1_camera(
220 const struct imx_mx1_camera_data *data,
221 const struct mx1_camera_pdata *pdata);
222
Arnd Bergmann82906b12012-08-24 15:14:29 +0200223#include <linux/platform_data/camera-mx2.h>
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100224struct imx_mx2_camera_data {
Shawn Guo27b76482012-09-16 16:26:20 +0800225 const char *devid;
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100226 resource_size_t iobasecsi;
227 resource_size_t iosizecsi;
228 resource_size_t irqcsi;
229 resource_size_t iobaseemmaprp;
230 resource_size_t iosizeemmaprp;
231 resource_size_t irqemmaprp;
232};
233struct platform_device *__init imx_add_mx2_camera(
234 const struct imx_mx2_camera_data *data,
235 const struct mx2_camera_platform_data *pdata);
Gaëtan Carlier3ab3a352012-09-05 13:06:15 +0200236
237
238struct imx_mx2_emma_data {
239 resource_size_t iobase;
240 resource_size_t iosize;
241 resource_size_t irq;
242};
Javier Martin52f1a842012-01-13 06:31:57 -0300243struct platform_device *__init imx_add_mx2_emmaprp(
Gaëtan Carlier3ab3a352012-09-05 13:06:15 +0200244 const struct imx_mx2_emma_data *data);
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100245
Arnd Bergmann82906b12012-08-24 15:14:29 +0200246#include <linux/platform_data/usb-ehci-mxc.h>
Uwe Kleine-König2eb42d52010-11-05 18:52:09 +0100247struct imx_mxc_ehci_data {
248 int id;
249 resource_size_t iobase;
250 resource_size_t irq;
251};
252struct platform_device *__init imx_add_mxc_ehci(
253 const struct imx_mxc_ehci_data *data,
254 const struct mxc_usbh_platform_data *pdata);
255
Arnd Bergmann82906b12012-08-24 15:14:29 +0200256#include <linux/platform_data/mmc-mxcmmc.h>
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100257struct imx_mxc_mmc_data {
Shawn Guo7f917a82012-09-16 16:54:30 +0800258 const char *devid;
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100259 int id;
260 resource_size_t iobase;
Uwe Kleine-König6a697e32010-11-12 11:10:55 +0100261 resource_size_t iosize;
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100262 resource_size_t irq;
263 resource_size_t dmareq;
264};
265struct platform_device *__init imx_add_mxc_mmc(
266 const struct imx_mxc_mmc_data *data,
267 const struct imxmmc_platform_data *pdata);
268
Arnd Bergmann82906b12012-08-24 15:14:29 +0200269#include <linux/platform_data/mtd-mxc_nand.h>
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200270struct imx_mxc_nand_data {
Shawn Guo4d624352012-09-15 13:34:09 +0800271 const char *devid;
Sascha Hauer63a7c6d2010-08-03 11:59:46 +0200272 /*
273 * id is traditionally 0, but -1 is more appropriate. We use -1 for new
274 * machines but don't change existing devices as the nand device usually
275 * appears in the kernel command line to pass its partitioning.
276 */
277 int id;
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200278 resource_size_t iobase;
279 resource_size_t iosize;
Sascha Hauer63a7c6d2010-08-03 11:59:46 +0200280 resource_size_t axibase;
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200281 resource_size_t irq;
282};
283struct platform_device *__init imx_add_mxc_nand(
284 const struct imx_mxc_nand_data *data,
285 const struct mxc_nand_platform_data *pdata);
Uwe Kleine-König02870732010-06-21 18:02:55 +0200286
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +0200287struct imx_pata_imx_data {
288 resource_size_t iobase;
Fabio Estevam236c4e82011-08-23 17:18:06 -0300289 resource_size_t iosize;
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +0200290 resource_size_t irq;
291};
292struct platform_device *__init imx_add_pata_imx(
293 const struct imx_pata_imx_data *data);
294
Uwe Kleine-Königbf182bc2010-11-05 15:01:16 +0100295struct imx_mxc_pwm_data {
Uwe Kleine-König5f3d1092010-11-10 22:15:45 +0100296 int id;
Uwe Kleine-Königbf182bc2010-11-05 15:01:16 +0100297 resource_size_t iobase;
Uwe Kleine-König5f3d1092010-11-10 22:15:45 +0100298 resource_size_t iosize;
Uwe Kleine-Königbf182bc2010-11-05 15:01:16 +0100299 resource_size_t irq;
300};
301struct platform_device *__init imx_add_mxc_pwm(
302 const struct imx_mxc_pwm_data *data);
303
Uwe Kleine-König83422672011-03-01 11:04:34 +0100304/* mxc_rtc */
305struct imx_mxc_rtc_data {
Shawn Guobb1d34a2012-09-15 14:26:14 +0800306 const char *devid;
Uwe Kleine-König83422672011-03-01 11:04:34 +0100307 resource_size_t iobase;
308 resource_size_t irq;
309};
310struct platform_device *__init imx_add_mxc_rtc(
311 const struct imx_mxc_rtc_data *data);
312
313/* mxc_w1 */
Uwe Kleine-Königae71a562010-10-29 10:56:07 +0200314struct imx_mxc_w1_data {
315 resource_size_t iobase;
316};
317struct platform_device *__init imx_add_mxc_w1(
318 const struct imx_mxc_w1_data *data);
319
Arnd Bergmann82906b12012-08-24 15:14:29 +0200320#include <linux/platform_data/mmc-esdhc-imx.h>
Uwe Kleine-König124bf942010-11-19 21:03:33 +0100321struct imx_sdhci_esdhc_imx_data {
Shawn Guo57ed3312011-06-30 09:24:26 +0800322 const char *devid;
Uwe Kleine-König124bf942010-11-19 21:03:33 +0100323 int id;
324 resource_size_t iobase;
325 resource_size_t irq;
326};
327struct platform_device *__init imx_add_sdhci_esdhc_imx(
328 const struct imx_sdhci_esdhc_imx_data *data,
329 const struct esdhc_platform_data *pdata);
330
Arnd Bergmann82906b12012-08-24 15:14:29 +0200331#include <linux/platform_data/spi-imx.h>
Uwe Kleine-König35bab052010-09-09 21:02:02 +0200332struct imx_spi_imx_data {
Uwe Kleine-Königab560502010-09-09 21:02:02 +0200333 const char *devid;
Uwe Kleine-König35bab052010-09-09 21:02:02 +0200334 int id;
335 resource_size_t iobase;
336 resource_size_t iosize;
337 int irq;
338};
339struct platform_device *__init imx_add_spi_imx(
340 const struct imx_spi_imx_data *data,
Uwe Kleine-König02870732010-06-21 18:02:55 +0200341 const struct spi_imx_master *pdata);
Shawn Guo36223602011-06-22 22:41:30 +0800342
Shawn Guoe51d0f02012-09-15 21:11:28 +0800343struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
Shawn Guo73930eb2012-09-15 15:57:00 +0800344 int irq, int irq_err);
Shawn Guo62550cd2011-07-13 21:33:17 +0800345struct platform_device *imx_add_imx_sdma(char *name,
Shawn Guo36223602011-06-22 22:41:30 +0800346 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
Richard Zhu97915bd2011-09-28 15:41:53 +0800347
348#include <linux/ahci_platform.h>
349struct imx_ahci_imx_data {
350 const char *devid;
351 resource_size_t iobase;
352 resource_size_t irq;
353};
354struct platform_device *__init imx_add_ahci_imx(
355 const struct imx_ahci_imx_data *data,
356 const struct ahci_platform_data *pdata);