[coreboot-gerrit] Change in coreboot[master]: soc/cavium: Clean uart code

Patrick Rudolph (Code Review) gerrit at coreboot.org
Thu Mar 29 16:03:46 CEST 2018


Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/25448


Change subject: soc/cavium: Clean uart code
......................................................................

soc/cavium: Clean uart code

* Don't init uart1 in bootblock.
* 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 <patrick.rudolph at 9elements.com>
---
M src/mainboard/cavium/cn8100_sff_evb/bootblock.c
M src/mainboard/cavium/cn8100_sff_evb/mainboard.c
M src/soc/cavium/cn81xx/uart.c
3 files changed, 16 insertions(+), 3 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/48/25448/1

diff --git a/src/mainboard/cavium/cn8100_sff_evb/bootblock.c b/src/mainboard/cavium/cn8100_sff_evb/bootblock.c
index 4fe6e43..dcc9c90 100644
--- a/src/mainboard/cavium/cn8100_sff_evb/bootblock.c
+++ b/src/mainboard/cavium/cn8100_sff_evb/bootblock.c
@@ -16,8 +16,6 @@
 	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);
 	}
 }
 
diff --git a/src/mainboard/cavium/cn8100_sff_evb/mainboard.c b/src/mainboard/cavium/cn8100_sff_evb/mainboard.c
index cc23cb5..b2b98dd 100644
--- a/src/mainboard/cavium/cn8100_sff_evb/mainboard.c
+++ b/src/mainboard/cavium/cn8100_sff_evb/mainboard.c
@@ -15,10 +15,17 @@
  */
 
 #include <device/device.h>
+#include <soc/uart.h>
 
 static void mainboard_init(device_t 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(device_t dev)
diff --git a/src/soc/cavium/cn81xx/uart.c b/src/soc/cavium/cn81xx/uart.c
index b3cce8e..e2d0157 100644
--- a/src/soc/cavium/cn81xx/uart.c
+++ b/src/soc/cavium/cn81xx/uart.c
@@ -225,6 +225,14 @@
 	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

-- 
To view, visit https://review.coreboot.org/25448
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1043b30318ec6210e2dd6b7ac313a41171d37f55
Gerrit-Change-Number: 25448
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180329/e5203bba/attachment.html>


More information about the coreboot-gerrit mailing list