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