diff mbox

[v1] i.MX35-PDK: Add Camera support

Message ID 1331651129-30540-1-git-send-email-alexg@meprolight.com
State New
Headers show

Commit Message

Alex Gershgorin March 13, 2012, 3:05 p.m. UTC
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>
---
 arch/arm/mach-imx/mach-mx35_3ds.c |   96 +++++++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

Comments

Mauro Carvalho Chehab March 19, 2012, 10:03 p.m. UTC | #1
Em 13-03-2012 12:05, Alex Gershgorin escreveu:
> 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>

Patch doesn't apply over v3.3:

patching file arch/arm/mach-imx/mach-mx35_3ds.c
Hunk #3 FAILED at 149.
Hunk #4 succeeded at 126 with fuzz 1 (offset -55 lines).
Hunk #5 FAILED at 323.
Hunk #6 succeeded at 277 (offset -57 lines).
Hunk #7 succeeded at 293 (offset -57 lines).
2 out of 7 hunks FAILED -- saving rejects to file arch/arm/mach-imx/mach-mx35_3ds.c.rej
 arch/arm/mach-imx/mach-mx35_3ds.c |   87 ++++++++++++++++++++++++++++++++++++++


> ---
>  arch/arm/mach-imx/mach-mx35_3ds.c |   96 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 96 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
> index 0af6c9c..a7dd8e6 100644
> --- a/arch/arm/mach-imx/mach-mx35_3ds.c
> +++ b/arch/arm/mach-imx/mach-mx35_3ds.c
> @@ -4,6 +4,11 @@
>   *
>   * Author: Fabio Estevam <fabio.estevam@freescale.com>
>   *
> + * Copyright (C) 2011 Meprolight, Ltd.
> + * Alex Gershgorin <alexg@meprolight.com>
> + *
> + * Modified from i.MX31 3-Stack Development System
> + *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License as published by
>   * the Free Software Foundation; either version 2 of the License, or
> @@ -34,6 +39,7 @@
>  #include <asm/mach/arch.h>
>  #include <asm/mach/time.h>
>  #include <asm/mach/map.h>
> +#include <asm/memblock.h>
>  
>  #include <mach/hardware.h>
>  #include <mach/common.h>
> @@ -41,6 +47,8 @@
>  #include <mach/irqs.h>
>  #include <mach/3ds_debugboard.h>
>  
> +#include <media/soc_camera.h>
> +
>  #include "devices-imx35.h"
>  
>  #define EXPIO_PARENT_INT	gpio_to_irq(IMX_GPIO_NR(1, 1))
> @@ -120,6 +128,83 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
>  	/* I2C1 */
>  	MX35_PAD_I2C1_CLK__I2C1_SCL,
>  	MX35_PAD_I2C1_DAT__I2C1_SDA,
> +	/* CSI */
> +	MX35_PAD_TX1__IPU_CSI_D_6,
> +	MX35_PAD_TX0__IPU_CSI_D_7,
> +	MX35_PAD_CSI_D8__IPU_CSI_D_8,
> +	MX35_PAD_CSI_D9__IPU_CSI_D_9,
> +	MX35_PAD_CSI_D10__IPU_CSI_D_10,
> +	MX35_PAD_CSI_D11__IPU_CSI_D_11,
> +	MX35_PAD_CSI_D12__IPU_CSI_D_12,
> +	MX35_PAD_CSI_D13__IPU_CSI_D_13,
> +	MX35_PAD_CSI_D14__IPU_CSI_D_14,
> +	MX35_PAD_CSI_D15__IPU_CSI_D_15,
> +	MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC,
> +	MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
> +	MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
> +	MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
> +};
> +
> +/*
> + * Camera support
> +*/
> +static phys_addr_t mx3_camera_base __initdata;
> +#define MX35_3DS_CAMERA_BUF_SIZE SZ_8M
> +
> +static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = {
> +	.flags = MX3_CAMERA_DATAWIDTH_8,
> +	.mclk_10khz = 2000,
> +};
> +
> +static int __init imx35_3ds_init_camera(void)
> +{
> +	int dma, ret = -ENOMEM;
> +	struct platform_device *pdev =
> +		imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata);
> +
> +	if (IS_ERR(pdev))
> +		return PTR_ERR(pdev);
> +
> +	if (!mx3_camera_base)
> +		goto err;
> +
> +	dma = dma_declare_coherent_memory(&pdev->dev,
> +					mx3_camera_base, mx3_camera_base,
> +					MX35_3DS_CAMERA_BUF_SIZE,
> +					DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
> +
> +	if (!(dma & DMA_MEMORY_MAP))
> +		goto err;
> +
> +	ret = platform_device_add(pdev);
> +	if (ret)
> +err:
> +		platform_device_put(pdev);
> +
> +	return ret;
> +}
> +
> +static const struct ipu_platform_data mx35_3ds_ipu_data __initconst = {
> +	.irq_base = MXC_IPU_IRQ_START,
> +};
> +
> +static struct i2c_board_info mx35_3ds_i2c_camera = {
> +	I2C_BOARD_INFO("ov2640", 0x30),
> +};
> +
> +static struct soc_camera_link iclink_ov2640 = {
> +	.bus_id		= 0,
> +	.board_info	= &mx35_3ds_i2c_camera,
> +	.i2c_adapter_id	= 0,
> +	.power		= NULL,
> +};
> +
> +static struct platform_device mx35_3ds_ov2640 = {
> +	.name	= "soc-camera-pdrv",
> +	.id	= 0,
> +	.dev	= {
> +		.platform_data = &iclink_ov2640,
> +	},
>  };
>  
>  static int mx35_3ds_otg_init(struct platform_device *pdev)
> @@ -204,6 +289,9 @@ static void __init mx35_3ds_init(void)
>  		pr_warn("Init of the debugboard failed, all "
>  				"devices on the debugboard are unusable.\n");
>  	imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
> +	imx35_add_ipu_core(&mx35_3ds_ipu_data);
> +	platform_device_register(&mx35_3ds_ov2640);
> +	imx35_3ds_init_camera();
>  }
>  
>  static void __init mx35pdk_timer_init(void)
> @@ -215,6 +303,13 @@ struct sys_timer mx35pdk_timer = {
>  	.init	= mx35pdk_timer_init,
>  };
>  
> +static void __init mx35_3ds_reserve(void)
> +{
> +	/* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */
> +	mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE,
> +					 MX35_3DS_CAMERA_BUF_SIZE);
> +}
> +
>  MACHINE_START(MX35_3DS, "Freescale MX35PDK")
>  	/* Maintainer: Freescale Semiconductor, Inc */
>  	.atag_offset = 0x100,
> @@ -224,5 +319,6 @@ MACHINE_START(MX35_3DS, "Freescale MX35PDK")
>  	.handle_irq = imx35_handle_irq,
>  	.timer = &mx35pdk_timer,
>  	.init_machine = mx35_3ds_init,
> +	.reserve = mx35_3ds_reserve,
>  	.restart	= mxc_restart,
>  MACHINE_END
Mauro Carvalho Chehab March 19, 2012, 10:17 p.m. UTC | #2
Em 19-03-2012 19:03, Mauro Carvalho Chehab escreveu:
> Em 13-03-2012 12:05, Alex Gershgorin escreveu:
>> 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>
> 
> Patch doesn't apply over v3.3:

