summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mainboard/cavium/cn8100_sff_evb/bootblock.c6
-rw-r--r--src/mainboard/cavium/cn8100_sff_evb/mainboard.c9
-rw-r--r--src/soc/cavium/cn81xx/uart.c8
3 files changed, 18 insertions, 5 deletions
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 <soc/twsi.h>
#include <soc/gpio.h>
#include <delay.h>
+#include <soc/uart.h>
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)
diff --git a/src/soc/cavium/cn81xx/uart.c b/src/soc/cavium/cn81xx/uart.c
index 9fb83871ad..7a9ea3a158 100644
--- a/src/soc/cavium/cn81xx/uart.c
+++ b/src/soc/cavium/cn81xx/uart.c
@@ -233,6 +233,14 @@ int uart_setup(const size_t bus, int baudrate)
write64(&uart->uctl_ctl, ctl.u);
/**
+ * Exit here if the UART is not going to be used in coreboot.
+ * The previous initialization steps are sufficient to make the Linux
+ * kernel not panic.
+ */
+ if (!baudrate)
+ return 0;
+
+ /**
* 7. Initialize the integer and fractional baud rate divider registers
* UARTIBRD and UARTFBRD as follows:
* a. Baud Rate Divisor = UARTCLK/(16xBaud Rate) = BRDI + BRDF