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
14 extern struct device mxc_aips_bus;
15 extern struct device mxc_ahb_bus;
16
imx_add_platform_device_dmamask(const char * name,int id,const struct resource * res,unsigned int num_resources,const void * data,size_t size_data,u64 dmamask)17 static inline struct platform_device *imx_add_platform_device_dmamask(
18 const char *name, int id,
19 const struct resource *res, unsigned int num_resources,
20 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 }
33
imx_add_platform_device(const char * name,int id,const struct resource * res,unsigned int num_resources,const void * data,size_t size_data)34 static 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 }
42
43 #include <linux/fec.h>
44 struct imx_fec_data {
45 const char *devid;
46 resource_size_t iobase;
47 resource_size_t irq;
48 };
49 struct platform_device *__init imx_add_fec(
50 const struct imx_fec_data *data,
51 const struct fec_platform_data *pdata);
52
53 #include <linux/can/platform/flexcan.h>
54 struct imx_flexcan_data {
55 int id;
56 resource_size_t iobase;
57 resource_size_t iosize;
58 resource_size_t irq;
59 };
60 struct platform_device *__init imx_add_flexcan(
61 const struct imx_flexcan_data *data,
62 const struct flexcan_platform_data *pdata);
63
64 #include <linux/fsl_devices.h>
65 struct imx_fsl_usb2_udc_data {
66 const char *devid;
67 resource_size_t iobase;
68 resource_size_t irq;
69 };
70 struct 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
74 #include <linux/gpio_keys.h>
75 struct platform_device *__init imx_add_gpio_keys(
76 const struct gpio_keys_platform_data *pdata);
77
78 #include <linux/platform_data/usb-mx2.h>
79 struct imx_imx21_hcd_data {
80 resource_size_t iobase;
81 resource_size_t irq;
82 };
83 struct platform_device *__init imx_add_imx21_hcd(
84 const struct imx_imx21_hcd_data *data,
85 const struct mx21_usbh_platform_data *pdata);
86
87 struct imx_imx27_coda_data {
88 resource_size_t iobase;
89 resource_size_t iosize;
90 resource_size_t irq;
91 };
92 struct platform_device *__init imx_add_imx27_coda(
93 const struct imx_imx27_coda_data *data);
94
95 struct imx_imx2_wdt_data {
96 int id;
97 resource_size_t iobase;
98 resource_size_t iosize;
99 };
100 struct platform_device *__init imx_add_imx2_wdt(
101 const struct imx_imx2_wdt_data *data);
102
103 struct imx_imxdi_rtc_data {
104 resource_size_t iobase;
105 resource_size_t irq;
106 };
107 struct platform_device *__init imx_add_imxdi_rtc(
108 const struct imx_imxdi_rtc_data *data);
109
110 #include <linux/platform_data/video-imxfb.h>
111 struct imx_imx_fb_data {
112 const char *devid;
113 resource_size_t iobase;
114 resource_size_t iosize;
115 resource_size_t irq;
116 };
117 struct platform_device *__init imx_add_imx_fb(
118 const struct imx_imx_fb_data *data,
119 const struct imx_fb_platform_data *pdata);
120
121 #include <linux/platform_data/i2c-imx.h>
122 struct imx_imx_i2c_data {
123 const char *devid;
124 int id;
125 resource_size_t iobase;
126 resource_size_t iosize;
127 resource_size_t irq;
128 };
129 struct platform_device *__init imx_add_imx_i2c(
130 const struct imx_imx_i2c_data *data,
131 const struct imxi2c_platform_data *pdata);
132
133 #include <linux/input/matrix_keypad.h>
134 struct imx_imx_keypad_data {
135 resource_size_t iobase;
136 resource_size_t iosize;
137 resource_size_t irq;
138 };
139 struct platform_device *__init imx_add_imx_keypad(
140 const struct imx_imx_keypad_data *data,
141 const struct matrix_keymap_data *pdata);
142
143 #include <linux/platform_data/asoc-imx-ssi.h>
144 struct 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 };
154 struct platform_device *__init imx_add_imx_ssi(
155 const struct imx_imx_ssi_data *data,
156 const struct imx_ssi_platform_data *pdata);
157
158 #include <linux/platform_data/serial-imx.h>
159 struct 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 };
167 struct platform_device *__init imx_add_imx_uart_3irq(
168 const struct imx_imx_uart_3irq_data *data,
169 const struct imxuart_platform_data *pdata);
170
171 struct imx_imx_uart_1irq_data {
172 int id;
173 resource_size_t iobase;
174 resource_size_t iosize;
175 resource_size_t irq;
176 };
177 struct platform_device *__init imx_add_imx_uart_1irq(
178 const struct imx_imx_uart_1irq_data *data,
179 const struct imxuart_platform_data *pdata);
180
181 #include <linux/platform_data/usb-imx_udc.h>
182 struct 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 };
193 struct platform_device *__init imx_add_imx_udc(
194 const struct imx_imx_udc_data *data,
195 const struct imxusb_platform_data *pdata);
196
197 #include <linux/platform_data/video-mx3fb.h>
198 #include <linux/platform_data/camera-mx3.h>
199 struct imx_ipu_core_data {
200 resource_size_t iobase;
201 resource_size_t synirq;
202 resource_size_t errirq;
203 };
204 struct platform_device *__init imx_add_ipu_core(
205 const struct imx_ipu_core_data *data);
206 struct platform_device *__init imx_alloc_mx3_camera(
207 const struct imx_ipu_core_data *data,
208 const struct mx3_camera_pdata *pdata);
209 struct platform_device *__init imx_add_mx3_sdc_fb(
210 const struct imx_ipu_core_data *data,
211 struct mx3fb_platform_data *pdata);
212
213 #include <linux/platform_data/camera-mx1.h>
214 struct imx_mx1_camera_data {
215 resource_size_t iobase;
216 resource_size_t iosize;
217 resource_size_t irq;
218 };
219 struct platform_device *__init imx_add_mx1_camera(
220 const struct imx_mx1_camera_data *data,
221 const struct mx1_camera_pdata *pdata);
222
223 #include <linux/platform_data/camera-mx2.h>
224 struct imx_mx2_camera_data {
225 const char *devid;
226 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 };
233 struct platform_device *__init imx_add_mx2_camera(
234 const struct imx_mx2_camera_data *data,
235 const struct mx2_camera_platform_data *pdata);
236
237
238 struct imx_mx2_emma_data {
239 resource_size_t iobase;
240 resource_size_t iosize;
241 resource_size_t irq;
242 };
243 struct platform_device *__init imx_add_mx2_emmaprp(
244 const struct imx_mx2_emma_data *data);
245
246 #include <linux/platform_data/usb-ehci-mxc.h>
247 struct imx_mxc_ehci_data {
248 int id;
249 resource_size_t iobase;
250 resource_size_t irq;
251 };
252 struct platform_device *__init imx_add_mxc_ehci(
253 const struct imx_mxc_ehci_data *data,
254 const struct mxc_usbh_platform_data *pdata);
255
256 #include <linux/platform_data/mmc-mxcmmc.h>
257 struct imx_mxc_mmc_data {
258 const char *devid;
259 int id;
260 resource_size_t iobase;
261 resource_size_t iosize;
262 resource_size_t irq;
263 resource_size_t dmareq;
264 };
265 struct platform_device *__init imx_add_mxc_mmc(
266 const struct imx_mxc_mmc_data *data,
267 const struct imxmmc_platform_data *pdata);
268
269 #include <linux/platform_data/mtd-mxc_nand.h>
270 struct imx_mxc_nand_data {
271 const char *devid;
272 /*
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;
278 resource_size_t iobase;
279 resource_size_t iosize;
280 resource_size_t axibase;
281 resource_size_t irq;
282 };
283 struct platform_device *__init imx_add_mxc_nand(
284 const struct imx_mxc_nand_data *data,
285 const struct mxc_nand_platform_data *pdata);
286
287 struct imx_pata_imx_data {
288 resource_size_t iobase;
289 resource_size_t iosize;
290 resource_size_t irq;
291 };
292 struct platform_device *__init imx_add_pata_imx(
293 const struct imx_pata_imx_data *data);
294
295 struct imx_mxc_pwm_data {
296 int id;
297 resource_size_t iobase;
298 resource_size_t iosize;
299 resource_size_t irq;
300 };
301 struct platform_device *__init imx_add_mxc_pwm(
302 const struct imx_mxc_pwm_data *data);
303
304 /* mxc_rtc */
305 struct imx_mxc_rtc_data {
306 const char *devid;
307 resource_size_t iobase;
308 resource_size_t irq;
309 };
310 struct platform_device *__init imx_add_mxc_rtc(
311 const struct imx_mxc_rtc_data *data);
312
313 /* mxc_w1 */
314 struct imx_mxc_w1_data {
315 resource_size_t iobase;
316 };
317 struct platform_device *__init imx_add_mxc_w1(
318 const struct imx_mxc_w1_data *data);
319
320 #include <linux/platform_data/mmc-esdhc-imx.h>
321 struct imx_sdhci_esdhc_imx_data {
322 const char *devid;
323 int id;
324 resource_size_t iobase;
325 resource_size_t irq;
326 };
327 struct 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
331 #include <linux/platform_data/spi-imx.h>
332 struct imx_spi_imx_data {
333 const char *devid;
334 int id;
335 resource_size_t iobase;
336 resource_size_t iosize;
337 int irq;
338 };
339 struct platform_device *__init imx_add_spi_imx(
340 const struct imx_spi_imx_data *data,
341 const struct spi_imx_master *pdata);
342
343 struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
344 int irq, int irq_err);
345 struct platform_device *imx_add_imx_sdma(char *name,
346 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
347