diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-02 12:50:55 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-17 04:01:24 -0500 |
commit | b2997cb12b302ee6d233808e32214d00afdcf128 (patch) | |
tree | e9c7896465e257f72846fb0c5b89ed33fb8593ec /arch | |
parent | 3bde75b5370bd69fd7f07a8e254bef05b1b5b219 (diff) |
ARM: imx: dynamically allocate mx2-camera device
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-imx/devices-imx27.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.c | 32 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-mx2-camera.c | 53 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/devices-common.h | 13 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/mx27.h | 4 |
8 files changed, 76 insertions, 35 deletions
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h index b957e78e052b..84b3405e982d 100644 --- a/arch/arm/mach-imx/devices-imx27.h +++ b/arch/arm/mach-imx/devices-imx27.h | |||
@@ -31,6 +31,10 @@ extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst; | |||
31 | #define imx27_add_imx_uart4(pdata) imx27_add_imx_uart(4, pdata) | 31 | #define imx27_add_imx_uart4(pdata) imx27_add_imx_uart(4, pdata) |
32 | #define imx27_add_imx_uart5(pdata) imx27_add_imx_uart(5, pdata) | 32 | #define imx27_add_imx_uart5(pdata) imx27_add_imx_uart(5, pdata) |
33 | 33 | ||
34 | extern const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst; | ||
35 | #define imx27_add_mx2_camera(pdata) \ | ||
36 | imx_add_mx2_camera(&imx27_mx2_camera_data, pdata) | ||
37 | |||
34 | extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst; | 38 | extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst; |
35 | #define imx27_add_mxc_nand(pdata) \ | 39 | #define imx27_add_mxc_nand(pdata) \ |
36 | imx_add_mxc_nand(&imx27_mxc_nand_data, pdata) | 40 | imx_add_mxc_nand(&imx27_mxc_nand_data, pdata) |
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c index 31c9d6c583a3..0c5ade48d598 100644 --- a/arch/arm/mach-imx/devices.c +++ b/arch/arm/mach-imx/devices.c | |||
@@ -77,38 +77,6 @@ int __init imx1_register_gpios(void) | |||
77 | #endif | 77 | #endif |
78 | 78 | ||
79 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) | 79 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) |
80 | |||
81 | #ifdef CONFIG_MACH_MX27 | ||
82 | static struct resource mx27_camera_resources[] = { | ||
83 | { | ||
84 | .start = MX27_CSI_BASE_ADDR, | ||
85 | .end = MX27_CSI_BASE_ADDR + 0x1f, | ||
86 | .flags = IORESOURCE_MEM, | ||
87 | }, { | ||
88 | .start = MX27_EMMA_PRP_BASE_ADDR, | ||
89 | .end = MX27_EMMA_PRP_BASE_ADDR + 0x1f, | ||
90 | .flags = IORESOURCE_MEM, | ||
91 | }, { | ||
92 | .start = MX27_INT_CSI, | ||
93 | .end = MX27_INT_CSI, | ||
94 | .flags = IORESOURCE_IRQ, | ||
95 | },{ | ||
96 | .start = MX27_INT_EMMAPRP, | ||
97 | .end = MX27_INT_EMMAPRP, | ||
98 | .flags = IORESOURCE_IRQ, | ||
99 | }, | ||
100 | }; | ||
101 | struct platform_device mx27_camera_device = { | ||
102 | .name = "mx2-camera", | ||
103 | .id = 0, | ||
104 | .num_resources = ARRAY_SIZE(mx27_camera_resources), | ||
105 | .resource = mx27_camera_resources, | ||
106 | .dev = { | ||
107 | .coherent_dma_mask = 0xffffffff, | ||
108 | }, | ||
109 | }; | ||
110 | #endif | ||
111 | |||
112 | /* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */ | 80 | /* Watchdog: i.MX1 has seperate driver, i.MX21 and i.MX27 are equal */ |
113 | static struct resource mxc_wdt_resources[] = { | 81 | static struct resource mxc_wdt_resources[] = { |
114 | { | 82 | { |
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h index 8f14452c7d23..3d020b91ef5d 100644 --- a/arch/arm/mach-imx/devices.h +++ b/arch/arm/mach-imx/devices.h | |||
@@ -5,7 +5,6 @@ extern struct platform_device mxc_pwm_device; | |||
5 | extern struct platform_device mxc_sdhc_device0; | 5 | extern struct platform_device mxc_sdhc_device0; |
6 | extern struct platform_device mxc_sdhc_device1; | 6 | extern struct platform_device mxc_sdhc_device1; |
7 | extern struct platform_device mxc_otg_udc_device; | 7 | extern struct platform_device mxc_otg_udc_device; |
8 | extern struct platform_device mx27_camera_device; | ||
9 | extern struct platform_device mxc_otg_host; | 8 | extern struct platform_device mxc_otg_host; |
10 | extern struct platform_device mxc_usbh1; | 9 | extern struct platform_device mxc_usbh1; |
11 | extern struct platform_device mxc_usbh2; | 10 | extern struct platform_device mxc_usbh2; |
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 61a3e25cada6..37d7e001d72c 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig | |||
@@ -28,6 +28,9 @@ config IMX_HAVE_PLATFORM_IMX_UDC | |||
28 | config IMX_HAVE_PLATFORM_MX1_CAMERA | 28 | config IMX_HAVE_PLATFORM_MX1_CAMERA |
29 | bool | 29 | bool |
30 | 30 | ||
31 | config IMX_HAVE_PLATFORM_MX2_CAMERA | ||
32 | bool | ||
33 | |||
31 | config IMX_HAVE_PLATFORM_MXC_NAND | 34 | config IMX_HAVE_PLATFORM_MXC_NAND |
32 | bool | 35 | bool |
33 | 36 | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index 86b47f2b610e..88392fc47c0a 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -8,6 +8,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o | |||
8 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o | 8 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o |
9 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o | 9 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o |
10 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o | 10 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MX1_CAMERA) += platform-mx1-camera.o |
11 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MX2_CAMERA) += platform-mx2-camera.o | ||
11 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o | 12 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o |
12 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o | 13 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o |
13 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o | 14 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o |
diff --git a/arch/arm/plat-mxc/devices/platform-mx2-camera.c b/arch/arm/plat-mxc/devices/platform-mx2-camera.c new file mode 100644 index 000000000000..a18c80355de0 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-mx2-camera.c | |||
@@ -0,0 +1,53 @@ | |||
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 <mach/devices-common.h> | ||
11 | |||
12 | #define imx_mx2_camera_data_entry_single(soc) \ | ||
13 | { \ | ||
14 | .iobasecsi = soc ## _CSI_BASE_ADDR, \ | ||
15 | .iosizecsi = SZ_32, \ | ||
16 | .irqcsi = soc ## _INT_CSI, \ | ||
17 | .iobaseemmaprp = soc ## _EMMAPRP_BASE_ADDR, \ | ||
18 | .iosizeemmaprp = SZ_32, \ | ||
19 | .irqemmaprp = soc ## _INT_EMMAPRP, \ | ||
20 | } | ||
21 | |||
22 | #ifdef CONFIG_SOC_IMX27 | ||
23 | const struct imx_mx2_camera_data imx27_mx2_camera_data __initconst = | ||
24 | imx_mx2_camera_data_entry_single(MX27); | ||
25 | #endif /* ifdef CONFIG_SOC_IMX27 */ | ||
26 | |||
27 | struct platform_device *__init imx_add_mx2_camera( | ||
28 | const struct imx_mx2_camera_data *data, | ||
29 | const struct mx2_camera_platform_data *pdata) | ||
30 | { | ||
31 | struct resource res[] = { | ||
32 | { | ||
33 | .start = data->iobasecsi, | ||
34 | .end = data->iobasecsi + data->iosizecsi - 1, | ||
35 | .flags = IORESOURCE_MEM, | ||
36 | }, { | ||
37 | .start = data->iobaseemmaprp, | ||
38 | .end = data->iobaseemmaprp + data->iosizeemmaprp - 1, | ||
39 | .flags = IORESOURCE_MEM, | ||
40 | }, { | ||
41 | .start = data->irqcsi, | ||
42 | .end = data->irqcsi, | ||
43 | .flags = IORESOURCE_IRQ, | ||
44 | }, { | ||
45 | .start = data->irqemmaprp, | ||
46 | .end = data->irqemmaprp, | ||
47 | .flags = IORESOURCE_IRQ, | ||
48 | }, | ||
49 | }; | ||
50 | return imx_add_platform_device_dmamask("mx2-camera", 0, | ||
51 | res, ARRAY_SIZE(res), | ||
52 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | ||
53 | } | ||
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index ab0500a7b5e7..e31fc50384c8 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -118,6 +118,19 @@ struct platform_device *__init imx_add_mx1_camera( | |||
118 | const struct imx_mx1_camera_data *data, | 118 | const struct imx_mx1_camera_data *data, |
119 | const struct mx1_camera_pdata *pdata); | 119 | const struct mx1_camera_pdata *pdata); |
120 | 120 | ||
121 | #include <mach/mx2_cam.h> | ||
122 | struct imx_mx2_camera_data { | ||
123 | resource_size_t iobasecsi; | ||
124 | resource_size_t iosizecsi; | ||
125 | resource_size_t irqcsi; | ||
126 | resource_size_t iobaseemmaprp; | ||
127 | resource_size_t iosizeemmaprp; | ||
128 | resource_size_t irqemmaprp; | ||
129 | }; | ||
130 | struct platform_device *__init imx_add_mx2_camera( | ||
131 | const struct imx_mx2_camera_data *data, | ||
132 | const struct mx2_camera_platform_data *pdata); | ||
133 | |||
121 | #include <mach/mxc_nand.h> | 134 | #include <mach/mxc_nand.h> |
122 | struct imx_mxc_nand_data { | 135 | struct imx_mxc_nand_data { |
123 | /* | 136 | /* |
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h index 3116b3b3d83e..2734d24e8e1c 100644 --- a/arch/arm/plat-mxc/include/mach/mx27.h +++ b/arch/arm/plat-mxc/include/mach/mx27.h | |||
@@ -67,8 +67,8 @@ | |||
67 | #define MX27_USBOTG_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x24000) | 67 | #define MX27_USBOTG_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x24000) |
68 | #define MX27_OTG_BASE_ADDR MX27_USBOTG_BASE_ADDR | 68 | #define MX27_OTG_BASE_ADDR MX27_USBOTG_BASE_ADDR |
69 | #define MX27_SAHARA_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x25000) | 69 | #define MX27_SAHARA_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x25000) |
70 | #define MX27_EMMA_PP_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x26000) | 70 | #define MX27_EMMAPP_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x26000) |
71 | #define MX27_EMMA_PRP_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x26400) | 71 | #define MX27_EMMAPRP_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x26400) |
72 | #define MX27_CCM_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x27000) | 72 | #define MX27_CCM_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x27000) |
73 | #define MX27_SYSCTRL_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x27800) | 73 | #define MX27_SYSCTRL_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x27800) |
74 | #define MX27_IIM_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x28000) | 74 | #define MX27_IIM_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x28000) |