aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mx31moboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx3/mx31moboard.c')
-rw-r--r--arch/arm/mach-mx3/mx31moboard.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/mx31moboard.c b/arch/arm/mach-mx3/mx31moboard.c
index 2f95dcd805cc..b167f131f7c0 100644
--- a/arch/arm/mach-mx3/mx31moboard.c
+++ b/arch/arm/mach-mx3/mx31moboard.c
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/dma-mapping.h>
20#include <linux/fsl_devices.h> 21#include <linux/fsl_devices.h>
21#include <linux/gpio.h> 22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
@@ -403,6 +404,39 @@ static struct platform_device *devices[] __initdata = {
403 &mx31moboard_leds_device, 404 &mx31moboard_leds_device,
404}; 405};
405 406
407static struct mx3_camera_pdata camera_pdata = {
408 .dma_dev = &mx3_ipu.dev,
409 .flags = MX3_CAMERA_DATAWIDTH_8 | MX3_CAMERA_DATAWIDTH_10,
410 .mclk_10khz = 4800,
411};
412
413#define CAMERA_BUF_SIZE (4*1024*1024)
414
415static int __init mx31moboard_cam_alloc_dma(const size_t buf_size)
416{
417 dma_addr_t dma_handle;
418 void *buf;
419 int dma;
420
421 if (buf_size < 2 * 1024 * 1024)
422 return -EINVAL;
423
424 buf = dma_alloc_coherent(NULL, buf_size, &dma_handle, GFP_KERNEL);
425 if (!buf) {
426 pr_err("%s: cannot allocate camera buffer-memory\n", __func__);
427 return -ENOMEM;
428 }
429
430 memset(buf, 0, buf_size);
431
432 dma = dma_declare_coherent_memory(&mx3_camera.dev,
433 dma_handle, dma_handle, buf_size,
434 DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
435
436 /* The way we call dma_declare_coherent_memory only a malloc can fail */
437 return dma & DMA_MEMORY_MAP ? 0 : -ENOMEM;
438}
439
406static int mx31moboard_baseboard; 440static int mx31moboard_baseboard;
407core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444); 441core_param(mx31moboard_baseboard, mx31moboard_baseboard, int, 0444);
408 442
@@ -436,6 +470,8 @@ static void __init mxc_board_init(void)
436 mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata); 470 mxc_register_device(&mxcsdhc_device0, &sdhc1_pdata);
437 471
438 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 472 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
473 if (!mx31moboard_cam_alloc_dma(CAMERA_BUF_SIZE))
474 mxc_register_device(&mx3_camera, &camera_pdata);
439 475
440 usb_xcvr_reset(); 476 usb_xcvr_reset();
441 477