Commit 574b9a04 authored by Jiaxun Yang's avatar Jiaxun Yang Committed by Paul Burton

MIPS: Loongson2ef: Convert to early_printk_8250

early_printk.c is doing the same with early_printk_8250.
Remove duplicated code.
Signed-off-by: default avatarJiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: default avatarPaul Burton <paulburton@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: chenhe@lemote.com
parent 2a598436
...@@ -21,7 +21,6 @@ extern void mach_prepare_shutdown(void); ...@@ -21,7 +21,6 @@ extern void mach_prepare_shutdown(void);
/* environment arguments from bootloader */ /* environment arguments from bootloader */
extern u32 cpu_clock_freq; extern u32 cpu_clock_freq;
extern u32 memsize, highmemsize; extern u32 memsize, highmemsize;
extern const struct plat_smp_ops loongson3_smp_ops;
/* loongson-specific command line, env and memory initialization */ /* loongson-specific command line, env and memory initialization */
extern void __init prom_init_memory(void); extern void __init prom_init_memory(void);
......
...@@ -23,6 +23,7 @@ config LEMOTE_FULOONG2E ...@@ -23,6 +23,7 @@ config LEMOTE_FULOONG2E
select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_SUPPORTS_LITTLE_ENDIAN
select SYS_SUPPORTS_HIGHMEM select SYS_SUPPORTS_HIGHMEM
select SYS_HAS_EARLY_PRINTK select SYS_HAS_EARLY_PRINTK
select USE_GENERIC_EARLY_PRINTK_8250
select GENERIC_ISA_DMA_SUPPORT_BROKEN select GENERIC_ISA_DMA_SUPPORT_BROKEN
select CPU_HAS_WB select CPU_HAS_WB
select LOONGSON_MC146818 select LOONGSON_MC146818
...@@ -52,6 +53,7 @@ config LEMOTE_MACH2F ...@@ -52,6 +53,7 @@ config LEMOTE_MACH2F
select ISA select ISA
select SYS_HAS_CPU_LOONGSON2F select SYS_HAS_CPU_LOONGSON2F
select SYS_HAS_EARLY_PRINTK select SYS_HAS_EARLY_PRINTK
select USE_GENERIC_EARLY_PRINTK_8250
select SYS_SUPPORTS_64BIT_KERNEL select SYS_SUPPORTS_64BIT_KERNEL
select SYS_SUPPORTS_HIGHMEM select SYS_SUPPORTS_HIGHMEM
select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_SUPPORTS_LITTLE_ENDIAN
......
...@@ -10,7 +10,6 @@ obj-$(CONFIG_PCI) += pci.o ...@@ -10,7 +10,6 @@ obj-$(CONFIG_PCI) += pci.o
# #
# Serial port support # Serial port support
# #
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o obj-$(CONFIG_LOONGSON_UART_BASE) += uart_base.o
obj-$(CONFIG_LOONGSON_MC146818) += rtc.o obj-$(CONFIG_LOONGSON_MC146818) += rtc.o
......
// SPDX-License-Identifier: GPL-2.0-or-later
/* early printk support
*
* Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
* Copyright (c) 2009 Lemote Inc.
* Author: Wu Zhangjin, wuzhangjin@gmail.com
*/
#include <linux/serial_reg.h>
#include <asm/setup.h>
#include <loongson.h>
#define PORT(base, offset) (u8 *)(base + offset)
static inline unsigned int serial_in(unsigned char *base, int offset)
{
return readb(PORT(base, offset));
}
static inline void serial_out(unsigned char *base, int offset, int value)
{
writeb(value, PORT(base, offset));
}
void prom_putchar(char c)
{
int timeout;
unsigned char *uart_base;
uart_base = (unsigned char *)_loongson_uart_base;
timeout = 1024;
while (((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) &&
(timeout-- > 0))
;
serial_out(uart_base, UART_TX, c);
}
...@@ -44,7 +44,6 @@ void __init prom_init(void) ...@@ -44,7 +44,6 @@ void __init prom_init(void)
/*init the uart base address */ /*init the uart base address */
prom_init_uart_base(); prom_init_uart_base();
register_smp_ops(&loongson3_smp_ops);
board_nmi_handler_setup = mips_nmi_setup; board_nmi_handler_setup = mips_nmi_setup;
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/setup.h>
#include <loongson.h> #include <loongson.h>
...@@ -38,4 +39,5 @@ void prom_init_loongson_uart_base(void) ...@@ -38,4 +39,5 @@ void prom_init_loongson_uart_base(void)
} }
_loongson_uart_base = TO_UNCAC(loongson_uart_base); _loongson_uart_base = TO_UNCAC(loongson_uart_base);
setup_8250_early_printk_port(_loongson_uart_base, 0, 1024);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment