xref: /openbmc/linux/arch/arm/mach-davinci/sram.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
23acf731cSArnd Bergmann /*
33acf731cSArnd Bergmann  * mach/sram.h - DaVinci simple SRAM allocator
43acf731cSArnd Bergmann  *
53acf731cSArnd Bergmann  * Copyright (C) 2009 David Brownell
63acf731cSArnd Bergmann  */
73acf731cSArnd Bergmann #ifndef __MACH_SRAM_H
83acf731cSArnd Bergmann #define __MACH_SRAM_H
93acf731cSArnd Bergmann 
103acf731cSArnd Bergmann /* ARBITRARY:  SRAM allocations are multiples of this 2^N size */
113acf731cSArnd Bergmann #define SRAM_GRANULARITY	512
123acf731cSArnd Bergmann 
133acf731cSArnd Bergmann /*
143acf731cSArnd Bergmann  * SRAM allocations return a CPU virtual address, or NULL on error.
153acf731cSArnd Bergmann  * If a DMA address is requested and the SRAM supports DMA, its
163acf731cSArnd Bergmann  * mapped address is also returned.
173acf731cSArnd Bergmann  *
183acf731cSArnd Bergmann  * Errors include SRAM memory not being available, and requesting
193acf731cSArnd Bergmann  * DMA mapped SRAM on systems which don't allow that.
203acf731cSArnd Bergmann  */
213acf731cSArnd Bergmann extern void *sram_alloc(size_t len, dma_addr_t *dma);
223acf731cSArnd Bergmann extern void sram_free(void *addr, size_t len);
233acf731cSArnd Bergmann 
243acf731cSArnd Bergmann /* Get the struct gen_pool * for use in platform data */
253acf731cSArnd Bergmann extern struct gen_pool *sram_get_gen_pool(void);
263acf731cSArnd Bergmann 
273acf731cSArnd Bergmann #endif /* __MACH_SRAM_H */
28