All of lore.kernel.org
 help / color / mirror / Atom feed
From: gcembed@gmail.com (Gaëtan Carlier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: mx27_3ds: Reserve memory for camera usage
Date: Wed, 10 Oct 2012 08:51:00 +0200	[thread overview]
Message-ID: <50751AD4.3000002@gmail.com> (raw)
In-Reply-To: <1349839770-13848-1-git-send-email-festevam@gmail.com>

Hi Fabio,
On 10/10/2012 05:29 AM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Reserve dedicated memory block for camera usage.
Why camera need to have a dedicated memory block reserved in the 
platform file ?
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>   arch/arm/mach-imx/mach-mx27_3ds.c |   32 +++++++++++++++++++++++++++++++-
>   1 file changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
> index 05996f3..d3b9a60 100644
> --- a/arch/arm/mach-imx/mach-mx27_3ds.c
> +++ b/arch/arm/mach-imx/mach-mx27_3ds.c
> @@ -30,6 +30,7 @@
>   #include <linux/spi/spi.h>
>   #include <linux/regulator/machine.h>
>   #include <linux/spi/l4f00242t03.h>
> +#include <asm/memblock.h>
>
>   #include <media/soc_camera.h>
>
> @@ -165,6 +166,9 @@ static const int mx27pdk_pins[] __initconst = {
>   	PC19_PF_SSI4_CLK,
>   };
>
> +static phys_addr_t mx2_camera_base __initdata;
> +#define MX27PDK_CAM_BUF_SIZE	SZ_8M
> +
>   static struct gpio mx27_3ds_camera_gpios[] = {
>   	{ CSI_PWRDWN, GPIOF_OUT_INIT_HIGH, "camera-power" },
>   	{ CSI_RESET, GPIOF_OUT_INIT_HIGH, "camera-reset" },
> @@ -478,6 +482,24 @@ static const struct mx2_camera_platform_data mx27_3ds_cam_pdata __initconst = {
>   	.clk = 26000000,
>   };
>
> +static void __init mx27pdk_init_camera(void)
> +{
> +	struct platform_device *pdev;
> +	int dma;
> +
> +	pdev = imx27_add_mx2_camera(&mx27_3ds_cam_pdata);
> +
> +	if (IS_ERR(pdev))
> +		return;
> +
> +	dma = dma_declare_coherent_memory(&pdev->dev,
> +				mx2_camera_base, mx2_camera_base,
> +				MX27PDK_CAM_BUF_SIZE,
> +				DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE);
> +	if (!(dma & DMA_MEMORY_MAP))
> +		return;
> +}
> +
>   static const struct imxi2c_platform_data mx27_3ds_i2c0_data __initconst = {
>   	.bitrate = 100000,
>   };
> @@ -527,7 +549,7 @@ static void __init mx27pdk_init(void)
>   		iclink_ov2640.power = NULL;
>   	}
>
> -	imx27_add_mx2_camera(&mx27_3ds_cam_pdata);
> +	mx27pdk_init_camera();
>   	imx27_add_imx_ssi(0, &mx27_3ds_ssi_pdata);
>
>   	imx_add_platform_device("imx_mc13783", 0, NULL, 0, NULL, 0);
> @@ -542,6 +564,13 @@ static struct sys_timer mx27pdk_timer = {
>   	.init	= mx27pdk_timer_init,
>   };
>
> +static void __init mx27pdk_reserve(void)
> +{
> +	/* reserve MX27_3DS_CAMERA_BUF_SIZE bytes for mx2-camera */
> +	mx2_camera_base = arm_memblock_steal(MX27PDK_CAM_BUF_SIZE,
> +						MX27PDK_CAM_BUF_SIZE);
> +}
> +
>   MACHINE_START(MX27_3DS, "Freescale MX27PDK")
>   	/* maintainer: Freescale Semiconductor, Inc. */
>   	.atag_offset = 0x100,
> @@ -551,5 +580,6 @@ MACHINE_START(MX27_3DS, "Freescale MX27PDK")
>   	.handle_irq = imx27_handle_irq,
>   	.timer = &mx27pdk_timer,
>   	.init_machine = mx27pdk_init,
> +	.reserve = mx27pdk_reserve,
>   	.restart	= mxc_restart,
>   MACHINE_END
>
Thank you.
Best regards,
Ga?tan Carlier.

  parent reply	other threads:[~2012-10-10  6:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-10  3:29 [PATCH 1/2] ARM: mx27_3ds: Reserve memory for camera usage Fabio Estevam
2012-10-10  3:29 ` [PATCH 2/2] ARM: mx27_3ds: Add VPU support Fabio Estevam
2012-10-10  6:51 ` Gaëtan Carlier [this message]
2012-10-10  7:52 ` [PATCH 1/2] ARM: mx27_3ds: Reserve memory for camera usage Sascha Hauer
2012-10-16  4:08   ` Fabio Estevam
2012-10-16  7:13     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50751AD4.3000002@gmail.com \
    --to=gcembed@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.