aboutsummaryrefslogtreecommitdiff
path: root/arch/avr32
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2008-03-05 10:00:28 +0100
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-07-02 11:05:01 +0200
commitb83d6ee17588f1a4fbfc8ef0451b0900a5ef5950 (patch)
treebde2ffd7f1ad14d8a6f15300a8e0d7b36224bbc9 /arch/avr32
parent7951f188a0b7f9b2f181c692efb0d31082bec346 (diff)
avr32: Add simple SRAM allocator
Add SRAM allocator for avr32, which is just a thin wrapper around genalloc. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32')
-rw-r--r--arch/avr32/Kconfig1
-rw-r--r--arch/avr32/mach-at32ap/at32ap700x.c26
2 files changed, 27 insertions, 0 deletions
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index a5793c13f50..e8ee5fa017b 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -88,6 +88,7 @@ config PLATFORM_AT32AP
select MMU
select PERFORMANCE_COUNTERS
select HAVE_GPIO_LIB
+ select GENERIC_ALLOCATOR
#
# CPU types
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c
index 3ee5e727879..07b21b121ee 100644
--- a/arch/avr32/mach-at32ap/at32ap700x.c
+++ b/arch/avr32/mach-at32ap/at32ap700x.c
@@ -20,6 +20,7 @@
#include <asm/arch/at32ap700x.h>
#include <asm/arch/board.h>
#include <asm/arch/portmux.h>
+#include <asm/arch/sram.h>
#include <video/atmel_lcdc.h>
@@ -2120,3 +2121,28 @@ void __init setup_platform(void)
at32_init_pio(&pio3_device);
at32_init_pio(&pio4_device);
}
+
+struct gen_pool *sram_pool;
+
+static int __init sram_init(void)
+{
+ struct gen_pool *pool;
+
+ /* 1KiB granularity */
+ pool = gen_pool_create(10, -1);
+ if (!pool)
+ goto fail;
+
+ if (gen_pool_add(pool, 0x24000000, 0x8000, -1))
+ goto err_pool_add;
+
+ sram_pool = pool;
+ return 0;
+
+err_pool_add:
+ gen_pool_destroy(pool);
+fail:
+ pr_err("Failed to create SRAM pool\n");
+ return -ENOMEM;
+}
+core_initcall(sram_init);