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_1irq_data {
158 int id;
159 resource_size_t iobase;
160 resource_size_t iosize;
161 resource_size_t irq;
162 };
163 struct platform_device *__init imx_add_imx_uart_1irq(
164 const struct imx_imx_uart_1irq_data *data,
165 const struct imxuart_platform_data *pdata);
166
167 #include <linux/platform_data/video-mx3fb.h>
168 #include <linux/platform_data/media/camera-mx3.h>
169 struct imx_ipu_core_data {
170 resource_size_t iobase;
171 resource_size_t synirq;
172 resource_size_t errirq;
173 };
174 struct platform_device *__init imx_add_ipu_core(
175 const struct imx_ipu_core_data *data);
176 struct platform_device *__init imx_alloc_mx3_camera(
177 const struct imx_ipu_core_data *data,
178 const struct mx3_camera_pdata *pdata);
179 struct platform_device *__init imx_add_mx3_sdc_fb(
180 const struct imx_ipu_core_data *data,
181 struct mx3fb_platform_data *pdata);
182
183 #include <linux/platform_data/media/camera-mx2.h>
184 struct imx_mx2_camera_data {
185 const char *devid;
186 resource_size_t iobasecsi;
187 resource_size_t iosizecsi;
188 resource_size_t irqcsi;
189 resource_size_t iobaseemmaprp;
190 resource_size_t iosizeemmaprp;
191 resource_size_t irqemmaprp;
192 };
193 struct platform_device *__init imx_add_mx2_camera(
194 const struct imx_mx2_camera_data *data,
195 const struct mx2_camera_platform_data *pdata);
196
197
198 struct imx_mx2_emma_data {
199 resource_size_t iobase;
200 resource_size_t iosize;
201 resource_size_t irq;
202 };
203 struct platform_device *__init imx_add_mx2_emmaprp(
204 const struct imx_mx2_emma_data *data);
205
206 #include <linux/platform_data/usb-ehci-mxc.h>
207 struct imx_mxc_ehci_data {
208 int id;
209 resource_size_t iobase;
210 resource_size_t irq;
211 };
212 struct platform_device *__init imx_add_mxc_ehci(
213 const struct imx_mxc_ehci_data *data,
214 const struct mxc_usbh_platform_data *pdata);
215
216 #include <linux/platform_data/mmc-mxcmmc.h>
217 struct imx_mxc_mmc_data {
218 const char *devid;
219 int id;
220 resource_size_t iobase;
221 resource_size_t iosize;
222 resource_size_t irq;
223 resource_size_t dmareq;
224 };
225 struct platform_device *__init imx_add_mxc_mmc(
226 const struct imx_mxc_mmc_data *data,
227 const struct imxmmc_platform_data *pdata);
228
229 #include <linux/platform_data/mtd-mxc_nand.h>
230 struct imx_mxc_nand_data {
231 const char *devid;
232 /*
233 * id is traditionally 0, but -1 is more appropriate. We use -1 for new
234 * machines but don't change existing devices as the nand device usually
235 * appears in the kernel command line to pass its partitioning.
236 */
237 int id;
238 resource_size_t iobase;
239 resource_size_t iosize;
240 resource_size_t axibase;
241 resource_size_t irq;
242 };
243 struct platform_device *__init imx_add_mxc_nand(
244 const struct imx_mxc_nand_data *data,
245 const struct mxc_nand_platform_data *pdata);
246
247 struct imx_pata_imx_data {
248 resource_size_t iobase;
249 resource_size_t iosize;
250 resource_size_t irq;
251 };
252 struct platform_device *__init imx_add_pata_imx(
253 const struct imx_pata_imx_data *data);
254
255 /* mxc_rtc */
256 struct imx_mxc_rtc_data {
257 const char *devid;
258 resource_size_t iobase;
259 resource_size_t irq;
260 };
261 struct platform_device *__init imx_add_mxc_rtc(
262 const struct imx_mxc_rtc_data *data);
263
264 /* mxc_w1 */
265 struct imx_mxc_w1_data {
266 resource_size_t iobase;
267 };
268 struct platform_device *__init imx_add_mxc_w1(
269 const struct imx_mxc_w1_data *data);
270
271 #include <linux/platform_data/mmc-esdhc-imx.h>
272 struct imx_sdhci_esdhc_imx_data {
273 const char *devid;
274 int id;
275 resource_size_t iobase;
276 resource_size_t irq;
277 };
278 struct platform_device *__init imx_add_sdhci_esdhc_imx(
279 const struct imx_sdhci_esdhc_imx_data *data,
280 const struct esdhc_platform_data *pdata);
281
282 #include <linux/platform_data/spi-imx.h>
283 struct imx_spi_imx_data {
284 const char *devid;
285 int id;
286 resource_size_t iobase;
287 resource_size_t iosize;
288 int irq;
289 };
290 struct platform_device *__init imx_add_spi_imx(
291 const struct imx_spi_imx_data *data,
292 const struct spi_imx_master *pdata);
293
294 struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
295 int irq, int irq_err);
296 struct platform_device *imx_add_imx_sdma(char *name,
297 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
298