From d0dcf877e4dc85f951e6c8c53702292fff060bc6 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Wed, 28 Mar 2018 12:28:02 +0200 Subject: soc/cavium: Clean uart code * Only init UART_FOR_CONSOLE * Allow UART init with zero baudrate. * Init UART0..3 on Cavium's cn8100_sff_evb to fix kernel panic. Tested on CN8100_SFF_EVB. Change-Id: I1043b30318ec6210e2dd6b7ac313a41171d37f55 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/25448 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks --- src/mainboard/cavium/cn8100_sff_evb/bootblock.c | 6 ++---- src/mainboard/cavium/cn8100_sff_evb/mainboard.c | 9 ++++++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/mainboard/cavium/cn8100_sff_evb') diff --git a/src/mainboard/cavium/cn8100_sff_evb/bootblock.c b/src/mainboard/cavium/cn8100_sff_evb/bootblock.c index 36332cc6e3..a13b966df7 100644 --- a/src/mainboard/cavium/cn8100_sff_evb/bootblock.c +++ b/src/mainboard/cavium/cn8100_sff_evb/bootblock.c @@ -21,10 +21,8 @@ void bootblock_mainboard_early_init(void) { if (IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE)) { - if (!uart_is_enabled(0)) - uart_setup(0, CONFIG_TTYS0_BAUD); - if (!uart_is_enabled(1)) - uart_setup(0, CONFIG_TTYS0_BAUD); + if (!uart_is_enabled(CONFIG_UART_FOR_CONSOLE)) + uart_setup(CONFIG_UART_FOR_CONSOLE, CONFIG_TTYS0_BAUD); } } diff --git a/src/mainboard/cavium/cn8100_sff_evb/mainboard.c b/src/mainboard/cavium/cn8100_sff_evb/mainboard.c index b6d4ad8a7c..1c2c4365d2 100644 --- a/src/mainboard/cavium/cn8100_sff_evb/mainboard.c +++ b/src/mainboard/cavium/cn8100_sff_evb/mainboard.c @@ -22,12 +22,19 @@ #include #include #include +#include extern const struct bdk_devicetree_key_value devtree[]; static void mainboard_init(struct device *dev) { - /* FIXME: stub */ + size_t i; + + /* Init UARTs */ + for (i = 0; i < 4; i++) { + if (!uart_is_enabled(i)) + uart_setup(i, 0); + } } static void mainboard_enable(struct device *dev) -- cgit v1.2.3