blob: 2a685adec1df754979792138a6507d58e2b3086c [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Uwe Kleine-König253ff1f2010-06-15 11:31:02 +02002/*
3 * Copyright (C) 2009-2010 Pengutronix
4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Uwe Kleine-König253ff1f2010-06-15 11:31:02 +02005 */
6#include <linux/kernel.h>
7#include <linux/platform_device.h>
8#include <linux/init.h>
Arnd Bergmann82906b12012-08-24 15:14:29 +02009#include <linux/platform_data/dma-imx-sdma.h>
Uwe Kleine-König253ff1f2010-06-15 11:31:02 +020010
Shawn Guob78d8e52011-06-06 00:07:55 +080011extern struct device mxc_aips_bus;
Shawn Guo36223602011-06-22 22:41:30 +080012extern struct device mxc_ahb_bus;
Shawn Guob78d8e52011-06-06 00:07:55 +080013
Uwe Kleine-König0e392412011-08-25 11:16:01 +020014static inline struct platform_device *imx_add_platform_device_dmamask(
Uwe Kleine-König6332c102010-11-02 11:56:54 +010015 const char *name, int id,
Uwe Kleine-König253ff1f2010-06-15 11:31:02 +020016 const struct resource *res, unsigned int num_resources,
Uwe Kleine-König0e392412011-08-25 11:16:01 +020017 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}
Uwe Kleine-König6332c102010-11-02 11:56:54 +010030
31static 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}
Uwe Kleine-König66384ee2010-06-15 18:14:19 +020039
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020040#include <linux/fec.h>
41struct imx_fec_data {
Shawn Guo0ca1e292011-07-01 18:11:22 +080042 const char *devid;
Uwe Kleine-König6bd96f32010-10-06 12:00:18 +020043 resource_size_t iobase;
44 resource_size_t irq;
45};
46struct platform_device *__init imx_add_fec(
47 const struct imx_fec_data *data,
48 const struct fec_platform_data *pdata);
49
Uwe Kleine-Königfc40d012010-11-04 12:02:35 +010050struct imx_flexcan_data {
51 int id;
52 resource_size_t iobase;
53 resource_size_t iosize;
54 resource_size_t irq;
55};
56struct platform_device *__init imx_add_flexcan(
Marc Kleine-Budde30caa4b2013-06-10 23:12:56 -030057 const struct imx_flexcan_data *data);
Marc Kleine-Budde61c68502010-07-22 11:45:34 +020058
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010059#include <linux/fsl_devices.h>
60struct imx_fsl_usb2_udc_data {
Peter Chenf0ea8832013-01-17 18:03:15 +080061 const char *devid;
Uwe Kleine-Königbd455ed2010-11-09 17:52:14 +010062 resource_size_t iobase;
63 resource_size_t irq;
64};
65struct 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
Dinh Nguyen47c53822010-10-23 09:12:46 -050069#include <linux/gpio_keys.h>
70struct platform_device *__init imx_add_gpio_keys(
71 const struct gpio_keys_platform_data *pdata);
72
Arnd Bergmann82906b12012-08-24 15:14:29 +020073#include <linux/platform_data/usb-mx2.h>
Uwe Kleine-König9f8714692010-11-10 10:11:23 +010074struct imx_imx21_hcd_data {
75 resource_size_t iobase;
76 resource_size_t irq;
77};
78struct platform_device *__init imx_add_imx21_hcd(
79 const struct imx_imx21_hcd_data *data,
80 const struct mx21_usbh_platform_data *pdata);
81
Javier Martin6d8c4522012-07-26 05:45:32 -030082struct imx_imx27_coda_data {
83 resource_size_t iobase;
84 resource_size_t iosize;
85 resource_size_t irq;
86};
87struct platform_device *__init imx_add_imx27_coda(
88 const struct imx_imx27_coda_data *data);
89
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010090struct imx_imx2_wdt_data {
Fabio Estevam8c2efec2010-12-06 16:38:32 -020091 int id;
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010092 resource_size_t iobase;
Uwe Kleine-König00871502010-11-11 16:58:50 +010093 resource_size_t iosize;
Uwe Kleine-Könige0a19612010-11-04 10:09:10 +010094};
95struct platform_device *__init imx_add_imx2_wdt(
96 const struct imx_imx2_wdt_data *data);
97
Uwe Kleine-Könige7c74b32010-11-11 11:57:21 +010098struct imx_imxdi_rtc_data {
99 resource_size_t iobase;
100 resource_size_t irq;
101};
102struct platform_device *__init imx_add_imxdi_rtc(
103 const struct imx_imxdi_rtc_data *data);
104
Arnd Bergmann82906b12012-08-24 15:14:29 +0200105#include <linux/platform_data/video-imxfb.h>
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100106struct imx_imx_fb_data {
Shawn Guoe69dc9a2012-09-16 19:59:53 +0800107 const char *devid;
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100108 resource_size_t iobase;
Uwe Kleine-König194ee8e2010-11-11 15:32:21 +0100109 resource_size_t iosize;
Uwe Kleine-Königad851bf2010-11-04 17:07:48 +0100110 resource_size_t irq;
111};
112struct platform_device *__init imx_add_imx_fb(
113 const struct imx_imx_fb_data *data,
114 const struct imx_fb_platform_data *pdata);
115
Arnd Bergmann82906b12012-08-24 15:14:29 +0200116#include <linux/platform_data/i2c-imx.h>
Uwe Kleine-König64de5ec2010-09-21 12:13:34 +0200117struct imx_imx_i2c_data {
Shawn Guo5bdfba22012-09-14 15:19:00 +0800118 const char *devid;
Uwe Kleine-König64de5ec2010-09-21 12:13:34 +0200119 int id;
120 resource_size_t iobase;
121 resource_size_t iosize;
122 resource_size_t irq;
123};
124struct platform_device *__init imx_add_imx_i2c(
125 const struct imx_imx_i2c_data *data,
Uwe Kleine-König99a754d2010-06-16 14:37:51 +0200126 const struct imxi2c_platform_data *pdata);
127
Uwe Kleine-König3f880142010-11-10 09:58:56 +0100128#include <linux/input/matrix_keypad.h>
129struct imx_imx_keypad_data {
130 resource_size_t iobase;
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +0100131 resource_size_t iosize;
Uwe Kleine-König3f880142010-11-10 09:58:56 +0100132 resource_size_t irq;
133};
134struct platform_device *__init imx_add_imx_keypad(
135 const struct imx_imx_keypad_data *data,
136 const struct matrix_keymap_data *pdata);
137
Arnd Bergmann82906b12012-08-24 15:14:29 +0200138#include <linux/platform_data/asoc-imx-ssi.h>
Uwe Kleine-König4697bb922010-08-25 17:37:45 +0200139struct 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};
149struct platform_device *__init imx_add_imx_ssi(
150 const struct imx_imx_ssi_data *data,
151 const struct imx_ssi_platform_data *pdata);
152
Arnd Bergmann82906b12012-08-24 15:14:29 +0200153#include <linux/platform_data/serial-imx.h>
Uwe Kleine-König5162de02010-08-10 22:57:24 +0200154struct imx_imx_uart_1irq_data {
155 int id;
156 resource_size_t iobase;
157 resource_size_t iosize;
158 resource_size_t irq;
159};
160struct platform_device *__init imx_add_imx_uart_1irq(
161 const struct imx_imx_uart_1irq_data *data,
Uwe Kleine-König2db68232010-06-22 14:49:20 +0200162 const struct imxuart_platform_data *pdata);
163
Arnd Bergmann82906b12012-08-24 15:14:29 +0200164#include <linux/platform_data/video-mx3fb.h>
Mauro Carvalho Chehaba71daaa2015-11-17 07:11:13 -0200165#include <linux/platform_data/media/camera-mx3.h>
Uwe Kleine-Königafa77ef2011-03-03 21:32:02 +0100166struct imx_ipu_core_data {
167 resource_size_t iobase;
168 resource_size_t synirq;
169 resource_size_t errirq;
170};
171struct platform_device *__init imx_add_ipu_core(
Shawn Guo88289c82012-06-13 14:07:31 +0800172 const struct imx_ipu_core_data *data);
Uwe Kleine-Königafa77ef2011-03-03 21:32:02 +0100173struct platform_device *__init imx_alloc_mx3_camera(
174 const struct imx_ipu_core_data *data,
175 const struct mx3_camera_pdata *pdata);
176struct platform_device *__init imx_add_mx3_sdc_fb(
177 const struct imx_ipu_core_data *data,
178 struct mx3fb_platform_data *pdata);
179
Mauro Carvalho Chehaba71daaa2015-11-17 07:11:13 -0200180#include <linux/platform_data/media/camera-mx2.h>
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100181struct imx_mx2_camera_data {
Shawn Guo27b76482012-09-16 16:26:20 +0800182 const char *devid;
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100183 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};
190struct platform_device *__init imx_add_mx2_camera(
191 const struct imx_mx2_camera_data *data,
192 const struct mx2_camera_platform_data *pdata);
Gaëtan Carlier3ab3a352012-09-05 13:06:15 +0200193
194
195struct imx_mx2_emma_data {
196 resource_size_t iobase;
197 resource_size_t iosize;
198 resource_size_t irq;
199};
Javier Martin52f1a842012-01-13 06:31:57 -0300200struct platform_device *__init imx_add_mx2_emmaprp(
Gaëtan Carlier3ab3a352012-09-05 13:06:15 +0200201 const struct imx_mx2_emma_data *data);
Uwe Kleine-Königb2997cb2010-11-02 17:50:55 +0100202
Arnd Bergmann82906b12012-08-24 15:14:29 +0200203#include <linux/platform_data/usb-ehci-mxc.h>
Uwe Kleine-König2eb42d52010-11-05 18:52:09 +0100204struct imx_mxc_ehci_data {
205 int id;
206 resource_size_t iobase;
207 resource_size_t irq;
208};
209struct platform_device *__init imx_add_mxc_ehci(
210 const struct imx_mxc_ehci_data *data,
211 const struct mxc_usbh_platform_data *pdata);
212
Arnd Bergmann82906b12012-08-24 15:14:29 +0200213#include <linux/platform_data/mmc-mxcmmc.h>
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100214struct imx_mxc_mmc_data {
Shawn Guo7f917a82012-09-16 16:54:30 +0800215 const char *devid;
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100216 int id;
217 resource_size_t iobase;
Uwe Kleine-König6a697e32010-11-12 11:10:55 +0100218 resource_size_t iosize;
Uwe Kleine-König9d3d9452010-11-05 17:26:09 +0100219 resource_size_t irq;
220 resource_size_t dmareq;
221};
222struct platform_device *__init imx_add_mxc_mmc(
223 const struct imx_mxc_mmc_data *data,
224 const struct imxmmc_platform_data *pdata);
225
Arnd Bergmann82906b12012-08-24 15:14:29 +0200226#include <linux/platform_data/mtd-mxc_nand.h>
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200227struct imx_mxc_nand_data {
Shawn Guo4d624352012-09-15 13:34:09 +0800228 const char *devid;
Sascha Hauer63a7c6d2010-08-03 11:59:46 +0200229 /*
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;
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200235 resource_size_t iobase;
236 resource_size_t iosize;
Sascha Hauer63a7c6d2010-08-03 11:59:46 +0200237 resource_size_t axibase;
Uwe Kleine-König00b57bf2010-08-23 11:25:52 +0200238 resource_size_t irq;
239};
240struct platform_device *__init imx_add_mxc_nand(
241 const struct imx_mxc_nand_data *data,
242 const struct mxc_nand_platform_data *pdata);
Uwe Kleine-König02870732010-06-21 18:02:55 +0200243
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +0200244struct imx_pata_imx_data {
245 resource_size_t iobase;
Fabio Estevam236c4e82011-08-23 17:18:06 -0300246 resource_size_t iosize;
Arnaud Patard (Rtp)a45adf12011-07-26 16:54:25 +0200247 resource_size_t irq;
248};
249struct platform_device *__init imx_add_pata_imx(
250 const struct imx_pata_imx_data *data);
251
Uwe Kleine-König83422672011-03-01 11:04:34 +0100252/* mxc_rtc */
253struct imx_mxc_rtc_data {
Shawn Guobb1d34a2012-09-15 14:26:14 +0800254 const char *devid;
Uwe Kleine-König83422672011-03-01 11:04:34 +0100255 resource_size_t iobase;
256 resource_size_t irq;
257};
258struct platform_device *__init imx_add_mxc_rtc(
259 const struct imx_mxc_rtc_data *data);
260
261/* mxc_w1 */
Uwe Kleine-Königae71a562010-10-29 10:56:07 +0200262struct imx_mxc_w1_data {
263 resource_size_t iobase;
264};
265struct platform_device *__init imx_add_mxc_w1(
266 const struct imx_mxc_w1_data *data);
267
Arnd Bergmann82906b12012-08-24 15:14:29 +0200268#include <linux/platform_data/mmc-esdhc-imx.h>
Uwe Kleine-König124bf942010-11-19 21:03:33 +0100269struct imx_sdhci_esdhc_imx_data {
Shawn Guo57ed3312011-06-30 09:24:26 +0800270 const char *devid;
Uwe Kleine-König124bf942010-11-19 21:03:33 +0100271 int id;
272 resource_size_t iobase;
273 resource_size_t irq;
274};
275struct 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
Arnd Bergmann82906b12012-08-24 15:14:29 +0200279#include <linux/platform_data/spi-imx.h>
Uwe Kleine-König35bab052010-09-09 21:02:02 +0200280struct imx_spi_imx_data {
Uwe Kleine-Königab560502010-09-09 21:02:02 +0200281 const char *devid;
Uwe Kleine-König35bab052010-09-09 21:02:02 +0200282 int id;
283 resource_size_t iobase;
284 resource_size_t iosize;
285 int irq;
286};
287struct platform_device *__init imx_add_spi_imx(
288 const struct imx_spi_imx_data *data,
Uwe Kleine-König02870732010-06-21 18:02:55 +0200289 const struct spi_imx_master *pdata);
Shawn Guo36223602011-06-22 22:41:30 +0800290
Shawn Guoe51d0f02012-09-15 21:11:28 +0800291struct platform_device *imx_add_imx_dma(char *name, resource_size_t iobase,
Shawn Guo73930eb2012-09-15 15:57:00 +0800292 int irq, int irq_err);
Shawn Guo62550cd2011-07-13 21:33:17 +0800293struct platform_device *imx_add_imx_sdma(char *name,
Shawn Guo36223602011-06-22 22:41:30 +0800294 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);