From patchwork Fri Sep 28 19:37:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 1522581 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork1.kernel.org (Postfix) with ESMTP id 5F5723FE80 for ; Fri, 28 Sep 2012 19:40:43 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8SJdEwl006447; Fri, 28 Sep 2012 14:39:14 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8SJdEOs021775; Fri, 28 Sep 2012 14:39:14 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Fri, 28 Sep 2012 14:39:13 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8SJdDbY026291; Fri, 28 Sep 2012 14:39:13 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id AB17080627; Fri, 28 Sep 2012 14:39:13 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 64F0F8062B for ; Fri, 28 Sep 2012 14:37:52 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id q8SJbqbc023910 for ; Fri, 28 Sep 2012 14:37:52 -0500 (CDT) Received: from psmtp.com (na3sys009amx186.postini.com [74.125.149.167]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id q8SJbovC028196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 28 Sep 2012 14:37:51 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]) (using TLSv1) by na3sys009amx186.postini.com ([74.125.148.10]) with SMTP; Fri, 28 Sep 2012 15:37:51 EDT Received: by mail-ie0-f173.google.com with SMTP id 17so7532626iea.4 for ; Fri, 28 Sep 2012 12:37:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=upYI6FK/QBaaCGEoa9Pih7rd86TaX1XD8JSrfF0Kei0=; b=sRMrreVcskZ7spy2gv6PTZfD8K7qsNQ4YjVD4RRgX9PlwwAl3jIpRUAqWKqFkRPXqt bqTpYyyotod1EjH0bMZNCBYUUYLOGcjc3j2yssQ5KSXcSelM+4R+4e0Vtxe7CzPW6p6w DnAU8rAi51E7xtZyad8EP6EV5ptLl+BG6neqrZzmX12Y+GC1Lsnywu7pYL7lAJb8evvv 0meo5B07A1XFmGmQz41Fj6M0yLbtShL8bWOPim+H9hxF/d+dbbH9MnJN9meI/otJb3UW eUuIKdCtHdvkumw2qSUdaIy3X+A8xQo3BcrBzpmJLXocUeCXRN6GMc0VyXrZvpEeAtFR P2/g== Received: by 10.42.148.2 with SMTP id p2mr6482616icv.7.1348861070745; Fri, 28 Sep 2012 12:37:50 -0700 (PDT) Received: from beef.ohporter.com (cpe-24-166-64-7.neo.res.rr.com. [24.166.64.7]) by mx.google.com with ESMTPS id q1sm449747igj.15.2012.09.28.12.37.49 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 12:37:50 -0700 (PDT) From: Matt Porter To: Greg Kroah-Hartman , "Hans J. Koch" , Benoit Cousson , Paul Walmsley , Sekhar Nori Subject: [PATCH v2 4/7] ARM: davinci: Add support for an L3RAM gen_pool Date: Fri, 28 Sep 2012 15:37:49 -0400 Message-ID: <1348861072-14507-5-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348861072-14507-1-git-send-email-mporter@ti.com> References: <1348861072-14507-1-git-send-email-mporter@ti.com> X-pstn-levels: (S:76.97501/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-dkim: 1 skipped:not-enabled X-pstn-settings: 2 (0.5000:0.0050) s cv GT3 gt2 gt1 r p m c X-pstn-addresses: from [82/3] CC: Linux DaVinci Kernel List , Russell King , Tony Lindgren , Linux Kernel Mailing List , Linux OMAP List , Linux ARM Kernel List X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com L3RAM (shared SRAM) is needed for use by several drivers. This creates a genalloc pool and a hook for the platform code to provide the struct gen_pool * in platform data. Signed-off-by: Matt Porter --- arch/arm/mach-davinci/include/mach/common.h | 2 ++ arch/arm/mach-davinci/include/mach/sram.h | 3 +++ arch/arm/mach-davinci/sram.c | 28 ++++++++++++++++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h index bdc4aa8..5a2ea37 100644 --- a/arch/arm/mach-davinci/include/mach/common.h +++ b/arch/arm/mach-davinci/include/mach/common.h @@ -77,6 +77,8 @@ struct davinci_soc_info { struct emac_platform_data *emac_pdata; dma_addr_t sram_dma; unsigned sram_len; + dma_addr_t l3ram_dma; + unsigned l3ram_len; }; extern struct davinci_soc_info davinci_soc_info; diff --git a/arch/arm/mach-davinci/include/mach/sram.h b/arch/arm/mach-davinci/include/mach/sram.h index 111f7cc..1a81e5b 100644 --- a/arch/arm/mach-davinci/include/mach/sram.h +++ b/arch/arm/mach-davinci/include/mach/sram.h @@ -24,4 +24,7 @@ extern void *sram_alloc(size_t len, dma_addr_t *dma); extern void sram_free(void *addr, size_t len); +/* Get the l3ram struct gen_pool * for use in platform data */ +extern struct gen_pool *sram_get_l3ram_pool(void); + #endif /* __MACH_SRAM_H */ diff --git a/arch/arm/mach-davinci/sram.c b/arch/arm/mach-davinci/sram.c index db0f778..e609fa3 100644 --- a/arch/arm/mach-davinci/sram.c +++ b/arch/arm/mach-davinci/sram.c @@ -15,7 +15,12 @@ #include #include -static struct gen_pool *sram_pool; +static struct gen_pool *sram_pool, *l3ram_pool; + +struct gen_pool *sram_get_l3ram_pool(void) +{ + return l3ram_pool; +} void *sram_alloc(size_t len, dma_addr_t *dma) { @@ -54,6 +59,9 @@ EXPORT_SYMBOL(sram_free); static int __init sram_init(void) { unsigned len = davinci_soc_info.sram_len; + unsigned l3ram_dma = davinci_soc_info.l3ram_dma; + unsigned l3ram_len = davinci_soc_info.l3ram_len; + void *l3ram_virt; int status = 0; if (len) { @@ -65,6 +73,24 @@ static int __init sram_init(void) if (sram_pool) status = gen_pool_add(sram_pool, SRAM_VIRT, len, -1); WARN_ON(status < 0); + + if (l3ram_dma) { + l3ram_pool = + gen_pool_create(ilog2(SRAM_GRANULARITY), -1); + if (!l3ram_pool) + status = -ENOMEM; + } + + if (l3ram_pool) { + l3ram_virt = ioremap(l3ram_dma, l3ram_len); + if (l3ram_virt) + status = gen_pool_add_virt(l3ram_pool, + (unsigned long)l3ram_virt, + l3ram_dma, l3ram_len, -1); + else + status = -ENOMEM; + } + return status; } core_initcall(sram_init);