From patchwork Sun Oct 10 17:40:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Contreras X-Patchwork-Id: 244521 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 o9AHf1EK005572 for ; Sun, 10 Oct 2010 17:41:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755882Ab0JJRlA (ORCPT ); Sun, 10 Oct 2010 13:41:00 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:63650 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755068Ab0JJRk7 (ORCPT ); Sun, 10 Oct 2010 13:40:59 -0400 Received: by mail-bw0-f46.google.com with SMTP id 15so1272773bwz.19 for ; Sun, 10 Oct 2010 10:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=duxYpmORX89flpO0muLUY9xh6qArbhoaNK+9biGPuaQ=; b=etoOrMg+Iw5k7+EFlmj4q+PGD0SgAlcDbqIHfvyq5y2GT3R22iSCU+4zoCXj7GzOVw LdFhuv3/uIfSp8RPqpObBKvvsha2g5hq5hXS7itiq45PjHJ/ropffAtsbKNWWrFZcpv7 DaidZCM2C9L/zzYbsWW9wyAEpnri01o98au+A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=q+T+Wl6J5t8uep1HOy7aeND8g14TrJcBnUGA6BMmEce7WqCUfeSD5vUhaXY5TnKOMx ASzuiwU6f1bEAPPUWQ0zZli3+i3LNWfwJhFkVfdBZeDPYvMOO/CHlFtSWJNRh1cHd1X/ iNXRj7NtuEhrtAVHg/H0DOiK0by8vzLxu+97k= Received: by 10.204.103.16 with SMTP id i16mr3963217bko.98.1286732458367; Sun, 10 Oct 2010 10:40:58 -0700 (PDT) Received: from localhost (a91-153-253-80.elisa-laajakaista.fi [91.153.253.80]) by mx.google.com with ESMTPS id x13sm4750572bki.0.2010.10.10.10.40.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 10 Oct 2010 10:40:57 -0700 (PDT) From: Felipe Contreras To: linux-arm , linux-omap , Greg KH Cc: Omar Ramirez Luna , Russell King , Felipe Contreras Subject: [PATCH 2/3] omap: dsp: fix ioremap() usage Date: Sun, 10 Oct 2010 20:40:39 +0300 Message-Id: <1286732440-28644-3-git-send-email-felipe.contreras@gmail.com> X-Mailer: git-send-email 1.7.3.1.2.g7fe2b In-Reply-To: <1286732440-28644-1-git-send-email-felipe.contreras@gmail.com> References: <1286732440-28644-1-git-send-email-felipe.contreras@gmail.com> 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, 10 Oct 2010 17:41:01 +0000 (UTC) diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c index 57205a4..3fee3ca 100644 --- a/arch/arm/plat-omap/common.c +++ b/arch/arm/plat-omap/common.c @@ -37,7 +37,6 @@ #include #include #include -#include #include @@ -84,11 +83,49 @@ const void *omap_get_var_config(u16 tag, size_t *len) } EXPORT_SYMBOL(omap_get_var_config); -void __init omap_reserve(void) +#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE) + +static phys_addr_t omap_dsp_mempool_base; + +static void __init omap_dsp_reserve_mem(struct meminfo *mi) +{ + phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE; + phys_addr_t addr = ~0; + int i; + + if (!size) + return; + + for (i = mi->nr_banks - 1; i >= 0; i--) + if (mi->bank[i].size >= size) { + mi->bank[i].size -= size; + addr = mi->bank[i].start + mi->bank[i].size; + break; + } + + if (addr == ~0) { + pr_err("%s: failed to reserve 0x%x bytes\n", + __func__, size); + return; + } + + omap_dsp_mempool_base = addr; +} + +phys_addr_t omap_dsp_get_mempool_base(void) +{ + return omap_dsp_mempool_base; +} +EXPORT_SYMBOL(omap_dsp_get_mempool_base); +#else +static inline void omap_dsp_reserve_mem(struct meminfo *mi) { } +#endif + +void __init omap_reserve(struct meminfo *mi) { omapfb_reserve_sdram_memblock(); omap_vram_reserve_sdram_memblock(); - omap_dsp_reserve_sdram_memblock(); + omap_dsp_reserve_mem(mi); } /* diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index 4c8f9b9..d1920be 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -273,35 +272,6 @@ static void omap_init_wdt(void) static inline void omap_init_wdt(void) {} #endif -#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE) - -static phys_addr_t omap_dsp_phys_mempool_base; - -void __init omap_dsp_reserve_sdram_memblock(void) -{ - phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE; - phys_addr_t paddr; - - if (!size) - return; - - paddr = __memblock_alloc_base(size, SZ_1M, MEMBLOCK_REAL_LIMIT); - if (!paddr) { - pr_err("%s: failed to reserve %x bytes\n", - __func__, size); - return; - } - - omap_dsp_phys_mempool_base = paddr; -} - -phys_addr_t omap_dsp_get_mempool_base(void) -{ - return omap_dsp_phys_mempool_base; -} -EXPORT_SYMBOL(omap_dsp_get_mempool_base); -#endif - /* * This gets called after board-specific INIT_MACHINE, and initializes most * on-chip peripherals accessible on this board (except for few like USB): diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h index 9776b41..3675492 100644 --- a/arch/arm/plat-omap/include/plat/common.h +++ b/arch/arm/plat-omap/include/plat/common.h @@ -30,11 +30,12 @@ #include struct sys_timer; +struct meminfo; extern void omap_map_common_io(void); extern struct sys_timer omap_timer; -extern void omap_reserve(void); +extern void omap_reserve(struct meminfo *mi); /* * IO bases for various OMAP processors diff --git a/arch/arm/plat-omap/include/plat/dsp.h b/arch/arm/plat-omap/include/plat/dsp.h index 9c604b3..4e53687 100644 --- a/arch/arm/plat-omap/include/plat/dsp.h +++ b/arch/arm/plat-omap/include/plat/dsp.h @@ -22,10 +22,4 @@ struct omap_dsp_platform_data { phys_addr_t phys_mempool_size; }; -#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE) -extern void omap_dsp_reserve_sdram_memblock(void); -#else -static inline void omap_dsp_reserve_sdram_memblock(void) { } -#endif - #endif