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