From patchwork Fri Dec 10 11:03:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 398122 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 oBAB3hcI013424 for ; Fri, 10 Dec 2010 11:03:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754271Ab0LJLDl (ORCPT ); Fri, 10 Dec 2010 06:03:41 -0500 Received: from d1.icnet.pl ([212.160.220.21]:47654 "EHLO d1.icnet.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752376Ab0LJLDk (ORCPT ); Fri, 10 Dec 2010 06:03:40 -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 1PR0lH-0007b2-LQ; Fri, 10 Dec 2010 12:03:39 +0100 From: Janusz Krzysztofik Organization: Tele-Info-System, Poznan, PL To: "linux-omap@vger.kernel.org" Subject: [RESEND] [PATCH 1/2] OMAP1: allow reserving memory for camera Date: Fri, 10 Dec 2010 12:03:07 +0100 User-Agent: KMail/1.9.10 Cc: Tony Lindgren , Linux Media Mailing List , Guennadi Liakhovetski , linux-arm-kernel@lists.infradead.org References: <201012051929.07220.jkrzyszt@tis.icnet.pl> <201012101159.21845.jkrzyszt@tis.icnet.pl> In-Reply-To: <201012101159.21845.jkrzyszt@tis.icnet.pl> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <201012101203.09441.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]); Fri, 10 Dec 2010 11:03:44 +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)