aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/Kconfig2
-rw-r--r--arch/arm/mach-imx/Makefile2
-rw-r--r--arch/arm/mach-imx/devices-imx1.h2
-rw-r--r--arch/arm/mach-imx/devices-imx21.h2
-rw-r--r--arch/arm/mach-imx/devices-imx25.h2
-rw-r--r--arch/arm/mach-imx/devices-imx27.h2
-rw-r--r--arch/arm/mach-imx/devices-imx31.h2
-rw-r--r--arch/arm/mach-imx/devices-imx35.h2
-rw-r--r--arch/arm/mach-imx/devices-imx50.h2
-rw-r--r--arch/arm/mach-imx/devices-imx51.h2
-rw-r--r--arch/arm/mach-imx/devices/Kconfig89
-rw-r--r--arch/arm/mach-imx/devices/Makefile32
-rw-r--r--arch/arm/mach-imx/devices/devices-common.h341
-rw-r--r--arch/arm/mach-imx/devices/devices.c49
-rw-r--r--arch/arm/mach-imx/devices/platform-ahci-imx.c156
-rw-r--r--arch/arm/mach-imx/devices/platform-fec.c74
-rw-r--r--arch/arm/mach-imx/devices/platform-flexcan.c58
-rw-r--r--arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c62
-rw-r--r--arch/arm/mach-imx/devices/platform-gpio-mxc.c32
-rw-r--r--arch/arm/mach-imx/devices/platform-gpio_keys.c27
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-dma.c34
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-fb.c58
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-i2c.c126
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-keypad.c72
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-ssi.c118
-rw-r--r--arch/arm/mach-imx/devices/platform-imx-uart.c178
-rw-r--r--arch/arm/mach-imx/devices/platform-imx2-wdt.c77
-rw-r--r--arch/arm/mach-imx/devices/platform-imx21-hcd.c41
-rw-r--r--arch/arm/mach-imx/devices/platform-imx27-coda.c37
-rw-r--r--arch/arm/mach-imx/devices/platform-imx_udc.c75
-rw-r--r--arch/arm/mach-imx/devices/platform-imxdi_rtc.c41
-rw-r--r--arch/arm/mach-imx/devices/platform-ipu-core.c129
-rw-r--r--arch/arm/mach-imx/devices/platform-mx1-camera.c42
-rw-r--r--arch/arm/mach-imx/devices/platform-mx2-camera.c82
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc-ehci.c79
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc-mmc.c73
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_nand.c82
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_pwm.c69
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_rnga.c56
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_rtc.c45
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_w1.c50
-rw-r--r--arch/arm/mach-imx/devices/platform-pata_imx.c59
-rw-r--r--arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c99
-rw-r--r--arch/arm/mach-imx/devices/platform-spi_imx.c127
-rw-r--r--arch/arm/mach-imx/mm-imx21.c2
-rw-r--r--arch/arm/mach-imx/mm-imx25.c2
-rw-r--r--arch/arm/mach-imx/mm-imx27.c2
-rw-r--r--arch/arm/mach-imx/mm-imx3.c2
-rw-r--r--arch/arm/mach-imx/mm-imx5.c2
-rw-r--r--arch/arm/mach-imx/pm-imx3.c2
50 files changed, 2787 insertions, 14 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index f10282ca796c..dffa273b124e 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -772,3 +772,5 @@ config SOC_IMX6Q
772 This enables support for Freescale i.MX6 Quad processor. 772 This enables support for Freescale i.MX6 Quad processor.
773 773
774endif 774endif
775
776source "arch/arm/mach-imx/devices/Kconfig"
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 5025a9dcf5d9..257893e6db93 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -92,3 +92,5 @@ obj-$(CONFIG_MACH_MX50_RDP) += mach-mx50_rdp.o
92 92
93obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o 93obj-$(CONFIG_MACH_IMX51_DT) += imx51-dt.o
94obj-$(CONFIG_SOC_IMX53) += mach-imx53.o 94obj-$(CONFIG_SOC_IMX53) += mach-imx53.o
95
96obj-y += devices/
diff --git a/arch/arm/mach-imx/devices-imx1.h b/arch/arm/mach-imx/devices-imx1.h
index eb2603b59b5a..f9b5afc6bcd1 100644
--- a/arch/arm/mach-imx/devices-imx1.h
+++ b/arch/arm/mach-imx/devices-imx1.h
@@ -6,7 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices/devices-common.h"
10 10
11extern const struct imx_imx_fb_data imx1_imx_fb_data; 11extern const struct imx_imx_fb_data imx1_imx_fb_data;
12#define imx1_add_imx_fb(pdata) \ 12#define imx1_add_imx_fb(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h
index e2014daa52b4..bd9393280159 100644
--- a/arch/arm/mach-imx/devices-imx21.h
+++ b/arch/arm/mach-imx/devices-imx21.h
@@ -6,7 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices/devices-common.h"
10 10
11extern const struct imx_imx21_hcd_data imx21_imx21_hcd_data; 11extern const struct imx_imx21_hcd_data imx21_imx21_hcd_data;
12#define imx21_add_imx21_hcd(pdata) \ 12#define imx21_add_imx21_hcd(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx25.h b/arch/arm/mach-imx/devices-imx25.h
index 29e9706c24c2..0d2922bc575c 100644
--- a/arch/arm/mach-imx/devices-imx25.h
+++ b/arch/arm/mach-imx/devices-imx25.h
@@ -6,7 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices/devices-common.h"
10 10
11extern const struct imx_fec_data imx25_fec_data; 11extern const struct imx_fec_data imx25_fec_data;
12#define imx25_add_fec(pdata) \ 12#define imx25_add_fec(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
index e2250430b7dd..8a1ad7972d4c 100644
--- a/arch/arm/mach-imx/devices-imx27.h
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -6,7 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices/devices-common.h"
10 10
11extern const struct imx_fec_data imx27_fec_data; 11extern const struct imx_fec_data imx27_fec_data;
12#define imx27_add_fec(pdata) \ 12#define imx27_add_fec(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx31.h b/arch/arm/mach-imx/devices-imx31.h
index 20565f90e82c..e8d1611bbc8e 100644
--- a/arch/arm/mach-imx/devices-imx31.h
+++ b/arch/arm/mach-imx/devices-imx31.h
@@ -6,7 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices/devices-common.h"
10 10
11extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data; 11extern const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data;
12#define imx31_add_fsl_usb2_udc(pdata) \ 12#define imx31_add_fsl_usb2_udc(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx35.h b/arch/arm/mach-imx/devices-imx35.h
index e45b5cbaac96..e2675f1b141c 100644
--- a/arch/arm/mach-imx/devices-imx35.h
+++ b/arch/arm/mach-imx/devices-imx35.h
@@ -6,7 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices/devices-common.h"
10 10
11extern const struct imx_fec_data imx35_fec_data; 11extern const struct imx_fec_data imx35_fec_data;
12#define imx35_add_fec(pdata) \ 12#define imx35_add_fec(pdata) \
diff --git a/arch/arm/mach-imx/devices-imx50.h b/arch/arm/mach-imx/devices-imx50.h
index 1615a6ab40d9..2c290391f298 100644
--- a/arch/arm/mach-imx/devices-imx50.h
+++ b/arch/arm/mach-imx/devices-imx50.h
@@ -18,7 +18,7 @@
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */ 19 */
20 20
21#include <mach/devices-common.h> 21#include "devices/devices-common.h"
22 22
23extern const struct imx_imx_uart_1irq_data imx50_imx_uart_data[]; 23extern const struct imx_imx_uart_1irq_data imx50_imx_uart_data[];
24#define imx50_add_imx_uart(id, pdata) \ 24#define imx50_add_imx_uart(id, pdata) \
diff --git a/arch/arm/mach-imx/devices-imx51.h b/arch/arm/mach-imx/devices-imx51.h
index f448104837e2..deee5baee88c 100644
--- a/arch/arm/mach-imx/devices-imx51.h
+++ b/arch/arm/mach-imx/devices-imx51.h
@@ -6,7 +6,7 @@
6 * the terms of the GNU General Public License version 2 as published by the 6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation. 7 * Free Software Foundation.
8 */ 8 */
9#include <mach/devices-common.h> 9#include "devices/devices-common.h"
10 10
11extern const struct imx_fec_data imx51_fec_data; 11extern const struct imx_fec_data imx51_fec_data;
12#define imx51_add_fec(pdata) \ 12#define imx51_add_fec(pdata) \
diff --git a/arch/arm/mach-imx/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
new file mode 100644
index 000000000000..a35d9841f494
--- /dev/null
+++ b/arch/arm/mach-imx/devices/Kconfig
@@ -0,0 +1,89 @@
1config IMX_HAVE_PLATFORM_FEC
2 bool
3 default y if ARCH_MX25 || SOC_IMX27 || SOC_IMX35 || SOC_IMX50 || SOC_IMX51 || SOC_IMX53
4
5config IMX_HAVE_PLATFORM_FLEXCAN
6 bool
7 select HAVE_CAN_FLEXCAN if CAN
8
9config IMX_HAVE_PLATFORM_FSL_USB2_UDC
10 bool
11
12config IMX_HAVE_PLATFORM_GPIO_KEYS
13 bool
14 default y if SOC_IMX51
15
16config IMX_HAVE_PLATFORM_IMX21_HCD
17 bool
18
19config IMX_HAVE_PLATFORM_IMX27_CODA
20 bool
21 default y if SOC_IMX27
22
23config IMX_HAVE_PLATFORM_IMX2_WDT
24 bool
25
26config IMX_HAVE_PLATFORM_IMXDI_RTC
27 bool
28
29config IMX_HAVE_PLATFORM_IMX_FB
30 bool
31
32config IMX_HAVE_PLATFORM_IMX_I2C
33 bool
34
35config IMX_HAVE_PLATFORM_IMX_KEYPAD
36 bool
37
38config IMX_HAVE_PLATFORM_PATA_IMX
39 bool
40
41config IMX_HAVE_PLATFORM_IMX_SSI
42 bool
43
44config IMX_HAVE_PLATFORM_IMX_UART
45 bool
46
47config IMX_HAVE_PLATFORM_IMX_UDC
48 bool
49
50config IMX_HAVE_PLATFORM_IPU_CORE
51 bool
52
53config IMX_HAVE_PLATFORM_MX1_CAMERA
54 bool
55
56config IMX_HAVE_PLATFORM_MX2_CAMERA
57 bool
58
59config IMX_HAVE_PLATFORM_MXC_EHCI
60 bool
61
62config IMX_HAVE_PLATFORM_MXC_MMC
63 bool
64
65config IMX_HAVE_PLATFORM_MXC_NAND
66 bool
67
68config IMX_HAVE_PLATFORM_MXC_PWM
69 bool
70
71config IMX_HAVE_PLATFORM_MXC_RNGA
72 bool
73 select ARCH_HAS_RNGA
74
75config IMX_HAVE_PLATFORM_MXC_RTC
76 bool
77
78config IMX_HAVE_PLATFORM_MXC_W1
79 bool
80
81config IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
82 bool
83
84config IMX_HAVE_PLATFORM_SPI_IMX
85 bool
86
87config IMX_HAVE_PLATFORM_AHCI
88 bool
89 default y if ARCH_MX53
diff --git a/arch/arm/mach-imx/devices/Makefile b/arch/arm/mach-imx/devices/Makefile
new file mode 100644
index 000000000000..2abe2a5144d0
--- /dev/null
+++ b/arch/arm/mach-imx/devices/Makefile
@@ -0,0 +1,32 @@
1obj-y := devices.o
2
3obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
4obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
5obj-$(CONFIG_IMX_HAVE_PLATFORM_FSL_USB2_UDC) += platform-fsl-usb2-udc.o
6obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
7obj-y += platform-gpio-mxc.o
8obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
9obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX27_CODA) += platform-imx27-coda.o
10obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
11obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o
12obj-y += platform-imx-dma.o
13obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
14obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
15obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o
16obj-$(CONFIG_IMX_HAVE_PLATFORM_PATA_IMX) += platform-pata_imx.o
17obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
18obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
19obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
20obj-$(CONFIG_IMX_HAVE_PLATFORM_IPU_CORE) += platform-ipu-core.o
21obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
22obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
23obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
24obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o
25obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
26obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o
27obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o
28obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o
29obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
30obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o
31obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
32obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += platform-ahci-imx.o
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
new file mode 100644
index 000000000000..eaf79d220c9a
--- /dev/null
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -0,0 +1,341 @@
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
14extern struct device mxc_aips_bus;
15extern struct device mxc_ahb_bus;
16
17static 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
34static 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>
44struct imx_fec_data {
45 const char *devid;
46 resource_size_t iobase;
47 resource_size_t irq;
48};
49struct 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>
54struct imx_flexcan_data {
55 int id;
56 resource_size_t iobase;
57 resource_size_t iosize;
58 resource_size_t irq;
59};
60struct 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>
65struct imx_fsl_usb2_udc_data {
66 resource_size_t iobase;
67 resource_size_t irq;
68};
69struct 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>
74struct platform_device *__init imx_add_gpio_keys(
75 const struct gpio_keys_platform_data *pdata);
76
77#include <linux/platform_data/usb-mx2.h>
78struct imx_imx21_hcd_data {
79 resource_size_t iobase;
80 resource_size_t irq;
81};
82struct platform_device *__init imx_add_imx21_hcd(
83 const struct imx_imx21_hcd_data *data,
84 const struct mx21_usbh_platform_data *pdata);
85
86struct imx_imx27_coda_data {
87 resource_size_t iobase;
88 resource_size_t iosize;
89 resource_size_t irq;
90};
91struct platform_device *__init imx_add_imx27_coda(
92 const struct imx_imx27_coda_data *data);
93
94struct imx_imx2_wdt_data {
95 int id;
96 resource_size_t iobase;
97 resource_size_t iosize;
98};
99struct platform_device *__init imx_add_imx2_wdt(
100 const struct imx_imx2_wdt_data *data);
101
102struct imx_imxdi_rtc_data {
103 resource_size_t iobase;
104 resource_size_t irq;
105};
106struct platform_device *__init imx_add_imxdi_rtc(
107 const struct imx_imxdi_rtc_data *data);
108
109#include <linux/platform_data/video-imxfb.h>
110struct imx_imx_fb_data {
111 resource_size_t iobase;
112 resource_size_t iosize;
113 resource_size_t irq;
114};
115struct 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>
120struct imx_imx_i2c_data {
121 int id;
122 resource_size_t iobase;
123 resource_size_t iosize;
124 resource_size_t irq;
125};
126struct platform_device *__init imx_add_imx_i2c(
127 const struct imx_imx_i2c_data *data,
128 const struct imxi2c_platform_data *pdata);
129
130#include <linux/input/matrix_keypad.h>
131struct imx_imx_keypad_data {
132 resource_size_t iobase;
133 resource_size_t iosize;
134 resource_size_t irq;
135};
136struct platform_device *__init imx_add_imx_keypad(
137 const struct imx_imx_keypad_data *data,
138 const struct matrix_keymap_data *pdata);
139
140#include <linux/platform_data/asoc-imx-ssi.h>
141struct imx_imx_ssi_data {
142 int id;
143 resource_size_t iobase;
144 resource_size_t iosize;
145 resource_size_t irq;
146 resource_size_t dmatx0;
147 resource_size_t dmarx0;
148 resource_size_t dmatx1;
149 resource_size_t dmarx1;
150};
151struct platform_device *__init imx_add_imx_ssi(
152 const struct imx_imx_ssi_data *data,
153 const struct imx_ssi_platform_data *pdata);
154
155#include <linux/platform_data/serial-imx.h>
156struct imx_imx_uart_3irq_data {
157 int id;
158 resource_size_t iobase;
159 resource_size_t iosize;
160 resource_size_t irqrx;
161 resource_size_t irqtx;
162 resource_size_t irqrts;
163};
164struct platform_device *__init imx_add_imx_uart_3irq(
165 const struct imx_imx_uart_3irq_data *data,
166 const struct imxuart_platform_data *pdata);
167
168struct imx_imx_uart_1irq_data {
169 int id;
170 resource_size_t iobase;
171 resource_size_t iosize;
172 resource_size_t irq;
173};
174struct platform_device *__init imx_add_imx_uart_1irq(
175 const struct imx_imx_uart_1irq_data *data,
176 const struct imxuart_platform_data *pdata);
177
178#include <linux/platform_data/usb-imx_udc.h>
179struct imx_imx_udc_data {
180 resource_size_t iobase;
181 resource_size_t iosize;
182 resource_size_t irq0;
183 resource_size_t irq1;
184 resource_size_t irq2;
185 resource_size_t irq3;
186 resource_size_t irq4;
187 resource_size_t irq5;
188 resource_size_t irq6;
189};
190struct platform_device *__init imx_add_imx_udc(
191 const struct imx_imx_udc_data *data,
192 const struct imxusb_platform_data *pdata);
193
194#include <linux/platform_data/video-mx3fb.h>
195#include <linux/platform_data/camera-mx3.h>
196struct imx_ipu_core_data {
197 resource_size_t iobase;
198 resource_size_t synirq;
199 resource_size_t errirq;
200};
201struct platform_device *__init imx_add_ipu_core(
202 const struct imx_ipu_core_data *data);
203struct platform_device *__init imx_alloc_mx3_camera(
204 const struct imx_ipu_core_data *data,
205 const struct mx3_camera_pdata *pdata);
206struct platform_device *__init imx_add_mx3_sdc_fb(
207 const struct imx_ipu_core_data *data,
208 struct mx3fb_platform_data *pdata);
209
210#include <linux/platform_data/camera-mx1.h>
211struct imx_mx1_camera_data {
212 resource_size_t iobase;
213 resource_size_t iosize;
214 resource_size_t irq;
215};
216struct platform_device *__init imx_add_mx1_camera(
217 const struct imx_mx1_camera_data *data,
218 const struct mx1_camera_pdata *pdata);
219
220#include <linux/platform_data/camera-mx2.h>
221struct imx_mx2_camera_data {
222 resource_size_t iobasecsi;
223 resource_size_t iosizecsi;
224 resource_size_t irqcsi;
225 resource_size_t iobaseemmaprp;
226 resource_size_t iosizeemmaprp;
227 resource_size_t irqemmaprp;
228};
229struct platform_device *__init imx_add_mx2_camera(
230 const struct imx_mx2_camera_data *data,
231 const struct mx2_camera_platform_data *pdata);
232struct platform_device *__init imx_add_mx2_emmaprp(
233 const struct imx_mx2_camera_data *data);
234
235#include <linux/platform_data/usb-ehci-mxc.h>
236struct imx_mxc_ehci_data {
237 int id;
238 resource_size_t iobase;
239 resource_size_t irq;
240};
241struct platform_device *__init imx_add_mxc_ehci(
242 const struct imx_mxc_ehci_data *data,
243 const struct mxc_usbh_platform_data *pdata);
244
245#include <linux/platform_data/mmc-mxcmmc.h>
246struct imx_mxc_mmc_data {
247 int id;
248 resource_size_t iobase;
249 resource_size_t iosize;
250 resource_size_t irq;
251 resource_size_t dmareq;
252};
253struct platform_device *__init imx_add_mxc_mmc(
254 const struct imx_mxc_mmc_data *data,
255 const struct imxmmc_platform_data *pdata);
256
257#include <linux/platform_data/mtd-mxc_nand.h>
258struct imx_mxc_nand_data {
259 /*
260 * id is traditionally 0, but -1 is more appropriate. We use -1 for new
261 * machines but don't change existing devices as the nand device usually
262 * appears in the kernel command line to pass its partitioning.
263 */
264 int id;
265 resource_size_t iobase;
266 resource_size_t iosize;
267 resource_size_t axibase;
268 resource_size_t irq;
269};
270struct platform_device *__init imx_add_mxc_nand(
271 const struct imx_mxc_nand_data *data,
272 const struct mxc_nand_platform_data *pdata);
273
274struct imx_pata_imx_data {
275 resource_size_t iobase;
276 resource_size_t iosize;
277 resource_size_t irq;
278};
279struct platform_device *__init imx_add_pata_imx(
280 const struct imx_pata_imx_data *data);
281
282struct imx_mxc_pwm_data {
283 int id;
284 resource_size_t iobase;
285 resource_size_t iosize;
286 resource_size_t irq;
287};
288struct platform_device *__init imx_add_mxc_pwm(
289 const struct imx_mxc_pwm_data *data);
290
291/* mxc_rtc */
292struct imx_mxc_rtc_data {
293 resource_size_t iobase;
294 resource_size_t irq;
295};
296struct platform_device *__init imx_add_mxc_rtc(
297 const struct imx_mxc_rtc_data *data);
298
299/* mxc_w1 */
300struct imx_mxc_w1_data {
301 resource_size_t iobase;
302};
303struct platform_device *__init imx_add_mxc_w1(
304 const struct imx_mxc_w1_data *data);
305
306#include <linux/platform_data/mmc-esdhc-imx.h>
307struct imx_sdhci_esdhc_imx_data {
308 const char *devid;
309 int id;
310 resource_size_t iobase;
311 resource_size_t irq;
312};
313struct platform_device *__init imx_add_sdhci_esdhc_imx(
314 const struct imx_sdhci_esdhc_imx_data *data,
315 const struct esdhc_platform_data *pdata);
316
317#include <linux/platform_data/spi-imx.h>
318struct imx_spi_imx_data {
319 const char *devid;
320 int id;
321 resource_size_t iobase;
322 resource_size_t iosize;
323 int irq;
324};
325struct platform_device *__init imx_add_spi_imx(
326 const struct imx_spi_imx_data *data,
327 const struct spi_imx_master *pdata);
328
329struct platform_device *imx_add_imx_dma(void);
330struct platform_device *imx_add_imx_sdma(char *name,
331 resource_size_t iobase, int irq, struct sdma_platform_data *pdata);
332
333#include <linux/ahci_platform.h>
334struct imx_ahci_imx_data {
335 const char *devid;
336 resource_size_t iobase;
337 resource_size_t irq;
338};
339struct platform_device *__init imx_add_ahci_imx(
340 const struct imx_ahci_imx_data *data,
341 const struct ahci_platform_data *pdata);
diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c
new file mode 100644
index 000000000000..4d55a7a26e98
--- /dev/null
+++ b/arch/arm/mach-imx/devices/devices.c
@@ -0,0 +1,49 @@
1/*
2 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18
19#include <linux/kernel.h>
20#include <linux/slab.h>
21#include <linux/init.h>
22#include <linux/err.h>
23#include <linux/platform_device.h>
24#include <mach/common.h>
25
26struct device mxc_aips_bus = {
27 .init_name = "mxc_aips",
28 .parent = &platform_bus,
29};
30
31struct device mxc_ahb_bus = {
32 .init_name = "mxc_ahb",
33 .parent = &platform_bus,
34};
35
36static int __init mxc_device_init(void)
37{
38 int ret;
39
40 ret = device_register(&mxc_aips_bus);
41 if (IS_ERR_VALUE(ret))
42 goto done;
43
44 ret = device_register(&mxc_ahb_bus);
45
46done:
47 return ret;
48}
49core_initcall(mxc_device_init);
diff --git a/arch/arm/mach-imx/devices/platform-ahci-imx.c b/arch/arm/mach-imx/devices/platform-ahci-imx.c
new file mode 100644
index 000000000000..bf7f46d930eb
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-ahci-imx.c
@@ -0,0 +1,156 @@
1/*
2 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#include <linux/io.h>
22#include <linux/clk.h>
23#include <linux/err.h>
24#include <linux/device.h>
25#include <linux/dma-mapping.h>
26#include <asm/sizes.h>
27#include <mach/hardware.h>
28#include "devices-common.h"
29
30#define imx_ahci_imx_data_entry_single(soc, _devid) \
31 { \
32 .devid = _devid, \
33 .iobase = soc ## _SATA_BASE_ADDR, \
34 .irq = soc ## _INT_SATA, \
35 }
36
37#ifdef CONFIG_SOC_IMX53
38const struct imx_ahci_imx_data imx53_ahci_imx_data __initconst =
39 imx_ahci_imx_data_entry_single(MX53, "imx53-ahci");
40#endif
41
42enum {
43 HOST_CAP = 0x00,
44 HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */
45 HOST_PORTS_IMPL = 0x0c,
46 HOST_TIMER1MS = 0xe0, /* Timer 1-ms */
47};
48
49static struct clk *sata_clk, *sata_ref_clk;
50
51/* AHCI module Initialization, if return 0, initialization is successful. */
52static int imx_sata_init(struct device *dev, void __iomem *addr)
53{
54 u32 tmpdata;
55 int ret = 0;
56 struct clk *clk;
57
58 sata_clk = clk_get(dev, "ahci");
59 if (IS_ERR(sata_clk)) {
60 dev_err(dev, "no sata clock.\n");
61 return PTR_ERR(sata_clk);
62 }
63 ret = clk_prepare_enable(sata_clk);
64 if (ret) {
65 dev_err(dev, "can't prepare/enable sata clock.\n");
66 goto put_sata_clk;
67 }
68
69 /* Get the AHCI SATA PHY CLK */
70 sata_ref_clk = clk_get(dev, "ahci_phy");
71 if (IS_ERR(sata_ref_clk)) {
72 dev_err(dev, "no sata ref clock.\n");
73 ret = PTR_ERR(sata_ref_clk);
74 goto release_sata_clk;
75 }
76 ret = clk_prepare_enable(sata_ref_clk);
77 if (ret) {
78 dev_err(dev, "can't prepare/enable sata ref clock.\n");
79 goto put_sata_ref_clk;
80 }
81
82 /* Get the AHB clock rate, and configure the TIMER1MS reg later */
83 clk = clk_get(dev, "ahci_dma");
84 if (IS_ERR(clk)) {
85 dev_err(dev, "no dma clock.\n");
86 ret = PTR_ERR(clk);
87 goto release_sata_ref_clk;
88 }
89 tmpdata = clk_get_rate(clk) / 1000;
90 clk_put(clk);
91
92 writel(tmpdata, addr + HOST_TIMER1MS);
93
94 tmpdata = readl(addr + HOST_CAP);
95 if (!(tmpdata & HOST_CAP_SSS)) {
96 tmpdata |= HOST_CAP_SSS;
97 writel(tmpdata, addr + HOST_CAP);
98 }
99
100 if (!(readl(addr + HOST_PORTS_IMPL) & 0x1))
101 writel((readl(addr + HOST_PORTS_IMPL) | 0x1),
102 addr + HOST_PORTS_IMPL);
103
104 return 0;
105
106release_sata_ref_clk:
107 clk_disable_unprepare(sata_ref_clk);
108put_sata_ref_clk:
109 clk_put(sata_ref_clk);
110release_sata_clk:
111 clk_disable_unprepare(sata_clk);
112put_sata_clk:
113 clk_put(sata_clk);
114
115 return ret;
116}
117
118static void imx_sata_exit(struct device *dev)
119{
120 clk_disable_unprepare(sata_ref_clk);
121 clk_put(sata_ref_clk);
122
123 clk_disable_unprepare(sata_clk);
124 clk_put(sata_clk);
125
126}
127struct platform_device *__init imx_add_ahci_imx(
128 const struct imx_ahci_imx_data *data,
129 const struct ahci_platform_data *pdata)
130{
131 struct resource res[] = {
132 {
133 .start = data->iobase,
134 .end = data->iobase + SZ_4K - 1,
135 .flags = IORESOURCE_MEM,
136 }, {
137 .start = data->irq,
138 .end = data->irq,
139 .flags = IORESOURCE_IRQ,
140 },
141 };
142
143 return imx_add_platform_device_dmamask(data->devid, 0,
144 res, ARRAY_SIZE(res),
145 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
146}
147
148struct platform_device *__init imx53_add_ahci_imx(void)
149{
150 struct ahci_platform_data pdata = {
151 .init = imx_sata_init,
152 .exit = imx_sata_exit,
153 };
154
155 return imx_add_ahci_imx(&imx53_ahci_imx_data, &pdata);
156}
diff --git a/arch/arm/mach-imx/devices/platform-fec.c b/arch/arm/mach-imx/devices/platform-fec.c
new file mode 100644
index 000000000000..e62114f1f4f4
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-fec.c
@@ -0,0 +1,74 @@
1/*
2 * Copyright (C) 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/dma-mapping.h>
10#include <asm/sizes.h>
11#include <mach/hardware.h>
12#include "devices-common.h"
13
14#define imx_fec_data_entry_single(soc, _devid) \
15 { \
16 .devid = _devid, \
17 .iobase = soc ## _FEC_BASE_ADDR, \
18 .irq = soc ## _INT_FEC, \
19 }
20
21#ifdef CONFIG_SOC_IMX25
22const struct imx_fec_data imx25_fec_data __initconst =
23 imx_fec_data_entry_single(MX25, "imx25-fec");
24#endif /* ifdef CONFIG_SOC_IMX25 */
25
26#ifdef CONFIG_SOC_IMX27
27const struct imx_fec_data imx27_fec_data __initconst =
28 imx_fec_data_entry_single(MX27, "imx27-fec");
29#endif /* ifdef CONFIG_SOC_IMX27 */
30
31#ifdef CONFIG_SOC_IMX35
32/* i.mx35 has the i.mx27 type fec */
33const struct imx_fec_data imx35_fec_data __initconst =
34 imx_fec_data_entry_single(MX35, "imx27-fec");
35#endif
36
37#ifdef CONFIG_SOC_IMX50
38/* i.mx50 has the i.mx25 type fec */
39const struct imx_fec_data imx50_fec_data __initconst =
40 imx_fec_data_entry_single(MX50, "imx25-fec");
41#endif
42
43#ifdef CONFIG_SOC_IMX51
44/* i.mx51 has the i.mx27 type fec */
45const struct imx_fec_data imx51_fec_data __initconst =
46 imx_fec_data_entry_single(MX51, "imx27-fec");
47#endif
48
49#ifdef CONFIG_SOC_IMX53
50/* i.mx53 has the i.mx25 type fec */
51const struct imx_fec_data imx53_fec_data __initconst =
52 imx_fec_data_entry_single(MX53, "imx25-fec");
53#endif
54
55struct platform_device *__init imx_add_fec(
56 const struct imx_fec_data *data,
57 const struct fec_platform_data *pdata)
58{
59 struct resource res[] = {
60 {
61 .start = data->iobase,
62 .end = data->iobase + SZ_4K - 1,
63 .flags = IORESOURCE_MEM,
64 }, {
65 .start = data->irq,
66 .end = data->irq,
67 .flags = IORESOURCE_IRQ,
68 },
69 };
70
71 return imx_add_platform_device_dmamask(data->devid, 0,
72 res, ARRAY_SIZE(res),
73 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
74}
diff --git a/arch/arm/mach-imx/devices/platform-flexcan.c b/arch/arm/mach-imx/devices/platform-flexcan.c
new file mode 100644
index 000000000000..e776d8efea92
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-flexcan.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2010 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
7 */
8#include <mach/hardware.h>
9#include "devices-common.h"
10
11#define imx_flexcan_data_entry_single(soc, _id, _hwid, _size) \
12 { \
13 .id = _id, \
14 .iobase = soc ## _CAN ## _hwid ## _BASE_ADDR, \
15 .iosize = _size, \
16 .irq = soc ## _INT_CAN ## _hwid, \
17 }
18
19#define imx_flexcan_data_entry(soc, _id, _hwid, _size) \
20 [_id] = imx_flexcan_data_entry_single(soc, _id, _hwid, _size)
21
22#ifdef CONFIG_SOC_IMX25
23const struct imx_flexcan_data imx25_flexcan_data[] __initconst = {
24#define imx25_flexcan_data_entry(_id, _hwid) \
25 imx_flexcan_data_entry(MX25, _id, _hwid, SZ_16K)
26 imx25_flexcan_data_entry(0, 1),
27 imx25_flexcan_data_entry(1, 2),
28};
29#endif /* ifdef CONFIG_SOC_IMX25 */
30
31#ifdef CONFIG_SOC_IMX35
32const struct imx_flexcan_data imx35_flexcan_data[] __initconst = {
33#define imx35_flexcan_data_entry(_id, _hwid) \
34 imx_flexcan_data_entry(MX35, _id, _hwid, SZ_16K)
35 imx35_flexcan_data_entry(0, 1),
36 imx35_flexcan_data_entry(1, 2),
37};
38#endif /* ifdef CONFIG_SOC_IMX35 */
39
40struct platform_device *__init imx_add_flexcan(
41 const struct imx_flexcan_data *data,
42 const struct flexcan_platform_data *pdata)
43{
44 struct resource res[] = {
45 {
46 .start = data->iobase,
47 .end = data->iobase + data->iosize - 1,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = data->irq,
51 .end = data->irq,
52 .flags = IORESOURCE_IRQ,
53 },
54 };
55
56 return imx_add_platform_device("flexcan", data->id,
57 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
58}
diff --git a/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
new file mode 100644
index 000000000000..6ecccf977746
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-fsl-usb2-udc.c
@@ -0,0 +1,62 @@
1/*
2 * Copyright (C) 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/dma-mapping.h>
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#define imx_fsl_usb2_udc_data_entry_single(soc) \
14 { \
15 .iobase = soc ## _USB_OTG_BASE_ADDR, \
16 .irq = soc ## _INT_USB_OTG, \
17 }
18
19#ifdef CONFIG_SOC_IMX25
20const struct imx_fsl_usb2_udc_data imx25_fsl_usb2_udc_data __initconst =
21 imx_fsl_usb2_udc_data_entry_single(MX25);
22#endif /* ifdef CONFIG_SOC_IMX25 */
23
24#ifdef CONFIG_SOC_IMX27
25const struct imx_fsl_usb2_udc_data imx27_fsl_usb2_udc_data __initconst =
26 imx_fsl_usb2_udc_data_entry_single(MX27);
27#endif /* ifdef CONFIG_SOC_IMX27 */
28
29#ifdef CONFIG_SOC_IMX31
30const struct imx_fsl_usb2_udc_data imx31_fsl_usb2_udc_data __initconst =
31 imx_fsl_usb2_udc_data_entry_single(MX31);
32#endif /* ifdef CONFIG_SOC_IMX31 */
33
34#ifdef CONFIG_SOC_IMX35
35const struct imx_fsl_usb2_udc_data imx35_fsl_usb2_udc_data __initconst =
36 imx_fsl_usb2_udc_data_entry_single(MX35);
37#endif /* ifdef CONFIG_SOC_IMX35 */
38
39#ifdef CONFIG_SOC_IMX51
40const struct imx_fsl_usb2_udc_data imx51_fsl_usb2_udc_data __initconst =
41 imx_fsl_usb2_udc_data_entry_single(MX51);
42#endif
43
44struct platform_device *__init imx_add_fsl_usb2_udc(
45 const struct imx_fsl_usb2_udc_data *data,
46 const struct fsl_usb2_platform_data *pdata)
47{
48 struct resource res[] = {
49 {
50 .start = data->iobase,
51 .end = data->iobase + SZ_512 - 1,
52 .flags = IORESOURCE_MEM,
53 }, {
54 .start = data->irq,
55 .end = data->irq,
56 .flags = IORESOURCE_IRQ,
57 },
58 };
59 return imx_add_platform_device_dmamask("fsl-usb2-udc", -1,
60 res, ARRAY_SIZE(res),
61 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
62}
diff --git a/arch/arm/mach-imx/devices/platform-gpio-mxc.c b/arch/arm/mach-imx/devices/platform-gpio-mxc.c
new file mode 100644
index 000000000000..26483fa94b75
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-gpio-mxc.c
@@ -0,0 +1,32 @@
1/*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2011 Linaro Limited
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 "devices-common.h"
10
11struct platform_device *__init mxc_register_gpio(char *name, int id,
12 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high)
13{
14 struct resource res[] = {
15 {
16 .start = iobase,
17 .end = iobase + iosize - 1,
18 .flags = IORESOURCE_MEM,
19 }, {
20 .start = irq,
21 .end = irq,
22 .flags = IORESOURCE_IRQ,
23 }, {
24 .start = irq_high,
25 .end = irq_high,
26 .flags = IORESOURCE_IRQ,
27 },
28 };
29
30 return platform_device_register_resndata(&mxc_aips_bus,
31 name, id, res, ARRAY_SIZE(res), NULL, 0);
32}
diff --git a/arch/arm/mach-imx/devices/platform-gpio_keys.c b/arch/arm/mach-imx/devices/platform-gpio_keys.c
new file mode 100644
index 000000000000..3f8727952ed9
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-gpio_keys.c
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18#include <asm/sizes.h>
19#include <mach/hardware.h>
20#include "devices-common.h"
21
22struct platform_device *__init imx_add_gpio_keys(
23 const struct gpio_keys_platform_data *pdata)
24{
25 return imx_add_platform_device("gpio-keys", -1, NULL,
26 0, pdata, sizeof(*pdata));
27}
diff --git a/arch/arm/mach-imx/devices/platform-imx-dma.c b/arch/arm/mach-imx/devices/platform-imx-dma.c
new file mode 100644
index 000000000000..c35c99d21820
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx-dma.c
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 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 "devices-common.h"
10
11struct platform_device __init __maybe_unused *imx_add_imx_dma(void)
12{
13 return platform_device_register_resndata(&mxc_ahb_bus,
14 "imx-dma", -1, NULL, 0, NULL, 0);
15}
16
17struct platform_device __init __maybe_unused *imx_add_imx_sdma(char *name,
18 resource_size_t iobase, int irq, struct sdma_platform_data *pdata)
19{
20 struct resource res[] = {
21 {
22 .start = iobase,
23 .end = iobase + SZ_16K - 1,
24 .flags = IORESOURCE_MEM,
25 }, {
26 .start = irq,
27 .end = irq,
28 .flags = IORESOURCE_IRQ,
29 },
30 };
31
32 return platform_device_register_resndata(&mxc_ahb_bus, name,
33 -1, res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
34}
diff --git a/arch/arm/mach-imx/devices/platform-imx-fb.c b/arch/arm/mach-imx/devices/platform-imx-fb.c
new file mode 100644
index 000000000000..4e6f85703918
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx-fb.c
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 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/dma-mapping.h>
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#define imx_imx_fb_data_entry_single(soc, _size) \
14 { \
15 .iobase = soc ## _LCDC_BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_LCDC, \
18 }
19
20#ifdef CONFIG_SOC_IMX1
21const struct imx_imx_fb_data imx1_imx_fb_data __initconst =
22 imx_imx_fb_data_entry_single(MX1, SZ_4K);
23#endif /* ifdef CONFIG_SOC_IMX1 */
24
25#ifdef CONFIG_SOC_IMX21
26const struct imx_imx_fb_data imx21_imx_fb_data __initconst =
27 imx_imx_fb_data_entry_single(MX21, SZ_4K);
28#endif /* ifdef CONFIG_SOC_IMX21 */
29
30#ifdef CONFIG_SOC_IMX25
31const struct imx_imx_fb_data imx25_imx_fb_data __initconst =
32 imx_imx_fb_data_entry_single(MX25, SZ_16K);
33#endif /* ifdef CONFIG_SOC_IMX25 */
34
35#ifdef CONFIG_SOC_IMX27
36const struct imx_imx_fb_data imx27_imx_fb_data __initconst =
37 imx_imx_fb_data_entry_single(MX27, SZ_4K);
38#endif /* ifdef CONFIG_SOC_IMX27 */
39
40struct platform_device *__init imx_add_imx_fb(
41 const struct imx_imx_fb_data *data,
42 const struct imx_fb_platform_data *pdata)
43{
44 struct resource res[] = {
45 {
46 .start = data->iobase,
47 .end = data->iobase + data->iosize - 1,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = data->irq,
51 .end = data->irq,
52 .flags = IORESOURCE_IRQ,
53 },
54 };
55 return imx_add_platform_device_dmamask("imx-fb", 0,
56 res, ARRAY_SIZE(res),
57 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
58}
diff --git a/arch/arm/mach-imx/devices/platform-imx-i2c.c b/arch/arm/mach-imx/devices/platform-imx-i2c.c
new file mode 100644
index 000000000000..e0c7d6291bed
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx-i2c.c
@@ -0,0 +1,126 @@
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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size) \
13 { \
14 .id = _id, \
15 .iobase = soc ## _I2C ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_I2C ## _hwid, \
18 }
19
20#define imx_imx_i2c_data_entry(soc, _id, _hwid, _size) \
21 [_id] = imx_imx_i2c_data_entry_single(soc, _id, _hwid, _size)
22
23#ifdef CONFIG_SOC_IMX1
24const struct imx_imx_i2c_data imx1_imx_i2c_data __initconst =
25 imx_imx_i2c_data_entry_single(MX1, 0, , SZ_4K);
26#endif /* ifdef CONFIG_SOC_IMX1 */
27
28#ifdef CONFIG_SOC_IMX21
29const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst =
30 imx_imx_i2c_data_entry_single(MX21, 0, , SZ_4K);
31#endif /* ifdef CONFIG_SOC_IMX21 */
32
33#ifdef CONFIG_SOC_IMX25
34const struct imx_imx_i2c_data imx25_imx_i2c_data[] __initconst = {
35#define imx25_imx_i2c_data_entry(_id, _hwid) \
36 imx_imx_i2c_data_entry(MX25, _id, _hwid, SZ_16K)
37 imx25_imx_i2c_data_entry(0, 1),
38 imx25_imx_i2c_data_entry(1, 2),
39 imx25_imx_i2c_data_entry(2, 3),
40};
41#endif /* ifdef CONFIG_SOC_IMX25 */
42
43#ifdef CONFIG_SOC_IMX27
44const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst = {
45#define imx27_imx_i2c_data_entry(_id, _hwid) \
46 imx_imx_i2c_data_entry(MX27, _id, _hwid, SZ_4K)
47 imx27_imx_i2c_data_entry(0, 1),
48 imx27_imx_i2c_data_entry(1, 2),
49};
50#endif /* ifdef CONFIG_SOC_IMX27 */
51
52#ifdef CONFIG_SOC_IMX31
53const struct imx_imx_i2c_data imx31_imx_i2c_data[] __initconst = {
54#define imx31_imx_i2c_data_entry(_id, _hwid) \
55 imx_imx_i2c_data_entry(MX31, _id, _hwid, SZ_4K)
56 imx31_imx_i2c_data_entry(0, 1),
57 imx31_imx_i2c_data_entry(1, 2),
58 imx31_imx_i2c_data_entry(2, 3),
59};
60#endif /* ifdef CONFIG_SOC_IMX31 */
61
62#ifdef CONFIG_SOC_IMX35
63const struct imx_imx_i2c_data imx35_imx_i2c_data[] __initconst = {
64#define imx35_imx_i2c_data_entry(_id, _hwid) \
65 imx_imx_i2c_data_entry(MX35, _id, _hwid, SZ_4K)
66 imx35_imx_i2c_data_entry(0, 1),
67 imx35_imx_i2c_data_entry(1, 2),
68 imx35_imx_i2c_data_entry(2, 3),
69};
70#endif /* ifdef CONFIG_SOC_IMX35 */
71
72#ifdef CONFIG_SOC_IMX50
73const struct imx_imx_i2c_data imx50_imx_i2c_data[] __initconst = {
74#define imx50_imx_i2c_data_entry(_id, _hwid) \
75 imx_imx_i2c_data_entry(MX50, _id, _hwid, SZ_4K)
76 imx50_imx_i2c_data_entry(0, 1),
77 imx50_imx_i2c_data_entry(1, 2),
78 imx50_imx_i2c_data_entry(2, 3),
79};
80#endif /* ifdef CONFIG_SOC_IMX51 */
81
82#ifdef CONFIG_SOC_IMX51
83const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst = {
84#define imx51_imx_i2c_data_entry(_id, _hwid) \
85 imx_imx_i2c_data_entry(MX51, _id, _hwid, SZ_4K)
86 imx51_imx_i2c_data_entry(0, 1),
87 imx51_imx_i2c_data_entry(1, 2),
88 {
89 .id = 2,
90 .iobase = MX51_HSI2C_DMA_BASE_ADDR,
91 .iosize = SZ_16K,
92 .irq = MX51_INT_HS_I2C,
93 },
94};
95#endif /* ifdef CONFIG_SOC_IMX51 */
96
97#ifdef CONFIG_SOC_IMX53
98const struct imx_imx_i2c_data imx53_imx_i2c_data[] __initconst = {
99#define imx53_imx_i2c_data_entry(_id, _hwid) \
100 imx_imx_i2c_data_entry(MX53, _id, _hwid, SZ_4K)
101 imx53_imx_i2c_data_entry(0, 1),
102 imx53_imx_i2c_data_entry(1, 2),
103 imx53_imx_i2c_data_entry(2, 3),
104};
105#endif /* ifdef CONFIG_SOC_IMX53 */
106
107struct platform_device *__init imx_add_imx_i2c(
108 const struct imx_imx_i2c_data *data,
109 const struct imxi2c_platform_data *pdata)
110{
111 struct resource res[] = {
112 {
113 .start = data->iobase,
114 .end = data->iobase + data->iosize - 1,
115 .flags = IORESOURCE_MEM,
116 }, {
117 .start = data->irq,
118 .end = data->irq,
119 .flags = IORESOURCE_IRQ,
120 },
121 };
122
123 return imx_add_platform_device("imx-i2c", data->id,
124 res, ARRAY_SIZE(res),
125 pdata, sizeof(*pdata));
126}
diff --git a/arch/arm/mach-imx/devices/platform-imx-keypad.c b/arch/arm/mach-imx/devices/platform-imx-keypad.c
new file mode 100644
index 000000000000..371b1e6ec954
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx-keypad.c
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) 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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_imx_keypad_data_entry_single(soc, _size) \
13 { \
14 .iobase = soc ## _KPP_BASE_ADDR, \
15 .iosize = _size, \
16 .irq = soc ## _INT_KPP, \
17 }
18
19#ifdef CONFIG_SOC_IMX21
20const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst =
21 imx_imx_keypad_data_entry_single(MX21, SZ_16);
22#endif /* ifdef CONFIG_SOC_IMX21 */
23
24#ifdef CONFIG_SOC_IMX25
25const struct imx_imx_keypad_data imx25_imx_keypad_data __initconst =
26 imx_imx_keypad_data_entry_single(MX25, SZ_16K);
27#endif /* ifdef CONFIG_SOC_IMX25 */
28
29#ifdef CONFIG_SOC_IMX27
30const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
31 imx_imx_keypad_data_entry_single(MX27, SZ_16);
32#endif /* ifdef CONFIG_SOC_IMX27 */
33
34#ifdef CONFIG_SOC_IMX31
35const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst =
36 imx_imx_keypad_data_entry_single(MX31, SZ_16);
37#endif /* ifdef CONFIG_SOC_IMX31 */
38
39#ifdef CONFIG_SOC_IMX35
40const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
41 imx_imx_keypad_data_entry_single(MX35, SZ_16);
42#endif /* ifdef CONFIG_SOC_IMX35 */
43
44#ifdef CONFIG_SOC_IMX51
45const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst =
46 imx_imx_keypad_data_entry_single(MX51, SZ_16);
47#endif /* ifdef CONFIG_SOC_IMX51 */
48
49#ifdef CONFIG_SOC_IMX53
50const struct imx_imx_keypad_data imx53_imx_keypad_data __initconst =
51 imx_imx_keypad_data_entry_single(MX53, SZ_16);
52#endif /* ifdef CONFIG_SOC_IMX53 */
53
54struct platform_device *__init imx_add_imx_keypad(
55 const struct imx_imx_keypad_data *data,
56 const struct matrix_keymap_data *pdata)
57{
58 struct resource res[] = {
59 {
60 .start = data->iobase,
61 .end = data->iobase + data->iosize - 1,
62 .flags = IORESOURCE_MEM,
63 }, {
64 .start = data->irq,
65 .end = data->irq,
66 .flags = IORESOURCE_IRQ,
67 },
68 };
69
70 return imx_add_platform_device("imx-keypad", -1,
71 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
72}
diff --git a/arch/arm/mach-imx/devices/platform-imx-ssi.c b/arch/arm/mach-imx/devices/platform-imx-ssi.c
new file mode 100644
index 000000000000..bf0c5e4e2d1b
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx-ssi.c
@@ -0,0 +1,118 @@
1/*
2 * Copyright (C) 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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_imx_ssi_data_entry(soc, _id, _hwid, _size) \
13 [_id] = { \
14 .id = _id, \
15 .iobase = soc ## _SSI ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_SSI ## _hwid, \
18 .dmatx0 = soc ## _DMA_REQ_SSI ## _hwid ## _TX0, \
19 .dmarx0 = soc ## _DMA_REQ_SSI ## _hwid ## _RX0, \
20 .dmatx1 = soc ## _DMA_REQ_SSI ## _hwid ## _TX1, \
21 .dmarx1 = soc ## _DMA_REQ_SSI ## _hwid ## _RX1, \
22 }
23
24#ifdef CONFIG_SOC_IMX21
25const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst = {
26#define imx21_imx_ssi_data_entry(_id, _hwid) \
27 imx_imx_ssi_data_entry(MX21, _id, _hwid, SZ_4K)
28 imx21_imx_ssi_data_entry(0, 1),
29 imx21_imx_ssi_data_entry(1, 2),
30};
31#endif /* ifdef CONFIG_SOC_IMX21 */
32
33#ifdef CONFIG_SOC_IMX25
34const struct imx_imx_ssi_data imx25_imx_ssi_data[] __initconst = {
35#define imx25_imx_ssi_data_entry(_id, _hwid) \
36 imx_imx_ssi_data_entry(MX25, _id, _hwid, SZ_4K)
37 imx25_imx_ssi_data_entry(0, 1),
38 imx25_imx_ssi_data_entry(1, 2),
39};
40#endif /* ifdef CONFIG_SOC_IMX25 */
41
42#ifdef CONFIG_SOC_IMX27
43const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
44#define imx27_imx_ssi_data_entry(_id, _hwid) \
45 imx_imx_ssi_data_entry(MX27, _id, _hwid, SZ_4K)
46 imx27_imx_ssi_data_entry(0, 1),
47 imx27_imx_ssi_data_entry(1, 2),
48};
49#endif /* ifdef CONFIG_SOC_IMX27 */
50
51#ifdef CONFIG_SOC_IMX31
52const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst = {
53#define imx31_imx_ssi_data_entry(_id, _hwid) \
54 imx_imx_ssi_data_entry(MX31, _id, _hwid, SZ_4K)
55 imx31_imx_ssi_data_entry(0, 1),
56 imx31_imx_ssi_data_entry(1, 2),
57};
58#endif /* ifdef CONFIG_SOC_IMX31 */
59
60#ifdef CONFIG_SOC_IMX35
61const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
62#define imx35_imx_ssi_data_entry(_id, _hwid) \
63 imx_imx_ssi_data_entry(MX35, _id, _hwid, SZ_4K)
64 imx35_imx_ssi_data_entry(0, 1),
65 imx35_imx_ssi_data_entry(1, 2),
66};
67#endif /* ifdef CONFIG_SOC_IMX35 */
68
69#ifdef CONFIG_SOC_IMX51
70const struct imx_imx_ssi_data imx51_imx_ssi_data[] __initconst = {
71#define imx51_imx_ssi_data_entry(_id, _hwid) \
72 imx_imx_ssi_data_entry(MX51, _id, _hwid, SZ_16K)
73 imx51_imx_ssi_data_entry(0, 1),
74 imx51_imx_ssi_data_entry(1, 2),
75 imx51_imx_ssi_data_entry(2, 3),
76};
77#endif /* ifdef CONFIG_SOC_IMX51 */
78
79#ifdef CONFIG_SOC_IMX53
80const struct imx_imx_ssi_data imx53_imx_ssi_data[] __initconst = {
81#define imx53_imx_ssi_data_entry(_id, _hwid) \
82 imx_imx_ssi_data_entry(MX53, _id, _hwid, SZ_16K)
83 imx53_imx_ssi_data_entry(0, 1),
84 imx53_imx_ssi_data_entry(1, 2),
85 imx53_imx_ssi_data_entry(2, 3),
86};
87#endif /* ifdef CONFIG_SOC_IMX53 */
88
89struct platform_device *__init imx_add_imx_ssi(
90 const struct imx_imx_ssi_data *data,
91 const struct imx_ssi_platform_data *pdata)
92{
93 struct resource res[] = {
94 {
95 .start = data->iobase,
96 .end = data->iobase + data->iosize - 1,
97 .flags = IORESOURCE_MEM,
98 }, {
99 .start = data->irq,
100 .end = data->irq,
101 .flags = IORESOURCE_IRQ,
102 },
103#define DMARES(_name) { \
104 .name = #_name, \
105 .start = data->dma ## _name, \
106 .end = data->dma ## _name, \
107 .flags = IORESOURCE_DMA, \
108}
109 DMARES(tx0),
110 DMARES(rx0),
111 DMARES(tx1),
112 DMARES(rx1),
113 };
114
115 return imx_add_platform_device("imx-ssi", data->id,
116 res, ARRAY_SIZE(res),
117 pdata, sizeof(*pdata));
118}
diff --git a/arch/arm/mach-imx/devices/platform-imx-uart.c b/arch/arm/mach-imx/devices/platform-imx-uart.c
new file mode 100644
index 000000000000..e6132f2b98e6
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx-uart.c
@@ -0,0 +1,178 @@
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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_imx_uart_3irq_data_entry(soc, _id, _hwid, _size) \
13 [_id] = { \
14 .id = _id, \
15 .iobase = soc ## _UART ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irqrx = soc ## _INT_UART ## _hwid ## RX, \
18 .irqtx = soc ## _INT_UART ## _hwid ## TX, \
19 .irqrts = soc ## _INT_UART ## _hwid ## RTS, \
20 }
21
22#define imx_imx_uart_1irq_data_entry(soc, _id, _hwid, _size) \
23 [_id] = { \
24 .id = _id, \
25 .iobase = soc ## _UART ## _hwid ## _BASE_ADDR, \
26 .iosize = _size, \
27 .irq = soc ## _INT_UART ## _hwid, \
28 }
29
30#ifdef CONFIG_SOC_IMX1
31const struct imx_imx_uart_3irq_data imx1_imx_uart_data[] __initconst = {
32#define imx1_imx_uart_data_entry(_id, _hwid) \
33 imx_imx_uart_3irq_data_entry(MX1, _id, _hwid, 0xd0)
34 imx1_imx_uart_data_entry(0, 1),
35 imx1_imx_uart_data_entry(1, 2),
36};
37#endif /* ifdef CONFIG_SOC_IMX1 */
38
39#ifdef CONFIG_SOC_IMX21
40const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst = {
41#define imx21_imx_uart_data_entry(_id, _hwid) \
42 imx_imx_uart_1irq_data_entry(MX21, _id, _hwid, SZ_4K)
43 imx21_imx_uart_data_entry(0, 1),
44 imx21_imx_uart_data_entry(1, 2),
45 imx21_imx_uart_data_entry(2, 3),
46 imx21_imx_uart_data_entry(3, 4),
47};
48#endif
49
50#ifdef CONFIG_SOC_IMX25
51const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst = {
52#define imx25_imx_uart_data_entry(_id, _hwid) \
53 imx_imx_uart_1irq_data_entry(MX25, _id, _hwid, SZ_16K)
54 imx25_imx_uart_data_entry(0, 1),
55 imx25_imx_uart_data_entry(1, 2),
56 imx25_imx_uart_data_entry(2, 3),
57 imx25_imx_uart_data_entry(3, 4),
58 imx25_imx_uart_data_entry(4, 5),
59};
60#endif /* ifdef CONFIG_SOC_IMX25 */
61
62#ifdef CONFIG_SOC_IMX27
63const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst = {
64#define imx27_imx_uart_data_entry(_id, _hwid) \
65 imx_imx_uart_1irq_data_entry(MX27, _id, _hwid, SZ_4K)
66 imx27_imx_uart_data_entry(0, 1),
67 imx27_imx_uart_data_entry(1, 2),
68 imx27_imx_uart_data_entry(2, 3),
69 imx27_imx_uart_data_entry(3, 4),
70 imx27_imx_uart_data_entry(4, 5),
71 imx27_imx_uart_data_entry(5, 6),
72};
73#endif /* ifdef CONFIG_SOC_IMX27 */
74
75#ifdef CONFIG_SOC_IMX31
76const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst = {
77#define imx31_imx_uart_data_entry(_id, _hwid) \
78 imx_imx_uart_1irq_data_entry(MX31, _id, _hwid, SZ_4K)
79 imx31_imx_uart_data_entry(0, 1),
80 imx31_imx_uart_data_entry(1, 2),
81 imx31_imx_uart_data_entry(2, 3),
82 imx31_imx_uart_data_entry(3, 4),
83 imx31_imx_uart_data_entry(4, 5),
84};
85#endif /* ifdef CONFIG_SOC_IMX31 */
86
87#ifdef CONFIG_SOC_IMX35
88const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst = {
89#define imx35_imx_uart_data_entry(_id, _hwid) \
90 imx_imx_uart_1irq_data_entry(MX35, _id, _hwid, SZ_16K)
91 imx35_imx_uart_data_entry(0, 1),
92 imx35_imx_uart_data_entry(1, 2),
93 imx35_imx_uart_data_entry(2, 3),
94};
95#endif /* ifdef CONFIG_SOC_IMX35 */
96
97#ifdef CONFIG_SOC_IMX50
98const struct imx_imx_uart_1irq_data imx50_imx_uart_data[] __initconst = {
99#define imx50_imx_uart_data_entry(_id, _hwid) \
100 imx_imx_uart_1irq_data_entry(MX50, _id, _hwid, SZ_4K)
101 imx50_imx_uart_data_entry(0, 1),
102 imx50_imx_uart_data_entry(1, 2),
103 imx50_imx_uart_data_entry(2, 3),
104 imx50_imx_uart_data_entry(3, 4),
105 imx50_imx_uart_data_entry(4, 5),
106};
107#endif /* ifdef CONFIG_SOC_IMX50 */
108
109#ifdef CONFIG_SOC_IMX51
110const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst = {
111#define imx51_imx_uart_data_entry(_id, _hwid) \
112 imx_imx_uart_1irq_data_entry(MX51, _id, _hwid, SZ_4K)
113 imx51_imx_uart_data_entry(0, 1),
114 imx51_imx_uart_data_entry(1, 2),
115 imx51_imx_uart_data_entry(2, 3),
116};
117#endif /* ifdef CONFIG_SOC_IMX51 */
118
119#ifdef CONFIG_SOC_IMX53
120const struct imx_imx_uart_1irq_data imx53_imx_uart_data[] __initconst = {
121#define imx53_imx_uart_data_entry(_id, _hwid) \
122 imx_imx_uart_1irq_data_entry(MX53, _id, _hwid, SZ_4K)
123 imx53_imx_uart_data_entry(0, 1),
124 imx53_imx_uart_data_entry(1, 2),
125 imx53_imx_uart_data_entry(2, 3),
126 imx53_imx_uart_data_entry(3, 4),
127 imx53_imx_uart_data_entry(4, 5),
128};
129#endif /* ifdef CONFIG_SOC_IMX53 */
130
131struct platform_device *__init imx_add_imx_uart_3irq(
132 const struct imx_imx_uart_3irq_data *data,
133 const struct imxuart_platform_data *pdata)
134{
135 struct resource res[] = {
136 {
137 .start = data->iobase,
138 .end = data->iobase + data->iosize - 1,
139 .flags = IORESOURCE_MEM,
140 }, {
141 .start = data->irqrx,
142 .end = data->irqrx,
143 .flags = IORESOURCE_IRQ,
144 }, {
145 .start = data->irqtx,
146 .end = data->irqtx,
147 .flags = IORESOURCE_IRQ,
148 }, {
149 .start = data->irqrts,
150 .end = data->irqrx,
151 .flags = IORESOURCE_IRQ,
152 },
153 };
154
155 return imx_add_platform_device("imx1-uart", data->id, res,
156 ARRAY_SIZE(res), pdata, sizeof(*pdata));
157}
158
159struct platform_device *__init imx_add_imx_uart_1irq(
160 const struct imx_imx_uart_1irq_data *data,
161 const struct imxuart_platform_data *pdata)
162{
163 struct resource res[] = {
164 {
165 .start = data->iobase,
166 .end = data->iobase + data->iosize - 1,
167 .flags = IORESOURCE_MEM,
168 }, {
169 .start = data->irq,
170 .end = data->irq,
171 .flags = IORESOURCE_IRQ,
172 },
173 };
174
175 /* i.mx21 type uart runs on all i.mx except i.mx1 */
176 return imx_add_platform_device("imx21-uart", data->id,
177 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
178}
diff --git a/arch/arm/mach-imx/devices/platform-imx2-wdt.c b/arch/arm/mach-imx/devices/platform-imx2-wdt.c
new file mode 100644
index 000000000000..729c1914e221
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx2-wdt.c
@@ -0,0 +1,77 @@
1/*
2 * Copyright (C) 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 <asm/sizes.h>
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#define imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size) \
14 { \
15 .id = _id, \
16 .iobase = soc ## _WDOG ## _hwid ## _BASE_ADDR, \
17 .iosize = _size, \
18 }
19#define imx_imx2_wdt_data_entry(soc, _id, _hwid, _size) \
20 [_id] = imx_imx2_wdt_data_entry_single(soc, _id, _hwid, _size)
21
22#ifdef CONFIG_SOC_IMX21
23const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
24 imx_imx2_wdt_data_entry_single(MX21, 0, , SZ_4K);
25#endif /* ifdef CONFIG_SOC_IMX21 */
26
27#ifdef CONFIG_SOC_IMX25
28const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst =
29 imx_imx2_wdt_data_entry_single(MX25, 0, , SZ_16K);
30#endif /* ifdef CONFIG_SOC_IMX25 */
31
32#ifdef CONFIG_SOC_IMX27
33const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
34 imx_imx2_wdt_data_entry_single(MX27, 0, , SZ_4K);
35#endif /* ifdef CONFIG_SOC_IMX27 */
36
37#ifdef CONFIG_SOC_IMX31
38const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst =
39 imx_imx2_wdt_data_entry_single(MX31, 0, , SZ_16K);
40#endif /* ifdef CONFIG_SOC_IMX31 */
41
42#ifdef CONFIG_SOC_IMX35
43const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst =
44 imx_imx2_wdt_data_entry_single(MX35, 0, , SZ_16K);
45#endif /* ifdef CONFIG_SOC_IMX35 */
46
47#ifdef CONFIG_SOC_IMX51
48const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst = {
49#define imx51_imx2_wdt_data_entry(_id, _hwid) \
50 imx_imx2_wdt_data_entry(MX51, _id, _hwid, SZ_16K)
51 imx51_imx2_wdt_data_entry(0, 1),
52 imx51_imx2_wdt_data_entry(1, 2),
53};
54#endif /* ifdef CONFIG_SOC_IMX51 */
55
56#ifdef CONFIG_SOC_IMX53
57const struct imx_imx2_wdt_data imx53_imx2_wdt_data[] __initconst = {
58#define imx53_imx2_wdt_data_entry(_id, _hwid) \
59 imx_imx2_wdt_data_entry(MX53, _id, _hwid, SZ_16K)
60 imx53_imx2_wdt_data_entry(0, 1),
61 imx53_imx2_wdt_data_entry(1, 2),
62};
63#endif /* ifdef CONFIG_SOC_IMX53 */
64
65struct platform_device *__init imx_add_imx2_wdt(
66 const struct imx_imx2_wdt_data *data)
67{
68 struct resource res[] = {
69 {
70 .start = data->iobase,
71 .end = data->iobase + data->iosize - 1,
72 .flags = IORESOURCE_MEM,
73 },
74 };
75 return imx_add_platform_device("imx2-wdt", data->id,
76 res, ARRAY_SIZE(res), NULL, 0);
77}
diff --git a/arch/arm/mach-imx/devices/platform-imx21-hcd.c b/arch/arm/mach-imx/devices/platform-imx21-hcd.c
new file mode 100644
index 000000000000..18b9963f6079
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx21-hcd.c
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_imx21_hcd_data_entry_single(soc) \
13 { \
14 .iobase = soc ## _USBOTG_BASE_ADDR, \
15 .irq = soc ## _INT_USBHOST, \
16 }
17
18#ifdef CONFIG_SOC_IMX21
19const struct imx_imx21_hcd_data imx21_imx21_hcd_data __initconst =
20 imx_imx21_hcd_data_entry_single(MX21);
21#endif /* ifdef CONFIG_SOC_IMX21 */
22
23struct platform_device *__init imx_add_imx21_hcd(
24 const struct imx_imx21_hcd_data *data,
25 const struct mx21_usbh_platform_data *pdata)
26{
27 struct resource res[] = {
28 {
29 .start = data->iobase,
30 .end = data->iobase + SZ_8K - 1,
31 .flags = IORESOURCE_MEM,
32 }, {
33 .start = data->irq,
34 .end = data->irq,
35 .flags = IORESOURCE_IRQ,
36 },
37 };
38 return imx_add_platform_device_dmamask("imx21-hcd", 0,
39 res, ARRAY_SIZE(res),
40 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
41}
diff --git a/arch/arm/mach-imx/devices/platform-imx27-coda.c b/arch/arm/mach-imx/devices/platform-imx27-coda.c
new file mode 100644
index 000000000000..54996038e754
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx27-coda.c
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2012 Vista Silicon
3 * Javier Martin <javier.martin@vista-silicon.com>
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
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#ifdef CONFIG_SOC_IMX27
14const struct imx_imx27_coda_data imx27_coda_data __initconst = {
15 .iobase = MX27_VPU_BASE_ADDR,
16 .iosize = SZ_512,
17 .irq = MX27_INT_VPU,
18};
19#endif
20
21struct platform_device *__init imx_add_imx27_coda(
22 const struct imx_imx27_coda_data *data)
23{
24 struct resource res[] = {
25 {
26 .start = data->iobase,
27 .end = data->iobase + data->iosize - 1,
28 .flags = IORESOURCE_MEM,
29 }, {
30 .start = data->irq,
31 .end = data->irq,
32 .flags = IORESOURCE_IRQ,
33 },
34 };
35 return imx_add_platform_device_dmamask("coda-imx27", 0, res, 2, NULL,
36 0, DMA_BIT_MASK(32));
37}
diff --git a/arch/arm/mach-imx/devices/platform-imx_udc.c b/arch/arm/mach-imx/devices/platform-imx_udc.c
new file mode 100644
index 000000000000..75aee0bf034d
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imx_udc.c
@@ -0,0 +1,75 @@
1/*
2 * Copyright (C) 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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_imx_udc_data_entry_single(soc, _size) \
13 { \
14 .iobase = soc ## _USBD_BASE_ADDR, \
15 .iosize = _size, \
16 .irq0 = soc ## _INT_USBD0, \
17 .irq1 = soc ## _INT_USBD1, \
18 .irq2 = soc ## _INT_USBD2, \
19 .irq3 = soc ## _INT_USBD3, \
20 .irq4 = soc ## _INT_USBD4, \
21 .irq5 = soc ## _INT_USBD5, \
22 .irq6 = soc ## _INT_USBD6, \
23 }
24
25#define imx_imx_udc_data_entry(soc, _size) \
26 [_id] = imx_imx_udc_data_entry_single(soc, _size)
27
28#ifdef CONFIG_SOC_IMX1
29const struct imx_imx_udc_data imx1_imx_udc_data __initconst =
30 imx_imx_udc_data_entry_single(MX1, SZ_4K);
31#endif /* ifdef CONFIG_SOC_IMX1 */
32
33struct platform_device *__init imx_add_imx_udc(
34 const struct imx_imx_udc_data *data,
35 const struct imxusb_platform_data *pdata)
36{
37 struct resource res[] = {
38 {
39 .start = data->iobase,
40 .end = data->iobase + data->iosize - 1,
41 .flags = IORESOURCE_MEM,
42 }, {
43 .start = data->irq0,
44 .end = data->irq0,
45 .flags = IORESOURCE_IRQ,
46 }, {
47 .start = data->irq1,
48 .end = data->irq1,
49 .flags = IORESOURCE_IRQ,
50 }, {
51 .start = data->irq2,
52 .end = data->irq2,
53 .flags = IORESOURCE_IRQ,
54 }, {
55 .start = data->irq3,
56 .end = data->irq3,
57 .flags = IORESOURCE_IRQ,
58 }, {
59 .start = data->irq4,
60 .end = data->irq4,
61 .flags = IORESOURCE_IRQ,
62 }, {
63 .start = data->irq5,
64 .end = data->irq5,
65 .flags = IORESOURCE_IRQ,
66 }, {
67 .start = data->irq6,
68 .end = data->irq6,
69 .flags = IORESOURCE_IRQ,
70 },
71 };
72
73 return imx_add_platform_device("imx_udc", 0,
74 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
75}
diff --git a/arch/arm/mach-imx/devices/platform-imxdi_rtc.c b/arch/arm/mach-imx/devices/platform-imxdi_rtc.c
new file mode 100644
index 000000000000..e4b22eb5950e
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-imxdi_rtc.c
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 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 <asm/sizes.h>
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#define imx_imxdi_rtc_data_entry_single(soc) \
14 { \
15 .iobase = soc ## _DRYICE_BASE_ADDR, \
16 .irq = soc ## _INT_DRYICE, \
17 }
18
19#ifdef CONFIG_SOC_IMX25
20const struct imx_imxdi_rtc_data imx25_imxdi_rtc_data __initconst =
21 imx_imxdi_rtc_data_entry_single(MX25);
22#endif /* ifdef CONFIG_SOC_IMX25 */
23
24struct platform_device *__init imx_add_imxdi_rtc(
25 const struct imx_imxdi_rtc_data *data)
26{
27 struct resource res[] = {
28 {
29 .start = data->iobase,
30 .end = data->iobase + SZ_16K - 1,
31 .flags = IORESOURCE_MEM,
32 }, {
33 .start = data->irq,
34 .end = data->irq,
35 .flags = IORESOURCE_IRQ,
36 },
37 };
38
39 return imx_add_platform_device("imxdi_rtc", 0,
40 res, ARRAY_SIZE(res), NULL, 0);
41}
diff --git a/arch/arm/mach-imx/devices/platform-ipu-core.c b/arch/arm/mach-imx/devices/platform-ipu-core.c
new file mode 100644
index 000000000000..dc0e8370caef
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-ipu-core.c
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2011 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/dma-mapping.h>
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#define imx_ipu_core_entry_single(soc) \
14{ \
15 .iobase = soc ## _IPU_CTRL_BASE_ADDR, \
16 .synirq = soc ## _INT_IPU_SYN, \
17 .errirq = soc ## _INT_IPU_ERR, \
18}
19
20#ifdef CONFIG_SOC_IMX31
21const struct imx_ipu_core_data imx31_ipu_core_data __initconst =
22 imx_ipu_core_entry_single(MX31);
23#endif
24
25#ifdef CONFIG_SOC_IMX35
26const struct imx_ipu_core_data imx35_ipu_core_data __initconst =
27 imx_ipu_core_entry_single(MX35);
28#endif
29
30static struct platform_device *imx_ipu_coredev __initdata;
31
32struct platform_device *__init imx_add_ipu_core(
33 const struct imx_ipu_core_data *data)
34{
35 /* The resource order is important! */
36 struct resource res[] = {
37 {
38 .start = data->iobase,
39 .end = data->iobase + 0x5f,
40 .flags = IORESOURCE_MEM,
41 }, {
42 .start = data->iobase + 0x88,
43 .end = data->iobase + 0xb3,
44 .flags = IORESOURCE_MEM,
45 }, {
46 .start = data->synirq,
47 .end = data->synirq,
48 .flags = IORESOURCE_IRQ,
49 }, {
50 .start = data->errirq,
51 .end = data->errirq,
52 .flags = IORESOURCE_IRQ,
53 },
54 };
55
56 return imx_ipu_coredev = imx_add_platform_device("ipu-core", -1,
57 res, ARRAY_SIZE(res), NULL, 0);
58}
59
60struct platform_device *__init imx_alloc_mx3_camera(
61 const struct imx_ipu_core_data *data,
62 const struct mx3_camera_pdata *pdata)
63{
64 struct resource res[] = {
65 {
66 .start = data->iobase + 0x60,
67 .end = data->iobase + 0x87,
68 .flags = IORESOURCE_MEM,
69 },
70 };
71 int ret = -ENOMEM;
72 struct platform_device *pdev;
73
74 if (IS_ERR_OR_NULL(imx_ipu_coredev))
75 return ERR_PTR(-ENODEV);
76
77 pdev = platform_device_alloc("mx3-camera", 0);
78 if (!pdev)
79 goto err;
80
81 pdev->dev.dma_mask = kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
82 if (!pdev->dev.dma_mask)
83 goto err;
84
85 *pdev->dev.dma_mask = DMA_BIT_MASK(32);
86 pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
87
88 ret = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
89 if (ret)
90 goto err;
91
92 if (pdata) {
93 struct mx3_camera_pdata *copied_pdata;
94
95 ret = platform_device_add_data(pdev, pdata, sizeof(*pdata));
96 if (ret) {
97err:
98 kfree(pdev->dev.dma_mask);
99 platform_device_put(pdev);
100 return ERR_PTR(-ENODEV);
101 }
102 copied_pdata = dev_get_platdata(&pdev->dev);
103 copied_pdata->dma_dev = &imx_ipu_coredev->dev;
104 }
105
106 return pdev;
107}
108
109struct platform_device *__init imx_add_mx3_sdc_fb(
110 const struct imx_ipu_core_data *data,
111 struct mx3fb_platform_data *pdata)
112{
113 struct resource res[] = {
114 {
115 .start = data->iobase + 0xb4,
116 .end = data->iobase + 0x1bf,
117 .flags = IORESOURCE_MEM,
118 },
119 };
120
121 if (IS_ERR_OR_NULL(imx_ipu_coredev))
122 return ERR_PTR(-ENODEV);
123
124 pdata->dma_dev = &imx_ipu_coredev->dev;
125
126 return imx_add_platform_device_dmamask("mx3_sdc_fb", -1,
127 res, ARRAY_SIZE(res), pdata, sizeof(*pdata),
128 DMA_BIT_MASK(32));
129}
diff --git a/arch/arm/mach-imx/devices/platform-mx1-camera.c b/arch/arm/mach-imx/devices/platform-mx1-camera.c
new file mode 100644
index 000000000000..756b0e659b2d
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mx1-camera.c
@@ -0,0 +1,42 @@
1/*
2 * Copyright (C) 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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_mx1_camera_data_entry_single(soc, _size) \
13 { \
14 .iobase = soc ## _CSI ## _BASE_ADDR, \
15 .iosize = _size, \
16 .irq = soc ## _INT_CSI, \
17 }
18
19#ifdef CONFIG_SOC_IMX1
20const struct imx_mx1_camera_data imx1_mx1_camera_data __initconst =
21 imx_mx1_camera_data_entry_single(MX1, 10);
22#endif /* ifdef CONFIG_SOC_IMX1 */
23
24struct platform_device *__init imx_add_mx1_camera(
25 const struct imx_mx1_camera_data *data,
26 const struct mx1_camera_pdata *pdata)
27{
28 struct resource res[] = {
29 {
30 .start = data->iobase,
31 .end = data->iobase + data->iosize - 1,
32 .flags = IORESOURCE_MEM,
33 }, {
34 .start = data->irq,
35 .end = data->irq,
36 .flags = IORESOURCE_IRQ,
37 },
38 };
39 return imx_add_platform_device_dmamask("mx1-camera", 0,
40 res, ARRAY_SIZE(res),
41 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
42}
diff --git a/arch/arm/mach-imx/devices/platform-mx2-camera.c b/arch/arm/mach-imx/devices/platform-mx2-camera.c
new file mode 100644
index 000000000000..9ad5b2d97054
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mx2-camera.c
@@ -0,0 +1,82 @@
1/*
2 * Copyright (C) 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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_mx2_camera_data_entry_single(soc) \
13 { \
14 .iobasecsi = soc ## _CSI_BASE_ADDR, \
15 .iosizecsi = SZ_4K, \
16 .irqcsi = soc ## _INT_CSI, \
17 }
18#define imx_mx2_camera_data_entry_single_emma(soc) \
19 { \
20 .iobasecsi = soc ## _CSI_BASE_ADDR, \
21 .iosizecsi = SZ_32, \
22 .irqcsi = soc ## _INT_CSI, \
23 .iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR, \
24 .iosizeemmaprp = SZ_32, \
25 .irqemmaprp = soc ## _INT_EMMAPRP, \
26 }
27
28#ifdef CONFIG_SOC_IMX25
29const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst =
30 imx_mx2_camera_data_entry_single(MX25);
31#endif /* ifdef CONFIG_SOC_IMX25 */
32
33#ifdef CONFIG_SOC_IMX27
34const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst =
35 imx_mx2_camera_data_entry_single_emma(MX27);
36#endif /* ifdef CONFIG_SOC_IMX27 */
37
38struct platform_device *__init imx_add_mx2_camera(
39 const struct imx_mx2_camera_data *data,
40 const struct mx2_camera_platform_data *pdata)
41{
42 struct resource res[] = {
43 {
44 .start = data->iobasecsi,
45 .end = data->iobasecsi + data->iosizecsi - 1,
46 .flags = IORESOURCE_MEM,
47 }, {
48 .start = data->irqcsi,
49 .end = data->irqcsi,
50 .flags = IORESOURCE_IRQ,
51 }, {
52 .start = data->iobaseemmaprp,
53 .end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
54 .flags = IORESOURCE_MEM,
55 }, {
56 .start = data->irqemmaprp,
57 .end = data->irqemmaprp,
58 .flags = IORESOURCE_IRQ,
59 },
60 };
61 return imx_add_platform_device_dmamask("mx2-camera", 0,
62 res, data->iobaseemmaprp ? 4 : 2,
63 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
64}
65
66struct platform_device *__init imx_add_mx2_emmaprp(
67 const struct imx_mx2_camera_data *data)
68{
69 struct resource res[] = {
70 {
71 .start = data->iobaseemmaprp,
72 .end = data->iobaseemmaprp + data->iosizeemmaprp - 1,
73 .flags = IORESOURCE_MEM,
74 }, {
75 .start = data->irqemmaprp,
76 .end = data->irqemmaprp,
77 .flags = IORESOURCE_IRQ,
78 },
79 };
80 return imx_add_platform_device_dmamask("m2m-emmaprp", 0,
81 res, 2, NULL, 0, DMA_BIT_MASK(32));
82}
diff --git a/arch/arm/mach-imx/devices/platform-mxc-ehci.c b/arch/arm/mach-imx/devices/platform-mxc-ehci.c
new file mode 100644
index 000000000000..27c81713a645
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mxc-ehci.c
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 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/dma-mapping.h>
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#define imx_mxc_ehci_data_entry_single(soc, _id, hs) \
14 { \
15 .id = _id, \
16 .iobase = soc ## _USB_ ## hs ## _BASE_ADDR, \
17 .irq = soc ## _INT_USB_ ## hs, \
18 }
19
20#ifdef CONFIG_SOC_IMX25
21const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst =
22 imx_mxc_ehci_data_entry_single(MX25, 0, OTG);
23const struct imx_mxc_ehci_data imx25_mxc_ehci_hs_data __initconst =
24 imx_mxc_ehci_data_entry_single(MX25, 1, HS);
25#endif /* ifdef CONFIG_SOC_IMX25 */
26
27#ifdef CONFIG_SOC_IMX27
28const struct imx_mxc_ehci_data imx27_mxc_ehci_otg_data __initconst =
29 imx_mxc_ehci_data_entry_single(MX27, 0, OTG);
30const struct imx_mxc_ehci_data imx27_mxc_ehci_hs_data[] __initconst = {
31 imx_mxc_ehci_data_entry_single(MX27, 1, HS1),
32 imx_mxc_ehci_data_entry_single(MX27, 2, HS2),
33};
34#endif /* ifdef CONFIG_SOC_IMX27 */
35
36#ifdef CONFIG_SOC_IMX31
37const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data __initconst =
38 imx_mxc_ehci_data_entry_single(MX31, 0, OTG);
39const struct imx_mxc_ehci_data imx31_mxc_ehci_hs_data[] __initconst = {
40 imx_mxc_ehci_data_entry_single(MX31, 1, HS1),
41 imx_mxc_ehci_data_entry_single(MX31, 2, HS2),
42};
43#endif /* ifdef CONFIG_SOC_IMX31 */
44
45#ifdef CONFIG_SOC_IMX35
46const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data __initconst =
47 imx_mxc_ehci_data_entry_single(MX35, 0, OTG);
48const struct imx_mxc_ehci_data imx35_mxc_ehci_hs_data __initconst =
49 imx_mxc_ehci_data_entry_single(MX35, 1, HS);
50#endif /* ifdef CONFIG_SOC_IMX35 */
51
52#ifdef CONFIG_SOC_IMX51
53const struct imx_mxc_ehci_data imx51_mxc_ehci_otg_data __initconst =
54 imx_mxc_ehci_data_entry_single(MX51, 0, OTG);
55const struct imx_mxc_ehci_data imx51_mxc_ehci_hs_data[] __initconst = {
56 imx_mxc_ehci_data_entry_single(MX51, 1, HS1),
57 imx_mxc_ehci_data_entry_single(MX51, 2, HS2),
58};
59#endif /* ifdef CONFIG_SOC_IMX51 */
60
61struct platform_device *__init imx_add_mxc_ehci(
62 const struct imx_mxc_ehci_data *data,
63 const struct mxc_usbh_platform_data *pdata)
64{
65 struct resource res[] = {
66 {
67 .start = data->iobase,
68 .end = data->iobase + SZ_512 - 1,
69 .flags = IORESOURCE_MEM,
70 }, {
71 .start = data->irq,
72 .end = data->irq,
73 .flags = IORESOURCE_IRQ,
74 },
75 };
76 return imx_add_platform_device_dmamask("mxc-ehci", data->id,
77 res, ARRAY_SIZE(res),
78 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
79}
diff --git a/arch/arm/mach-imx/devices/platform-mxc-mmc.c b/arch/arm/mach-imx/devices/platform-mxc-mmc.c
new file mode 100644
index 000000000000..ce90ab0c22fc
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mxc-mmc.c
@@ -0,0 +1,73 @@
1/*
2 * Copyright (C) 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/dma-mapping.h>
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#define imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size) \
14 { \
15 .id = _id, \
16 .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \
17 .iosize = _size, \
18 .irq = soc ## _INT_SDHC ## _hwid, \
19 .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \
20 }
21#define imx_mxc_mmc_data_entry(soc, _id, _hwid, _size) \
22 [_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size)
23
24#ifdef CONFIG_SOC_IMX21
25const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
26#define imx21_mxc_mmc_data_entry(_id, _hwid) \
27 imx_mxc_mmc_data_entry(MX21, _id, _hwid, SZ_4K)
28 imx21_mxc_mmc_data_entry(0, 1),
29 imx21_mxc_mmc_data_entry(1, 2),
30};
31#endif /* ifdef CONFIG_SOC_IMX21 */
32
33#ifdef CONFIG_SOC_IMX27
34const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
35#define imx27_mxc_mmc_data_entry(_id, _hwid) \
36 imx_mxc_mmc_data_entry(MX27, _id, _hwid, SZ_4K)
37 imx27_mxc_mmc_data_entry(0, 1),
38 imx27_mxc_mmc_data_entry(1, 2),
39};
40#endif /* ifdef CONFIG_SOC_IMX27 */
41
42#ifdef CONFIG_SOC_IMX31
43const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = {
44#define imx31_mxc_mmc_data_entry(_id, _hwid) \
45 imx_mxc_mmc_data_entry(MX31, _id, _hwid, SZ_16K)
46 imx31_mxc_mmc_data_entry(0, 1),
47 imx31_mxc_mmc_data_entry(1, 2),
48};
49#endif /* ifdef CONFIG_SOC_IMX31 */
50
51struct platform_device *__init imx_add_mxc_mmc(
52 const struct imx_mxc_mmc_data *data,
53 const struct imxmmc_platform_data *pdata)
54{
55 struct resource res[] = {
56 {
57 .start = data->iobase,
58 .end = data->iobase + SZ_4K - 1,
59 .flags = IORESOURCE_MEM,
60 }, {
61 .start = data->irq,
62 .end = data->irq,
63 .flags = IORESOURCE_IRQ,
64 }, {
65 .start = data->dmareq,
66 .end = data->dmareq,
67 .flags = IORESOURCE_DMA,
68 },
69 };
70 return imx_add_platform_device_dmamask("mxc-mmc", data->id,
71 res, ARRAY_SIZE(res),
72 pdata, sizeof(*pdata), DMA_BIT_MASK(32));
73}
diff --git a/arch/arm/mach-imx/devices/platform-mxc_nand.c b/arch/arm/mach-imx/devices/platform-mxc_nand.c
new file mode 100644
index 000000000000..54b1d02cc27b
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mxc_nand.c
@@ -0,0 +1,82 @@
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 <asm/sizes.h>
10#include <mach/hardware.h>
11#include "devices-common.h"
12
13#define imx_mxc_nand_data_entry_single(soc, _size) \
14 { \
15 .iobase = soc ## _NFC_BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_NFC \
18 }
19
20#define imx_mxc_nandv3_data_entry_single(soc, _size) \
21 { \
22 .id = -1, \
23 .iobase = soc ## _NFC_BASE_ADDR, \
24 .iosize = _size, \
25 .axibase = soc ## _NFC_AXI_BASE_ADDR, \
26 .irq = soc ## _INT_NFC \
27 }
28
29#ifdef CONFIG_SOC_IMX21
30const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
31 imx_mxc_nand_data_entry_single(MX21, SZ_4K);
32#endif /* ifdef CONFIG_SOC_IMX21 */
33
34#ifdef CONFIG_SOC_IMX25
35const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
36 imx_mxc_nand_data_entry_single(MX25, SZ_8K);
37#endif /* ifdef CONFIG_SOC_IMX25 */
38
39#ifdef CONFIG_SOC_IMX27
40const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
41 imx_mxc_nand_data_entry_single(MX27, SZ_4K);
42#endif /* ifdef CONFIG_SOC_IMX27 */
43
44#ifdef CONFIG_SOC_IMX31
45const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
46 imx_mxc_nand_data_entry_single(MX31, SZ_4K);
47#endif
48
49#ifdef CONFIG_SOC_IMX35
50const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
51 imx_mxc_nand_data_entry_single(MX35, SZ_8K);
52#endif
53
54#ifdef CONFIG_SOC_IMX51
55const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
56 imx_mxc_nandv3_data_entry_single(MX51, SZ_16K);
57#endif
58
59struct platform_device *__init imx_add_mxc_nand(
60 const struct imx_mxc_nand_data *data,
61 const struct mxc_nand_platform_data *pdata)
62{
63 /* AXI has to come first, that's how the mxc_nand driver expect it */
64 struct resource res[] = {
65 {
66 .start = data->iobase,
67 .end = data->iobase + data->iosize - 1,
68 .flags = IORESOURCE_MEM,
69 }, {
70 .start = data->irq,
71 .end = data->irq,
72 .flags = IORESOURCE_IRQ,
73 }, {
74 .start = data->axibase,
75 .end = data->axibase + SZ_16K - 1,
76 .flags = IORESOURCE_MEM,
77 },
78 };
79 return imx_add_platform_device("mxc_nand", data->id,
80 res, ARRAY_SIZE(res) - !data->axibase,
81 pdata, sizeof(*pdata));
82}
diff --git a/arch/arm/mach-imx/devices/platform-mxc_pwm.c b/arch/arm/mach-imx/devices/platform-mxc_pwm.c
new file mode 100644
index 000000000000..a0551bfff550
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mxc_pwm.c
@@ -0,0 +1,69 @@
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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size) \
13 { \
14 .id = _id, \
15 .iobase = soc ## _PWM ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_PWM ## _hwid, \
18 }
19#define imx_mxc_pwm_data_entry(soc, _id, _hwid, _size) \
20 [_id] = imx_mxc_pwm_data_entry_single(soc, _id, _hwid, _size)
21
22#ifdef CONFIG_SOC_IMX21
23const struct imx_mxc_pwm_data imx21_mxc_pwm_data __initconst =
24 imx_mxc_pwm_data_entry_single(MX21, 0, , SZ_4K);
25#endif /* ifdef CONFIG_SOC_IMX21 */
26
27#ifdef CONFIG_SOC_IMX25
28const struct imx_mxc_pwm_data imx25_mxc_pwm_data[] __initconst = {
29#define imx25_mxc_pwm_data_entry(_id, _hwid) \
30 imx_mxc_pwm_data_entry(MX25, _id, _hwid, SZ_16K)
31 imx25_mxc_pwm_data_entry(0, 1),
32 imx25_mxc_pwm_data_entry(1, 2),
33 imx25_mxc_pwm_data_entry(2, 3),
34 imx25_mxc_pwm_data_entry(3, 4),
35};
36#endif /* ifdef CONFIG_SOC_IMX25 */
37
38#ifdef CONFIG_SOC_IMX27
39const struct imx_mxc_pwm_data imx27_mxc_pwm_data __initconst =
40 imx_mxc_pwm_data_entry_single(MX27, 0, , SZ_4K);
41#endif /* ifdef CONFIG_SOC_IMX27 */
42
43#ifdef CONFIG_SOC_IMX51
44const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst = {
45#define imx51_mxc_pwm_data_entry(_id, _hwid) \
46 imx_mxc_pwm_data_entry(MX51, _id, _hwid, SZ_16K)
47 imx51_mxc_pwm_data_entry(0, 1),
48 imx51_mxc_pwm_data_entry(1, 2),
49};
50#endif /* ifdef CONFIG_SOC_IMX51 */
51
52struct platform_device *__init imx_add_mxc_pwm(
53 const struct imx_mxc_pwm_data *data)
54{
55 struct resource res[] = {
56 {
57 .start = data->iobase,
58 .end = data->iobase + data->iosize - 1,
59 .flags = IORESOURCE_MEM,
60 }, {
61 .start = data->irq,
62 .end = data->irq,
63 .flags = IORESOURCE_IRQ,
64 },
65 };
66
67 return imx_add_platform_device("mxc_pwm", data->id,
68 res, ARRAY_SIZE(res), NULL, 0);
69}
diff --git a/arch/arm/mach-imx/devices/platform-mxc_rnga.c b/arch/arm/mach-imx/devices/platform-mxc_rnga.c
new file mode 100644
index 000000000000..37bb23caa9d8
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mxc_rnga.c
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 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 <mach/hardware.h>
10#include "devices-common.h"
11
12struct imx_mxc_rnga_data {
13 resource_size_t iobase;
14};
15
16#define imx_mxc_rnga_data_entry_single(soc) \
17 { \
18 .iobase = soc ## _RNGA_BASE_ADDR, \
19 }
20
21#ifdef CONFIG_SOC_IMX31
22static const struct imx_mxc_rnga_data imx31_mxc_rnga_data __initconst =
23 imx_mxc_rnga_data_entry_single(MX31);
24#endif /* ifdef CONFIG_SOC_IMX31 */
25
26static struct platform_device *__init imx_add_mxc_rnga(
27 const struct imx_mxc_rnga_data *data)
28{
29 struct resource res[] = {
30 {
31 .start = data->iobase,
32 .end = data->iobase + SZ_16K - 1,
33 .flags = IORESOURCE_MEM,
34 },
35 };
36 return imx_add_platform_device("mxc_rnga", -1,
37 res, ARRAY_SIZE(res), NULL, 0);
38}
39
40static int __init imxXX_add_mxc_rnga(void)
41{
42 struct platform_device *ret;
43
44#if defined(CONFIG_SOC_IMX31)
45 if (cpu_is_mx31())
46 ret = imx_add_mxc_rnga(&imx31_mxc_rnga_data);
47 else
48#endif /* if defined(CONFIG_SOC_IMX31) */
49 ret = ERR_PTR(-ENODEV);
50
51 if (IS_ERR(ret))
52 return PTR_ERR(ret);
53
54 return 0;
55}
56arch_initcall(imxXX_add_mxc_rnga);
diff --git a/arch/arm/mach-imx/devices/platform-mxc_rtc.c b/arch/arm/mach-imx/devices/platform-mxc_rtc.c
new file mode 100644
index 000000000000..daaf9795db18
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mxc_rtc.c
@@ -0,0 +1,45 @@
1/*
2 * Copyright (C) 2010-2011 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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_mxc_rtc_data_entry_single(soc) \
13 { \
14 .iobase = soc ## _RTC_BASE_ADDR, \
15 .irq = soc ## _INT_RTC, \
16 }
17
18#ifdef CONFIG_SOC_IMX31
19const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst =
20 imx_mxc_rtc_data_entry_single(MX31);
21#endif /* ifdef CONFIG_SOC_IMX31 */
22
23#ifdef CONFIG_SOC_IMX35
24const struct imx_mxc_rtc_data imx35_mxc_rtc_data __initconst =
25 imx_mxc_rtc_data_entry_single(MX35);
26#endif /* ifdef CONFIG_SOC_IMX35 */
27
28struct platform_device *__init imx_add_mxc_rtc(
29 const struct imx_mxc_rtc_data *data)
30{
31 struct resource res[] = {
32 {
33 .start = data->iobase,
34 .end = data->iobase + SZ_16K - 1,
35 .flags = IORESOURCE_MEM,
36 }, {
37 .start = data->irq,
38 .end = data->irq,
39 .flags = IORESOURCE_IRQ,
40 },
41 };
42
43 return imx_add_platform_device("mxc_rtc", -1,
44 res, ARRAY_SIZE(res), NULL, 0);
45}
diff --git a/arch/arm/mach-imx/devices/platform-mxc_w1.c b/arch/arm/mach-imx/devices/platform-mxc_w1.c
new file mode 100644
index 000000000000..5f972c669567
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-mxc_w1.c
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_mxc_w1_data_entry_single(soc) \
13 { \
14 .iobase = soc ## _OWIRE_BASE_ADDR, \
15 }
16
17#ifdef CONFIG_SOC_IMX21
18const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst =
19 imx_mxc_w1_data_entry_single(MX21);
20#endif /* ifdef CONFIG_SOC_IMX21 */
21
22#ifdef CONFIG_SOC_IMX27
23const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst =
24 imx_mxc_w1_data_entry_single(MX27);
25#endif /* ifdef CONFIG_SOC_IMX27 */
26
27#ifdef CONFIG_SOC_IMX31
28const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst =
29 imx_mxc_w1_data_entry_single(MX31);
30#endif /* ifdef CONFIG_SOC_IMX31 */
31
32#ifdef CONFIG_SOC_IMX35
33const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst =
34 imx_mxc_w1_data_entry_single(MX35);
35#endif /* ifdef CONFIG_SOC_IMX35 */
36
37struct platform_device *__init imx_add_mxc_w1(
38 const struct imx_mxc_w1_data *data)
39{
40 struct resource res[] = {
41 {
42 .start = data->iobase,
43 .end = data->iobase + SZ_4K - 1,
44 .flags = IORESOURCE_MEM,
45 },
46 };
47
48 return imx_add_platform_device("mxc_w1", 0,
49 res, ARRAY_SIZE(res), NULL, 0);
50}
diff --git a/arch/arm/mach-imx/devices/platform-pata_imx.c b/arch/arm/mach-imx/devices/platform-pata_imx.c
new file mode 100644
index 000000000000..3627ec8d8a97
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-pata_imx.c
@@ -0,0 +1,59 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it under
3 * the terms of the GNU General Public License version 2 as published by the
4 * Free Software Foundation.
5 */
6#include <mach/hardware.h>
7#include "devices-common.h"
8
9#define imx_pata_imx_data_entry_single(soc, _size) \
10 { \
11 .iobase = soc ## _ATA_BASE_ADDR, \
12 .iosize = _size, \
13 .irq = soc ## _INT_ATA, \
14 }
15
16#ifdef CONFIG_SOC_IMX27
17const struct imx_pata_imx_data imx27_pata_imx_data __initconst =
18 imx_pata_imx_data_entry_single(MX27, SZ_4K);
19#endif /* ifdef CONFIG_SOC_IMX27 */
20
21#ifdef CONFIG_SOC_IMX31
22const struct imx_pata_imx_data imx31_pata_imx_data __initconst =
23 imx_pata_imx_data_entry_single(MX31, SZ_16K);
24#endif /* ifdef CONFIG_SOC_IMX31 */
25
26#ifdef CONFIG_SOC_IMX35
27const struct imx_pata_imx_data imx35_pata_imx_data __initconst =
28 imx_pata_imx_data_entry_single(MX35, SZ_16K);
29#endif /* ifdef CONFIG_SOC_IMX35 */
30
31#ifdef CONFIG_SOC_IMX51
32const struct imx_pata_imx_data imx51_pata_imx_data __initconst =
33 imx_pata_imx_data_entry_single(MX51, SZ_16K);
34#endif /* ifdef CONFIG_SOC_IMX51 */
35
36#ifdef CONFIG_SOC_IMX53
37const struct imx_pata_imx_data imx53_pata_imx_data __initconst =
38 imx_pata_imx_data_entry_single(MX53, SZ_16K);
39#endif /* ifdef CONFIG_SOC_IMX53 */
40
41struct platform_device *__init imx_add_pata_imx(
42 const struct imx_pata_imx_data *data)
43{
44 struct resource res[] = {
45 {
46 .start = data->iobase,
47 .end = data->iobase + data->iosize - 1,
48 .flags = IORESOURCE_MEM,
49 },
50 {
51 .start = data->irq,
52 .end = data->irq,
53 .flags = IORESOURCE_IRQ,
54 },
55 };
56 return imx_add_platform_device("pata_imx", -1,
57 res, ARRAY_SIZE(res), NULL, 0);
58}
59
diff --git a/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
new file mode 100644
index 000000000000..772ba2dc3f5e
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-sdhci-esdhc-imx.c
@@ -0,0 +1,99 @@
1/*
2 * Copyright (C) 2010 Pengutronix, Wolfram Sang <w.sang@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
7 */
8
9#include <mach/hardware.h>
10#include <linux/platform_data/mmc-esdhc-imx.h>
11#include "devices-common.h"
12
13#define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \
14 { \
15 .devid = _devid, \
16 .id = _id, \
17 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \
18 .irq = soc ## _INT_ESDHC ## hwid, \
19 }
20
21#define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \
22 [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid)
23
24#ifdef CONFIG_SOC_IMX25
25const struct imx_sdhci_esdhc_imx_data
26imx25_sdhci_esdhc_imx_data[] __initconst = {
27#define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \
28 imx_sdhci_esdhc_imx_data_entry(MX25, "sdhci-esdhc-imx25", _id, _hwid)
29 imx25_sdhci_esdhc_imx_data_entry(0, 1),
30 imx25_sdhci_esdhc_imx_data_entry(1, 2),
31};
32#endif /* ifdef CONFIG_SOC_IMX25 */
33
34#ifdef CONFIG_SOC_IMX35
35const struct imx_sdhci_esdhc_imx_data
36imx35_sdhci_esdhc_imx_data[] __initconst = {
37#define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \
38 imx_sdhci_esdhc_imx_data_entry(MX35, "sdhci-esdhc-imx35", _id, _hwid)
39 imx35_sdhci_esdhc_imx_data_entry(0, 1),
40 imx35_sdhci_esdhc_imx_data_entry(1, 2),
41 imx35_sdhci_esdhc_imx_data_entry(2, 3),
42};
43#endif /* ifdef CONFIG_SOC_IMX35 */
44
45#ifdef CONFIG_SOC_IMX51
46const struct imx_sdhci_esdhc_imx_data
47imx51_sdhci_esdhc_imx_data[] __initconst = {
48#define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \
49 imx_sdhci_esdhc_imx_data_entry(MX51, "sdhci-esdhc-imx51", _id, _hwid)
50 imx51_sdhci_esdhc_imx_data_entry(0, 1),
51 imx51_sdhci_esdhc_imx_data_entry(1, 2),
52 imx51_sdhci_esdhc_imx_data_entry(2, 3),
53 imx51_sdhci_esdhc_imx_data_entry(3, 4),
54};
55#endif /* ifdef CONFIG_SOC_IMX51 */
56
57#ifdef CONFIG_SOC_IMX53
58const struct imx_sdhci_esdhc_imx_data
59imx53_sdhci_esdhc_imx_data[] __initconst = {
60#define imx53_sdhci_esdhc_imx_data_entry(_id, _hwid) \
61 imx_sdhci_esdhc_imx_data_entry(MX53, "sdhci-esdhc-imx53", _id, _hwid)
62 imx53_sdhci_esdhc_imx_data_entry(0, 1),
63 imx53_sdhci_esdhc_imx_data_entry(1, 2),
64 imx53_sdhci_esdhc_imx_data_entry(2, 3),
65 imx53_sdhci_esdhc_imx_data_entry(3, 4),
66};
67#endif /* ifdef CONFIG_SOC_IMX53 */
68
69static const struct esdhc_platform_data default_esdhc_pdata __initconst = {
70 .wp_type = ESDHC_WP_NONE,
71 .cd_type = ESDHC_CD_NONE,
72};
73
74struct platform_device *__init imx_add_sdhci_esdhc_imx(
75 const struct imx_sdhci_esdhc_imx_data *data,
76 const struct esdhc_platform_data *pdata)
77{
78 struct resource res[] = {
79 {
80 .start = data->iobase,
81 .end = data->iobase + SZ_16K - 1,
82 .flags = IORESOURCE_MEM,
83 }, {
84 .start = data->irq,
85 .end = data->irq,
86 .flags = IORESOURCE_IRQ,
87 },
88 };
89
90 /*
91 * If machine does not provide pdata, use the default one
92 * which means no WP/CD support
93 */
94 if (!pdata)
95 pdata = &default_esdhc_pdata;
96
97 return imx_add_platform_device(data->devid, data->id, res,
98 ARRAY_SIZE(res), pdata, sizeof(*pdata));
99}
diff --git a/arch/arm/mach-imx/devices/platform-spi_imx.c b/arch/arm/mach-imx/devices/platform-spi_imx.c
new file mode 100644
index 000000000000..63a116bae10e
--- /dev/null
+++ b/arch/arm/mach-imx/devices/platform-spi_imx.c
@@ -0,0 +1,127 @@
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 <mach/hardware.h>
10#include "devices-common.h"
11
12#define imx_spi_imx_data_entry_single(soc, type, _devid, _id, hwid, _size) \
13 { \
14 .devid = _devid, \
15 .id = _id, \
16 .iobase = soc ## _ ## type ## hwid ## _BASE_ADDR, \
17 .iosize = _size, \
18 .irq = soc ## _INT_ ## type ## hwid, \
19 }
20
21#define imx_spi_imx_data_entry(soc, type, devid, id, hwid, size) \
22 [id] = imx_spi_imx_data_entry_single(soc, type, devid, id, hwid, size)
23
24#ifdef CONFIG_SOC_IMX1
25const struct imx_spi_imx_data imx1_cspi_data[] __initconst = {
26#define imx1_cspi_data_entry(_id, _hwid) \
27 imx_spi_imx_data_entry(MX1, CSPI, "imx1-cspi", _id, _hwid, SZ_4K)
28 imx1_cspi_data_entry(0, 1),
29 imx1_cspi_data_entry(1, 2),
30};
31#endif
32
33#ifdef CONFIG_SOC_IMX21
34const struct imx_spi_imx_data imx21_cspi_data[] __initconst = {
35#define imx21_cspi_data_entry(_id, _hwid) \
36 imx_spi_imx_data_entry(MX21, CSPI, "imx21-cspi", _id, _hwid, SZ_4K)
37 imx21_cspi_data_entry(0, 1),
38 imx21_cspi_data_entry(1, 2),
39};
40#endif
41
42#ifdef CONFIG_SOC_IMX25
43/* i.mx25 has the i.mx35 type cspi */
44const struct imx_spi_imx_data imx25_cspi_data[] __initconst = {
45#define imx25_cspi_data_entry(_id, _hwid) \
46 imx_spi_imx_data_entry(MX25, CSPI, "imx35-cspi", _id, _hwid, SZ_16K)
47 imx25_cspi_data_entry(0, 1),
48 imx25_cspi_data_entry(1, 2),
49 imx25_cspi_data_entry(2, 3),
50};
51#endif /* ifdef CONFIG_SOC_IMX25 */
52
53#ifdef CONFIG_SOC_IMX27
54const struct imx_spi_imx_data imx27_cspi_data[] __initconst = {
55#define imx27_cspi_data_entry(_id, _hwid) \
56 imx_spi_imx_data_entry(MX27, CSPI, "imx27-cspi", _id, _hwid, SZ_4K)
57 imx27_cspi_data_entry(0, 1),
58 imx27_cspi_data_entry(1, 2),
59 imx27_cspi_data_entry(2, 3),
60};
61#endif /* ifdef CONFIG_SOC_IMX27 */
62
63#ifdef CONFIG_SOC_IMX31
64const struct imx_spi_imx_data imx31_cspi_data[] __initconst = {
65#define imx31_cspi_data_entry(_id, _hwid) \
66 imx_spi_imx_data_entry(MX31, CSPI, "imx31-cspi", _id, _hwid, SZ_4K)
67 imx31_cspi_data_entry(0, 1),
68 imx31_cspi_data_entry(1, 2),
69 imx31_cspi_data_entry(2, 3),
70};
71#endif /* ifdef CONFIG_SOC_IMX31 */
72
73#ifdef CONFIG_SOC_IMX35
74const struct imx_spi_imx_data imx35_cspi_data[] __initconst = {
75#define imx35_cspi_data_entry(_id, _hwid) \
76 imx_spi_imx_data_entry(MX35, CSPI, "imx35-cspi", _id, _hwid, SZ_4K)
77 imx35_cspi_data_entry(0, 1),
78 imx35_cspi_data_entry(1, 2),
79};
80#endif /* ifdef CONFIG_SOC_IMX35 */
81
82#ifdef CONFIG_SOC_IMX51
83/* i.mx51 has the i.mx35 type cspi */
84const struct imx_spi_imx_data imx51_cspi_data __initconst =
85 imx_spi_imx_data_entry_single(MX51, CSPI, "imx35-cspi", 2, , SZ_4K);
86
87const struct imx_spi_imx_data imx51_ecspi_data[] __initconst = {
88#define imx51_ecspi_data_entry(_id, _hwid) \
89 imx_spi_imx_data_entry(MX51, ECSPI, "imx51-ecspi", _id, _hwid, SZ_4K)
90 imx51_ecspi_data_entry(0, 1),
91 imx51_ecspi_data_entry(1, 2),
92};
93#endif /* ifdef CONFIG_SOC_IMX51 */
94
95#ifdef CONFIG_SOC_IMX53
96/* i.mx53 has the i.mx35 type cspi */
97const struct imx_spi_imx_data imx53_cspi_data __initconst =
98 imx_spi_imx_data_entry_single(MX53, CSPI, "imx35-cspi", 2, , SZ_4K);
99
100/* i.mx53 has the i.mx51 type ecspi */
101const struct imx_spi_imx_data imx53_ecspi_data[] __initconst = {
102#define imx53_ecspi_data_entry(_id, _hwid) \
103 imx_spi_imx_data_entry(MX53, ECSPI, "imx51-ecspi", _id, _hwid, SZ_4K)
104 imx53_ecspi_data_entry(0, 1),
105 imx53_ecspi_data_entry(1, 2),
106};
107#endif /* ifdef CONFIG_SOC_IMX53 */
108
109struct platform_device *__init imx_add_spi_imx(
110 const struct imx_spi_imx_data *data,
111 const struct spi_imx_master *pdata)
112{
113 struct resource res[] = {
114 {
115 .start = data->iobase,
116 .end = data->iobase + data->iosize - 1,
117 .flags = IORESOURCE_MEM,
118 }, {
119 .start = data->irq,
120 .end = data->irq,
121 .flags = IORESOURCE_IRQ,
122 },
123 };
124
125 return imx_add_platform_device(data->devid, data->id,
126 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
127}
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
index 5fda6810c162..79d94aaa0640 100644
--- a/arch/arm/mach-imx/mm-imx21.c
+++ b/arch/arm/mach-imx/mm-imx21.c
@@ -23,10 +23,10 @@
23#include <linux/pinctrl/machine.h> 23#include <linux/pinctrl/machine.h>
24#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <mach/common.h> 25#include <mach/common.h>
26#include <mach/devices-common.h>
27#include <asm/pgtable.h> 26#include <asm/pgtable.h>
28#include <asm/mach/map.h> 27#include <asm/mach/map.h>
29 28
29#include "devices/devices-common.h"
30#include "iomux-v1.h" 30#include "iomux-v1.h"
31 31
32/* MX21 memory map definition */ 32/* MX21 memory map definition */
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index 47bde02f7f55..c8ea3aaf4323 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -25,10 +25,10 @@
25#include <asm/mach/map.h> 25#include <asm/mach/map.h>
26 26
27#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/devices-common.h>
29#include <mach/hardware.h> 28#include <mach/hardware.h>
30#include <mach/mx25.h> 29#include <mach/mx25.h>
31 30
31#include "devices/devices-common.h"
32#include "iomux-v3.h" 32#include "iomux-v3.h"
33 33
34/* 34/*
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
index 8d8133eb4266..6d91808a0445 100644
--- a/arch/arm/mach-imx/mm-imx27.c
+++ b/arch/arm/mach-imx/mm-imx27.c
@@ -23,10 +23,10 @@
23#include <linux/pinctrl/machine.h> 23#include <linux/pinctrl/machine.h>
24#include <mach/hardware.h> 24#include <mach/hardware.h>
25#include <mach/common.h> 25#include <mach/common.h>
26#include <mach/devices-common.h>
27#include <asm/pgtable.h> 26#include <asm/pgtable.h>
28#include <asm/mach/map.h> 27#include <asm/mach/map.h>
29 28
29#include "devices/devices-common.h"
30#include "iomux-v1.h" 30#include "iomux-v1.h"
31 31
32/* MX27 memory map definition */ 32/* MX27 memory map definition */
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 87fb8644d65a..6a5d4e496f8c 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -27,10 +27,10 @@
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include <mach/common.h> 29#include <mach/common.h>
30#include <mach/devices-common.h>
31#include <mach/hardware.h> 30#include <mach/hardware.h>
32 31
33#include "crmregs-imx3.h" 32#include "crmregs-imx3.h"
33#include "devices/devices-common.h"
34#include "iomux-v3.h" 34#include "iomux-v3.h"
35 35
36void __iomem *mx3_ccm_base; 36void __iomem *mx3_ccm_base;
diff --git a/arch/arm/mach-imx/mm-imx5.c b/arch/arm/mach-imx/mm-imx5.c
index b721b7990178..cc1423c0cce8 100644
--- a/arch/arm/mach-imx/mm-imx5.c
+++ b/arch/arm/mach-imx/mm-imx5.c
@@ -20,8 +20,8 @@
20 20
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <mach/common.h> 22#include <mach/common.h>
23#include <mach/devices-common.h>
24 23
24#include "devices/devices-common.h"
25#include "iomux-v3.h" 25#include "iomux-v3.h"
26 26
27/* 27/*
diff --git a/arch/arm/mach-imx/pm-imx3.c b/arch/arm/mach-imx/pm-imx3.c
index 822103bdb709..884dc9453d30 100644
--- a/arch/arm/mach-imx/pm-imx3.c
+++ b/arch/arm/mach-imx/pm-imx3.c
@@ -11,8 +11,8 @@
11#include <linux/io.h> 11#include <linux/io.h>
12#include <mach/common.h> 12#include <mach/common.h>
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14#include <mach/devices-common.h>
15#include "crmregs-imx3.h" 14#include "crmregs-imx3.h"
15#include "devices/devices-common.h"
16 16
17/* 17/*
18 * Set cpu low power mode before WFI instruction. This function is called 18 * Set cpu low power mode before WFI instruction. This function is called