diff options
author | Alex Gershgorin <alexg@meprolight.com> | 2012-03-13 11:05:29 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-03-14 15:16:09 -0400 |
commit | 25af2d9f85750bb129eb224b7b3a07d3c93d282d (patch) | |
tree | 446dc60d3951e74ed532f6a4b664fa03ab5805b4 /arch/arm/mach-imx/mach-mx35_3ds.c | |
parent | 881e09f8c615e105000ca914c489311a2533c893 (diff) |
i.MX35-PDK: Add Camera support
In i.MX35-PDK, OV2640 camera is populated on the
personality board. This camera is registered as a subdevice via soc-camera interface.
Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-imx/mach-mx35_3ds.c')
-rw-r--r-- | arch/arm/mach-imx/mach-mx35_3ds.c | 98 |
1 files changed, 97 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c index e6c64d04d363..e14291d89e4f 100644 --- a/arch/arm/mach-imx/mach-mx35_3ds.c +++ b/arch/arm/mach-imx/mach-mx35_3ds.c | |||
@@ -4,6 +4,11 @@ | |||
4 | * | 4 | * |
5 | * Author: Fabio Estevam <fabio.estevam@freescale.com> | 5 | * Author: Fabio Estevam <fabio.estevam@freescale.com> |
6 | * | 6 | * |
7 | * Copyright (C) 2011 Meprolight, Ltd. | ||
8 | * Alex Gershgorin <alexg@meprolight.com> | ||
9 | * | ||
10 | * Modified from i.MX31 3-Stack Development System | ||
11 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | 12 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 13 | * it under the terms of the GNU General Public License as published by |
9 | * the Free Software Foundation; either version 2 of the License, or | 14 | * the Free Software Foundation; either version 2 of the License, or |
@@ -34,6 +39,7 @@ | |||
34 | #include <asm/mach/arch.h> | 39 | #include <asm/mach/arch.h> |
35 | #include <asm/mach/time.h> | 40 | #include <asm/mach/time.h> |
36 | #include <asm/mach/map.h> | 41 | #include <asm/mach/map.h> |
42 | #include <asm/memblock.h> | ||
37 | 43 | ||
38 | #include <mach/hardware.h> | 44 | #include <mach/hardware.h> |
39 | #include <mach/common.h> | 45 | #include <mach/common.h> |
@@ -42,6 +48,8 @@ | |||
42 | #include <mach/3ds_debugboard.h> | 48 | #include <mach/3ds_debugboard.h> |
43 | #include <video/platform_lcd.h> | 49 | #include <video/platform_lcd.h> |
44 | 50 | ||
51 | #include <media/soc_camera.h> | ||
52 | |||
45 | #include "devices-imx35.h" | 53 | #include "devices-imx35.h" |
46 | 54 | ||
47 | #define GPIO_MC9S08DZ60_GPS_ENABLE 0 | 55 | #define GPIO_MC9S08DZ60_GPS_ENABLE 0 |
@@ -230,6 +238,83 @@ static iomux_v3_cfg_t mx35pdk_pads[] = { | |||
230 | MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC, | 238 | MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC, |
231 | MX35_PAD_D3_REV__IPU_DISPB_D3_REV, | 239 | MX35_PAD_D3_REV__IPU_DISPB_D3_REV, |
232 | MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS, | 240 | MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS, |
241 | /* CSI */ | ||
242 | MX35_PAD_TX1__IPU_CSI_D_6, | ||
243 | MX35_PAD_TX0__IPU_CSI_D_7, | ||
244 | MX35_PAD_CSI_D8__IPU_CSI_D_8, | ||
245 | MX35_PAD_CSI_D9__IPU_CSI_D_9, | ||
246 | MX35_PAD_CSI_D10__IPU_CSI_D_10, | ||
247 | MX35_PAD_CSI_D11__IPU_CSI_D_11, | ||
248 | MX35_PAD_CSI_D12__IPU_CSI_D_12, | ||
249 | MX35_PAD_CSI_D13__IPU_CSI_D_13, | ||
250 | MX35_PAD_CSI_D14__IPU_CSI_D_14, | ||
251 | MX35_PAD_CSI_D15__IPU_CSI_D_15, | ||
252 | MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC, | ||
253 | MX35_PAD_CSI_MCLK__IPU_CSI_MCLK, | ||
254 | MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK, | ||
255 | MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC, | ||
256 | }; | ||
257 | |||
258 | /* | ||
259 | * Camera support | ||
260 | */ | ||
261 | static phys_addr_t mx3_camera_base __initdata; | ||
262 | #define MX35_3DS_CAMERA_BUF_SIZE SZ_8M | ||
263 | |||
264 | static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = { | ||
265 | .flags = MX3_CAMERA_DATAWIDTH_8, | ||
266 | .mclk_10khz = 2000, | ||
267 | }; | ||
268 | |||
269 | static int __init imx35_3ds_init_camera(void) | ||
270 | { | ||
271 | int dma, ret = -ENOMEM; | ||
272 | struct platform_device *pdev = | ||
273 | imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata); | ||
274 | |||
275 | if (IS_ERR(pdev)) | ||
276 | return PTR_ERR(pdev); | ||
277 | |||
278 | if (!mx3_camera_base) | ||
279 | goto err; | ||
280 | |||
281 | dma = dma_declare_coherent_memory(&pdev->dev, | ||
282 | mx3_camera_base, mx3_camera_base, | ||
283 | MX35_3DS_CAMERA_BUF_SIZE, | ||
284 | DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE); | ||
285 | |||
286 | if (!(dma & DMA_MEMORY_MAP)) | ||
287 | goto err; | ||
288 | |||
289 | ret = platform_device_add(pdev); | ||
290 | if (ret) | ||
291 | err: | ||
292 | platform_device_put(pdev); | ||
293 | |||
294 | return ret; | ||
295 | } | ||
296 | |||
297 | static const struct ipu_platform_data mx35_3ds_ipu_data __initconst = { | ||
298 | .irq_base = MXC_IPU_IRQ_START, | ||
299 | }; | ||
300 | |||
301 | static struct i2c_board_info mx35_3ds_i2c_camera = { | ||
302 | I2C_BOARD_INFO("ov2640", 0x30), | ||
303 | }; | ||
304 | |||
305 | static struct soc_camera_link iclink_ov2640 = { | ||
306 | .bus_id = 0, | ||
307 | .board_info = &mx35_3ds_i2c_camera, | ||
308 | .i2c_adapter_id = 0, | ||
309 | .power = NULL, | ||
310 | }; | ||
311 | |||
312 | static struct platform_device mx35_3ds_ov2640 = { | ||
313 | .name = "soc-camera-pdrv", | ||
314 | .id = 0, | ||
315 | .dev = { | ||
316 | .platform_data = &iclink_ov2640, | ||
317 | }, | ||
233 | }; | 318 | }; |
234 | 319 | ||
235 | static int mx35_3ds_otg_init(struct platform_device *pdev) | 320 | static int mx35_3ds_otg_init(struct platform_device *pdev) |
@@ -320,7 +405,10 @@ static void __init mx35_3ds_init(void) | |||
320 | i2c_register_board_info( | 405 | i2c_register_board_info( |
321 | 0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds)); | 406 | 0, i2c_devices_3ds, ARRAY_SIZE(i2c_devices_3ds)); |
322 | 407 | ||
323 | imx35_add_ipu_core(&mx3_ipu_data); | 408 | imx35_add_ipu_core(&mx35_3ds_ipu_data); |
409 | platform_device_register(&mx35_3ds_ov2640); | ||
410 | imx35_3ds_init_camera(); | ||
411 | |||
324 | imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata); | 412 | imx35_fb_pdev = imx35_add_mx3_sdc_fb(&mx3fb_pdata); |
325 | mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev; | 413 | mx35_3ds_lcd.dev.parent = &imx35_fb_pdev->dev; |
326 | platform_device_register(&mx35_3ds_lcd); | 414 | platform_device_register(&mx35_3ds_lcd); |
@@ -335,6 +423,13 @@ struct sys_timer mx35pdk_timer = { | |||
335 | .init = mx35pdk_timer_init, | 423 | .init = mx35pdk_timer_init, |
336 | }; | 424 | }; |
337 | 425 | ||
426 | static void __init mx35_3ds_reserve(void) | ||
427 | { | ||
428 | /* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */ | ||
429 | mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE, | ||
430 | MX35_3DS_CAMERA_BUF_SIZE); | ||
431 | } | ||
432 | |||
338 | MACHINE_START(MX35_3DS, "Freescale MX35PDK") | 433 | MACHINE_START(MX35_3DS, "Freescale MX35PDK") |
339 | /* Maintainer: Freescale Semiconductor, Inc */ | 434 | /* Maintainer: Freescale Semiconductor, Inc */ |
340 | .atag_offset = 0x100, | 435 | .atag_offset = 0x100, |
@@ -344,5 +439,6 @@ MACHINE_START(MX35_3DS, "Freescale MX35PDK") | |||
344 | .handle_irq = imx35_handle_irq, | 439 | .handle_irq = imx35_handle_irq, |
345 | .timer = &mx35pdk_timer, | 440 | .timer = &mx35pdk_timer, |
346 | .init_machine = mx35_3ds_init, | 441 | .init_machine = mx35_3ds_init, |
442 | .reserve = mx35_3ds_reserve, | ||
347 | .restart = mxc_restart, | 443 | .restart = mxc_restart, |
348 | MACHINE_END | 444 | MACHINE_END |