h8300: switch EARLYCON
authorYoshinori Sato <ysato@users.sourceforge.jp>
Sat, 21 Nov 2015 12:42:58 +0000 (21:42 +0900)
committerYoshinori Sato <ysato@users.sourceforge.jp>
Thu, 24 Mar 2016 16:45:19 +0000 (01:45 +0900)
earlyprintk is architecture specific option.
earlycon is generic and small footprint.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
arch/h8300/configs/h8300h-sim_defconfig
arch/h8300/kernel/setup.c
arch/h8300/kernel/sim-console.c

index 067bfe9c49b3a6c96fea0713a0e27837f021b1fe..80624f46b0ed4797ca1faa1f45625ae849b68713 100644 (file)
@@ -34,7 +34,7 @@ CONFIG_BINFMT_FLAT=y
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_DEVKMEM is not set
 CONFIG_SERIAL_SH_SCI=y
-CONFIG_SERIAL_SH_SCI_CONSOLE=y
+CONFIG_SERIAL_SH_SCI_EARLYCON=y
 # CONFIG_HW_RANDOM is not set
 # CONFIG_HWMON is not set
 # CONFIG_USB_SUPPORT is not set
index e4985dfa91dc853e1c227759808814b2e5e2ea97..c8c25a4e9e489eb8944d87551f55694dc6e50b8a 100644 (file)
@@ -20,8 +20,6 @@
 #include <linux/bootmem.h>
 #include <linux/seq_file.h>
 #include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 #include <linux/of_platform.h>
@@ -137,11 +135,6 @@ void __init setup_arch(char **cmdline_p)
        parse_early_param();
 
        bootmem_init();
-#if defined(CONFIG_H8300H_SIM) || defined(CONFIG_H8S_SIM)
-       sim_console_register();
-#endif
-
-       early_platform_driver_probe("earlyprintk", 1, 0);
        /*
         * get kmalloc into gear
         */
index a15edf0565d9e69c3ada3de938e2ac549be5e782..46138f55a9ea7eedb86eeb60e074655d863bcc69 100644 (file)
@@ -1,79 +1,30 @@
 /*
- * arch/h8300/kernel/early_printk.c
+ * arch/h8300/kernel/sim-console.c
  *
- *  Copyright (C) 2009 Yoshinori Sato <ysato@users.sourceforge.jp>
+ *  Copyright (C) 2015 Yoshinori Sato <ysato@users.sourceforge.jp>
  *
  * 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.
  */
 #include <linux/console.h>
-#include <linux/tty.h>
 #include <linux/init.h>
-#include <linux/io.h>
-#include <linux/platform_device.h>
+#include <linux/serial_core.h>
 
-static void sim_write(struct console *co, const char *ptr,
-                                unsigned len)
+static void sim_write(struct console *con, const char *s, unsigned n)
 {
        register const int fd __asm__("er0") = 1; /* stdout */
-       register const char *_ptr __asm__("er1") = ptr;
-       register const unsigned _len __asm__("er2") = len;
+       register const char *_ptr __asm__("er1") = s;
+       register const unsigned _len __asm__("er2") = n;
 
        __asm__(".byte 0x5e,0x00,0x00,0xc7\n\t" /* jsr @0xc7 (sys_write) */
                : : "g"(fd), "g"(_ptr), "g"(_len));
 }
 
-static struct console sim_console = {
-       .name           = "sim_console",
-       .write          = sim_write,
-       .setup          = NULL,
-       .flags          = CON_PRINTBUFFER,
-       .index          = -1,
-};
-
-static char sim_console_buf[32];
-
-static int sim_probe(struct platform_device *pdev)
-{
-       if (sim_console.data)
-               return -EEXIST;
-
-       if (!strstr(sim_console_buf, "keep"))
-               sim_console.flags |= CON_BOOT;
-
-       register_console(&sim_console);
-       return 0;
-}
-
-static int sim_remove(struct platform_device *pdev)
+static int __init sim_setup(struct earlycon_device *device, const char *opt)
 {
+       device->con->write = sim_write;
        return 0;
 }
 
-static struct platform_driver sim_driver = {
-       .probe          = sim_probe,
-       .remove         = sim_remove,
-       .driver         = {
-               .name   = "h8300-sim",
-               .owner  = THIS_MODULE,
-       },
-};
-
-early_platform_init_buffer("earlyprintk", &sim_driver,
-                          sim_console_buf, ARRAY_SIZE(sim_console_buf));
-
-static struct platform_device sim_console_device = {
-       .name           = "h8300-sim",
-       .id             = 0,
-};
-
-static struct platform_device *devices[] __initdata = {
-       &sim_console_device,
-};
-
-void __init sim_console_register(void)
-{
-       early_platform_add_devices(devices,
-                                  ARRAY_SIZE(devices));
-}
+EARLYCON_DECLARE(h8sim, sim_setup);