18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_SRAM_H 38c2ecf20Sopenharmony_ci#define __ASM_SRAM_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifdef CONFIG_HAVE_SRAM_POOL 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#include <linux/spinlock.h> 88c2ecf20Sopenharmony_ci#include <linux/genalloc.h> 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* arch/sh/mm/sram.c */ 118c2ecf20Sopenharmony_ciextern struct gen_pool *sram_pool; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cistatic inline unsigned long sram_alloc(size_t len) 148c2ecf20Sopenharmony_ci{ 158c2ecf20Sopenharmony_ci if (!sram_pool) 168c2ecf20Sopenharmony_ci return 0UL; 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci return gen_pool_alloc(sram_pool, len); 198c2ecf20Sopenharmony_ci} 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistatic inline void sram_free(unsigned long addr, size_t len) 228c2ecf20Sopenharmony_ci{ 238c2ecf20Sopenharmony_ci return gen_pool_free(sram_pool, addr, len); 248c2ecf20Sopenharmony_ci} 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#else 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistatic inline unsigned long sram_alloc(size_t len) 298c2ecf20Sopenharmony_ci{ 308c2ecf20Sopenharmony_ci return 0; 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistatic inline void sram_free(unsigned long addr, size_t len) 348c2ecf20Sopenharmony_ci{ 358c2ecf20Sopenharmony_ci} 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#endif /* CONFIG_HAVE_SRAM_POOL */ 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#endif /* __ASM_SRAM_H */ 40