1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2009-2010 Pengutronix
4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 */
6 #include <linux/kernel.h>
7 #include <linux/platform_device.h>
8 #include <linux/init.h>
9 #include <linux/platform_data/dma-imx-sdma.h>
10
11 extern struct device mxc_aips_bus;
12 extern struct device mxc_ahb_bus;
13
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)14 static inline struct platform_device *imx_add_platform_device_dmamask(
15 const char *name, int id,
16 const struct resource *res, unsigned int num_resources,
17 const void *data, size_t size_data, u64 dmamask)
18 {
19 struct platform_device_info pdevinfo = {
20 .name = name,
21 .id = id,
22 .res = res,
23 .num_res = num_resources,
24 .data = data,
25 .size_data = size_data,
26 .dma_mask = dmamask,
27 };
28 return platform_device_register_full(&pdevinfo);
29 }
30
imx_add_platform_device(const char * name,int id,const struct resource * res,unsigned int num_resources,const void * data,size_t size_data)31 static inline struct platform_device *imx_add_platform_device(
32 const char *name, int id,
33 const struct resource *res, unsigned int num_resources,
34 const void *data, size_t size_data)
35 {
36 return imx_add_platform_device_dmamask(
37 name, id, res, num_resources, data, size_data, 0);
38 }
39
40 #include <linux/fec.h>
41 struct imx_fec_data {
42 const char *devid;
43 resource_size_t iobase;
44 resource_size_t irq;
45 };
46 struct platform_device *__init imx_add_fec(
47 const struct imx_fec_data *data,
48 const struct fec_platform_data *pdata);
49
50 struct imx_flexcan_data {
51 int id;
52 resource_size_t iobase;
53 resource_size_t iosize;
54 resource_size_t irq;
55 };
56 struct platform_device *__init imx_add_flexcan(
57 const struct imx_flexcan_data *data);
58
59 #include <linux/fsl_devices.h>
60 struct imx_fsl_usb2_udc_data {
61 const char *devid;
62 resource_size_t iobase;
63 resource_size_t irq;
64 };
65 struct platform_device *__init imx_add_fsl_usb2_udc(
66 const struct imx_fsl_usb2_udc_data *data,
67 const struct fsl_usb2_platform_data *pdata);
68
69 #include <linux/gpio_keys.h>
70 struct platform_device *__init imx_add_gpio_keys(
71 const struct gpio_keys_platform_data *pdata);
72
73 #include <linux/platform_data/usb-mx2.h>
74 struct imx_imx21_hcd_data {
75 resource_size_t iobase;
76 resource_size_t irq;
77 };
78 struct platform_device *__init imx_add_imx21_hcd(
79 const struct imx_imx21_hcd_data *data,
80 const struct mx21_usbh_platform_data *pdata);
81
82 struct imx_imx27_coda_data {
83 resource_size_t iobase;
84 resource_size_t iosize;
85 resource_size_t irq;
86 };
87 struct platform_device *__init imx_add_imx27_coda(
88 const struct imx_imx27_coda_data *data);
89
90 struct imx_imx2_wdt_data {
91 int id;
92 resource_size_t iobase;
93 resource_size_t iosize;
94 };
95 struct platform_device *__init imx_add_imx2_wdt(
96 const struct imx_imx2_wdt_data *data);
97
98 struct imx_imxdi_rtc_data {
99 resource_size_t iobase;
100 resource_size_t irq;
101 };
102 struct platform_device *__init imx_add_imxdi_rtc(
103 const struct imx_imxdi_rtc_data *data);
104
105 #include <linux/platform_data/video-imxfb.h>
106 struct imx_imx_fb_data {
107 const char *devid;
108 resource_size_t iobase;
109 resource_size_t iosize;
110 resource_size_t irq;
111 };
112 struct platform_device *__init imx_add_imx_fb(
113 const struct imx_imx_fb_data *data,
114 const struct imx_fb_platform_data *pdata);
115
116 #include <linux/platform_data/i2c-imx.h>
117 struct imx_imx_i2c_data {
118 const char *devid;
119 int id;
120 resource_size_t iobase;
121 resource_size_t iosize;
122 resource_size_t irq;
123 };
124 struct platform_device *__init imx_add_imx_i2c(
125 const struct imx_imx_i2c_data *data,
126 const struct imxi2c_platform_data *pdata);
127
128 #include <linux/input/matrix_keypad.h>
129 struct imx_imx_keypad_data {
130 resource_size_t iobase;
131 resource_size_t iosize;
132 resource_size_t irq;
133 };
134 struct platform_device *__init imx_add_imx_keypad(
135 const struct imx_imx_keypad_data *data,
136 const struct matrix_keymap_data *pdata);
137
138 #include <linux/platform_data/asoc-imx-ssi.h>
139 struct imx_imx_ssi_data {
140 int id;
141 resource_size_t iobase;
142 resource_size_t iosize;
143 resource_size_t irq;
144 resource_size_t dmatx0;
145 resource_size_t dmarx0;
146 resource_size_t dmatx1;
147 resource_size_t dmarx1;
148 };
149 struct platform_device *__init imx_add_imx_ssi(
150 const struct imx_imx_ssi_data *data,
151 const struct imx_ssi_platform_data *pdata);
152
153 #include <linux/platform_data/serial-imx.h>
154 struct imx_imx_uart_1irq_data {
155 int id;
156 resource_size_t iobase;
157 resource_size_t iosize;
158 resource_size_t irq;
159 };
160 struct platform_device *__init imx_add_imx_uart_1irq(
161 const struct imx_imx_uart_1irq_data *data,
162 const struct imxuart_platform_data *pdata);
163
164 #include <linux/platform_data/video-mx3fb.h>
165 #include <linux/platform_data/media/camera-mx3.h>
166 struct imx_ipu_core_data {
167 resource_size_t iobase;
168 resource_size_t synirq;
169 resource_size_t errirq;
170 };
171 struct platform_device *__init imx_add_ipu_core(
172 const struct imx_ipu_core_data *data);
173 struct platform_device *__init imx_alloc_mx3_camera(
174 const struct imx_ipu_core_data *data,
175 const struct mx3_camera_pdata *pdata);
176 struct platform_device *__init imx_add_mx3_sdc_fb(
177 const struct imx_ipu_core_data *data,
178 struct mx3fb_platform_data *pdata);
179
180 #include <linux/platform_data/media/camera-mx2.h>
181 struct imx_mx2_camera_data {
182 const char *devid;
183 resource_size_t iobasecsi;
184 resource_size_t iosizecsi;
185 resource_size_t irqcsi;
186 resource_size_t iobaseemmaprp;
187 resource_size_t iosizeemmaprp;
188 resource_size_t irqemmaprp;
189 };
190 struct platform_device *__init imx_add_mx2_camera(
191 const struct imx_mx2_camera_data *data,
192 const struct mx2_camera_platform_data *pdata);
193
194
195 struct imx_mx2_emma_data {
196 resource_size_t iobase;
197 resource_size_t iosize;
198 resource_size_t irq;
199 };
200 struct platform_device *__init imx_add_mx2_emmaprp(
201 const struct imx_mx2_emma_data *data);
202
203 #include <linux/platform_data/usb-ehci-mxc.h>
204 struct imx_mxc_ehci_data {
205 int id;
206 resource_size_t iobase;
207 resource_size_t irq;
208 };
209 struct platform_device *__init imx_add_mxc_ehci(
210 const struct imx_mxc_ehci_data *data,
211 const struct mxc_usbh_platform_data *pdata);
212
213 #include <linux/platform_data/mmc-mxcmmc.h>
214 struct imx_mxc_mmc_data {
215 const char *devid;
216 int id;
217 resource_size_t iobase;
218 resource_size_t iosize;
219 resource_size_t irq;
220 resource_size_t dmareq;
221 };
222 struct platform_device *__init imx_add_mxc_mmc(
223 const struct imx_mxc_mmc_data *data,
224 const struct imxmmc_platform_data *pdata);
225
226 #include <linux/platform_data/mtd-mxc_nand.h>
227 struct imx_mxc_nand_data {
228 const char *devid;
229 /*
230 * id is traditionally 0, but -1 is more appropriate. We use -1 for new
231 * machines but don't change existing devices as the nand device usually
232 * appears in the kernel command line to pass its partitioning.
233 */
234 int id;
235 resource_size_t iobase;
236 resource_size_t iosize;
237 resource_size_t axibase;
238 resource_size_t irq;
239 };
240 struct platform_device *__init imx_add_mxc_nand(
241 const struct imx_mxc_nand_data *data,
242 const struct mxc_nand_platform_data *pdata);
243
244 struct imx_pata_imx_data {
245 resource_size_t iobase;
246 resource_size_t iosize;
247 resource_size_t irq;
248 };
249 struct platform_device *__init imx_add_pata_imx(
250 const struct imx_pata_imx_data *data);
251
252 /* mxc_rtc */
253 struct imx_mxc_rtc_data {
254 const char *devid;
255 resource_size_t iobase;
256 resource_size_t irq;
257 };
258 struct platform_device *__init imx_add_mxc_rtc(
259 const struct imx_mxc_rtc_data *data);
260
261 /* mxc_w1 */
262 struct imx_mxc_w1_data {
263 resource_size_t iobase;
264 };
265 struct platform_device *__init imx_add_mxc_w1(
266 const struct imx_mxc_w1_data *data);
267
268 #include <linux/platform_data/mmc-esdhc-imx.h>
269 struct imx_sdhci_esdhc_imx_data {
270 const char *devid;
271 int id;
272 resource_size_t iobase;
273 resource_size_t irq;
274 };
275 struct platform_device *__init imx_add_sdhci_esdhc_imx(
276 const struct imx_sdhci_esdhc_imx_data *data,
277 const struct esdhc_platform_data *pdata);
278
279 #include <linux/platform_data/spi-imx.h>
280 struct imx_spi_imx_data {
281 const char *devid;
282 int id;
283 resource_size_t iobase;
284 resource_size_t iosize;
285 int irq;
286 };
287 struct platform_device *__init imx_add_spi_imx(
288 const struct imx_spi_imx_data *data,
289 const struct spi_imx_master *pdata);
290
291 struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
292 int irq, int irq_err);
293 struct platform_device *imx_add_imx_sdma(char *name,
294 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
295