18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 2003 Keith M Wesolowski
78c2ecf20Sopenharmony_ci * Copyright (C) 2005 Ilya A. Volynets (Total Knowledge)
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#include <linux/types.h>
108c2ecf20Sopenharmony_ci#include <linux/init.h>
118c2ecf20Sopenharmony_ci#include <linux/kernel.h>
128c2ecf20Sopenharmony_ci#include <linux/memblock.h>
138c2ecf20Sopenharmony_ci#include <linux/mm.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <asm/ip32/crime.h>
168c2ecf20Sopenharmony_ci#include <asm/bootinfo.h>
178c2ecf20Sopenharmony_ci#include <asm/page.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciextern void crime_init(void);
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_civoid __init prom_meminit(void)
228c2ecf20Sopenharmony_ci{
238c2ecf20Sopenharmony_ci	u64 base, size;
248c2ecf20Sopenharmony_ci	int bank;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	crime_init();
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci	for (bank=0; bank < CRIME_MAXBANKS; bank++) {
298c2ecf20Sopenharmony_ci		u64 bankctl = crime->bank_ctrl[bank];
308c2ecf20Sopenharmony_ci		base = (bankctl & CRIME_MEM_BANK_CONTROL_ADDR) << 25;
318c2ecf20Sopenharmony_ci		if (bank != 0 && base == 0)
328c2ecf20Sopenharmony_ci			continue;
338c2ecf20Sopenharmony_ci		size = (bankctl & CRIME_MEM_BANK_CONTROL_SDRAM_SIZE) ? 128 : 32;
348c2ecf20Sopenharmony_ci		size <<= 20;
358c2ecf20Sopenharmony_ci		if (base + size > (256 << 20))
368c2ecf20Sopenharmony_ci			base += CRIME_HI_MEM_BASE;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci		printk("CRIME MC: bank %u base 0x%016Lx size %LuMiB\n",
398c2ecf20Sopenharmony_ci			bank, base, size >> 20);
408c2ecf20Sopenharmony_ci		memblock_add(base, size);
418c2ecf20Sopenharmony_ci	}
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_civoid __init prom_free_prom_memory(void)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci}
48