blob: 9b987fe98b5b004d6bb4fe635a081c14fcd21f4d [file] [log] [blame]
Wu Zhangjinbd92aa02009-07-02 23:22:36 +08001/*
Wu Zhangjina3ed4952009-11-06 18:35:34 +08002 * Copyright (C) 2009 Lemote Inc.
Wu Zhangjinf7a904d2010-01-04 17:16:51 +08003 * Author: Wu Zhangjin, wuzhangjin@gmail.com
Wu Zhangjinbd92aa02009-07-02 23:22:36 +08004 *
Ralf Baechle70342282013-01-22 12:59:30 +01005 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
Wu Zhangjinbd92aa02009-07-02 23:22:36 +08007 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
Wu Zhangjinbd92aa02009-07-02 23:22:36 +080011#include <linux/bootmem.h>
Aaro Koskinen8387efd2014-11-19 23:52:50 +020012#include <asm/bootinfo.h>
Huacai Chen300459d2014-03-21 18:44:08 +080013#include <asm/smp-ops.h>
Wu Zhangjinbd92aa02009-07-02 23:22:36 +080014
Wu Zhangjin5e983ff2009-07-02 23:23:03 +080015#include <loongson.h>
Wu Zhangjinbd92aa02009-07-02 23:22:36 +080016
Wu Zhangjin6f7a2512009-11-06 18:45:05 +080017/* Loongson CPU address windows config space base address */
18unsigned long __maybe_unused _loongson_addrwincfg_base;
19
Wu Zhangjinbd92aa02009-07-02 23:22:36 +080020void __init prom_init(void)
21{
Wu Zhangjin55045ff2009-11-11 13:39:12 +080022#ifdef CONFIG_CPU_SUPPORTS_ADDRWINCFG
Wu Zhangjin6f7a2512009-11-06 18:45:05 +080023 _loongson_addrwincfg_base = (unsigned long)
24 ioremap(LOONGSON_ADDRWINCFG_BASE, LOONGSON_ADDRWINCFG_SIZE);
25#endif
26
Wu Zhangjinbd92aa02009-07-02 23:22:36 +080027 prom_init_cmdline();
28 prom_init_env();
Huacai Chen1a08f152014-03-21 18:44:02 +080029
30 /* init base address of io space */
31 set_io_port_base((unsigned long)
32 ioremap(LOONGSON_PCIIO_BASE, LOONGSON_PCIIO_SIZE));
33
Huacai Chenc4617312014-06-26 11:41:28 +080034#ifdef CONFIG_NUMA
35 prom_init_numa_memory();
36#else
Wu Zhangjinbd92aa02009-07-02 23:22:36 +080037 prom_init_memory();
Huacai Chenc4617312014-06-26 11:41:28 +080038#endif
Wu Zhangjina3ed4952009-11-06 18:35:34 +080039
40 /*init the uart base address */
Wu Zhangjina3ed4952009-11-06 18:35:34 +080041 prom_init_uart_base();
Huacai Chen300459d2014-03-21 18:44:08 +080042 register_smp_ops(&loongson3_smp_ops);
Wu Zhangjinbd92aa02009-07-02 23:22:36 +080043}
44
45void __init prom_free_prom_memory(void)
46{
47}