summaryrefslogtreecommitdiffstats
path: root/arch/mips/loongson32/common/prom.c
blob: 73dd251424843c1f343b6e609a9d72023ab8be09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
 *
 * Modified from arch/mips/pnx833x/common/prom.c.
 */

#include <linux/io.h>
#include <linux/init.h>
#include <linux/serial_reg.h>
#include <asm/bootinfo.h>
#include <asm/fw/fw.h>

#include <loongson1.h>

unsigned long memsize;

void __init prom_init(void)
{
	void __iomem *uart_base;

	fw_init_cmdline();

	memsize = fw_getenvl("memsize");
	if(!memsize)
		memsize = DEFAULT_MEMSIZE;

	if (strstr(arcs_cmdline, "console=ttyS3"))
		uart_base = ioremap_nocache(LS1X_UART3_BASE, 0x0f);
	else if (strstr(arcs_cmdline, "console=ttyS2"))
		uart_base = ioremap_nocache(LS1X_UART2_BASE, 0x0f);
	else if (strstr(arcs_cmdline, "console=ttyS1"))
		uart_base = ioremap_nocache(LS1X_UART1_BASE, 0x0f);
	else
		uart_base = ioremap_nocache(LS1X_UART0_BASE, 0x0f);
	setup_8250_early_printk_port((unsigned long)uart_base, 0, 0);
}

void __init prom_free_prom_memory(void)
{
}

void __init plat_mem_setup(void)
{
	add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
}