diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-05-07 12:31:42 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-05-28 18:18:13 -0400 |
commit | 20e9969b3aa5166d50c8df474967c9d80bf6d481 (patch) | |
tree | bc0a72c26cd5fece59dd02fb6df0851c69e3a74d /arch/arm/mach-davinci/include/mach | |
parent | 0d04eb47054f685b23033ed6ceadfb20db77c5b3 (diff) |
davinci: add SRAM allocator
Provide a generic SRAM allocator using genalloc, and vaguely
modeled after what AVR32 uses. This builds on top of the
static CPU mapping set up in the previous patch, and returns
DMA mappings as requested (if possible).
Compared to its OMAP cousin, there's no current support for
(currently non-existent) DaVinci power management code running
in SRAM; and this has ways to deallocate, instead of being
allocate-only.
The initial user of this should probably be the audio code,
because EDMA from DDR is subject to various dropouts on at
least DM355 and DM6446 chips.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/include/mach')
-rw-r--r-- | arch/arm/mach-davinci/include/mach/sram.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/include/mach/sram.h b/arch/arm/mach-davinci/include/mach/sram.h new file mode 100644 index 000000000000..111f7cc71e07 --- /dev/null +++ b/arch/arm/mach-davinci/include/mach/sram.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /* | ||
2 | * mach/sram.h - DaVinci simple SRAM allocator | ||
3 | * | ||
4 | * Copyright (C) 2009 David Brownell | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | #ifndef __MACH_SRAM_H | ||
11 | #define __MACH_SRAM_H | ||
12 | |||
13 | /* ARBITRARY: SRAM allocations are multiples of this 2^N size */ | ||
14 | #define SRAM_GRANULARITY 512 | ||
15 | |||
16 | /* | ||
17 | * SRAM allocations return a CPU virtual address, or NULL on error. | ||
18 | * If a DMA address is requested and the SRAM supports DMA, its | ||
19 | * mapped address is also returned. | ||
20 | * | ||
21 | * Errors include SRAM memory not being available, and requesting | ||
22 | * DMA mapped SRAM on systems which don't allow that. | ||
23 | */ | ||
24 | extern void *sram_alloc(size_t len, dma_addr_t *dma); | ||
25 | extern void sram_free(void *addr, size_t len); | ||
26 | |||
27 | #endif /* __MACH_SRAM_H */ | ||