xref: /openbmc/linux/arch/mips/loongson64/init.c (revision b58c6630)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2009 Lemote Inc.
4  * Author: Wu Zhangjin, wuzhangjin@gmail.com
5  */
6 
7 #include <linux/irqchip.h>
8 #include <linux/memblock.h>
9 #include <asm/bootinfo.h>
10 #include <asm/traps.h>
11 #include <asm/smp-ops.h>
12 #include <asm/cacheflush.h>
13 #include <asm/fw/fw.h>
14 
15 #include <loongson.h>
16 
17 static void __init mips_nmi_setup(void)
18 {
19 	void *base;
20 	extern char except_vec_nmi;
21 
22 	base = (void *)(CAC_BASE + 0x380);
23 	memcpy(base, &except_vec_nmi, 0x80);
24 	flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
25 }
26 
27 void __init prom_init(void)
28 {
29 	fw_init_cmdline();
30 	prom_init_env();
31 
32 	/* init base address of io space */
33 	set_io_port_base((unsigned long)
34 		ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
35 
36 	prom_init_numa_memory();
37 
38 	/* Hardcode to CPU UART 0 */
39 	setup_8250_early_printk_port(TO_UNCAC(LOONGSON_REG_BASE + 0x1e0), 0, 1024);
40 
41 	register_smp_ops(&loongson3_smp_ops);
42 	board_nmi_handler_setup = mips_nmi_setup;
43 }
44 
45 void __init prom_free_prom_memory(void)
46 {
47 }
48 
49 void __init arch_init_irq(void)
50 {
51 	irqchip_init();
52 }
53