Sorry, the previous version of this patch didn't apply. This compiles OK.

Sorry for the mess.

Anyway, it should be applied via arm subtree.

Regards,
Mauro

> 
> patching file arch/arm/mach-imx/mach-mx35_3ds.c
> Hunk #3 FAILED at 149.
> Hunk #4 succeeded at 126 with fuzz 1 (offset -55 lines).
> Hunk #5 FAILED at 323.
> Hunk #6 succeeded at 277 (offset -57 lines).
> Hunk #7 succeeded at 293 (offset -57 lines).
> 2 out of 7 hunks FAILED -- saving rejects to file arch/arm/mach-imx/mach-mx35_3ds.c.rej
>  arch/arm/mach-imx/mach-mx35_3ds.c |   87 ++++++++++++++++++++++++++++++++++++++
> 
> 
>> ---
>>  arch/arm/mach-imx/mach-mx35_3ds.c |   96 +++++++++++++++++++++++++++++++++++++
>>  1 files changed, 96 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
>> index 0af6c9c..a7dd8e6 100644
>> --- a/arch/arm/mach-imx/mach-mx35_3ds.c
>> +++ b/arch/arm/mach-imx/mach-mx35_3ds.c
>> @@ -4,6 +4,11 @@
>>   *
>>   * Author: Fabio Estevam <fabio.estevam@freescale.com>
>>   *
>> + * Copyright (C) 2011 Meprolight, Ltd.
>> + * Alex Gershgorin <alexg@meprolight.com>
>> + *
>> + * Modified from i.MX31 3-Stack Development System
>> + *
>>   * This program is free software; you can redistribute it and/or modify
>>   * it under the terms of the GNU General Public License as published by
>>   * the Free Software Foundation; either version 2 of the License, or
>> @@ -34,6 +39,7 @@
>>  #include <asm/mach/arch.h>
>>  #include <asm/mach/time.h>
>>  #include <asm/mach/map.h>
>> +#include <asm/memblock.h>
>>  
>>  #include <mach/hardware.h>
>>  #include <mach/common.h>
>> @@ -41,6 +47,8 @@
>>  #include <mach/irqs.h>
>>  #include <mach/3ds_debugboard.h>
>>  
>> +#include <media/soc_camera.h>
>> +
>>  #include "devices-imx35.h"
>>  
>>  #define EXPIO_PARENT_INT	gpio_to_irq(IMX_GPIO_NR(1, 1))
>> @@ -120,6 +128,83 @@ static iomux_v3_cfg_t mx35pdk_pads[] = {
>>  	/* I2C1 */
>>  	MX35_PAD_I2C1_CLK__I2C1_SCL,
>>  	MX35_PAD_I2C1_DAT__I2C1_SDA,
>> +	/* CSI */
>> +	MX35_PAD_TX1__IPU_CSI_D_6,
>> +	MX35_PAD_TX0__IPU_CSI_D_7,
>> +	MX35_PAD_CSI_D8__IPU_CSI_D_8,
>> +	MX35_PAD_CSI_D9__IPU_CSI_D_9,
>> +	MX35_PAD_CSI_D10__IPU_CSI_D_10,
>> +	MX35_PAD_CSI_D11__IPU_CSI_D_11,
>> +	MX35_PAD_CSI_D12__IPU_CSI_D_12,
>> +	MX35_PAD_CSI_D13__IPU_CSI_D_13,
>> +	MX35_PAD_CSI_D14__IPU_CSI_D_14,
>> +	MX35_PAD_CSI_D15__IPU_CSI_D_15,
>> +	MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC,
>> +	MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
>> +	MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
>> +	MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
>> +};
>> +
>> +/*
>> + * Camera support
>> +*/
>> +static phys_addr_t mx3_camera_base __initdata;
>> +#define MX35_3DS_CAMERA_BUF_SIZE SZ_8M
>> +
>> +static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = {
>> +	.flags = MX3_CAMERA_DATAWIDTH_8,
>> +	.mclk_10khz = 2000,
>> +};
>> +
>> +static int __init imx35_3ds_init_camera(void)
>> +{
>> +	int dma, ret = -ENOMEM;
>> +	struct platform_device *pdev =
>> +		imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata);
>> +
>> +	if (IS_ERR(pdev))
>> +		return PTR_ERR(pdev);
>> +
>> +	if (!mx3_camera_base)
>> +		goto err;
>> +
>> +	dma = dma_declare_coherent_memory(&pdev->dev,
>> +					mx3_camera_base, mx3_camera_base,
>> +					MX35_3DS_CAMERA_BUF_SIZE,
>> +					DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
>> +
>> +	if (!(dma & DMA_MEMORY_MAP))
>> +		goto err;
>> +
>> +	ret = platform_device_add(pdev);
>> +	if (ret)
>> +err:
>> +		platform_device_put(pdev);
>> +
>> +	return ret;
>> +}
>> +
>> +static const struct ipu_platform_data mx35_3ds_ipu_data __initconst = {
>> +	.irq_base = MXC_IPU_IRQ_START,
>> +};
>> +
>> +static struct i2c_board_info mx35_3ds_i2c_camera = {
>> +	I2C_BOARD_INFO("ov2640", 0x30),
>> +};
>> +
>> +static struct soc_camera_link iclink_ov2640 = {
>> +	.bus_id		= 0,
>> +	.board_info	= &mx35_3ds_i2c_camera,
>> +	.i2c_adapter_id	= 0,
>> +	.power		= NULL,
>> +};
>> +
>> +static struct platform_device mx35_3ds_ov2640 = {
>> +	.name	= "soc-camera-pdrv",
>> +	.id	= 0,
>> +	.dev	= {
>> +		.platform_data = &iclink_ov2640,
>> +	},
>>  };
>>  
>>  static int mx35_3ds_otg_init(struct platform_device *pdev)
>> @@ -204,6 +289,9 @@ static void __init mx35_3ds_init(void)
>>  		pr_warn("Init of the debugboard failed, all "
>>  				"devices on the debugboard are unusable.\n");
>>  	imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
>> +	imx35_add_ipu_core(&mx35_3ds_ipu_data);
>> +	platform_device_register(&mx35_3ds_ov2640);
>> +	imx35_3ds_init_camera();
>>  }
>>  
>>  static void __init mx35pdk_timer_init(void)
>> @@ -215,6 +303,13 @@ struct sys_timer mx35pdk_timer = {
>>  	.init	= mx35pdk_timer_init,
>>  };
>>  
>> +static void __init mx35_3ds_reserve(void)
>> +{
>> +	/* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */
>> +	mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE,
>> +					 MX35_3DS_CAMERA_BUF_SIZE);
>> +}
>> +
>>  MACHINE_START(MX35_3DS, "Freescale MX35PDK")
>>  	/* Maintainer: Freescale Semiconductor, Inc */
>>  	.atag_offset = 0x100,
>> @@ -224,5 +319,6 @@ MACHINE_START(MX35_3DS, "Freescale MX35PDK")
>>  	.handle_irq = imx35_handle_irq,
>>  	.timer = &mx35pdk_timer,
>>  	.init_machine = mx35_3ds_init,
>> +	.reserve = mx35_3ds_reserve,
>>  	.restart	= mxc_restart,
>>  MACHINE_END
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sascha Hauer March 19, 2012, 10:37 p.m. UTC | #3
On Mon, Mar 19, 2012 at 07:17:27PM -0300, Mauro Carvalho Chehab wrote:
> Em 19-03-2012 19:03, Mauro Carvalho Chehab escreveu:
> > Em 13-03-2012 12:05, Alex Gershgorin escreveu:
> >> 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>
> > 
> > Patch doesn't apply over v3.3:
> 
> Sorry, the previous version of this patch didn't apply. This compiles OK.
> 
> Sorry for the mess.
> 
> Anyway, it should be applied via arm subtree.

