Commit MetaInfo

Revision8cad489261c564d4ee1db4de4ac365af56807d8a (tree)
Time2016-03-25 01:45:19
AuthorYoshinori Sato <ysato@user...>
CommiterYoshinori Sato

Log Message

h8300: switch EARLYCON

earlyprintk is architecture specific option.
earlycon is generic and small footprint.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

Change Summary

Incremental Difference

--- a/arch/h8300/configs/h8300h-sim_defconfig
+++ b/arch/h8300/configs/h8300h-sim_defconfig
@@ -34,7 +34,7 @@ CONFIG_BINFMT_FLAT=y
3434 # CONFIG_LEGACY_PTYS is not set
3535 # CONFIG_DEVKMEM is not set
3636 CONFIG_SERIAL_SH_SCI=y
37-CONFIG_SERIAL_SH_SCI_CONSOLE=y
37+CONFIG_SERIAL_SH_SCI_EARLYCON=y
3838 # CONFIG_HW_RANDOM is not set
3939 # CONFIG_HWMON is not set
4040 # CONFIG_USB_SUPPORT is not set
--- a/arch/h8300/kernel/setup.c
+++ b/arch/h8300/kernel/setup.c
@@ -20,8 +20,6 @@
2020 #include <linux/bootmem.h>
2121 #include <linux/seq_file.h>
2222 #include <linux/init.h>
23-#include <linux/platform_device.h>
24-#include <linux/module.h>
2523 #include <linux/of.h>
2624 #include <linux/of_fdt.h>
2725 #include <linux/of_platform.h>
@@ -137,11 +135,6 @@ void __init setup_arch(char **cmdline_p)
137135 parse_early_param();
138136
139137 bootmem_init();
140-#if defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)
141- sim_console_register();
142-#endif
143-
144- early_platform_driver_probe("earlyprintk", 1, 0);
145138 /*
146139 * get kmalloc into gear
147140 */
--- a/arch/h8300/kernel/sim-console.c
+++ b/arch/h8300/kernel/sim-console.c
@@ -1,79 +1,30 @@
11 /*
2- * arch/h8300/kernel/early_printk.c
2+ * arch/h8300/kernel/sim-console.c
33 *
4- * Copyright (C) 2009 Yoshinori Sato <ysato@users.sourceforge.jp>
4+ * Copyright (C) 2015 Yoshinori Sato <ysato@users.sourceforge.jp>
55 *
66 * This file is subject to the terms and conditions of the GNU General Public
77 * License. See the file "COPYING" in the main directory of this archive
88 * for more details.
99 */
1010 #include <linux/console.h>
11-#include <linux/tty.h>
1211 #include <linux/init.h>
13-#include <linux/io.h>
14-#include <linux/platform_device.h>
12+#include <linux/serial_core.h>
1513
16-static void sim_write(struct console *co, const char *ptr,
17- unsigned len)
14+static void sim_write(struct console *con, const char *s, unsigned n)
1815 {
1916 register const int fd __asm__("er0") = 1; /* stdout */
20- register const char *_ptr __asm__("er1") = ptr;
21- register const unsigned _len __asm__("er2") = len;
17+ register const char *_ptr __asm__("er1") = s;
18+ register const unsigned _len __asm__("er2") = n;
2219
2320 __asm__(".byte 0x5e,0x00,0x00,0xc7\n\t" /* jsr @0xc7 (sys_write) */
2421 : : "g"(fd), "g"(_ptr), "g"(_len));
2522 }
2623
27-static struct console sim_console = {
28- .name = "sim_console",
29- .write = sim_write,
30- .setup = NULL,
31- .flags = CON_PRINTBUFFER,
32- .index = -1,
33-};
34-
35-static char sim_console_buf[32];
36-
37-static int sim_probe(struct platform_device *pdev)
38-{
39- if (sim_console.data)
40- return -EEXIST;
41-
42- if (!strstr(sim_console_buf, "keep"))
43- sim_console.flags |= CON_BOOT;
44-
45- register_console(&sim_console);
46- return 0;
47-}
48-
49-static int sim_remove(struct platform_device *pdev)
24+static int __init sim_setup(struct earlycon_device *device, const char *opt)
5025 {
26+ device->con->write = sim_write;
5127 return 0;
5228 }
5329
54-static struct platform_driver sim_driver = {
55- .probe = sim_probe,
56- .remove = sim_remove,
57- .driver = {
58- .name = "h8300-sim",
59- .owner = THIS_MODULE,
60- },
61-};
62-
63-early_platform_init_buffer("earlyprintk", &sim_driver,
64- sim_console_buf, ARRAY_SIZE(sim_console_buf));
65-
66-static struct platform_device sim_console_device = {
67- .name = "h8300-sim",
68- .id = 0,
69-};
70-
71-static struct platform_device *devices[] __initdata = {
72- &sim_console_device,
73-};
74-
75-void __init sim_console_register(void)
76-{
77- early_platform_add_devices(devices,
78- ARRAY_SIZE(devices));
79-}
30+EARLYCON_DECLARE(h8sim, sim_setup);
Show on old repository browser