From patchwork Wed Oct 10 03:29:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 1572081 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 4FBA93FD9C for ; Wed, 10 Oct 2012 03:31:27 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TLmzQ-0001fI-Bs; Wed, 10 Oct 2012 03:29:44 +0000 Received: from mail-gg0-f177.google.com ([209.85.161.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TLmzM-0001ek-Ss for linux-arm-kernel@lists.infradead.org; Wed, 10 Oct 2012 03:29:41 +0000 Received: by mail-gg0-f177.google.com with SMTP id h1so16112gge.36 for ; Tue, 09 Oct 2012 20:29:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=l6dquSFUd6q/jmiSTcNfibd43IxrfDXKQ4448pEmEN4=; b=B7SqqhQFOU1DFEjyl7xG/zpfb2PG2inxIu3140tgnwyqHIxXTwkm5ZlrAtS3W+bUCY cK/SW5dRkfKuR4IWvD8wKCwujjBpvHCCfHX/2EUXSStaX3MXhH9kPBPMBPBxFanHNoPA 0Wl3V2DX4PrPEwN8q7hYwEvAEyH0zT6uxtKMKM2G5ITHIYhVxGS7x3loTTpyQTjTeWz+ tJU8Z3eRqOXWuNN+VtXQgrqeBUnGYYsMhR+57xQSjtkFf+ZuwPBo9WHWaE2uXhx3+aGp kkZwfgVyY+Zyk9tfVIaOr75zIRso3WRWJy6+b5c7pYcTwjyt4J2aRxY3eXhoPrwmt6Dy dO3Q== Received: by 10.236.87.208 with SMTP id y56mr18402876yhe.9.1349839778980; Tue, 09 Oct 2012 20:29:38 -0700 (PDT) Received: from fabio-Latitude-E6410.cps.virtua.com.br ([201.82.136.72]) by mx.google.com with ESMTPS id m13sm143029ank.16.2012.10.09.20.29.37 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 20:29:38 -0700 (PDT) From: Fabio Estevam To: kernel@pengutronix.de Subject: [PATCH 1/2] ARM: mx27_3ds: Reserve memory for camera usage Date: Wed, 10 Oct 2012 00:29:29 -0300 Message-Id: <1349839770-13848-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.7.9.5 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (festevam[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.161.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Fabio Estevam , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Fabio Estevam Reserve dedicated memory block for camera usage. Signed-off-by: Fabio Estevam --- 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 #include #include +#include #include @@ -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