It's scheduled there. I should have responded with an applied message.

Sascha
Fabio Estevam March 19, 2012, 10:43 p.m. UTC | #4
Hi Sascha,

On Mon, Mar 19, 2012 at 7:37 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:

> It's scheduled there. I should have responded with an applied message.

Please apply this one too: http://patchwork.ozlabs.org/patch/144942/

Otherwise camera device cannot register.
Sascha Hauer March 19, 2012, 10:45 p.m. UTC | #5
On Mon, Mar 19, 2012 at 07:43:32PM -0300, Fabio Estevam wrote:
> Hi Sascha,
> 
> On Mon, Mar 19, 2012 at 7:37 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> > It's scheduled there. I should have responded with an applied message.
> 
> Please apply this one too: http://patchwork.ozlabs.org/patch/144942/
> 

Will do.

Sascha
Mauro Carvalho Chehab March 19, 2012, 10:49 p.m. UTC | #6
Em 19-03-2012 19:37, Sascha Hauer escreveu:
> On Mon, Mar 19, 2012 at 07:17:27PM -0300, Mauro Carvalho Chehab wrote:
>> Em 19-03-2012 19:03, Mauro Carvalho Chehab escreveu:
>>> Em 13-03-2012 12:05, Alex Gershgorin escreveu:
>>>> 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>
>>>
>>> Patch doesn't apply over v3.3:
>>
>> Sorry, the previous version of this patch didn't apply. This compiles OK.
>>
>> Sorry for the mess.
>>
>> Anyway, it should be applied via arm subtree.
> 
> It's scheduled there. I should have responded with an applied message.

