diff options
author | Javier Martin <javier.martin@vista-silicon.com> | 2012-02-28 11:31:51 -0500 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-03-02 02:25:26 -0500 |
commit | f52f5a5503b5ad20902f0aede3f09e660d7fcfc3 (patch) | |
tree | 301c77ba40f39636915a0696a3198cf052d2236d | |
parent | baa1dee18a0f15477f8b109227c0c8e7a92b7048 (diff) |
i.MX27: visstrim_m10: Add video support.
Vista Silicon Visstrim_m10 board has a tvp5150
video decoder attached to the CSI interface
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-imx27_visstrim_m10.c | 100 |
2 files changed, 101 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 3d82133a89f6..8102e7f361f3 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -320,6 +320,7 @@ config MACH_IMX27_VISSTRIM_M10 | |||
320 | select IMX_HAVE_PLATFORM_IMX_I2C | 320 | select IMX_HAVE_PLATFORM_IMX_I2C |
321 | select IMX_HAVE_PLATFORM_IMX_SSI | 321 | select IMX_HAVE_PLATFORM_IMX_SSI |
322 | select IMX_HAVE_PLATFORM_IMX_UART | 322 | select IMX_HAVE_PLATFORM_IMX_UART |
323 | select IMX_HAVE_PLATFORM_MX2_CAMERA | ||
323 | select IMX_HAVE_PLATFORM_MXC_EHCI | 324 | select IMX_HAVE_PLATFORM_MXC_EHCI |
324 | select IMX_HAVE_PLATFORM_MXC_MMC | 325 | select IMX_HAVE_PLATFORM_MXC_MMC |
325 | help | 326 | help |
diff --git a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c index 479d9e8bf84b..7208a9efad70 100644 --- a/arch/arm/mach-imx/mach-imx27_visstrim_m10.c +++ b/arch/arm/mach-imx/mach-imx27_visstrim_m10.c | |||
@@ -30,6 +30,9 @@ | |||
30 | #include <linux/input.h> | 30 | #include <linux/input.h> |
31 | #include <linux/gpio.h> | 31 | #include <linux/gpio.h> |
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/dma-mapping.h> | ||
34 | #include <linux/memblock.h> | ||
35 | #include <media/soc_camera.h> | ||
33 | #include <sound/tlv320aic32x4.h> | 36 | #include <sound/tlv320aic32x4.h> |
34 | #include <asm/mach-types.h> | 37 | #include <asm/mach-types.h> |
35 | #include <asm/mach/arch.h> | 38 | #include <asm/mach/arch.h> |
@@ -39,6 +42,8 @@ | |||
39 | 42 | ||
40 | #include "devices-imx27.h" | 43 | #include "devices-imx27.h" |
41 | 44 | ||
45 | #define TVP5150_RSTN (GPIO_PORTC + 18) | ||
46 | #define TVP5150_PWDN (GPIO_PORTC + 19) | ||
42 | #define OTG_PHY_CS_GPIO (GPIO_PORTF + 17) | 47 | #define OTG_PHY_CS_GPIO (GPIO_PORTF + 17) |
43 | #define SDHC1_IRQ IRQ_GPIOB(25) | 48 | #define SDHC1_IRQ IRQ_GPIOB(25) |
44 | 49 | ||
@@ -100,8 +105,99 @@ static const int visstrim_m10_pins[] __initconst = { | |||
100 | PE1_PF_USBOTG_STP, | 105 | PE1_PF_USBOTG_STP, |
101 | PB23_PF_USB_PWR, | 106 | PB23_PF_USB_PWR, |
102 | PB24_PF_USB_OC, | 107 | PB24_PF_USB_OC, |
108 | /* CSI */ | ||
109 | PB10_PF_CSI_D0, | ||
110 | PB11_PF_CSI_D1, | ||
111 | PB12_PF_CSI_D2, | ||
112 | PB13_PF_CSI_D3, | ||
113 | PB14_PF_CSI_D4, | ||
114 | PB15_PF_CSI_MCLK, | ||
115 | PB16_PF_CSI_PIXCLK, | ||
116 | PB17_PF_CSI_D5, | ||
117 | PB18_PF_CSI_D6, | ||
118 | PB19_PF_CSI_D7, | ||
119 | PB20_PF_CSI_VSYNC, | ||
120 | PB21_PF_CSI_HSYNC, | ||
103 | }; | 121 | }; |
104 | 122 | ||
123 | /* Camera */ | ||
124 | static int visstrim_camera_power(struct device *dev, int on) | ||
125 | { | ||
126 | gpio_set_value(TVP5150_PWDN, on); | ||
127 | |||
128 | return 0; | ||
129 | }; | ||
130 | |||
131 | static int visstrim_camera_reset(struct device *dev) | ||
132 | { | ||
133 | gpio_set_value(TVP5150_RSTN, 0); | ||
134 | ndelay(500); | ||
135 | gpio_set_value(TVP5150_RSTN, 1); | ||
136 | |||
137 | return 0; | ||
138 | }; | ||
139 | |||
140 | static struct i2c_board_info visstrim_i2c_camera = { | ||
141 | I2C_BOARD_INFO("tvp5150", 0x5d), | ||
142 | }; | ||
143 | |||
144 | static struct soc_camera_link iclink_tvp5150 = { | ||
145 | .bus_id = 0, | ||
146 | .board_info = &visstrim_i2c_camera, | ||
147 | .i2c_adapter_id = 0, | ||
148 | .power = visstrim_camera_power, | ||
149 | .reset = visstrim_camera_reset, | ||
150 | }; | ||
151 | |||
152 | static struct mx2_camera_platform_data visstrim_camera = { | ||
153 | .flags = MX2_CAMERA_CCIR | MX2_CAMERA_CCIR_INTERLACE | | ||
154 | MX2_CAMERA_SWAP16 | MX2_CAMERA_PCLK_SAMPLE_RISING, | ||
155 | .clk = 100000, | ||
156 | }; | ||
157 | |||
158 | static phys_addr_t mx2_camera_base __initdata; | ||
159 | #define MX2_CAMERA_BUF_SIZE SZ_8M | ||
160 | |||
161 | static void __init visstrim_camera_init(void) | ||
162 | { | ||
163 | struct platform_device *pdev; | ||
164 | int dma; | ||
165 | |||
166 | /* Initialize tvp5150 gpios */ | ||
167 | mxc_gpio_mode(TVP5150_RSTN | GPIO_GPIO | GPIO_OUT); | ||
168 | mxc_gpio_mode(TVP5150_PWDN | GPIO_GPIO | GPIO_OUT); | ||
169 | gpio_set_value(TVP5150_RSTN, 1); | ||
170 | gpio_set_value(TVP5150_PWDN, 0); | ||
171 | ndelay(1); | ||
172 | |||
173 | gpio_set_value(TVP5150_PWDN, 1); | ||
174 | ndelay(1); | ||
175 | gpio_set_value(TVP5150_RSTN, 0); | ||
176 | ndelay(500); | ||
177 | gpio_set_value(TVP5150_RSTN, 1); | ||
178 | ndelay(200000); | ||
179 | |||
180 | pdev = imx27_add_mx2_camera(&visstrim_camera); | ||
181 | if (IS_ERR(pdev)) | ||
182 | return; | ||
183 | |||
184 | dma = dma_declare_coherent_memory(&pdev->dev, | ||
185 | mx2_camera_base, mx2_camera_base, | ||
186 | MX2_CAMERA_BUF_SIZE, | ||
187 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | ||
188 | if (!(dma & DMA_MEMORY_MAP)) | ||
189 | return; | ||
190 | } | ||
191 | |||
192 | static void __init visstrim_reserve(void) | ||
193 | { | ||
194 | /* reserve 4 MiB for mx2-camera */ | ||
195 | mx2_camera_base = memblock_alloc(MX2_CAMERA_BUF_SIZE, | ||
196 | MX2_CAMERA_BUF_SIZE); | ||
197 | memblock_free(mx2_camera_base, MX2_CAMERA_BUF_SIZE); | ||
198 | memblock_remove(mx2_camera_base, MX2_CAMERA_BUF_SIZE); | ||
199 | } | ||
200 | |||
105 | /* GPIOs used as events for applications */ | 201 | /* GPIOs used as events for applications */ |
106 | static struct gpio_keys_button visstrim_gpio_keys[] = { | 202 | static struct gpio_keys_button visstrim_gpio_keys[] = { |
107 | { | 203 | { |
@@ -267,6 +363,9 @@ static void __init visstrim_m10_board_init(void) | |||
267 | imx27_add_fec(NULL); | 363 | imx27_add_fec(NULL); |
268 | imx_add_gpio_keys(&visstrim_gpio_keys_platform_data); | 364 | imx_add_gpio_keys(&visstrim_gpio_keys_platform_data); |
269 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 365 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
366 | platform_device_register_resndata(NULL, "soc-camera-pdrv", 0, NULL, 0, | ||
367 | &iclink_tvp5150, sizeof(iclink_tvp5150)); | ||
368 | visstrim_camera_init(); | ||
270 | } | 369 | } |
271 | 370 | ||
272 | static void __init visstrim_m10_timer_init(void) | 371 | static void __init visstrim_m10_timer_init(void) |
@@ -280,6 +379,7 @@ static struct sys_timer visstrim_m10_timer = { | |||
280 | 379 | ||
281 | MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10") | 380 | MACHINE_START(IMX27_VISSTRIM_M10, "Vista Silicon Visstrim_M10") |
282 | .atag_offset = 0x100, | 381 | .atag_offset = 0x100, |
382 | .reserve = visstrim_reserve, | ||
283 | .map_io = mx27_map_io, | 383 | .map_io = mx27_map_io, |
284 | .init_early = imx27_init_early, | 384 | .init_early = imx27_init_early, |
285 | .init_irq = mx27_init_irq, | 385 | .init_irq = mx27_init_irq, |