diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-11 11:11:34 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-19 15:53:48 -0500 |
commit | bb4c853ff18fe3b0e2aec45053c318479e0c55e3 (patch) | |
tree | fd5a90eeacaf73be2d121ff1c5d3a9db2cb5e80b | |
parent | 00871505dcf15418aebc402db9f124dd2738fa2d (diff) |
ARM: mx25: dynamically allocate mx2-camera devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r-- | arch/arm/mach-mx25/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-mx25/devices-imx25.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-mx25/devices.c | 45 | ||||
-rw-r--r-- | arch/arm/mach-mx25/devices.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-mx2-camera.c | 23 |
5 files changed, 22 insertions, 53 deletions
diff --git a/arch/arm/mach-mx25/Makefile b/arch/arm/mach-mx25/Makefile index d9e46ce00a4e..f7f7648d2a55 100644 --- a/arch/arm/mach-mx25/Makefile +++ b/arch/arm/mach-mx25/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-y := mm.o devices.o | 1 | obj-y := mm.o |
2 | obj-$(CONFIG_ARCH_MX25) += clock.o | 2 | obj-$(CONFIG_ARCH_MX25) += clock.o |
3 | obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o | 3 | obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o |
4 | obj-$(CONFIG_MACH_EUKREA_CPUIMX25) += mach-cpuimx25.o | 4 | obj-$(CONFIG_MACH_EUKREA_CPUIMX25) += mach-cpuimx25.o |
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h index bf70548caf04..953e1ce5334f 100644 --- a/arch/arm/mach-mx25/devices-imx25.h +++ b/arch/arm/mach-mx25/devices-imx25.h | |||
@@ -59,6 +59,10 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst; | |||
59 | #define imx25_add_imx_uart3(pdata) imx25_add_imx_uart(3, pdata) | 59 | #define imx25_add_imx_uart3(pdata) imx25_add_imx_uart(3, pdata) |
60 | #define imx25_add_imx_uart4(pdata) imx25_add_imx_uart(4, pdata) | 60 | #define imx25_add_imx_uart4(pdata) imx25_add_imx_uart(4, pdata) |
61 | 61 | ||
62 | extern const struct imx_mx2_camera_data imx25_mx2_camera_data __initconst; | ||
63 | #define imx25_add_mx2_camera(pdata) \ | ||
64 | imx_add_mx2_camera(&imx25_mx2_camera_data, pdata) | ||
65 | |||
62 | extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst; | 66 | extern const struct imx_mxc_ehci_data imx25_mxc_ehci_otg_data __initconst; |
63 | #define imx25_add_mxc_ehci_otg(pdata) \ | 67 | #define imx25_add_mxc_ehci_otg(pdata) \ |
64 | imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata) | 68 | imx_add_mxc_ehci(&imx25_mxc_ehci_otg_data, pdata) |
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c deleted file mode 100644 index 12f31ef43e9f..000000000000 --- a/arch/arm/mach-mx25/devices.c +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2009 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/platform_device.h> | ||
20 | #include <linux/dma-mapping.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <mach/mx25.h> | ||
23 | #include <mach/irqs.h> | ||
24 | |||
25 | static struct resource mx25_csi_resources[] = { | ||
26 | { | ||
27 | .start = MX25_CSI_BASE_ADDR, | ||
28 | .end = MX25_CSI_BASE_ADDR + 0xfff, | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | }, | ||
31 | { | ||
32 | .start = MX25_INT_CSI, | ||
33 | .flags = IORESOURCE_IRQ | ||
34 | }, | ||
35 | }; | ||
36 | |||
37 | struct platform_device mx25_csi_device = { | ||
38 | .name = "mx2-camera", | ||
39 | .id = 0, | ||
40 | .num_resources = ARRAY_SIZE(mx25_csi_resources), | ||
41 | .resource = mx25_csi_resources, | ||
42 | .dev = { | ||
43 | .coherent_dma_mask = 0xffffffff, | ||
44 | }, | ||
45 | }; | ||
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h index fbb75ff5de73..e69de29bb2d1 100644 --- a/arch/arm/mach-mx25/devices.h +++ b/arch/arm/mach-mx25/devices.h | |||
@@ -1 +0,0 @@ | |||
1 | extern struct platform_device mx25_csi_device; | ||
diff --git a/arch/arm/plat-mxc/devices/platform-mx2-camera.c b/arch/arm/plat-mxc/devices/platform-mx2-camera.c index a18c80355de0..b3f4828dc447 100644 --- a/arch/arm/plat-mxc/devices/platform-mx2-camera.c +++ b/arch/arm/plat-mxc/devices/platform-mx2-camera.c | |||
@@ -12,6 +12,12 @@ | |||
12 | #define imx_mx2_camera_data_entry_single(soc) \ | 12 | #define imx_mx2_camera_data_entry_single(soc) \ |
13 | { \ | 13 | { \ |
14 | .iobasecsi = soc ## _CSI_BASE_ADDR, \ | 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, \ | ||
15 | .iosizecsi = SZ_32, \ | 21 | .iosizecsi = SZ_32, \ |
16 | .irqcsi = soc ## _INT_CSI, \ | 22 | .irqcsi = soc ## _INT_CSI, \ |
17 | .iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR, \ | 23 | .iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR, \ |
@@ -19,9 +25,14 @@ | |||
19 | .irqemmaprp = soc ## _INT_EMMAPRP, \ | 25 | .irqemmaprp = soc ## _INT_EMMAPRP, \ |
20 | } | 26 | } |
21 | 27 | ||
28 | #ifdef CONFIG_SOC_IMX25 | ||
29 | const 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 | |||
22 | #ifdef CONFIG_SOC_IMX27 | 33 | #ifdef CONFIG_SOC_IMX27 |
23 | const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst = | 34 | const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst = |
24 | imx_mx2_camera_data_entry_single(MX27); | 35 | imx_mx2_camera_data_entry_single_emma(MX27); |
25 | #endif /* ifdef CONFIG_SOC_IMX27 */ | 36 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
26 | 37 | ||
27 | struct platform_device *__init imx_add_mx2_camera( | 38 | struct platform_device *__init imx_add_mx2_camera( |
@@ -34,20 +45,20 @@ struct platform_device *__init imx_add_mx2_camera( | |||
34 | .end = data->iobasecsi + data->iosizecsi - 1, | 45 | .end = data->iobasecsi + data->iosizecsi - 1, |
35 | .flags = IORESOURCE_MEM, | 46 | .flags = IORESOURCE_MEM, |
36 | }, { | 47 | }, { |
37 | .start = data->iobaseemmaprp, | ||
38 | .end = data->iobaseemmaprp + data->iosizeemmaprp - 1, | ||
39 | .flags = IORESOURCE_MEM, | ||
40 | }, { | ||
41 | .start = data->irqcsi, | 48 | .start = data->irqcsi, |
42 | .end = data->irqcsi, | 49 | .end = data->irqcsi, |
43 | .flags = IORESOURCE_IRQ, | 50 | .flags = IORESOURCE_IRQ, |
44 | }, { | 51 | }, { |
52 | .start = data->iobaseemmaprp, | ||
53 | .end = data->iobaseemmaprp + data->iosizeemmaprp - 1, | ||
54 | .flags = IORESOURCE_MEM, | ||
55 | }, { | ||
45 | .start = data->irqemmaprp, | 56 | .start = data->irqemmaprp, |
46 | .end = data->irqemmaprp, | 57 | .end = data->irqemmaprp, |
47 | .flags = IORESOURCE_IRQ, | 58 | .flags = IORESOURCE_IRQ, |
48 | }, | 59 | }, |
49 | }; | 60 | }; |
50 | return imx_add_platform_device_dmamask("mx2-camera", 0, | 61 | return imx_add_platform_device_dmamask("mx2-camera", 0, |
51 | res, ARRAY_SIZE(res), | 62 | res, data->iobaseemmaprp ? 4 : 2, |
52 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | 63 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); |
53 | } | 64 | } |