2009-07-02 23:22:36 +08:00
|
|
|
/*
|
2009-11-06 18:35:34 +08:00
|
|
|
* Copyright (C) 2009 Lemote Inc.
|
2010-01-04 17:16:51 +08:00
|
|
|
* Author: Wu Zhangjin, wuzhangjin@gmail.com
|
2009-07-02 23:22:36 +08:00
|
|
|
*
|
2013-01-22 19:59:30 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
2009-07-02 23:22:36 +08:00
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/bootmem.h>
|
2014-11-20 05:52:50 +08:00
|
|
|
#include <asm/bootinfo.h>
|
2017-06-22 23:06:50 +08:00
|
|
|
#include <asm/traps.h>
|
2014-03-21 18:44:08 +08:00
|
|
|
#include <asm/smp-ops.h>
|
2017-06-22 23:06:50 +08:00
|
|
|
#include <asm/cacheflush.h>
|
2009-07-02 23:22:36 +08:00
|
|
|
|
2009-07-02 23:23:03 +08:00
|
|
|
#include <loongson.h>
|
2009-07-02 23:22:36 +08:00
|
|
|
|
2009-11-06 18:45:05 +08:00
|
|
|
/* Loongson CPU address windows config space base address */
|
|
|
|
unsigned long __maybe_unused _loongson_addrwincfg_base;
|
|
|
|
|
2017-06-22 23:06:50 +08:00
|
|
|
static void __init mips_nmi_setup(void)
|
|
|
|
{
|
|
|
|
void *base;
|
|
|
|
extern char except_vec_nmi;
|
|
|
|
|
|
|
|
base = (void *)(CAC_BASE + 0x380);
|
|
|
|
memcpy(base, &except_vec_nmi, 0x80);
|
|
|
|
flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
|
|
|
|
}
|
|
|
|
|
2009-07-02 23:22:36 +08:00
|
|
|
void __init prom_init(void)
|
|
|
|
{
|
2009-11-11 13:39:12 +08:00
|
|
|
#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
|
2009-11-06 18:45:05 +08:00
|
|
|
_loongson_addrwincfg_base = (unsigned long)
|
|
|
|
ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE);
|
|
|
|
#endif
|
|
|
|
|
2009-07-02 23:22:36 +08:00
|
|
|
prom_init_cmdline();
|
|
|
|
prom_init_env();
|
2014-03-21 18:44:02 +08:00
|
|
|
|
|
|
|
/* init base address of io space */
|
|
|
|
set_io_port_base((unsigned long)
|
|
|
|
ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
|
|
|
|
|
2014-06-26 11:41:28 +08:00
|
|
|
#ifdef CONFIG_NUMA
|
|
|
|
prom_init_numa_memory();
|
|
|
|
#else
|
2009-07-02 23:22:36 +08:00
|
|
|
prom_init_memory();
|
2014-06-26 11:41:28 +08:00
|
|
|
#endif
|
2009-11-06 18:35:34 +08:00
|
|
|
|
|
|
|
/*init the uart base address */
|
|
|
|
prom_init_uart_base();
|
2014-03-21 18:44:08 +08:00
|
|
|
register_smp_ops(&loongson3_smp_ops);
|
2017-06-22 23:06:50 +08:00
|
|
|
board_nmi_handler_setup = mips_nmi_setup;
|
2009-07-02 23:22:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void __init prom_free_prom_memory(void)
|
|
|
|
{
|
|
|
|
}
|