MIPS: SEAD3: Use generic ns16550a earlycon support
authorPaul Burton <paul.burton@imgtec.com>
Fri, 26 Aug 2016 14:17:36 +0000 (15:17 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 4 Oct 2016 23:31:20 +0000 (01:31 +0200)
Stop selecting SYS_HAS_EARLY_PRINTK & remove the custom support for
early output to the ns16550a UARTs, instead relying upon generic
ns16550a earlycon support. This reduces the amount of platform code
required for SEAD3 without losing any functionality.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14049/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Kconfig
arch/mips/configs/sead3_defconfig
arch/mips/mti-sead3/Makefile
arch/mips/mti-sead3/sead3-console.c [deleted file]
arch/mips/mti-sead3/sead3-init.c

index 6fba0eff858e14ca442cda7e53040a1605507795..7ec9ed7ab67b7a94af32c405c8d688a8e2d5d8ac 100644 (file)
@@ -514,7 +514,6 @@ config MIPS_SEAD3
        select SYS_HAS_CPU_MIPS32_R2
        select SYS_HAS_CPU_MIPS32_R6
        select SYS_HAS_CPU_MIPS64_R1
-       select SYS_HAS_EARLY_PRINTK
        select SYS_SUPPORTS_32BIT_KERNEL
        select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
index deb48fb77d1fd565441970dfcca736a933b9fa38..23cce819d669c3fed5b9123b9f6f2d5318ba0374 100644 (file)
@@ -15,6 +15,8 @@ CONFIG_PROFILING=y
 CONFIG_OPROFILE=y
 CONFIG_MODULES=y
 # CONFIG_BLK_DEV_BSG is not set
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="earlycon"
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
index aad67aac3dbaea11408bda38516be4b7b21b3b49..a58b6d9648464a5e0345ab2ed7bd065b2bd30018 100644 (file)
@@ -17,5 +17,3 @@ obj-y += sead3-platform.o
 obj-y += sead3-reset.o
 obj-y += sead3-setup.o
 obj-y += sead3-time.o
-
-obj-$(CONFIG_EARLY_PRINTK)     += sead3-console.o
diff --git a/arch/mips/mti-sead3/sead3-console.c b/arch/mips/mti-sead3/sead3-console.c
deleted file mode 100644 (file)
index 031f47d..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2012 MIPS Technologies, Inc.  All rights reserved.
- */
-#include <linux/init.h>
-#include <linux/console.h>
-#include <linux/serial_reg.h>
-#include <linux/io.h>
-
-#define SEAD_UART1_REGS_BASE   0xbf000800   /* ttyS1 = DB9 port */
-#define SEAD_UART0_REGS_BASE   0xbf000900   /* ttyS0 = USB port   */
-#define PORT(base_addr, offset) ((unsigned int __iomem *)(base_addr+(offset)*4))
-
-static char console_port = 1;
-
-static inline unsigned int serial_in(int offset, unsigned int base_addr)
-{
-       return __raw_readl(PORT(base_addr, offset)) & 0xff;
-}
-
-static inline void serial_out(int offset, int value, unsigned int base_addr)
-{
-       __raw_writel(value, PORT(base_addr, offset));
-}
-
-void __init fw_init_early_console(char port)
-{
-       console_port = port;
-}
-
-int prom_putchar(char c)
-{
-       unsigned int base_addr;
-
-       base_addr = console_port ? SEAD_UART1_REGS_BASE : SEAD_UART0_REGS_BASE;
-
-       while ((serial_in(UART_LSR, base_addr) & UART_LSR_THRE) == 0)
-               ;
-
-       serial_out(UART_TX, c, base_addr);
-
-       return 1;
-}
index e81f5b7657f0cfe6000e794265dcaf1e7b3f78f7..50f3fcb0fd8064930f60bab2471814d5a3e0425b 100644 (file)
@@ -93,12 +93,6 @@ void __init prom_init(void)
        board_ejtag_handler_setup = mips_ejtag_setup;
 
        fw_init_cmdline();
-#ifdef CONFIG_EARLY_PRINTK
-       if ((strstr(fw_getcmdline(), "console=ttyS0")) != NULL)
-               fw_init_early_console(0);
-       else if ((strstr(fw_getcmdline(), "console=ttyS1")) != NULL)
-               fw_init_early_console(1);
-#endif
 }
 
 void __init prom_free_prom_memory(void)