Skip to content

Commit 44a4ed4

Browse files
tklauserLey Foon Tan
authored andcommitted
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>
1 parent 57ac76e commit 44a4ed4

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎arch/nios2/Kconfig.debug‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ config EARLY_PRINTK
1818
bool "Activate early kernel debugging"
1919
default y
2020
select SERIAL_CORE_CONSOLE
21-
depends on SERIAL_ALTERA_JTAGUART_CONSOLE || SERIAL_ALTERA_UART_CONSOLE
2221
help
2322
Enable early printk on console
2423
This is useful for kernel debugging when your machine crashes very

‎arch/nios2/boot/dts/10m50_devboard.dts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@
244244
};
245245

246246
chosen {
247-
bootargs = "debug console=ttyS0,115200";
247+
bootargs = "debug earlycon console=ttyS0,115200";
248+
stdout-path = &a_16550_uart_0;
248249
};
249250
};

‎arch/nios2/kernel/early_printk.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,11 @@ static void early_console_write(struct console *con, const char *s, unsigned n)
8181
}
8282

8383
#else
84-
# error Neither SERIAL_ALTERA_JTAGUART_CONSOLE nor SERIAL_ALTERA_UART_CONSOLE \
85-
selected
84+
85+
static void early_console_write(struct console *con, const char *s, unsigned n)
86+
{
87+
}
88+
8689
#endif
8790

8891
static struct console early_console_prom = {

‎arch/nios2/kernel/setup.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
137137
strncpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
138138
#endif
139139
#endif
140+
141+
parse_early_param();
140142
}
141143

142144
void __init setup_arch(char **cmdline_p)

0 commit comments

Comments
 (0)