瀏覽代碼

nios2: enable earlycon support

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>
Tobias Klauser 8 年之前
父節點
當前提交
44a4ed4257
共有 4 個文件被更改,包括 9 次插入4 次删除
  1. 0 1
      arch/nios2/Kconfig.debug
  2. 2 1
      arch/nios2/boot/dts/10m50_devboard.dts
  3. 5 2
      arch/nios2/kernel/early_printk.c
  4. 2 0
      arch/nios2/kernel/setup.c

+ 0 - 1
arch/nios2/Kconfig.debug

@@ -18,7 +18,6 @@ config EARLY_PRINTK
 	bool "Activate early kernel debugging"
 	bool "Activate early kernel debugging"
 	default y
 	default y
 	select SERIAL_CORE_CONSOLE
 	select SERIAL_CORE_CONSOLE
-	depends on SERIAL_ALTERA_JTAGUART_CONSOLE || SERIAL_ALTERA_UART_CONSOLE
 	help
 	help
 	  Enable early printk on console
 	  Enable early printk on console
 	  This is useful for kernel debugging when your machine crashes very
 	  This is useful for kernel debugging when your machine crashes very

+ 2 - 1
arch/nios2/boot/dts/10m50_devboard.dts

@@ -244,6 +244,7 @@
 	};
 	};
 
 
 	chosen {
 	chosen {
-		bootargs = "debug console=ttyS0,115200";
+		bootargs = "debug earlycon console=ttyS0,115200";
+		stdout-path = &a_16550_uart_0;
 	};
 	};
 };
 };

+ 5 - 2
arch/nios2/kernel/early_printk.c

@@ -81,8 +81,11 @@ static void early_console_write(struct console *con, const char *s, unsigned n)
 }
 }
 
 
 #else
 #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
 #endif
 
 
 static struct console early_console_prom = {
 static struct console early_console_prom = {

+ 2 - 0
arch/nios2/kernel/setup.c

@@ -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);
 		strncpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
 #endif
 #endif
 #endif
 #endif
+
+	parse_early_param();
 }
 }
 
 
 void __init setup_arch(char **cmdline_p)
 void __init setup_arch(char **cmdline_p)