xref: /openbmc/linux/arch/sh/mm/sram.c (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
1c993487eSPaul Mundt /*
2c993487eSPaul Mundt  * SRAM pool for tiny memories not otherwise managed.
3c993487eSPaul Mundt  *
4c993487eSPaul Mundt  * Copyright (C) 2010  Paul Mundt
5c993487eSPaul Mundt  *
6c993487eSPaul Mundt  * This file is subject to the terms and conditions of the GNU General Public
7c993487eSPaul Mundt  * License.  See the file "COPYING" in the main directory of this archive
8c993487eSPaul Mundt  * for more details.
9c993487eSPaul Mundt  */
10c993487eSPaul Mundt #include <linux/init.h>
11c993487eSPaul Mundt #include <linux/kernel.h>
12*f03c4866SPaul Mundt #include <linux/errno.h>
13c993487eSPaul Mundt #include <asm/sram.h>
14c993487eSPaul Mundt 
15c993487eSPaul Mundt /*
16c993487eSPaul Mundt  * This provides a standard SRAM pool for tiny memories that can be
17c993487eSPaul Mundt  * added either by the CPU or the platform code. Typical SRAM sizes
18c993487eSPaul Mundt  * to be inserted in to the pool will generally be less than the page
19c993487eSPaul Mundt  * size, with anything more reasonably sized handled as a NUMA memory
20c993487eSPaul Mundt  * node.
21c993487eSPaul Mundt  */
22c993487eSPaul Mundt struct gen_pool *sram_pool;
23c993487eSPaul Mundt 
sram_pool_init(void)24c993487eSPaul Mundt static int __init sram_pool_init(void)
25c993487eSPaul Mundt {
26c993487eSPaul Mundt 	/*
27c993487eSPaul Mundt 	 * This is a global pool, we don't care about node locality.
28c993487eSPaul Mundt 	 */
29c993487eSPaul Mundt 	sram_pool = gen_pool_create(1, -1);
30c993487eSPaul Mundt 	if (unlikely(!sram_pool))
31c993487eSPaul Mundt 		return -ENOMEM;
32c993487eSPaul Mundt 
33c993487eSPaul Mundt 	return 0;
34c993487eSPaul Mundt }
35c993487eSPaul Mundt core_initcall(sram_pool_init);
36