From patchwork Sun Dec 5 18:32:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 381611 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB5IX493020589 for ; Sun, 5 Dec 2010 18:33:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755773Ab0LESdD (ORCPT ); Sun, 5 Dec 2010 13:33:03 -0500 Received: from d1.icnet.pl ([212.160.220.21]:53701 "EHLO d1.icnet.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755715Ab0LESdC (ORCPT ); Sun, 5 Dec 2010 13:33:02 -0500 Received: from 87-205-12-81.ip.netia.com.pl ([87.205.12.81] helo=vclass.intranet) by d1.icnet.pl with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1PPJOO-0001PM-W1; Sun, 05 Dec 2010 19:33:01 +0100 From: Janusz Krzysztofik Organization: Tele-Info-System, Poznan, PL To: "linux-omap@vger.kernel.org" Subject: [PATCH 1/2] OMAP1: allow reserving memory for camera Date: Sun, 5 Dec 2010 19:32:32 +0100 User-Agent: KMail/1.9.10 Cc: Tony Lindgren , Linux Media Mailing List , Guennadi Liakhovetski References: <201012051929.07220.jkrzyszt@tis.icnet.pl> In-Reply-To: <201012051929.07220.jkrzyszt@tis.icnet.pl> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201012051932.34260.jkrzyszt@tis.icnet.pl> X-SA-Exim-Scanned: No (on d1.icnet); SAEximRunCond expanded to false Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sun, 05 Dec 2010 18:33:06 +0000 (UTC) --- linux-2.6.37-rc4/arch/arm/mach-omap1/devices.c.orig 2010-12-04 18:00:39.000000000 +0100 +++ linux-2.6.37-rc4/arch/arm/mach-omap1/devices.c 2010-12-04 22:22:13.000000000 +0100 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -222,13 +223,48 @@ static struct platform_device omap1_came .resource = omap1_camera_resources, }; +static phys_addr_t omap1_camera_phys_mempool_base; +static phys_addr_t omap1_camera_phys_mempool_size; + +void __init omap1_camera_reserve(phys_addr_t size) +{ + phys_addr_t paddr; + + if (!size) + return; + + paddr = memblock_alloc(size, SZ_1M); + + if (!paddr) { + pr_err("%s: failed to reserve %x bytes\n", __func__, size); + return; + } + memblock_free(paddr, size); + memblock_remove(paddr, size); + + omap1_camera_phys_mempool_base = paddr; + omap1_camera_phys_mempool_size = size; +} + void __init omap1_camera_init(void *info) { struct platform_device *dev = &omap1_camera_device; + dma_addr_t paddr = omap1_camera_phys_mempool_base; + dma_addr_t size = omap1_camera_phys_mempool_size; int ret; dev->dev.platform_data = info; + if (paddr) { + if (dma_declare_coherent_memory(&dev->dev, paddr, paddr, size, + DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE)) + pr_info("%s: reserved %d bytes camera buffer memory\n", + __func__, size); + else + pr_warn("%s: cannot reserve camera buffer memory\n", + __func__); + } + ret = platform_device_register(dev); if (ret) dev_err(&dev->dev, "unable to register device: %d\n", ret); --- linux-2.6.37-rc4/arch/arm/mach-omap1/include/mach/camera.h.orig 2010-12-04 18:00:39.000000000 +0100 +++ linux-2.6.37-rc4/arch/arm/mach-omap1/include/mach/camera.h 2010-12-04 22:26:23.000000000 +0100 @@ -3,6 +3,7 @@ #include +void omap1_camera_reserve(phys_addr_t); void omap1_camera_init(void *); static inline void omap1_set_camera_info(struct omap1_cam_platform_data *info)