mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
20e9969b3a
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>
28 lines
852 B
C
28 lines
852 B
C
/*
|
|
* mach/sram.h - DaVinci simple SRAM allocator
|
|
*
|
|
* Copyright (C) 2009 David Brownell
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
#ifndef __MACH_SRAM_H
|
|
#define __MACH_SRAM_H
|
|
|
|
/* ARBITRARY: SRAM allocations are multiples of this 2^N size */
|
|
#define SRAM_GRANULARITY 512
|
|
|
|
/*
|
|
* SRAM allocations return a CPU virtual address, or NULL on error.
|
|
* If a DMA address is requested and the SRAM supports DMA, its
|
|
* mapped address is also returned.
|
|
*
|
|
* Errors include SRAM memory not being available, and requesting
|
|
* DMA mapped SRAM on systems which don't allow that.
|
|
*/
|
|
extern void *sram_alloc(size_t len, dma_addr_t *dma);
|
|
extern void sram_free(void *addr, size_t len);
|
|
|
|
#endif /* __MACH_SRAM_H */
|