aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2011-03-03 15:32:02 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2011-05-19 07:11:20 -0400
commitafa77ef30ead4865ce2c0c1c55054d45521ce1c7 (patch)
tree87a455605b7d0ae9685e71ae7fd48a1a0d87d379 /arch
parent031e912741746e4350204bb0436590ca0e993a7d (diff)
ARM: mx3: dynamically allocate "ipu-core" devices
... together with the related devices "mx3_camera" and "mx3_sdc_fb". "mx3_camera" doesn't fit the scheme of the other devices that just are allocated and registered in a single function because it needs additional care to get some dmaable memory. So currently imx31_alloc_mx3_camera duplicates most of imx_add_platform_device_dmamask, but I'm not sure it's worth to split the latter to be able to reuse more code. This gets rid of mach-mx3/devices.[ch] and so several files need to be adapted not to #include devices.h anymore. LAKML-Reference: 1299271882-2130-5-git-send-email-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx3/Kconfig8
-rw-r--r--arch/arm/mach-mx3/Makefile2
-rw-r--r--arch/arm/mach-mx3/devices-imx31.h8
-rw-r--r--arch/arm/mach-mx3/devices-imx35.h8
-rw-r--r--arch/arm/mach-mx3/devices.c96
-rw-r--r--arch/arm/mach-mx3/devices.h3
-rw-r--r--arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c12
-rw-r--r--arch/arm/mach-mx3/mach-armadillo5x0.c12
-rw-r--r--arch/arm/mach-mx3/mach-cpuimx35.c1
-rw-r--r--arch/arm/mach-mx3/mach-kzm_arm11_01.c1
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c49
-rw-r--r--arch/arm/mach-mx3/mach-mx31ads.c1
-rw-r--r--arch/arm/mach-mx3/mach-mx31lilly.c1
-rw-r--r--arch/arm/mach-mx3/mach-mx31lite.c1
-rw-r--r--arch/arm/mach-mx3/mach-mx31moboard.c39
-rw-r--r--arch/arm/mach-mx3/mach-mx35_3ds.c1
-rw-r--r--arch/arm/mach-mx3/mach-pcm037.c37
-rw-r--r--arch/arm/mach-mx3/mach-pcm037_eet.c1
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c12
-rw-r--r--arch/arm/mach-mx3/mach-qong.c1
-rw-r--r--arch/arm/mach-mx3/mach-vpr200.c12
-rw-r--r--arch/arm/mach-mx3/mx31lilly-db.c10
-rw-r--r--arch/arm/mach-mx3/mx31lite-db.c1
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c1
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c1
-rw-r--r--arch/arm/mach-mx3/mx31moboard-smartbot.c1
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig3
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-ipu-core.c129
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h18
30 files changed, 263 insertions, 208 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index ae23211dbadc..cb7d4a3a092a 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -56,6 +56,7 @@ config MACH_PCM037
56 select IMX_HAVE_PLATFORM_IMX2_WDT 56 select IMX_HAVE_PLATFORM_IMX2_WDT
57 select IMX_HAVE_PLATFORM_IMX_I2C 57 select IMX_HAVE_PLATFORM_IMX_I2C
58 select IMX_HAVE_PLATFORM_IMX_UART 58 select IMX_HAVE_PLATFORM_IMX_UART
59 select IMX_HAVE_PLATFORM_IPU_CORE
59 select IMX_HAVE_PLATFORM_MXC_EHCI 60 select IMX_HAVE_PLATFORM_MXC_EHCI
60 select IMX_HAVE_PLATFORM_MXC_MMC 61 select IMX_HAVE_PLATFORM_MXC_MMC
61 select IMX_HAVE_PLATFORM_MXC_NAND 62 select IMX_HAVE_PLATFORM_MXC_NAND
@@ -99,6 +100,7 @@ config MACH_MX31_3DS
99 select IMX_HAVE_PLATFORM_IMX_I2C 100 select IMX_HAVE_PLATFORM_IMX_I2C
100 select IMX_HAVE_PLATFORM_IMX_KEYPAD 101 select IMX_HAVE_PLATFORM_IMX_KEYPAD
101 select IMX_HAVE_PLATFORM_IMX_UART 102 select IMX_HAVE_PLATFORM_IMX_UART
103 select IMX_HAVE_PLATFORM_IPU_CORE
102 select IMX_HAVE_PLATFORM_MXC_EHCI 104 select IMX_HAVE_PLATFORM_MXC_EHCI
103 select IMX_HAVE_PLATFORM_MXC_NAND 105 select IMX_HAVE_PLATFORM_MXC_NAND
104 select IMX_HAVE_PLATFORM_SPI_IMX 106 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -122,6 +124,7 @@ config MACH_MX31MOBOARD
122 select IMX_HAVE_PLATFORM_FSL_USB2_UDC 124 select IMX_HAVE_PLATFORM_FSL_USB2_UDC
123 select IMX_HAVE_PLATFORM_IMX_I2C 125 select IMX_HAVE_PLATFORM_IMX_I2C
124 select IMX_HAVE_PLATFORM_IMX_UART 126 select IMX_HAVE_PLATFORM_IMX_UART
127 select IMX_HAVE_PLATFORM_IPU_CORE
125 select IMX_HAVE_PLATFORM_MXC_EHCI 128 select IMX_HAVE_PLATFORM_MXC_EHCI
126 select IMX_HAVE_PLATFORM_MXC_MMC 129 select IMX_HAVE_PLATFORM_MXC_MMC
127 select IMX_HAVE_PLATFORM_SPI_IMX 130 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -134,6 +137,7 @@ config MACH_MX31LILLY
134 bool "Support MX31 LILLY-1131 platforms (INCO startec)" 137 bool "Support MX31 LILLY-1131 platforms (INCO startec)"
135 select SOC_IMX31 138 select SOC_IMX31
136 select IMX_HAVE_PLATFORM_IMX_UART 139 select IMX_HAVE_PLATFORM_IMX_UART
140 select IMX_HAVE_PLATFORM_IPU_CORE
137 select IMX_HAVE_PLATFORM_MXC_EHCI 141 select IMX_HAVE_PLATFORM_MXC_EHCI
138 select IMX_HAVE_PLATFORM_MXC_MMC 142 select IMX_HAVE_PLATFORM_MXC_MMC
139 select IMX_HAVE_PLATFORM_SPI_IMX 143 select IMX_HAVE_PLATFORM_SPI_IMX
@@ -159,6 +163,7 @@ config MACH_PCM043
159 select IMX_HAVE_PLATFORM_IMX_I2C 163 select IMX_HAVE_PLATFORM_IMX_I2C
160 select IMX_HAVE_PLATFORM_IMX_SSI 164 select IMX_HAVE_PLATFORM_IMX_SSI
161 select IMX_HAVE_PLATFORM_IMX_UART 165 select IMX_HAVE_PLATFORM_IMX_UART
166 select IMX_HAVE_PLATFORM_IPU_CORE
162 select IMX_HAVE_PLATFORM_MXC_EHCI 167 select IMX_HAVE_PLATFORM_MXC_EHCI
163 select IMX_HAVE_PLATFORM_MXC_NAND 168 select IMX_HAVE_PLATFORM_MXC_NAND
164 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 169 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
@@ -173,6 +178,7 @@ config MACH_ARMADILLO5X0
173 select IMX_HAVE_PLATFORM_GPIO_KEYS 178 select IMX_HAVE_PLATFORM_GPIO_KEYS
174 select IMX_HAVE_PLATFORM_IMX_I2C 179 select IMX_HAVE_PLATFORM_IMX_I2C
175 select IMX_HAVE_PLATFORM_IMX_UART 180 select IMX_HAVE_PLATFORM_IMX_UART
181 select IMX_HAVE_PLATFORM_IPU_CORE
176 select IMX_HAVE_PLATFORM_MXC_EHCI 182 select IMX_HAVE_PLATFORM_MXC_EHCI
177 select IMX_HAVE_PLATFORM_MXC_MMC 183 select IMX_HAVE_PLATFORM_MXC_MMC
178 select IMX_HAVE_PLATFORM_MXC_NAND 184 select IMX_HAVE_PLATFORM_MXC_NAND
@@ -238,6 +244,7 @@ config MACH_EUKREA_MBIMXSD35_BASEBOARD
238 bool "Eukrea MBIMXSD development board" 244 bool "Eukrea MBIMXSD development board"
239 select IMX_HAVE_PLATFORM_GPIO_KEYS 245 select IMX_HAVE_PLATFORM_GPIO_KEYS
240 select IMX_HAVE_PLATFORM_IMX_SSI 246 select IMX_HAVE_PLATFORM_IMX_SSI
247 select IMX_HAVE_PLATFORM_IPU_CORE
241 help 248 help
242 This adds board specific devices that can be found on Eukrea's 249 This adds board specific devices that can be found on Eukrea's
243 MBIMXSD evaluation board. 250 MBIMXSD evaluation board.
@@ -252,6 +259,7 @@ config MACH_VPR200
252 select IMX_HAVE_PLATFORM_IMX2_WDT 259 select IMX_HAVE_PLATFORM_IMX2_WDT
253 select IMX_HAVE_PLATFORM_IMX_UART 260 select IMX_HAVE_PLATFORM_IMX_UART
254 select IMX_HAVE_PLATFORM_IMX_I2C 261 select IMX_HAVE_PLATFORM_IMX_I2C
262 select IMX_HAVE_PLATFORM_IPU_CORE
255 select IMX_HAVE_PLATFORM_MXC_EHCI 263 select IMX_HAVE_PLATFORM_MXC_EHCI
256 select IMX_HAVE_PLATFORM_MXC_NAND 264 select IMX_HAVE_PLATFORM_MXC_NAND
257 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 265 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
diff --git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index a54faf2cf5fa..15a7ff826ce7 100644
--- a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -4,7 +4,7 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := mm.o devices.o cpu.o 7obj-y := mm.o cpu.o
8obj-$(CONFIG_SOC_IMX31) += clock-imx31.o iomux-imx31.o ehci-imx31.o 8obj-$(CONFIG_SOC_IMX31) += clock-imx31.o iomux-imx31.o ehci-imx31.o
9obj-$(CONFIG_SOC_IMX35) += clock-imx35.o ehci-imx35.o 9obj-$(CONFIG_SOC_IMX35) += clock-imx35.o ehci-imx35.o
10obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o 10obj-$(CONFIG_MACH_MX31ADS) += mach-mx31ads.o
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h
index 3059b3e33dec..dbe940d9c53a 100644
--- a/arch/arm/mach-mx3/devices-imx31.h
+++ b/arch/arm/mach-mx3/devices-imx31.h
@@ -41,6 +41,14 @@ extern const struct imx_imx_uart_1irq_data imx31_imx_uart_data[];
41#define imx31_add_imx_uart3(pdata) imx31_add_imx_uart(3, pdata) 41#define imx31_add_imx_uart3(pdata) imx31_add_imx_uart(3, pdata)
42#define imx31_add_imx_uart4(pdata) imx31_add_imx_uart(4, pdata) 42#define imx31_add_imx_uart4(pdata) imx31_add_imx_uart(4, pdata)
43 43
44extern const struct imx_ipu_core_data imx31_ipu_core_data;
45#define imx31_add_ipu_core(pdata) \
46 imx_add_ipu_core(&imx31_ipu_core_data, pdata)
47#define imx31_alloc_mx3_camera(pdata) \
48 imx_alloc_mx3_camera(&imx31_ipu_core_data, pdata)
49#define imx31_add_mx3_sdc_fb(pdata) \
50 imx_add_mx3_sdc_fb(&imx31_ipu_core_data, pdata)
51
44extern const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data; 52extern const struct imx_mxc_ehci_data imx31_mxc_ehci_otg_data;
45#define imx31_add_mxc_ehci_otg(pdata) \ 53#define imx31_add_mxc_ehci_otg(pdata) \
46 imx_add_mxc_ehci(&imx31_mxc_ehci_otg_data, pdata) 54 imx_add_mxc_ehci(&imx31_mxc_ehci_otg_data, pdata)
diff --git a/arch/arm/mach-mx3/devices-imx35.h b/arch/arm/mach-mx3/devices-imx35.h
index 35826656e599..234cbd3c18af 100644
--- a/arch/arm/mach-mx3/devices-imx35.h
+++ b/arch/arm/mach-mx3/devices-imx35.h
@@ -49,6 +49,14 @@ extern const struct imx_imx_uart_1irq_data imx35_imx_uart_data[];
49#define imx35_add_imx_uart1(pdata) imx35_add_imx_uart(1, pdata) 49#define imx35_add_imx_uart1(pdata) imx35_add_imx_uart(1, pdata)
50#define imx35_add_imx_uart2(pdata) imx35_add_imx_uart(2, pdata) 50#define imx35_add_imx_uart2(pdata) imx35_add_imx_uart(2, pdata)
51 51
52extern const struct imx_ipu_core_data imx35_ipu_core_data;
53#define imx35_add_ipu_core(pdata) \
54 imx_add_ipu_core(&imx35_ipu_core_data, pdata)
55#define imx35_alloc_mx3_camera(pdata) \
56 imx_alloc_mx3_camera(&imx35_ipu_core_data, pdata)
57#define imx35_add_mx3_sdc_fb(pdata) \
58 imx_add_mx3_sdc_fb(&imx35_ipu_core_data, pdata)
59
52extern const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data; 60extern const struct imx_mxc_ehci_data imx35_mxc_ehci_otg_data;
53#define imx35_add_mxc_ehci_otg(pdata) \ 61#define imx35_add_mxc_ehci_otg(pdata) \
54 imx_add_mxc_ehci(&imx35_mxc_ehci_otg_data, pdata) 62 imx_add_mxc_ehci(&imx35_mxc_ehci_otg_data, pdata)
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
deleted file mode 100644
index 0701ee45c548..000000000000
--- a/arch/arm/mach-mx3/devices.c
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#include <linux/dma-mapping.h>
21#include <linux/module.h>
22#include <linux/platform_device.h>
23#include <linux/serial.h>
24#include <linux/gpio.h>
25#include <mach/hardware.h>
26#include <mach/irqs.h>
27#include <mach/common.h>
28#include <mach/mx3_camera.h>
29
30#include "devices.h"
31
32/* i.MX31 Image Processing Unit */
33
34/* The resource order is important! */
35static struct resource mx3_ipu_rsrc[] = {
36 {
37 .start = MX3x_IPU_CTRL_BASE_ADDR,
38 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x5F,
39 .flags = IORESOURCE_MEM,
40 }, {
41 .start = MX3x_IPU_CTRL_BASE_ADDR + 0x88,
42 .end = MX3x_IPU_CTRL_BASE_ADDR + 0xB3,
43 .flags = IORESOURCE_MEM,
44 }, {
45 .start = MX3x_INT_IPU_SYN,
46 .end = MX3x_INT_IPU_SYN,
47 .flags = IORESOURCE_IRQ,
48 }, {
49 .start = MX3x_INT_IPU_ERR,
50 .end = MX3x_INT_IPU_ERR,
51 .flags = IORESOURCE_IRQ,
52 },
53};
54
55struct platform_device mx3_ipu = {
56 .name = "ipu-core",
57 .id = -1,
58 .num_resources = ARRAY_SIZE(mx3_ipu_rsrc),
59 .resource = mx3_ipu_rsrc,
60};
61
62static struct resource fb_resources[] = {
63 {
64 .start = MX3x_IPU_CTRL_BASE_ADDR + 0xB4,
65 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x1BF,
66 .flags = IORESOURCE_MEM,
67 },
68};
69
70struct platform_device mx3_fb = {
71 .name = "mx3_sdc_fb",
72 .id = -1,
73 .num_resources = ARRAY_SIZE(fb_resources),
74 .resource = fb_resources,
75 .dev = {
76 .coherent_dma_mask = DMA_BIT_MASK(32),
77 },
78};
79
80static struct resource camera_resources[] = {
81 {
82 .start = MX3x_IPU_CTRL_BASE_ADDR + 0x60,
83 .end = MX3x_IPU_CTRL_BASE_ADDR + 0x87,
84 .flags = IORESOURCE_MEM,
85 },
86};
87
88struct platform_device mx3_camera = {
89 .name = "mx3-camera",
90 .id = 0,
91 .num_resources = ARRAY_SIZE(camera_resources),
92 .resource = camera_resources,
93 .dev = {
94 .coherent_dma_mask = DMA_BIT_MASK(32),
95 },
96};
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
deleted file mode 100644
index d23f85375655..000000000000
--- a/arch/arm/mach-mx3/devices.h
+++ /dev/null
@@ -1,3 +0,0 @@
1extern struct platform_device mx3_ipu;
2extern struct platform_device mx3_fb;
3extern struct platform_device mx3_camera;
diff --git a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
index f61b2a923826..4909ea05855a 100644
--- a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
+++ b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
@@ -38,12 +38,9 @@
38#include <mach/hardware.h> 38#include <mach/hardware.h>
39#include <mach/common.h> 39#include <mach/common.h>
40#include <mach/iomux-mx35.h> 40#include <mach/iomux-mx35.h>
41#include <mach/ipu.h>
42#include <mach/mx3fb.h>
43#include <mach/audmux.h> 41#include <mach/audmux.h>
44 42
45#include "devices-imx35.h" 43#include "devices-imx35.h"
46#include "devices.h"
47 44
48static const struct fb_videomode fb_modedb[] = { 45static const struct fb_videomode fb_modedb[] = {
49 { 46 {
@@ -98,12 +95,11 @@ static const struct fb_videomode fb_modedb[] = {
98 }, 95 },
99}; 96};
100 97
101static struct ipu_platform_data mx3_ipu_data = { 98static const struct ipu_platform_data mx3_ipu_data __initconst = {
102 .irq_base = MXC_IPU_IRQ_START, 99 .irq_base = MXC_IPU_IRQ_START,
103}; 100};
104 101
105static struct mx3fb_platform_data mx3fb_pdata = { 102static struct mx3fb_platform_data mx3fb_pdata __initdata = {
106 .dma_dev = &mx3_ipu.dev,
107 .name = "CMO-QVGA", 103 .name = "CMO-QVGA",
108 .mode = fb_modedb, 104 .mode = fb_modedb,
109 .num_modes = ARRAY_SIZE(fb_modedb), 105 .num_modes = ARRAY_SIZE(fb_modedb),
@@ -280,8 +276,8 @@ void __init eukrea_mbimxsd35_baseboard_init(void)
280#endif 276#endif
281 277
282 imx35_add_imx_uart1(&uart_pdata); 278 imx35_add_imx_uart1(&uart_pdata);
283 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 279 imx35_add_ipu_core(&mx3_ipu_data);
284 mxc_register_device(&mx3_fb, &mx3fb_pdata); 280 imx35_add_mx3_sdc_fb(&mx3fb_pdata);
285 281
286 imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata); 282 imx35_add_imx_ssi(0, &eukrea_mbimxsd_ssi_pdata);
287 283
diff --git a/arch/arm/mach-mx3/mach-armadillo5x0.c b/arch/arm/mach-mx3/mach-armadillo5x0.c
index ace0c4c3b662..8e614b10dd5c 100644
--- a/arch/arm/mach-mx3/mach-armadillo5x0.c
+++ b/arch/arm/mach-mx3/mach-armadillo5x0.c
@@ -48,12 +48,9 @@
48 48
49#include <mach/common.h> 49#include <mach/common.h>
50#include <mach/iomux-mx3.h> 50#include <mach/iomux-mx3.h>
51#include <mach/ipu.h>
52#include <mach/mx3fb.h>
53#include <mach/ulpi.h> 51#include <mach/ulpi.h>
54 52
55#include "devices-imx31.h" 53#include "devices-imx31.h"
56#include "devices.h"
57#include "crm_regs.h" 54#include "crm_regs.h"
58 55
59static int armadillo5x0_pins[] = { 56static int armadillo5x0_pins[] = {
@@ -374,12 +371,11 @@ static const struct fb_videomode fb_modedb[] = {
374 }, 371 },
375}; 372};
376 373
377static struct ipu_platform_data mx3_ipu_data = { 374static const struct ipu_platform_data mx3_ipu_data __initconst = {
378 .irq_base = MXC_IPU_IRQ_START, 375 .irq_base = MXC_IPU_IRQ_START,
379}; 376};
380 377
381static struct mx3fb_platform_data mx3fb_pdata = { 378static struct mx3fb_platform_data mx3fb_pdata __initdata = {
382 .dma_dev = &mx3_ipu.dev,
383 .name = "CRT-VGA", 379 .name = "CRT-VGA",
384 .mode = fb_modedb, 380 .mode = fb_modedb,
385 .num_modes = ARRAY_SIZE(fb_modedb), 381 .num_modes = ARRAY_SIZE(fb_modedb),
@@ -512,8 +508,8 @@ static void __init armadillo5x0_init(void)
512 imx31_add_mxc_mmc(0, &sdhc_pdata); 508 imx31_add_mxc_mmc(0, &sdhc_pdata);
513 509
514 /* Register FB */ 510 /* Register FB */
515 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 511 imx31_add_ipu_core(&mx3_ipu_data);
516 mxc_register_device(&mx3_fb, &mx3fb_pdata); 512 imx31_add_mx3_sdc_fb(&mx3fb_pdata);
517 513
518 /* Register NOR Flash */ 514 /* Register NOR Flash */
519 mxc_register_device(&armadillo5x0_nor_flash, 515 mxc_register_device(&armadillo5x0_nor_flash,
diff --git a/arch/arm/mach-mx3/mach-cpuimx35.c b/arch/arm/mach-mx3/mach-cpuimx35.c
index ae13fd73a810..3f8ef825fa6f 100644
--- a/arch/arm/mach-mx3/mach-cpuimx35.c
+++ b/arch/arm/mach-mx3/mach-cpuimx35.c
@@ -43,7 +43,6 @@
43#include <mach/iomux-mx35.h> 43#include <mach/iomux-mx35.h>
44 44
45#include "devices-imx35.h" 45#include "devices-imx35.h"
46#include "devices.h"
47 46
48static const struct imxuart_platform_data uart_pdata __initconst = { 47static const struct imxuart_platform_data uart_pdata __initconst = {
49 .flags = IMXUART_HAVE_RTSCTS, 48 .flags = IMXUART_HAVE_RTSCTS,
diff --git a/arch/arm/mach-mx3/mach-kzm_arm11_01.c b/arch/arm/mach-mx3/mach-kzm_arm11_01.c
index d35621d62b4d..1ecae20cf4e3 100644
--- a/arch/arm/mach-mx3/mach-kzm_arm11_01.c
+++ b/arch/arm/mach-mx3/mach-kzm_arm11_01.c
@@ -39,7 +39,6 @@
39#include <mach/iomux-mx3.h> 39#include <mach/iomux-mx3.h>
40 40
41#include "devices-imx31.h" 41#include "devices-imx31.h"
42#include "devices.h"
43 42
44#define KZM_ARM11_IO_ADDRESS(x) (IOMEM( \ 43#define KZM_ARM11_IO_ADDRESS(x) (IOMEM( \
45 IMX_IO_P2V_MODULE(x, MX31_CS4) ?: \ 44 IMX_IO_P2V_MODULE(x, MX31_CS4) ?: \
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index 477b2d274396..9b982449cb52 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -39,12 +39,8 @@
39#include <mach/iomux-mx3.h> 39#include <mach/iomux-mx3.h>
40#include <mach/3ds_debugboard.h> 40#include <mach/3ds_debugboard.h>
41#include <mach/ulpi.h> 41#include <mach/ulpi.h>
42#include <mach/ipu.h>
43#include <mach/mx3fb.h>
44#include <mach/mx3_camera.h>
45 42
46#include "devices-imx31.h" 43#include "devices-imx31.h"
47#include "devices.h"
48 44
49/* CPLD IRQ line for external uart, external ethernet etc */ 45/* CPLD IRQ line for external uart, external ethernet etc */
50#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1) 46#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1)
@@ -177,22 +173,37 @@ static struct gpio mx31_3ds_camera_gpios[] = {
177 { MX31_3DS_GPIO_CAMERA_RST, GPIOF_OUT_INIT_HIGH, "camera-reset" }, 173 { MX31_3DS_GPIO_CAMERA_RST, GPIOF_OUT_INIT_HIGH, "camera-reset" },
178}; 174};
179 175
180static int __init mx31_3ds_camera_alloc_dma(void) 176static const struct mx3_camera_pdata mx31_3ds_camera_pdata __initconst = {
177 .flags = MX3_CAMERA_DATAWIDTH_10,
178 .mclk_10khz = 2600,
179};
180
181static int __init mx31_3ds_init_camera(void)
181{ 182{
182 int dma; 183 int dma, ret = -ENOMEM;
184 struct platform_device *pdev =
185 imx31_alloc_mx3_camera(&mx31_3ds_camera_pdata);
186
187 if (IS_ERR(pdev))
188 return PTR_ERR(pdev);
183 189
184 if (!mx3_camera_base) 190 if (!mx3_camera_base)
185 return -ENOMEM; 191 goto err;
186 192
187 dma = dma_declare_coherent_memory(&mx3_camera.dev, 193 dma = dma_declare_coherent_memory(&pdev->dev,
188 mx3_camera_base, mx3_camera_base, 194 mx3_camera_base, mx3_camera_base,
189 MX31_3DS_CAMERA_BUF_SIZE, 195 MX31_3DS_CAMERA_BUF_SIZE,
190 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); 196 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
191 197
192 if (!(dma & DMA_MEMORY_MAP)) 198 if (!(dma & DMA_MEMORY_MAP))
193 return -ENOMEM; 199 goto err;
194 200
195 return 0; 201 ret = platform_device_add(pdev);
202 if (ret)
203err:
204 platform_device_put(pdev);
205
206 return ret;
196} 207}
197 208
198static int mx31_3ds_camera_power(struct device *dev, int on) 209static int mx31_3ds_camera_power(struct device *dev, int on)
@@ -240,12 +251,6 @@ static struct platform_device mx31_3ds_ov2640 = {
240 }, 251 },
241}; 252};
242 253
243struct mx3_camera_pdata mx31_3ds_camera_pdata = {
244 .dma_dev = &mx3_ipu.dev,
245 .flags = MX3_CAMERA_DATAWIDTH_10,
246 .mclk_10khz = 2600,
247};
248
249/* 254/*
250 * FB support 255 * FB support
251 */ 256 */
@@ -272,8 +277,7 @@ static struct ipu_platform_data mx3_ipu_data = {
272 .irq_base = MXC_IPU_IRQ_START, 277 .irq_base = MXC_IPU_IRQ_START,
273}; 278};
274 279
275static struct mx3fb_platform_data mx3fb_pdata = { 280static struct mx3fb_platform_data mx3fb_pdata __initdata = {
276 .dma_dev = &mx3_ipu.dev,
277 .name = "Epson-VGA", 281 .name = "Epson-VGA",
278 .mode = fb_modedb, 282 .mode = fb_modedb,
279 .num_modes = ARRAY_SIZE(fb_modedb), 283 .num_modes = ARRAY_SIZE(fb_modedb),
@@ -722,8 +726,8 @@ static void __init mx31_3ds_init(void)
722 imx31_add_mxc_mmc(0, &sdhc1_pdata); 726 imx31_add_mxc_mmc(0, &sdhc1_pdata);
723 727
724 imx31_add_spi_imx0(&spi0_pdata); 728 imx31_add_spi_imx0(&spi0_pdata);
725 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 729 imx31_add_ipu_core(&mx3_ipu_data);
726 mxc_register_device(&mx3_fb, &mx3fb_pdata); 730 imx31_add_mx3_sdc_fb(&mx3fb_pdata);
727 731
728 /* CSI */ 732 /* CSI */
729 /* Camera power: default - off */ 733 /* Camera power: default - off */
@@ -734,10 +738,7 @@ static void __init mx31_3ds_init(void)
734 iclink_ov2640.power = NULL; 738 iclink_ov2640.power = NULL;
735 } 739 }
736 740
737 if (!mx31_3ds_camera_alloc_dma()) 741 mx31_3ds_init_camera();
738 mxc_register_device(&mx3_camera, &mx31_3ds_camera_pdata);
739 else
740 pr_err("Failed to allocate dma memory for camera");
741} 742}
742 743
743static void __init mx31_3ds_timer_init(void) 744static void __init mx31_3ds_timer_init(void)
diff --git a/arch/arm/mach-mx3/mach-mx31ads.c b/arch/arm/mach-mx3/mach-mx31ads.c
index 3d095d69bc68..f4dee0254634 100644
--- a/arch/arm/mach-mx3/mach-mx31ads.c
+++ b/arch/arm/mach-mx3/mach-mx31ads.c
@@ -38,7 +38,6 @@
38#endif 38#endif
39 39
40#include "devices-imx31.h" 40#include "devices-imx31.h"
41#include "devices.h"
42 41
43/* PBC Board interrupt status register */ 42/* PBC Board interrupt status register */
44#define PBC_INTSTATUS 0x000016 43#define PBC_INTSTATUS 0x000016
diff --git a/arch/arm/mach-mx3/mach-mx31lilly.c b/arch/arm/mach-mx3/mach-mx31lilly.c
index ed95745163b8..410e676ae087 100644
--- a/arch/arm/mach-mx3/mach-mx31lilly.c
+++ b/arch/arm/mach-mx3/mach-mx31lilly.c
@@ -46,7 +46,6 @@
46#include <mach/ulpi.h> 46#include <mach/ulpi.h>
47 47
48#include "devices-imx31.h" 48#include "devices-imx31.h"
49#include "devices.h"
50 49
51/* 50/*
52 * This file contains module-specific initialization routines for LILLY-1131. 51 * This file contains module-specific initialization routines for LILLY-1131.
diff --git a/arch/arm/mach-mx3/mach-mx31lite.c b/arch/arm/mach-mx3/mach-mx31lite.c
index 24a21a384bf1..ac9b4cad320e 100644
--- a/arch/arm/mach-mx3/mach-mx31lite.c
+++ b/arch/arm/mach-mx3/mach-mx31lite.c
@@ -44,7 +44,6 @@
44#include <mach/ulpi.h> 44#include <mach/ulpi.h>
45 45
46#include "devices-imx31.h" 46#include "devices-imx31.h"
47#include "devices.h"
48 47
49/* 48/*
50 * This file contains the module-specific initialization routines. 49 * This file contains the module-specific initialization routines.
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index 6c13061b6ac2..eaaea2dbd4fd 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -40,12 +40,9 @@
40#include <mach/common.h> 40#include <mach/common.h>
41#include <mach/hardware.h> 41#include <mach/hardware.h>
42#include <mach/iomux-mx3.h> 42#include <mach/iomux-mx3.h>
43#include <mach/ipu.h>
44#include <mach/mx3_camera.h>
45#include <mach/ulpi.h> 43#include <mach/ulpi.h>
46 44
47#include "devices-imx31.h" 45#include "devices-imx31.h"
48#include "devices.h"
49 46
50static unsigned int moboard_pins[] = { 47static unsigned int moboard_pins[] = {
51 /* UART0 */ 48 /* UART0 */
@@ -194,8 +191,8 @@ static struct regulator_init_data sdhc_vreg_data = {
194 191
195static struct regulator_consumer_supply cam_consumers[] = { 192static struct regulator_consumer_supply cam_consumers[] = {
196 { 193 {
197 .dev = &mx3_camera.dev, 194 .dev_name = "mx3_camera.0",
198 .supply = "cam_vcc", 195 .supply = "cam_vcc",
199 }, 196 },
200}; 197};
201 198
@@ -458,7 +455,7 @@ static struct platform_device mx31moboard_leds_device = {
458 }, 455 },
459}; 456};
460 457
461static struct ipu_platform_data mx3_ipu_data = { 458static const struct ipu_platform_data mx3_ipu_data __initconst = {
462 .irq_base = MXC_IPU_IRQ_START, 459 .irq_base = MXC_IPU_IRQ_START,
463}; 460};
464 461
@@ -467,8 +464,7 @@ static struct platform_device *devices[] __initdata = {
467 &mx31moboard_leds_device, 464 &mx31moboard_leds_device,
468}; 465};
469 466
470static struct mx3_camera_pdata camera_pdata = { 467static struct mx3_camera_pdata camera_pdata __initdata = {
471 .dma_dev = &mx3_ipu.dev,
472 .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, 468 .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
473 .mclk_10khz = 4800, 469 .mclk_10khz = 4800,
474}; 470};
@@ -476,18 +472,31 @@ static struct mx3_camera_pdata camera_pdata = {
476static phys_addr_t mx3_camera_base __initdata; 472static phys_addr_t mx3_camera_base __initdata;
477#define MX3_CAMERA_BUF_SIZE SZ_4M 473#define MX3_CAMERA_BUF_SIZE SZ_4M
478 474
479static int __init mx31moboard_cam_alloc_dma(void) 475static int __init mx31moboard_init_cam(void)
480{ 476{
481 int dma; 477 int dma, ret = -ENOMEM;
478 struct platform_device *pdev;
479
480 imx31_add_ipu_core(&mx3_ipu_data);
482 481
482 pdev = imx31_alloc_mx3_camera(&camera_pdata);
483 if (IS_ERR(pdev))
484 return PTR_ERR(pdev);
483 485
484 dma = dma_declare_coherent_memory(&mx3_camera.dev, 486 dma = dma_declare_coherent_memory(&pdev->dev,
485 mx3_camera_base, mx3_camera_base, 487 mx3_camera_base, mx3_camera_base,
486 MX3_CAMERA_BUF_SIZE, 488 MX3_CAMERA_BUF_SIZE,
487 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); 489 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
490 if (!(dma & DMA_MEMORY_MAP))
491 goto err;
492
493 ret = platform_device_add(pdev);
494 if (ret)
495err:
496 platform_device_put(pdev);
497
498 return ret;
488 499
489 /* The way we call dma_declare_coherent_memory only a malloc can fail */
490 return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM;
491} 500}
492 501
493static int mx31moboard_baseboard; 502static int mx31moboard_baseboard;
@@ -519,9 +528,7 @@ static void __init mx31moboard_init(void)
519 528
520 imx31_add_mxc_mmc(0, &sdhc1_pdata); 529 imx31_add_mxc_mmc(0, &sdhc1_pdata);
521 530
522 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 531 mx31moboard_init_cam();
523 if (!mx31moboard_cam_alloc_dma())
524 mxc_register_device(&mx3_camera, &camera_pdata);
525 532
526 usb_xcvr_reset(); 533 usb_xcvr_reset();
527 534
diff --git a/arch/arm/mach-mx3/mach-mx35_3ds.c b/arch/arm/mach-mx3/mach-mx35_3ds.c
index ff5fe231b8d6..882880ac1bbc 100644
--- a/arch/arm/mach-mx3/mach-mx35_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx35_3ds.c
@@ -42,7 +42,6 @@
42#include <mach/3ds_debugboard.h> 42#include <mach/3ds_debugboard.h>
43 43
44#include "devices-imx35.h" 44#include "devices-imx35.h"
45#include "devices.h"
46 45
47#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 1) 46#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 1)
48 47
diff --git a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
index 497b39b0f0e4..89c213b81295 100644
--- a/arch/arm/mach-mx3/mach-pcm037.c
+++ b/arch/arm/mach-mx3/mach-pcm037.c
@@ -42,13 +42,9 @@
42#include <mach/common.h> 42#include <mach/common.h>
43#include <mach/hardware.h> 43#include <mach/hardware.h>
44#include <mach/iomux-mx3.h> 44#include <mach/iomux-mx3.h>
45#include <mach/ipu.h>
46#include <mach/mx3_camera.h>
47#include <mach/mx3fb.h>
48#include <mach/ulpi.h> 45#include <mach/ulpi.h>
49 46
50#include "devices-imx31.h" 47#include "devices-imx31.h"
51#include "devices.h"
52#include "pcm037.h" 48#include "pcm037.h"
53 49
54static enum pcm037_board_variant pcm037_instance = PCM037_PCM970; 50static enum pcm037_board_variant pcm037_instance = PCM037_PCM970;
@@ -405,8 +401,7 @@ static const struct imxmmc_platform_data sdhc_pdata __initconst = {
405 .exit = pcm970_sdhc1_exit, 401 .exit = pcm970_sdhc1_exit,
406}; 402};
407 403
408struct mx3_camera_pdata camera_pdata = { 404struct mx3_camera_pdata camera_pdata __initdata = {
409 .dma_dev = &mx3_ipu.dev,
410 .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10, 405 .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
411 .mclk_10khz = 2000, 406 .mclk_10khz = 2000,
412}; 407};
@@ -414,17 +409,27 @@ struct mx3_camera_pdata camera_pdata = {
414static phys_addr_t mx3_camera_base __initdata; 409static phys_addr_t mx3_camera_base __initdata;
415#define MX3_CAMERA_BUF_SIZE SZ_4M 410#define MX3_CAMERA_BUF_SIZE SZ_4M
416 411
417static int __init pcm037_camera_alloc_dma(void) 412static int __init pcm037_init_camera(void)
418{ 413{
419 int dma; 414 int dma, ret = -ENOMEM;
415 struct platform_device *pdev = imx31_alloc_mx3_camera(&camera_pdata);
420 416
421 dma = dma_declare_coherent_memory(&mx3_camera.dev, 417 if (IS_ERR(pdev))
418 return PTR_ERR(pdev);
419
420 dma = dma_declare_coherent_memory(&pdev->dev,
422 mx3_camera_base, mx3_camera_base, 421 mx3_camera_base, mx3_camera_base,
423 MX3_CAMERA_BUF_SIZE, 422 MX3_CAMERA_BUF_SIZE,
424 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); 423 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
424 if (!(dma & DMA_MEMORY_MAP))
425 goto err;
426
427 ret = platform_device_add(pdev);
428 if (ret)
429err:
430 platform_device_put(pdev);
425 431
426 /* The way we call dma_declare_coherent_memory only a malloc can fail */ 432 return ret;
427 return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM;
428} 433}
429 434
430static struct platform_device *devices[] __initdata = { 435static struct platform_device *devices[] __initdata = {
@@ -434,7 +439,7 @@ static struct platform_device *devices[] __initdata = {
434 &pcm037_mt9v022, 439 &pcm037_mt9v022,
435}; 440};
436 441
437static struct ipu_platform_data mx3_ipu_data = { 442static const struct ipu_platform_data mx3_ipu_data __initconst = {
438 .irq_base = MXC_IPU_IRQ_START, 443 .irq_base = MXC_IPU_IRQ_START,
439}; 444};
440 445
@@ -492,7 +497,6 @@ static const struct fb_videomode fb_modedb[] = {
492}; 497};
493 498
494static struct mx3fb_platform_data mx3fb_pdata = { 499static struct mx3fb_platform_data mx3fb_pdata = {
495 .dma_dev = &mx3_ipu.dev,
496 .name = "Sharp-LQ035Q7DH06-QVGA", 500 .name = "Sharp-LQ035Q7DH06-QVGA",
497 .mode = fb_modedb, 501 .mode = fb_modedb,
498 .num_modes = ARRAY_SIZE(fb_modedb), 502 .num_modes = ARRAY_SIZE(fb_modedb),
@@ -630,8 +634,8 @@ static void __init pcm037_init(void)
630 634
631 imx31_add_mxc_nand(&pcm037_nand_board_info); 635 imx31_add_mxc_nand(&pcm037_nand_board_info);
632 imx31_add_mxc_mmc(0, &sdhc_pdata); 636 imx31_add_mxc_mmc(0, &sdhc_pdata);
633 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 637 imx31_add_ipu_core(&mx3_ipu_data);
634 mxc_register_device(&mx3_fb, &mx3fb_pdata); 638 imx31_add_mx3_sdc_fb(&mx3fb_pdata);
635 639
636 /* CSI */ 640 /* CSI */
637 /* Camera power: default - off */ 641 /* Camera power: default - off */
@@ -641,8 +645,7 @@ static void __init pcm037_init(void)
641 else 645 else
642 iclink_mt9t031.power = NULL; 646 iclink_mt9t031.power = NULL;
643 647
644 if (!pcm037_camera_alloc_dma()) 648 pcm037_init_camera();
645 mxc_register_device(&mx3_camera, &camera_pdata);
646 649
647 platform_device_register(&pcm970_sja1000); 650 platform_device_register(&pcm970_sja1000);
648 651
diff --git a/arch/arm/mach-mx3/mach-pcm037_eet.c b/arch/arm/mach-mx3/mach-pcm037_eet.c
index 20861d797841..1b7606bef8f4 100644
--- a/arch/arm/mach-mx3/mach-pcm037_eet.c
+++ b/arch/arm/mach-mx3/mach-pcm037_eet.c
@@ -17,7 +17,6 @@
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
18 18
19#include "pcm037.h" 19#include "pcm037.h"
20#include "devices.h"
21#include "devices-imx31.h" 20#include "devices-imx31.h"
22 21
23static unsigned int pcm037_eet_pins[] = { 22static unsigned int pcm037_eet_pins[] = {
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index 9caf38be3928..10154cb15567 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -36,13 +36,10 @@
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <mach/common.h> 37#include <mach/common.h>
38#include <mach/iomux-mx35.h> 38#include <mach/iomux-mx35.h>
39#include <mach/ipu.h>
40#include <mach/mx3fb.h>
41#include <mach/ulpi.h> 39#include <mach/ulpi.h>
42#include <mach/audmux.h> 40#include <mach/audmux.h>
43 41
44#include "devices-imx35.h" 42#include "devices-imx35.h"
45#include "devices.h"
46 43
47static const struct fb_videomode fb_modedb[] = { 44static const struct fb_videomode fb_modedb[] = {
48 { 45 {
@@ -80,12 +77,11 @@ static const struct fb_videomode fb_modedb[] = {
80 }, 77 },
81}; 78};
82 79
83static struct ipu_platform_data mx3_ipu_data = { 80static const struct ipu_platform_data mx3_ipu_data __initconst = {
84 .irq_base = MXC_IPU_IRQ_START, 81 .irq_base = MXC_IPU_IRQ_START,
85}; 82};
86 83
87static struct mx3fb_platform_data mx3fb_pdata = { 84static struct mx3fb_platform_data mx3fb_pdata __initdata = {
88 .dma_dev = &mx3_ipu.dev,
89 .name = "Sharp-LQ035Q7", 85 .name = "Sharp-LQ035Q7",
90 .mode = fb_modedb, 86 .mode = fb_modedb,
91 .num_modes = ARRAY_SIZE(fb_modedb), 87 .num_modes = ARRAY_SIZE(fb_modedb),
@@ -389,8 +385,8 @@ static void __init pcm043_init(void)
389 385
390 imx35_add_imx_i2c0(&pcm043_i2c0_data); 386 imx35_add_imx_i2c0(&pcm043_i2c0_data);
391 387
392 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 388 imx35_add_ipu_core(&mx3_ipu_data);
393 mxc_register_device(&mx3_fb, &mx3fb_pdata); 389 imx35_add_mx3_sdc_fb(&mx3fb_pdata);
394 390
395 if (otg_mode_host) { 391 if (otg_mode_host) {
396 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS | 392 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
diff --git a/arch/arm/mach-mx3/mach-qong.c b/arch/arm/mach-mx3/mach-qong.c
index 17f758b77623..a6052872ffb8 100644
--- a/arch/arm/mach-mx3/mach-qong.c
+++ b/arch/arm/mach-mx3/mach-qong.c
@@ -33,7 +33,6 @@
33#include <mach/iomux-mx3.h> 33#include <mach/iomux-mx3.h>
34 34
35#include "devices-imx31.h" 35#include "devices-imx31.h"
36#include "devices.h"
37 36
38/* FPGA defines */ 37/* FPGA defines */
39#define QONG_FPGA_VERSION(major, minor, rev) \ 38#define QONG_FPGA_VERSION(major, minor, rev) \
diff --git a/arch/arm/mach-mx3/mach-vpr200.c b/arch/arm/mach-mx3/mach-vpr200.c
index dab34c508256..d74e3473d236 100644
--- a/arch/arm/mach-mx3/mach-vpr200.c
+++ b/arch/arm/mach-mx3/mach-vpr200.c
@@ -32,15 +32,12 @@
32#include <mach/common.h> 32#include <mach/common.h>
33#include <mach/iomux-mx35.h> 33#include <mach/iomux-mx35.h>
34#include <mach/irqs.h> 34#include <mach/irqs.h>
35#include <mach/ipu.h>
36#include <mach/mx3fb.h>
37 35
38#include <linux/i2c.h> 36#include <linux/i2c.h>
39#include <linux/i2c/at24.h> 37#include <linux/i2c/at24.h>
40#include <linux/mfd/mc13xxx.h> 38#include <linux/mfd/mc13xxx.h>
41 39
42#include "devices-imx35.h" 40#include "devices-imx35.h"
43#include "devices.h"
44 41
45#define GPIO_LCDPWR IMX_GPIO_NR(1, 2) 42#define GPIO_LCDPWR IMX_GPIO_NR(1, 2)
46#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0) 43#define GPIO_PMIC_INT IMX_GPIO_NR(2, 0)
@@ -90,12 +87,11 @@ static const struct fb_videomode fb_modedb[] = {
90 } 87 }
91}; 88};
92 89
93static struct ipu_platform_data mx3_ipu_data = { 90static const struct ipu_platform_data mx3_ipu_data __initconst = {
94 .irq_base = MXC_IPU_IRQ_START, 91 .irq_base = MXC_IPU_IRQ_START,
95}; 92};
96 93
97static struct mx3fb_platform_data mx3fb_pdata = { 94static struct mx3fb_platform_data mx3fb_pdata __initdata = {
98 .dma_dev = &mx3_ipu.dev,
99 .name = "PT0708048", 95 .name = "PT0708048",
100 .mode = fb_modedb, 96 .mode = fb_modedb,
101 .num_modes = ARRAY_SIZE(fb_modedb), 97 .num_modes = ARRAY_SIZE(fb_modedb),
@@ -292,8 +288,8 @@ static void __init vpr200_board_init(void)
292 imx35_add_imx_uart0(NULL); 288 imx35_add_imx_uart0(NULL);
293 imx35_add_imx_uart2(NULL); 289 imx35_add_imx_uart2(NULL);
294 290
295 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 291 imx35_add_ipu_core(&mx3_ipu_data);
296 mxc_register_device(&mx3_fb, &mx3fb_pdata); 292 imx35_add_mx3_sdc_fb(&mx3fb_pdata);
297 293
298 imx35_add_fsl_usb2_udc(&otg_device_pdata); 294 imx35_add_fsl_usb2_udc(&otg_device_pdata);
299 imx35_add_mxc_ehci_hs(&usb_host_pdata); 295 imx35_add_mxc_ehci_hs(&usb_host_pdata);
diff --git a/arch/arm/mach-mx3/mx31lilly-db.c b/arch/arm/mach-mx3/mx31lilly-db.c
index 8f1a38ebf5c8..e70f4527c918 100644
--- a/arch/arm/mach-mx3/mx31lilly-db.c
+++ b/arch/arm/mach-mx3/mx31lilly-db.c
@@ -34,11 +34,8 @@
34#include <mach/common.h> 34#include <mach/common.h>
35#include <mach/iomux-mx3.h> 35#include <mach/iomux-mx3.h>
36#include <mach/board-mx31lilly.h> 36#include <mach/board-mx31lilly.h>
37#include <mach/mx3fb.h>
38#include <mach/ipu.h>
39 37
40#include "devices-imx31.h" 38#include "devices-imx31.h"
41#include "devices.h"
42 39
43/* 40/*
44 * This file contains board-specific initialization routines for the 41 * This file contains board-specific initialization routines for the
@@ -164,7 +161,7 @@ static const struct imxmmc_platform_data mmc_pdata __initconst = {
164}; 161};
165 162
166/* Framebuffer support */ 163/* Framebuffer support */
167static struct ipu_platform_data ipu_data __initdata = { 164static const struct ipu_platform_data ipu_data __initconst = {
168 .irq_base = MXC_IPU_IRQ_START, 165 .irq_base = MXC_IPU_IRQ_START,
169}; 166};
170 167
@@ -187,7 +184,6 @@ static const struct fb_videomode fb_modedb = {
187}; 184};
188 185
189static struct mx3fb_platform_data fb_pdata __initdata = { 186static struct mx3fb_platform_data fb_pdata __initdata = {
190 .dma_dev = &mx3_ipu.dev,
191 .name = "CRT-VGA", 187 .name = "CRT-VGA",
192 .mode = &fb_modedb, 188 .mode = &fb_modedb,
193 .num_modes = 1, 189 .num_modes = 1,
@@ -202,8 +198,8 @@ static void __init mx31lilly_init_fb(void)
202 return; 198 return;
203 } 199 }
204 200
205 mxc_register_device(&mx3_ipu, &ipu_data); 201 imx31_add_ipu_core(&ipu_data);
206 mxc_register_device(&mx3_fb, &fb_pdata); 202 imx31_add_mx3_sdc_fb(&fb_pdata);
207 gpio_direction_output(LCD_VCC_EN_GPIO, 1); 203 gpio_direction_output(LCD_VCC_EN_GPIO, 1);
208} 204}
209 205
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
index 04fab659947c..5aa053edc17c 100644
--- a/arch/arm/mach-mx3/mx31lite-db.c
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -37,7 +37,6 @@
37#include <mach/board-mx31lite.h> 37#include <mach/board-mx31lite.h>
38 38
39#include "devices-imx31.h" 39#include "devices-imx31.h"
40#include "devices.h"
41 40
42/* 41/*
43 * This file contains board-specific initialization routines for the 42 * This file contains board-specific initialization routines for the
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 6410b9c48a02..0aa25364360d 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -28,7 +28,6 @@
28#include <mach/ulpi.h> 28#include <mach/ulpi.h>
29 29
30#include "devices-imx31.h" 30#include "devices-imx31.h"
31#include "devices.h"
32 31
33static unsigned int devboard_pins[] = { 32static unsigned int devboard_pins[] = {
34 /* UART1 */ 33 /* UART1 */
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index f3aa0ce497b2..bb639cbda4e5 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -32,7 +32,6 @@
32#include <media/soc_camera.h> 32#include <media/soc_camera.h>
33 33
34#include "devices-imx31.h" 34#include "devices-imx31.h"
35#include "devices.h"
36 35
37static unsigned int marxbot_pins[] = { 36static unsigned int marxbot_pins[] = {
38 /* SDHC2 */ 37 /* SDHC2 */
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
index 35f806e737c1..fabb801e7994 100644
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -32,7 +32,6 @@
32#include <media/soc_camera.h> 32#include <media/soc_camera.h>
33 33
34#include "devices-imx31.h" 34#include "devices-imx31.h"
35#include "devices.h"
36 35
37static unsigned int smartbot_pins[] = { 36static unsigned int smartbot_pins[] = {
38 /* UART1 */ 37 /* UART1 */
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 0e8d7ab7898a..a860b16d7258 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -41,6 +41,9 @@ config IMX_HAVE_PLATFORM_IMX_UART
41config IMX_HAVE_PLATFORM_IMX_UDC 41config IMX_HAVE_PLATFORM_IMX_UDC
42 bool 42 bool
43 43
44config IMX_HAVE_PLATFORM_IPU_CORE
45 bool
46
44config IMX_HAVE_PLATFORM_MX1_CAMERA 47config IMX_HAVE_PLATFORM_MX1_CAMERA
45 bool 48 bool
46 49
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index ca227eaea7cc..ad2922acf480 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o
12obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o 12obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
13obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o 13obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
14obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o 14obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
15obj-$(CONFIG_IMX_HAVE_PLATFORM_IPU_CORE) += platform-ipu-core.o
15obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o 16obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o
16obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o 17obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o
17obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o 18obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o
diff --git a/arch/arm/plat-mxc/devices/platform-ipu-core.c b/arch/arm/plat-mxc/devices/platform-ipu-core.c
new file mode 100644
index 000000000000..edf65034aea5
--- /dev/null
+++ b/arch/arm/plat-mxc/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 <mach/hardware.h>
10#include <mach/devices-common.h>
11
12#define imx_ipu_core_entry_single(soc) \
13{ \
14 .iobase = soc ## _IPU_CTRL_BASE_ADDR, \
15 .synirq = soc ## _INT_IPU_SYN, \
16 .errirq = soc ## _INT_IPU_ERR, \
17}
18
19#ifdef CONFIG_SOC_IMX31
20const struct imx_ipu_core_data imx31_ipu_core_data __initconst =
21 imx_ipu_core_entry_single(MX31);
22#endif
23
24#ifdef CONFIG_SOC_IMX35
25const struct imx_ipu_core_data imx35_ipu_core_data __initconst =
26 imx_ipu_core_entry_single(MX35);
27#endif
28
29static struct platform_device *imx_ipu_coredev __initdata;
30
31struct platform_device *__init imx_add_ipu_core(
32 const struct imx_ipu_core_data *data,
33 const struct ipu_platform_data *pdata)
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), pdata, sizeof(*pdata));
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/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index b0bc1987c1d3..fa8477337f91 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -166,6 +166,24 @@ struct platform_device *__init imx_add_imx_udc(
166 const struct imx_imx_udc_data *data, 166 const struct imx_imx_udc_data *data,
167 const struct imxusb_platform_data *pdata); 167 const struct imxusb_platform_data *pdata);
168 168
169#include <mach/ipu.h>
170#include <mach/mx3fb.h>
171#include <mach/mx3_camera.h>
172struct imx_ipu_core_data {
173 resource_size_t iobase;
174 resource_size_t synirq;
175 resource_size_t errirq;
176};
177struct platform_device *__init imx_add_ipu_core(
178 const struct imx_ipu_core_data *data,
179 const struct ipu_platform_data *pdata);
180struct platform_device *__init imx_alloc_mx3_camera(
181 const struct imx_ipu_core_data *data,
182 const struct mx3_camera_pdata *pdata);
183struct platform_device *__init imx_add_mx3_sdc_fb(
184 const struct imx_ipu_core_data *data,
185 struct mx3fb_platform_data *pdata);
186
169#include <mach/mx1_camera.h> 187#include <mach/mx1_camera.h>
170struct imx_mx1_camera_data { 188struct imx_mx1_camera_data {
171 resource_size_t iobase; 189 resource_size_t iobase;