Ok, thanks! 

Regards,
Mauro
Alex Gershgorin March 20, 2012, 8:54 a.m. UTC | #7
Hi all,

Good news...
After several number of changes, yesterday the camera started to work :-) 
I will prepare some patches and send them. 

On Mon, Mar 19, 2012 at 07:43:32PM -0300, Fabio Estevam wrote:
> Hi Sascha,
>
> On Mon, Mar 19, 2012 at 7:37 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
> > It's scheduled there. I should have responded with an applied message.
>
> Please apply this one too: http://patchwork.ozlabs.org/patch/144942/
>

Regards,
Alex Gershgorin


--
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Fabio Estevam March 23, 2012, 12:47 a.m. UTC | #8
Hi Alex,

On Tue, Mar 20, 2012 at 5:54 AM, Alex Gershgorin <alexg@meprolight.com> wrote:
>
> Hi all,
>
> Good news...
> After several number of changes, yesterday the camera started to work :-)
> I will prepare some patches and send them.

Ok, great! Besides your mx35 clock patches: any other patch is
required to getting the camera to work?

Are you getting the camera image with the correct colors?

Thanks,

Fabio Estevam
diff mbox

Patch

diff --git a/arch/arm/mach-imx/mach-mx35_3ds.c b/arch/arm/mach-imx/mach-mx35_3ds.c
index 0af6c9c..a7dd8e6 100644
--- a/arch/arm/mach-imx/mach-mx35_3ds.c
+++ b/arch/arm/mach-imx/mach-mx35_3ds.c
@@ -4,6 +4,11 @@ 
  *
  * Author: Fabio Estevam <fabio.estevam@freescale.com>
  *
