serial: Add a debug console using the RISC-V SBI interface

The RISC-V SBI interface v0.1 provides a function for printing a
character to the console. Even though SBI v0.1 functions are deprecated,
the SBI console is quite useful for early debugging, because it works
without any dcache, memory, or MMIO access in S mode.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 3bb5b02..122a397 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -280,6 +280,14 @@
 	  U-Boot when running on top of EFI (Extensive Firmware Interface).
 	  This is a type of BIOS used by PCs.
 
+config DEBUG_SBI_CONSOLE
+	bool "SBI"
+	depends on SBI_V01
+	help
+	  Select this to enable a debug console which calls back to SBI to
+	  output to the console. This can be useful for early debugging of
+	  U-Boot when running on top of SBI (Supervisor Binary Interface).
+
 config DEBUG_UART_S5P
 	bool "Samsung S5P"
 	depends on ARCH_EXYNOS || ARCH_S5PC1XX
@@ -442,6 +450,7 @@
 config DEBUG_UART_BASE
 	hex "Base address of UART"
 	depends on DEBUG_UART
+	default 0 if DEBUG_SBI_CONSOLE
 	default 0 if DEBUG_UART_SANDBOX
 	help
 	  This is the base address of your UART for memory-mapped UARTs.
@@ -452,6 +461,7 @@
 config DEBUG_UART_CLOCK
 	int "UART input clock"
 	depends on DEBUG_UART
+	default 0 if DEBUG_SBI_CONSOLE
 	default 0 if DEBUG_UART_SANDBOX
 	default 0 if DEBUG_MVEBU_A3700_UART
 	help