summaryrefslogtreecommitdiffstats
path: root/arch/sh/mm/sram.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-10-15 02:09:00 +0900
committerPaul Mundt <lethal@linux-sh.org>2010-10-15 02:09:00 +0900
commitc993487ec87ba6d9ea47b03dad562123d503f4a2 (patch)
treeb7e9332b6fbbb8bf105b7db8e79bc0e1d6f55033 /arch/sh/mm/sram.c
parentb6b77b2d5ffd2f8ee74fcc27661f7f4962c34705 (diff)
downloadlinux-c993487ec87ba6d9ea47b03dad562123d503f4a2.tar.gz
linux-c993487ec87ba6d9ea47b03dad562123d503f4a2.tar.bz2
linux-c993487ec87ba6d9ea47b03dad562123d503f4a2.zip
sh: Provide a generic SRAM pool for tiny memories.
This sets up a generic SRAM pool for CPUs and platform code to insert their otherwise unused memories into. A simple alloc/free interface is provided (lifed from avr32) for generic code. This only applies to tiny SRAMs that are otherwise unmanaged, and does not take in to account the more complex SRAMs sitting behind transfer engines, or that employ an I/D split. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm/sram.c')
-rw-r--r--arch/sh/mm/sram.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/arch/sh/mm/sram.c b/arch/sh/mm/sram.c
new file mode 100644
index 000000000000..bc156ec4545e
--- /dev/null
+++ b/arch/sh/mm/sram.c
@@ -0,0 +1,34 @@
+/*
+ * SRAM pool for tiny memories not otherwise managed.
+ *
+ * Copyright (C) 2010 Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <asm/sram.h>
+
+/*
+ * This provides a standard SRAM pool for tiny memories that can be
+ * added either by the CPU or the platform code. Typical SRAM sizes
+ * to be inserted in to the pool will generally be less than the page
+ * size, with anything more reasonably sized handled as a NUMA memory
+ * node.
+ */
+struct gen_pool *sram_pool;
+
+static int __init sram_pool_init(void)
+{
+ /*
+ * This is a global pool, we don't care about node locality.
+ */
+ sram_pool = gen_pool_create(1, -1);
+ if (unlikely(!sram_pool))
+ return -ENOMEM;
+
+ return 0;
+}
+core_initcall(sram_pool_init);