+ * Copyright (C) 2011 Meprolight, Ltd.
+ * Alex Gershgorin <alexg@meprolight.com>
+ *
+ * Modified from i.MX31 3-Stack Development System
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -34,6 +39,7 @@ 
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
+#include <asm/memblock.h>
 
 #include <mach/hardware.h>
 #include <mach/common.h>
@@ -41,6 +47,8 @@ 
 #include <mach/irqs.h>
 #include <mach/3ds_debugboard.h>
 
+#include <media/soc_camera.h>
+
 #include "devices-imx35.h"
 
 #define EXPIO_PARENT_INT	gpio_to_irq(IMX_GPIO_NR(1, 1))
@@ -120,6 +128,83 @@  static iomux_v3_cfg_t mx35pdk_pads[] = {
 	/* I2C1 */
 	MX35_PAD_I2C1_CLK__I2C1_SCL,
 	MX35_PAD_I2C1_DAT__I2C1_SDA,
+	/* CSI */
+	MX35_PAD_TX1__IPU_CSI_D_6,
+	MX35_PAD_TX0__IPU_CSI_D_7,
+	MX35_PAD_CSI_D8__IPU_CSI_D_8,
+	MX35_PAD_CSI_D9__IPU_CSI_D_9,
+	MX35_PAD_CSI_D10__IPU_CSI_D_10,
+	MX35_PAD_CSI_D11__IPU_CSI_D_11,
+	MX35_PAD_CSI_D12__IPU_CSI_D_12,
+	MX35_PAD_CSI_D13__IPU_CSI_D_13,
+	MX35_PAD_CSI_D14__IPU_CSI_D_14,
+	MX35_PAD_CSI_D15__IPU_CSI_D_15,
+	MX35_PAD_CSI_HSYNC__IPU_CSI_HSYNC,
+	MX35_PAD_CSI_MCLK__IPU_CSI_MCLK,
+	MX35_PAD_CSI_PIXCLK__IPU_CSI_PIXCLK,
+	MX35_PAD_CSI_VSYNC__IPU_CSI_VSYNC,
+};
+
+/*
+ * Camera support
+*/
+static phys_addr_t mx3_camera_base __initdata;
+#define MX35_3DS_CAMERA_BUF_SIZE SZ_8M
+
+static const struct mx3_camera_pdata mx35_3ds_camera_pdata __initconst = {
+	.flags = MX3_CAMERA_DATAWIDTH_8,
+	.mclk_10khz = 2000,
+};
+
+static int __init imx35_3ds_init_camera(void)
+{
+	int dma, ret = -ENOMEM;
+	struct platform_device *pdev =
+		imx35_alloc_mx3_camera(&mx35_3ds_camera_pdata);
+
+	if (IS_ERR(pdev))
+		return PTR_ERR(pdev);
+
+	if (!mx3_camera_base)
+		goto err;
+
+	dma = dma_declare_coherent_memory(&pdev->dev,
+					mx3_camera_base, mx3_camera_base,
+					MX35_3DS_CAMERA_BUF_SIZE,
+					DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
+
+	if (!(dma & DMA_MEMORY_MAP))
+		goto err;
+
+	ret = platform_device_add(pdev);
+	if (ret)
+err:
+		platform_device_put(pdev);
+
+	return ret;
+}
+
+static const struct ipu_platform_data mx35_3ds_ipu_data __initconst = {
+	.irq_base = MXC_IPU_IRQ_START,
+};
+
+static struct i2c_board_info mx35_3ds_i2c_camera = {
+	I2C_BOARD_INFO("ov2640", 0x30),
+};
+
+static struct soc_camera_link iclink_ov2640 = {
+	.bus_id		= 0,
+	.board_info	= &mx35_3ds_i2c_camera,
+	.i2c_adapter_id	= 0,
+	.power		= NULL,
+};
+
+static struct platform_device mx35_3ds_ov2640 = {
+	.name	= "soc-camera-pdrv",
+	.id	= 0,
+	.dev	= {
+		.platform_data = &iclink_ov2640,
+	},
 };
 
 static int mx35_3ds_otg_init(struct platform_device *pdev)
@@ -204,6 +289,9 @@  static void __init mx35_3ds_init(void)
 		pr_warn("Init of the debugboard failed, all "
 				"devices on the debugboard are unusable.\n");
 	imx35_add_imx_i2c0(&mx35_3ds_i2c0_data);
+	imx35_add_ipu_core(&mx35_3ds_ipu_data);
+	platform_device_register(&mx35_3ds_ov2640);
+	imx35_3ds_init_camera();
 }
 
 static void __init mx35pdk_timer_init(void)
@@ -215,6 +303,13 @@  struct sys_timer mx35pdk_timer = {
 	.init	= mx35pdk_timer_init,
 };
 
+static void __init mx35_3ds_reserve(void)
+{
+	/* reserve MX35_3DS_CAMERA_BUF_SIZE bytes for mx3-camera */
+	mx3_camera_base = arm_memblock_steal(MX35_3DS_CAMERA_BUF_SIZE,
+					 MX35_3DS_CAMERA_BUF_SIZE);
+}
+
 MACHINE_START(MX35_3DS, "Freescale MX35PDK")
 	/* Maintainer: Freescale Semiconductor, Inc */
 	.atag_offset = 0x100,
@@ -224,5 +319,6 @@  MACHINE_START(MX35_3DS, "Freescale MX35PDK")
 	.handle_irq = imx35_handle_irq,
 	.timer = &mx35pdk_timer,
 	.init_machine = mx35_3ds_init,
+	.reserve = mx35_3ds_reserve,
 	.restart	= mxc_restart,
 MACHINE_END