From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752157AbaCUVK5 (ORCPT ); Fri, 21 Mar 2014 17:10:57 -0400 Received: from mail-oa0-f44.google.com ([209.85.219.44]:46173 "EHLO mail-oa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbaCUVJw (ORCPT ); Fri, 21 Mar 2014 17:09:52 -0400 From: Rob Herring To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Greg Kroah-Hartman , Jiri Slaby , Catalin Marinas , Russell King , Will Deacon , x86@kernel.org, Arnd Bergmann , Rob Herring Subject: [PATCH 8/8] arm64: remove arch specific earlyprintk Date: Fri, 21 Mar 2014 16:08:48 -0500 Message-Id: <1395436128-11244-9-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1395436128-11244-1-git-send-email-robherring2@gmail.com> References: <1395436128-11244-1-git-send-email-robherring2@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Herring Now that we have equivalent earlycon support, arm64's earlyprintk code can be removed. Signed-off-by: Rob Herring Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/Kconfig.debug | 9 --- arch/arm64/kernel/Makefile | 1 - arch/arm64/kernel/early_printk.c | 158 --------------------------------------- 3 files changed, 168 deletions(-) delete mode 100644 arch/arm64/kernel/early_printk.c diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug index 835c5597..7d7fb6f 100644 --- a/arch/arm64/Kconfig.debug +++ b/arch/arm64/Kconfig.debug @@ -6,15 +6,6 @@ config FRAME_POINTER bool default y -config EARLY_PRINTK - bool "Early printk support" - default y - help - Say Y here if you want to have an early console using the - earlyprintk=[,][,] kernel parameter. It - is assumed that the early console device has been initialised - by the boot loader prior to starting the Linux kernel. - config PID_IN_CONTEXTIDR bool "Write the current PID to the CONTEXTIDR register" help diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 7d811d9..7a6fce5 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -18,7 +18,6 @@ arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o topology.o arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o -arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o arm64-obj-$(CONFIG_KGDB) += kgdb.o diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c deleted file mode 100644 index ffbbdde..0000000 --- a/arch/arm64/kernel/early_printk.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Earlyprintk support. - * - * Copyright (C) 2012 ARM Ltd. - * Author: Catalin Marinas - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -static void __iomem *early_base; -static void (*printch)(char ch); - -/* - * PL011 single character TX. - */ -static void pl011_printch(char ch) -{ - while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_TXFF) - ; - writeb_relaxed(ch, early_base + UART01x_DR); - while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_BUSY) - ; -} - -/* - * Semihosting-based debug console - */ -static void smh_printch(char ch) -{ - asm volatile("mov x1, %0\n" - "mov x0, #3\n" - "hlt 0xf000\n" - : : "r" (&ch) : "x0", "x1", "memory"); -} - -/* - * 8250/16550 (8-bit aligned registers) single character TX. - */ -static void uart8250_8bit_printch(char ch) -{ - while (!(readb_relaxed(early_base + UART_LSR) & UART_LSR_THRE)) - ; - writeb_relaxed(ch, early_base + UART_TX); -} - -/* - * 8250/16550 (32-bit aligned registers) single character TX. - */ -static void uart8250_32bit_printch(char ch) -{ - while (!(readl_relaxed(early_base + (UART_LSR << 2)) & UART_LSR_THRE)) - ; - writel_relaxed(ch, early_base + (UART_TX << 2)); -} - -struct earlycon_match { - const char *name; - void (*printch)(char ch); -}; - -static const struct earlycon_match earlycon_match[] __initconst = { - { .name = "pl011", .printch = pl011_printch, }, - { .name = "smh", .printch = smh_printch, }, - { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, }, - { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, }, - {} -}; - -static void early_write(struct console *con, const char *s, unsigned n) -{ - while (n-- > 0) { - if (*s == '\n') - printch('\r'); - printch(*s); - s++; - } -} - -static struct console early_console_dev = { - .name = "earlycon", - .write = early_write, - .flags = CON_PRINTBUFFER | CON_BOOT, - .index = -1, -}; - -/* - * Parse earlyprintk=... parameter in the format: - * - * [,][,] - * - * and register the early console. It is assumed that the UART has been - * initialised by the bootloader already. - */ -static int __init setup_early_printk(char *buf) -{ - const struct earlycon_match *match = earlycon_match; - phys_addr_t paddr = 0; - - if (!buf) { - pr_warning("No earlyprintk arguments passed.\n"); - return 0; - } - - while (match->name) { - size_t len = strlen(match->name); - if (!strncmp(buf, match->name, len)) { - buf += len; - break; - } - match++; - } - if (!match->name) { - pr_warning("Unknown earlyprintk arguments: %s\n", buf); - return 0; - } - - /* I/O address */ - if (!strncmp(buf, ",0x", 3)) { - char *e; - paddr = simple_strtoul(buf + 1, &e, 16); - buf = e; - } - /* no options parsing yet */ - - if (paddr) { - set_fixmap_io(FIX_EARLYCON_MEM_BASE, paddr); - early_base = (void __iomem *)fix_to_virt(FIX_EARLYCON_MEM_BASE); - } - - printch = match->printch; - early_console = &early_console_dev; - register_console(&early_console_dev); - - return 0; -} - -early_param("earlyprintk", setup_early_printk); -- 1.8.3.2 From mboxrd@z Thu Jan 1 00:00:00 1970 From: robherring2@gmail.com (Rob Herring) Date: Fri, 21 Mar 2014 16:08:48 -0500 Subject: [PATCH 8/8] arm64: remove arch specific earlyprintk In-Reply-To: <1395436128-11244-1-git-send-email-robherring2@gmail.com> References: <1395436128-11244-1-git-send-email-robherring2@gmail.com> Message-ID: <1395436128-11244-9-git-send-email-robherring2@gmail.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org From: Rob Herring Now that we have equivalent earlycon support, arm64's earlyprintk code can be removed. Signed-off-by: Rob Herring Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/Kconfig.debug | 9 --- arch/arm64/kernel/Makefile | 1 - arch/arm64/kernel/early_printk.c | 158 --------------------------------------- 3 files changed, 168 deletions(-) delete mode 100644 arch/arm64/kernel/early_printk.c diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug index 835c5597..7d7fb6f 100644 --- a/arch/arm64/Kconfig.debug +++ b/arch/arm64/Kconfig.debug @@ -6,15 +6,6 @@ config FRAME_POINTER bool default y -config EARLY_PRINTK - bool "Early printk support" - default y - help - Say Y here if you want to have an early console using the - earlyprintk=[,][,] kernel parameter. It - is assumed that the early console device has been initialised - by the boot loader prior to starting the Linux kernel. - config PID_IN_CONTEXTIDR bool "Write the current PID to the CONTEXTIDR register" help diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index 7d811d9..7a6fce5 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -18,7 +18,6 @@ arm64-obj-$(CONFIG_SMP) += smp.o smp_spin_table.o topology.o arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o -arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o arm64-obj-$(CONFIG_KGDB) += kgdb.o diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c deleted file mode 100644 index ffbbdde..0000000 --- a/arch/arm64/kernel/early_printk.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Earlyprintk support. - * - * Copyright (C) 2012 ARM Ltd. - * Author: Catalin Marinas - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -static void __iomem *early_base; -static void (*printch)(char ch); - -/* - * PL011 single character TX. - */ -static void pl011_printch(char ch) -{ - while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_TXFF) - ; - writeb_relaxed(ch, early_base + UART01x_DR); - while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_BUSY) - ; -} - -/* - * Semihosting-based debug console - */ -static void smh_printch(char ch) -{ - asm volatile("mov x1, %0\n" - "mov x0, #3\n" - "hlt 0xf000\n" - : : "r" (&ch) : "x0", "x1", "memory"); -} - -/* - * 8250/16550 (8-bit aligned registers) single character TX. - */ -static void uart8250_8bit_printch(char ch) -{ - while (!(readb_relaxed(early_base + UART_LSR) & UART_LSR_THRE)) - ; - writeb_relaxed(ch, early_base + UART_TX); -} - -/* - * 8250/16550 (32-bit aligned registers) single character TX. - */ -static void uart8250_32bit_printch(char ch) -{ - while (!(readl_relaxed(early_base + (UART_LSR << 2)) & UART_LSR_THRE)) - ; - writel_relaxed(ch, early_base + (UART_TX << 2)); -} - -struct earlycon_match { - const char *name; - void (*printch)(char ch); -}; - -static const struct earlycon_match earlycon_match[] __initconst = { - { .name = "pl011", .printch = pl011_printch, }, - { .name = "smh", .printch = smh_printch, }, - { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, }, - { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, }, - {} -}; - -static void early_write(struct console *con, const char *s, unsigned n) -{ - while (n-- > 0) { - if (*s == '\n') - printch('\r'); - printch(*s); - s++; - } -} - -static struct console early_console_dev = { - .name = "earlycon", - .write = early_write, - .flags = CON_PRINTBUFFER | CON_BOOT, - .index = -1, -}; - -/* - * Parse earlyprintk=... parameter in the format: - * - * [,][,] - * - * and register the early console. It is assumed that the UART has been - * initialised by the bootloader already. - */ -static int __init setup_early_printk(char *buf) -{ - const struct earlycon_match *match = earlycon_match; - phys_addr_t paddr = 0; - - if (!buf) { - pr_warning("No earlyprintk arguments passed.\n"); - return 0; - } - - while (match->name) { - size_t len = strlen(match->name); - if (!strncmp(buf, match->name, len)) { - buf += len; - break; - } - match++; - } - if (!match->name) { - pr_warning("Unknown earlyprintk arguments: %s\n", buf); - return 0; - } - - /* I/O address */ - if (!strncmp(buf, ",0x", 3)) { - char *e; - paddr = simple_strtoul(buf + 1, &e, 16); - buf = e; - } - /* no options parsing yet */ - - if (paddr) { - set_fixmap_io(FIX_EARLYCON_MEM_BASE, paddr); - early_base = (void __iomem *)fix_to_virt(FIX_EARLYCON_MEM_BASE); - } - - printch = match->printch; - early_console = &early_console_dev; - register_console(&early_console_dev); - - return 0; -} - -early_param("earlyprintk", setup_early_printk); -- 1.8.3.2