mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matt Porter <mporter@ti.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Hans J. Koch" <hjk@hansjkoch.de>,
	Benoit Cousson <b-cousson@ti.com>, Paul Walmsley <paul@pwsan.com>,
	Sekhar Nori <nsekhar@ti.com>
Cc: Tony Lindgren <tony@atomide.com>,
	Russell King <linux@arm.linux.org.uk>,
	Linux OMAP List <linux-omap@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux ARM Kernel List <linux-arm-kernel@lists.infradead.org>,
	Linux DaVinci Kernel List 
	<davinci-linux-open-source@linux.davincidsp.com>
Subject: [PATCH v2 4/7] ARM: davinci: Add support for an L3RAM gen_pool
Date: Fri, 28 Sep 2012 15:37:49 -0400	[thread overview]
Message-ID: <1348861072-14507-5-git-send-email-mporter@ti.com> (raw)
In-Reply-To: <1348861072-14507-1-git-send-email-mporter@ti.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 <mporter@ti.com>
---
 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 <mach/common.h>
 #include <mach/sram.h>
 
-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);
-- 
1.7.9.5


  parent reply	other threads:[~2012-09-28 19:39 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 19:37 [PATCH v2 0/7] uio_pruss cleanup and platform support Matt Porter
2012-09-28 19:37 ` [PATCH v2 1/7] uio: uio_pruss: replace private SRAM API with genalloc Matt Porter
2012-09-28 19:37 ` [PATCH v2 2/7] uio: uio_pruss: add support for am33xx Matt Porter
2012-09-28 19:37 ` [PATCH v2 3/7] uio: dt: add TI PRUSS binding Matt Porter
2012-09-28 19:37 ` Matt Porter [this message]
2012-10-01 12:04   ` [PATCH v2 4/7] ARM: davinci: Add support for an L3RAM gen_pool Sekhar Nori
2012-10-01 12:32     ` Matt Porter
2012-10-01 13:50       ` Ben Gardiner
2012-10-02 11:13         ` Sekhar Nori
2012-10-02 15:51           ` Ben Gardiner
2012-10-02 16:20           ` Matt Porter
2012-10-01 13:56       ` Matt Porter
2012-10-02 10:02       ` Sekhar Nori
2012-10-02 16:14         ` Matt Porter
2012-09-28 19:37 ` [PATCH v2 5/7] ARM: davinci: Add support for PRUSS on DA850 Matt Porter
2012-09-28 19:37 ` [PATCH v2 6/7] ARM: omap: add DT support for deasserting hardware reset lines Matt Porter
2012-09-28 19:37 ` [PATCH v2 7/7] ARM: dts: AM33xx PRUSS support Matt Porter
2012-09-29 18:34 ` [PATCH v2 0/7] uio_pruss cleanup and platform support Paul Walmsley
2012-10-01 12:54   ` Matt Porter
2012-10-03 15:00 ` Matt Porter
2012-10-05  4:43   ` Hebbar, Gururaja
2012-10-05 21:28     ` Matt Porter
2012-10-08  5:13       ` Hebbar, Gururaja
2015-08-02 18:42   ` Matwey V. Kornilov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348861072-14507-5-git-send-email-mporter@ti.com \
    --to=mporter@ti.com \
    --cc=b-cousson@ti.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hjk@hansjkoch.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nsekhar@ti.com \
    --cc=paul@pwsan.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®