18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * rbtx4939 specific prom routines
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
58c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
68c2ecf20Sopenharmony_ci * for more details.
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/init.h>
108c2ecf20Sopenharmony_ci#include <linux/memblock.h>
118c2ecf20Sopenharmony_ci#include <asm/txx9/generic.h>
128c2ecf20Sopenharmony_ci#include <asm/txx9/rbtx4939.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_civoid __init rbtx4939_prom_init(void)
158c2ecf20Sopenharmony_ci{
168c2ecf20Sopenharmony_ci	unsigned long start, size;
178c2ecf20Sopenharmony_ci	u64 win;
188c2ecf20Sopenharmony_ci	int i;
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci	for (i = 0; i < 4; i++) {
218c2ecf20Sopenharmony_ci		if (!((__u32)____raw_readq(&tx4939_ddrcptr->winen) & (1 << i)))
228c2ecf20Sopenharmony_ci			continue;
238c2ecf20Sopenharmony_ci		win = ____raw_readq(&tx4939_ddrcptr->win[i]);
248c2ecf20Sopenharmony_ci		start = (unsigned long)(win >> 48);
258c2ecf20Sopenharmony_ci		size = (((unsigned long)(win >> 32) & 0xffff) + 1) - start;
268c2ecf20Sopenharmony_ci		memblock_add(start << 20, size << 20);
278c2ecf20Sopenharmony_ci	}
288c2ecf20Sopenharmony_ci	txx9_sio_putchar_init(TX4939_SIO_REG(0) & 0xfffffffffULL);
298c2ecf20Sopenharmony_ci}
30