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