diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-02 06:59:08 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-17 04:01:22 -0500 |
commit | 9bb39b3f600101b09cbb35e0a0deb9d56c4fe67f (patch) | |
tree | 65e5b6b88415b4ff2600fd006b2d24df97e8c9c1 /arch | |
parent | 6332c1071811a1d588cfc93330d87a57a7460a1b (diff) |
ARM: imx: dynamically allocate mx1-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.c | 25 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.h | 4 | ||||
-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-mx1-camera.c | 42 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/devices-common.h | 10 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/mx1.h | 2 |
7 files changed, 57 insertions, 30 deletions
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c index fba628551dc9..31c9d6c583a3 100644 --- a/arch/arm/mach-imx/devices.c +++ b/arch/arm/mach-imx/devices.c | |||
@@ -45,31 +45,6 @@ | |||
45 | #include "devices.h" | 45 | #include "devices.h" |
46 | 46 | ||
47 | #if defined(CONFIG_ARCH_MX1) | 47 | #if defined(CONFIG_ARCH_MX1) |
48 | static struct resource imx1_camera_resources[] = { | ||
49 | { | ||
50 | .start = 0x00224000, | ||
51 | .end = 0x00224010, | ||
52 | .flags = IORESOURCE_MEM, | ||
53 | }, { | ||
54 | .start = MX1_CSI_INT, | ||
55 | .end = MX1_CSI_INT, | ||
56 | .flags = IORESOURCE_IRQ, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | static u64 imx1_camera_dmamask = DMA_BIT_MASK(32); | ||
61 | |||
62 | struct platform_device imx1_camera_device = { | ||
63 | .name = "mx1-camera", | ||
64 | .id = 0, /* This is used to put cameras on this interface */ | ||
65 | .dev = { | ||
66 | .dma_mask = &imx1_camera_dmamask, | ||
67 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
68 | }, | ||
69 | .resource = imx1_camera_resources, | ||
70 | .num_resources = ARRAY_SIZE(imx1_camera_resources), | ||
71 | }; | ||
72 | |||
73 | /* GPIO port description */ | 48 | /* GPIO port description */ |
74 | static struct mxc_gpio_port imx_gpio_ports[] = { | 49 | static struct mxc_gpio_port imx_gpio_ports[] = { |
75 | { | 50 | { |
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h index 91906ce21c40..8f14452c7d23 100644 --- a/arch/arm/mach-imx/devices.h +++ b/arch/arm/mach-imx/devices.h | |||
@@ -1,7 +1,3 @@ | |||
1 | #ifdef CONFIG_ARCH_MX1 | ||
2 | extern struct platform_device imx1_camera_device; | ||
3 | #endif | ||
4 | |||
5 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) | 1 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) |
6 | extern struct platform_device mxc_wdt; | 2 | extern struct platform_device mxc_wdt; |
7 | extern struct platform_device mxc_fb_device; | 3 | extern struct platform_device mxc_fb_device; |
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 2703f5a05ce5..61a3e25cada6 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig | |||
@@ -25,6 +25,9 @@ config IMX_HAVE_PLATFORM_IMX_UART | |||
25 | config IMX_HAVE_PLATFORM_IMX_UDC | 25 | config IMX_HAVE_PLATFORM_IMX_UDC |
26 | bool | 26 | bool |
27 | 27 | ||
28 | config IMX_HAVE_PLATFORM_MX1_CAMERA | ||
29 | bool | ||
30 | |||
28 | config IMX_HAVE_PLATFORM_MXC_NAND | 31 | config IMX_HAVE_PLATFORM_MXC_NAND |
29 | bool | 32 | bool |
30 | 33 | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index 7c3eaf146f8b..86b47f2b610e 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o | |||
7 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o | 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_MXC_NAND) += platform-mxc_nand.o | 11 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o |
11 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o | 12 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o |
12 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o | 13 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o |
diff --git a/arch/arm/plat-mxc/devices/platform-mx1-camera.c b/arch/arm/plat-mxc/devices/platform-mx1-camera.c new file mode 100644 index 000000000000..edcc581a30a9 --- /dev/null +++ b/arch/arm/plat-mxc/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 <mach/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 | ||
20 | const 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 | |||
24 | struct 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/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index a5e97b8b3b79..ab0500a7b5e7 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -108,6 +108,16 @@ struct platform_device *__init imx_add_imx_udc( | |||
108 | const struct imx_imx_udc_data *data, | 108 | const struct imx_imx_udc_data *data, |
109 | const struct imxusb_platform_data *pdata); | 109 | const struct imxusb_platform_data *pdata); |
110 | 110 | ||
111 | #include <mach/mx1_camera.h> | ||
112 | struct imx_mx1_camera_data { | ||
113 | resource_size_t iobase; | ||
114 | resource_size_t iosize; | ||
115 | resource_size_t irq; | ||
116 | }; | ||
117 | struct platform_device *__init imx_add_mx1_camera( | ||
118 | const struct imx_mx1_camera_data *data, | ||
119 | const struct mx1_camera_pdata *pdata); | ||
120 | |||
111 | #include <mach/mxc_nand.h> | 121 | #include <mach/mxc_nand.h> |
112 | struct imx_mxc_nand_data { | 122 | struct imx_mxc_nand_data { |
113 | /* | 123 | /* |
diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/plat-mxc/include/mach/mx1.h index 2cd3fcd1e0cf..f1e336ebcb2e 100644 --- a/arch/arm/plat-mxc/include/mach/mx1.h +++ b/arch/arm/plat-mxc/include/mach/mx1.h | |||
@@ -77,7 +77,7 @@ | |||
77 | 77 | ||
78 | /* fixed interrput numbers */ | 78 | /* fixed interrput numbers */ |
79 | #define MX1_INT_SOFTINT 0 | 79 | #define MX1_INT_SOFTINT 0 |
80 | #define MX1_CSI_INT 6 | 80 | #define MX1_INT_CSI 6 |
81 | #define MX1_DSPA_MAC_INT 7 | 81 | #define MX1_DSPA_MAC_INT 7 |
82 | #define MX1_DSPA_INT 8 | 82 | #define MX1_DSPA_INT 8 |
83 | #define MX1_COMP_INT 9 | 83 | #define MX1_COMP_INT 9 |