Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
0004  *
0005  * Modified from arch/mips/pnx833x/common/prom.c.
0006  */
0007 
0008 #include <linux/io.h>
0009 #include <linux/init.h>
0010 #include <linux/memblock.h>
0011 #include <linux/serial_reg.h>
0012 #include <asm/fw/fw.h>
0013 
0014 #include <loongson1.h>
0015 
0016 unsigned long memsize;
0017 
0018 void __init prom_init(void)
0019 {
0020     void __iomem *uart_base;
0021 
0022     fw_init_cmdline();
0023 
0024     memsize = fw_getenvl("memsize");
0025     if(!memsize)
0026         memsize = DEFAULT_MEMSIZE;
0027 
0028     if (strstr(arcs_cmdline, "console=ttyS3"))
0029         uart_base = ioremap(LS1X_UART3_BASE, 0x0f);
0030     else if (strstr(arcs_cmdline, "console=ttyS2"))
0031         uart_base = ioremap(LS1X_UART2_BASE, 0x0f);
0032     else if (strstr(arcs_cmdline, "console=ttyS1"))
0033         uart_base = ioremap(LS1X_UART1_BASE, 0x0f);
0034     else
0035         uart_base = ioremap(LS1X_UART0_BASE, 0x0f);
0036     setup_8250_early_printk_port((unsigned long)uart_base, 0, 0);
0037 }
0038 
0039 void __init plat_mem_setup(void)
0040 {
0041     memblock_add(0x0, (memsize << 20));
0042 }