]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
nios2: enable earlycon support
authorTobias Klauser <tklauser@distanz.ch>
Mon, 3 Apr 2017 03:09:04 +0000 (20:09 -0700)
committerLey Foon Tan <ley.foon.tan@intel.com>
Mon, 8 May 2017 08:59:19 +0000 (16:59 +0800)
Enable generic earlycon support for nios2. This e.g. allows to use a
8250/16650 UART as earlycon.

In order to get the earlycon, we just need to call parse_early_param()
in early_init_devtree() as soon as the device tree is initially scanned.
By adding an stdout-path property to the dts (done in this patch for
10m50_devboard), the earlycon can be used.

In order to provide early printk support, we need to provide a dummy
implementation of early_console_write(), so that
arch/nios2/kernel/early_printk.c can still be compiled if neither
SERIAL_ALTERA_JTAGUART_CONSOLE nor SERIAL_ALTERA_UART_CONSOLE is
selected. As soon as the altera_uart and altera_jtaguart support
earlycon, the entire file can be removed.

Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
arch/nios2/Kconfig.debug
arch/nios2/boot/dts/10m50_devboard.dts
arch/nios2/kernel/early_printk.c
arch/nios2/kernel/setup.c

index 2fd08cbfdddb2a724db5685d0b7df86d6fe4d9bc..55105220370ce1c1688614ad29a1921c1226d24e 100644 (file)
@@ -18,7 +18,6 @@ config EARLY_PRINTK
        bool "Activate early kernel debugging"
        default y
        select SERIAL_CORE_CONSOLE
-       depends on SERIAL_ALTERA_JTAGUART_CONSOLE || SERIAL_ALTERA_UART_CONSOLE
        help
          Enable early printk on console
          This is useful for kernel debugging when your machine crashes very
index f362b2224ee7e13d327838c5bec7e5f91d97e22f..4bb4dc1b52e92c0cea2a1c33103e3418841381aa 100644 (file)
        };
 
        chosen {
-               bootargs = "debug console=ttyS0,115200";
+               bootargs = "debug earlycon console=ttyS0,115200";
+               stdout-path = &a_16550_uart_0;
        };
 };
index c08e4c1486fcaef5ae70ca49c34f5b867b2485d9..4a7bb98f744ca987aa9df7e339f2e7e847978bac 100644 (file)
@@ -81,8 +81,11 @@ static void early_console_write(struct console *con, const char *s, unsigned n)
 }
 
 #else
-# error Neither SERIAL_ALTERA_JTAGUART_CONSOLE nor SERIAL_ALTERA_UART_CONSOLE \
-selected
+
+static void early_console_write(struct console *con, const char *s, unsigned n)
+{
+}
+
 #endif
 
 static struct console early_console_prom = {
index 6044d9be28b4493323d362162e7e5ec6c56e1f33..8b5146082e3e9a3490cdaa85aca8968faf731515 100644 (file)
@@ -137,6 +137,8 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
                strncpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
 #endif
 #endif
+
+       parse_early_param();
 }
 
 void __init setup_arch(char **cmdline_p)