aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2014-05-28 12:23:39 -0400
committerRob Herring <robh@kernel.org>2014-05-28 12:23:39 -0400
commit728dd198aa543397c88f6f8e35f4f187b2bbc09d (patch)
treed9f93149b69c3ece5849243a2836fbc511d3aae4 /arch
parente723e4429983333c6fbd3848de50333834d5e89c (diff)
parent45e0f0f5684327a72866a34aedc3fcf8eec51889 (diff)
Merge branch 'earlycon-dt' into for-next
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/devtree.c11
-rw-r--r--arch/arm/mach-imx/clk-imx35.c4
-rw-r--r--arch/arm64/Kconfig3
-rw-r--r--arch/arm64/Kconfig.debug9
-rw-r--r--arch/arm64/kernel/Makefile1
-rw-r--r--arch/arm64/kernel/early_printk.c156
-rw-r--r--arch/x86/Kconfig3
7 files changed, 14 insertions, 173 deletions
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 3e5a2056a466..ea9ce92a4b52 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -33,18 +33,21 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
33} 33}
34 34
35#ifdef CONFIG_SMP 35#ifdef CONFIG_SMP
36extern struct of_cpu_method __cpu_method_of_table_begin[]; 36extern struct of_cpu_method __cpu_method_of_table[];
37extern struct of_cpu_method __cpu_method_of_table_end[]; 37
38static const struct of_cpu_method __cpu_method_of_table_sentinel
39 __used __section(__cpu_method_of_table_end);
40
38 41
39static int __init set_smp_ops_by_method(struct device_node *node) 42static int __init set_smp_ops_by_method(struct device_node *node)
40{ 43{
41 const char *method; 44 const char *method;
42 struct of_cpu_method *m = __cpu_method_of_table_begin; 45 struct of_cpu_method *m = __cpu_method_of_table;
43 46
44 if (of_property_read_string(node, "enable-method", &method)) 47 if (of_property_read_string(node, "enable-method", &method))
45 return 0; 48 return 0;
46 49
47 for (; m < __cpu_method_of_table_end; m++) 50 for (; m->method; m++)
48 if (!strcmp(m->method, method)) { 51 if (!strcmp(m->method, method)) {
49 smp_set_ops(m->ops); 52 smp_set_ops(m->ops);
50 return 1; 53 return 1;
diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index a4d5e425cd82..71c86a2f856d 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -289,14 +289,12 @@ int __init mx35_clocks_init(void)
289 return 0; 289 return 0;
290} 290}
291 291
292static int __init mx35_clocks_init_dt(struct device_node *ccm_node) 292static void __init mx35_clocks_init_dt(struct device_node *ccm_node)
293{ 293{
294 clk_data.clks = clk; 294 clk_data.clks = clk;
295 clk_data.clk_num = ARRAY_SIZE(clk); 295 clk_data.clk_num = ARRAY_SIZE(clk);
296 of_clk_add_provider(ccm_node, of_clk_src_onecell_get, &clk_data); 296 of_clk_add_provider(ccm_node, of_clk_src_onecell_get, &clk_data);
297 297
298 mx35_clocks_init(); 298 mx35_clocks_init();
299
300 return 0;
301} 299}
302CLK_OF_DECLARE(imx35, "fsl,imx35-ccm", mx35_clocks_init_dt); 300CLK_OF_DECLARE(imx35, "fsl,imx35-ccm", mx35_clocks_init_dt);
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index e759af5d7098..f5f63b715d91 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -112,6 +112,9 @@ config IOMMU_HELPER
112config KERNEL_MODE_NEON 112config KERNEL_MODE_NEON
113 def_bool y 113 def_bool y
114 114
115config FIX_EARLYCON_MEM
116 def_bool y
117
115source "init/Kconfig" 118source "init/Kconfig"
116 119
117source "kernel/Kconfig.freezer" 120source "kernel/Kconfig.freezer"
diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug
index d10ec334c93b..1c1b75629842 100644
--- a/arch/arm64/Kconfig.debug
+++ b/arch/arm64/Kconfig.debug
@@ -20,15 +20,6 @@ config STRICT_DEVMEM
20 20
21 If in doubt, say Y. 21 If in doubt, say Y.
22 22
23config EARLY_PRINTK
24 bool "Early printk support"
25 default y
26 help
27 Say Y here if you want to have an early console using the
28 earlyprintk=<name>[,<addr>][,<options>] kernel parameter. It
29 is assumed that the early console device has been initialised
30 by the boot loader prior to starting the Linux kernel.
31
32config PID_IN_CONTEXTIDR 23config PID_IN_CONTEXTIDR
33 bool "Write the current PID to the CONTEXTIDR register" 24 bool "Write the current PID to the CONTEXTIDR register"
34 help 25 help
diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile
index 7d811d9522bc..7a6fce5167e9 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
18arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o 18arm64-obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
19arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o 19arm64-obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
20arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o 20arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
21arm64-obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
22arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o 21arm64-obj-$(CONFIG_ARM64_CPU_SUSPEND) += sleep.o suspend.o
23arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o 22arm64-obj-$(CONFIG_JUMP_LABEL) += jump_label.o
24arm64-obj-$(CONFIG_KGDB) += kgdb.o 23arm64-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 2dc36d00addf..000000000000
--- a/arch/arm64/kernel/early_printk.c
+++ /dev/null
@@ -1,156 +0,0 @@
1/*
2 * Earlyprintk support.
3 *
4 * Copyright (C) 2012 ARM Ltd.
5 * Author: Catalin Marinas <catalin.marinas@arm.com>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#include <linux/kernel.h>
20#include <linux/console.h>
21#include <linux/init.h>
22#include <linux/string.h>
23#include <linux/mm.h>
24#include <linux/io.h>
25
26#include <linux/amba/serial.h>
27#include <linux/serial_reg.h>
28
29#include <asm/fixmap.h>
30
31static void __iomem *early_base;
32static void (*printch)(char ch);
33
34/*
35 * PL011 single character TX.
36 */
37static void pl011_printch(char ch)
38{
39 while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_TXFF)
40 ;
41 writeb_relaxed(ch, early_base + UART01x_DR);
42 while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_BUSY)
43 ;
44}
45
46/*
47 * Semihosting-based debug console
48 */
49static void smh_printch(char ch)
50{
51 asm volatile("mov x1, %0\n"
52 "mov x0, #3\n"
53 "hlt 0xf000\n"
54 : : "r" (&ch) : "x0", "x1", "memory");
55}
56
57/*
58 * 8250/16550 (8-bit aligned registers) single character TX.
59 */
60static void uart8250_8bit_printch(char ch)
61{
62 while (!(readb_relaxed(early_base + UART_LSR) & UART_LSR_THRE))
63 ;
64 writeb_relaxed(ch, early_base + UART_TX);
65}
66
67/*
68 * 8250/16550 (32-bit aligned registers) single character TX.
69 */
70static void uart8250_32bit_printch(char ch)
71{
72 while (!(readl_relaxed(early_base + (UART_LSR << 2)) & UART_LSR_THRE))
73 ;
74 writel_relaxed(ch, early_base + (UART_TX << 2));
75}
76
77struct earlycon_match {
78 const char *name;
79 void (*printch)(char ch);
80};
81
82static const struct earlycon_match earlycon_match[] __initconst = {
83 { .name = "pl011", .printch = pl011_printch, },
84 { .name = "smh", .printch = smh_printch, },
85 { .name = "uart8250-8bit", .printch = uart8250_8bit_printch, },
86 { .name = "uart8250-32bit", .printch = uart8250_32bit_printch, },
87 {}
88};
89
90static void early_write(struct console *con, const char *s, unsigned n)
91{
92 while (n-- > 0) {
93 if (*s == '\n')
94 printch('\r');
95 printch(*s);
96 s++;
97 }
98}
99
100static struct console early_console_dev = {
101 .name = "earlycon",
102 .write = early_write,
103 .flags = CON_PRINTBUFFER | CON_BOOT,
104 .index = -1,
105};
106
107/*
108 * Parse earlyprintk=... parameter in the format:
109 *
110 * <name>[,<addr>][,<options>]
111 *
112 * and register the early console. It is assumed that the UART has been
113 * initialised by the bootloader already.
114 */
115static int __init setup_early_printk(char *buf)
116{
117 const struct earlycon_match *match = earlycon_match;
118 phys_addr_t paddr = 0;
119
120 if (!buf) {
121 pr_warning("No earlyprintk arguments passed.\n");
122 return 0;
123 }
124
125 while (match->name) {
126 size_t len = strlen(match->name);
127 if (!strncmp(buf, match->name, len)) {
128 buf += len;
129 break;
130 }
131 match++;
132 }
133 if (!match->name) {
134 pr_warning("Unknown earlyprintk arguments: %s\n", buf);
135 return 0;
136 }
137
138 /* I/O address */
139 if (!strncmp(buf, ",0x", 3)) {
140 char *e;
141 paddr = simple_strtoul(buf + 1, &e, 16);
142 buf = e;
143 }
144 /* no options parsing yet */
145
146 if (paddr)
147 early_base = (void __iomem *)set_fixmap_offset_io(FIX_EARLYCON_MEM_BASE, paddr);
148
149 printch = match->printch;
150 early_console = &early_console_dev;
151 register_console(&early_console_dev);
152
153 return 0;
154}
155
156early_param("earlyprintk", setup_early_printk);
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 25d2c6f7325e..0fb6cfd50e75 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -261,6 +261,9 @@ config ARCH_HWEIGHT_CFLAGS
261config ARCH_SUPPORTS_UPROBES 261config ARCH_SUPPORTS_UPROBES
262 def_bool y 262 def_bool y
263 263
264config FIX_EARLYCON_MEM
265 def_bool y
266
264source "init/Kconfig" 267source "init/Kconfig"
265source "kernel/Kconfig.freezer" 268source "kernel/Kconfig.freezer"
266 269