xref: /openbmc/linux/arch/sh/include/asm/sram.h (revision c993487ec87ba6d9ea47b03dad562123d503f4a2)
1*c993487eSPaul Mundt #ifndef __ASM_SRAM_H
2*c993487eSPaul Mundt #define __ASM_SRAM_H
3*c993487eSPaul Mundt 
4*c993487eSPaul Mundt #ifdef CONFIG_HAVE_SRAM_POOL
5*c993487eSPaul Mundt 
6*c993487eSPaul Mundt #include <linux/spinlock.h>
7*c993487eSPaul Mundt #include <linux/genalloc.h>
8*c993487eSPaul Mundt 
9*c993487eSPaul Mundt /* arch/sh/mm/sram.c */
10*c993487eSPaul Mundt extern struct gen_pool *sram_pool;
11*c993487eSPaul Mundt 
12*c993487eSPaul Mundt static inline unsigned long sram_alloc(size_t len)
13*c993487eSPaul Mundt {
14*c993487eSPaul Mundt 	if (!sram_pool)
15*c993487eSPaul Mundt 		return 0UL;
16*c993487eSPaul Mundt 
17*c993487eSPaul Mundt 	return gen_pool_alloc(sram_pool, len);
18*c993487eSPaul Mundt }
19*c993487eSPaul Mundt 
20*c993487eSPaul Mundt static inline void sram_free(unsigned long addr, size_t len)
21*c993487eSPaul Mundt {
22*c993487eSPaul Mundt 	return gen_pool_free(sram_pool, addr, len);
23*c993487eSPaul Mundt }
24*c993487eSPaul Mundt 
25*c993487eSPaul Mundt #else
26*c993487eSPaul Mundt 
27*c993487eSPaul Mundt static inline unsigned long sram_alloc(size_t len)
28*c993487eSPaul Mundt {
29*c993487eSPaul Mundt 	return 0;
30*c993487eSPaul Mundt }
31*c993487eSPaul Mundt 
32*c993487eSPaul Mundt static inline void sram_free(unsigned long addr, size_t len)
33*c993487eSPaul Mundt {
34*c993487eSPaul Mundt }
35*c993487eSPaul Mundt 
36*c993487eSPaul Mundt #endif /* CONFIG_HAVE_SRAM_POOL */
37*c993487eSPaul Mundt 
38*c993487eSPaul Mundt #endif /* __ASM_SRAM_H */
39