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 <mach/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 	resource_size_t iobase;
67 	resource_size_t irq;
68 };
69 struct 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 
73 #include <linux/gpio_keys.h>
74 struct platform_device *__init imx_add_gpio_keys(
75 		const struct gpio_keys_platform_data *pdata);
76 
77 #include <mach/mx21-usbhost.h>
78 struct imx_imx21_hcd_data {
79 	resource_size_t iobase;
80 	resource_size_t irq;
81 };
82 struct platform_device *__init imx_add_imx21_hcd(
83 		const struct imx_imx21_hcd_data *data,
84 		const struct mx21_usbh_platform_data *pdata);
85 
86 struct imx_imx2_wdt_data {
87 	int id;
88 	resource_size_t iobase;
89 	resource_size_t iosize;
90 };
91 struct platform_device *__init imx_add_imx2_wdt(
92 		const struct imx_imx2_wdt_data *data);
93 
94 struct imx_imxdi_rtc_data {
95 	resource_size_t iobase;
96 	resource_size_t irq;
97 };
98 struct platform_device *__init imx_add_imxdi_rtc(
99 		const struct imx_imxdi_rtc_data *data);
100 
101 #include <mach/imxfb.h>
102 struct imx_imx_fb_data {
103 	resource_size_t iobase;
104 	resource_size_t iosize;
105 	resource_size_t irq;
106 };
107 struct platform_device *__init imx_add_imx_fb(
108 		const struct imx_imx_fb_data *data,
109 		const struct imx_fb_platform_data *pdata);
110 
111 #include <mach/i2c.h>
112 struct imx_imx_i2c_data {
113 	int id;
114 	resource_size_t iobase;
115 	resource_size_t iosize;
116 	resource_size_t irq;
117 };
118 struct platform_device *__init imx_add_imx_i2c(
119 		const struct imx_imx_i2c_data *data,
120 		const struct imxi2c_platform_data *pdata);
121 
122 #include <linux/input/matrix_keypad.h>
123 struct imx_imx_keypad_data {
124 	resource_size_t iobase;
125 	resource_size_t iosize;
126 	resource_size_t irq;
127 };
128 struct platform_device *__init imx_add_imx_keypad(
129 		const struct imx_imx_keypad_data *data,
130 		const struct matrix_keymap_data *pdata);
131 
132 #include <mach/ssi.h>
133 struct imx_imx_ssi_data {
134 	int id;
135 	resource_size_t iobase;
136 	resource_size_t iosize;
137 	resource_size_t irq;
138 	resource_size_t dmatx0;
139 	resource_size_t dmarx0;
140 	resource_size_t dmatx1;
141 	resource_size_t dmarx1;
142 };
143 struct platform_device *__init imx_add_imx_ssi(
144 		const struct imx_imx_ssi_data *data,
145 		const struct imx_ssi_platform_data *pdata);
146 
147 #include <mach/imx-uart.h>
148 struct imx_imx_uart_3irq_data {
149 	int id;
150 	resource_size_t iobase;
151 	resource_size_t iosize;
152 	resource_size_t irqrx;
153 	resource_size_t irqtx;
154 	resource_size_t irqrts;
155 };
156 struct platform_device *__init imx_add_imx_uart_3irq(
157 		const struct imx_imx_uart_3irq_data *data,
158 		const struct imxuart_platform_data *pdata);
159 
160 struct imx_imx_uart_1irq_data {
161 	int id;
162 	resource_size_t iobase;
163 	resource_size_t iosize;
164 	resource_size_t irq;
165 };
166 struct platform_device *__init imx_add_imx_uart_1irq(
167 		const struct imx_imx_uart_1irq_data *data,
168 		const struct imxuart_platform_data *pdata);
169 
170 #include <mach/usb.h>
171 struct imx_imx_udc_data {
172 	resource_size_t iobase;
173 	resource_size_t iosize;
174 	resource_size_t irq0;
175 	resource_size_t irq1;
176 	resource_size_t irq2;
177 	resource_size_t irq3;
178 	resource_size_t irq4;
179 	resource_size_t irq5;
180 	resource_size_t irq6;
181 };
182 struct platform_device *__init imx_add_imx_udc(
183 		const struct imx_imx_udc_data *data,
184 		const struct imxusb_platform_data *pdata);
185 
186 #include <mach/ipu.h>
187 #include <mach/mx3fb.h>
188 #include <mach/mx3_camera.h>
189 struct imx_ipu_core_data {
190 	resource_size_t iobase;
191 	resource_size_t synirq;
192 	resource_size_t errirq;
193 };
194 struct platform_device *__init imx_add_ipu_core(
195 		const struct imx_ipu_core_data *data,
196 		const struct ipu_platform_data *pdata);
197 struct platform_device *__init imx_alloc_mx3_camera(
198 		const struct imx_ipu_core_data *data,
199 		const struct mx3_camera_pdata *pdata);
200 struct platform_device *__init imx_add_mx3_sdc_fb(
201 		const struct imx_ipu_core_data *data,
202 		struct mx3fb_platform_data *pdata);
203 
204 #include <mach/mx1_camera.h>
205 struct imx_mx1_camera_data {
206 	resource_size_t iobase;
207 	resource_size_t iosize;
208 	resource_size_t irq;
209 };
210 struct platform_device *__init imx_add_mx1_camera(
211 		const struct imx_mx1_camera_data *data,
212 		const struct mx1_camera_pdata *pdata);
213 
214 #include <mach/mx2_cam.h>
215 struct imx_mx2_camera_data {
216 	resource_size_t iobasecsi;
217 	resource_size_t iosizecsi;
218 	resource_size_t irqcsi;
219 	resource_size_t iobaseemmaprp;
220 	resource_size_t iosizeemmaprp;
221 	resource_size_t irqemmaprp;
222 };
223 struct platform_device *__init imx_add_mx2_camera(
224 		const struct imx_mx2_camera_data *data,
225 		const struct mx2_camera_platform_data *pdata);
226 struct platform_device *__init imx_add_mx2_emmaprp(
227 		const struct imx_mx2_camera_data *data);
228 
229 #include <mach/mxc_ehci.h>
230 struct imx_mxc_ehci_data {
231 	int id;
232 	resource_size_t iobase;
233 	resource_size_t irq;
234 };
235 struct platform_device *__init imx_add_mxc_ehci(
236 		const struct imx_mxc_ehci_data *data,
237 		const struct mxc_usbh_platform_data *pdata);
238 
239 #include <mach/mmc.h>
240 struct imx_mxc_mmc_data {
241 	int id;
242 	resource_size_t iobase;
243 	resource_size_t iosize;
244 	resource_size_t irq;
245 	resource_size_t dmareq;
246 };
247 struct platform_device *__init imx_add_mxc_mmc(
248 		const struct imx_mxc_mmc_data *data,
249 		const struct imxmmc_platform_data *pdata);
250 
251 #include <mach/mxc_nand.h>
252 struct imx_mxc_nand_data {
253 	/*
254 	 * id is traditionally 0, but -1 is more appropriate.  We use -1 for new
255 	 * machines but don't change existing devices as the nand device usually
256 	 * appears in the kernel command line to pass its partitioning.
257 	 */
258 	int id;
259 	resource_size_t iobase;
260 	resource_size_t iosize;
261 	resource_size_t axibase;
262 	resource_size_t irq;
263 };
264 struct platform_device *__init imx_add_mxc_nand(
265 		const struct imx_mxc_nand_data *data,
266 		const struct mxc_nand_platform_data *pdata);
267 
268 struct imx_pata_imx_data {
269 	resource_size_t iobase;
270 	resource_size_t iosize;
271 	resource_size_t irq;
272 };
273 struct platform_device *__init imx_add_pata_imx(
274 		const struct imx_pata_imx_data *data);
275 
276 struct imx_mxc_pwm_data {
277 	int id;
278 	resource_size_t iobase;
279 	resource_size_t iosize;
280 	resource_size_t irq;
281 };
282 struct platform_device *__init imx_add_mxc_pwm(
283 		const struct imx_mxc_pwm_data *data);
284 
285 /* mxc_rtc */
286 struct imx_mxc_rtc_data {
287 	resource_size_t iobase;
288 	resource_size_t irq;
289 };
290 struct platform_device *__init imx_add_mxc_rtc(
291 		const struct imx_mxc_rtc_data *data);
292 
293 /* mxc_w1 */
294 struct imx_mxc_w1_data {
295 	resource_size_t iobase;
296 };
297 struct platform_device *__init imx_add_mxc_w1(
298 		const struct imx_mxc_w1_data *data);
299 
300 #include <mach/esdhc.h>
301 struct imx_sdhci_esdhc_imx_data {
302 	const char *devid;
303 	int id;
304 	resource_size_t iobase;
305 	resource_size_t irq;
306 };
307 struct platform_device *__init imx_add_sdhci_esdhc_imx(
308 		const struct imx_sdhci_esdhc_imx_data *data,
309 		const struct esdhc_platform_data *pdata);
310 
311 #include <mach/spi.h>
312 struct imx_spi_imx_data {
313 	const char *devid;
314 	int id;
315 	resource_size_t iobase;
316 	resource_size_t iosize;
317 	int irq;
318 };
319 struct platform_device *__init imx_add_spi_imx(
320 		const struct imx_spi_imx_data *data,
321 		const struct spi_imx_master *pdata);
322 
323 struct platform_device *imx_add_imx_dma(void);
324 struct platform_device *imx_add_imx_sdma(char *name,
325 	resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
326 
327 #include <linux/ahci_platform.h>
328 struct imx_ahci_imx_data {
329 	const char *devid;
330 	resource_size_t iobase;
331 	resource_size_t irq;
332 };
333 struct platform_device *__init imx_add_ahci_imx(
334 		const struct imx_ahci_imx_data *data,
335 		const struct ahci_platform_data *pdata);
336