xref: /OK3568_Linux_fs/kernel/arch/mips/txx9/rbtx4939/prom.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * rbtx4939 specific prom routines
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * This file is subject to the terms and conditions of the GNU General Public
5*4882a593Smuzhiyun  * License.  See the file "COPYING" in the main directory of this archive
6*4882a593Smuzhiyun  * for more details.
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #include <linux/init.h>
10*4882a593Smuzhiyun #include <linux/memblock.h>
11*4882a593Smuzhiyun #include <asm/txx9/generic.h>
12*4882a593Smuzhiyun #include <asm/txx9/rbtx4939.h>
13*4882a593Smuzhiyun 
rbtx4939_prom_init(void)14*4882a593Smuzhiyun void __init rbtx4939_prom_init(void)
15*4882a593Smuzhiyun {
16*4882a593Smuzhiyun 	unsigned long start, size;
17*4882a593Smuzhiyun 	u64 win;
18*4882a593Smuzhiyun 	int i;
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun 	for (i = 0; i < 4; i++) {
21*4882a593Smuzhiyun 		if (!((__u32)____raw_readq(&tx4939_ddrcptr->winen) & (1 << i)))
22*4882a593Smuzhiyun 			continue;
23*4882a593Smuzhiyun 		win = ____raw_readq(&tx4939_ddrcptr->win[i]);
24*4882a593Smuzhiyun 		start = (unsigned long)(win >> 48);
25*4882a593Smuzhiyun 		size = (((unsigned long)(win >> 32) & 0xffff) + 1) - start;
26*4882a593Smuzhiyun 		memblock_add(start << 20, size << 20);
27*4882a593Smuzhiyun 	}
28*4882a593Smuzhiyun 	txx9_sio_putchar_init(TX4939_SIO_REG(0) & 0xfffffffffULL);
29*4882a593Smuzhiyun }
30