summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-01 11:55:15 -0600
committerSimon Glass <sjg@chromium.org>2018-10-09 04:40:27 -0600
commitee4417644c7ba40d6365fc8e18ce0e8570544314 (patch)
treeef0c6957ea07efa37719e6ab677001d5acbfda0d
parent55d39911c0579b91a27f0acf3d0c1e123bb29ac1 (diff)
downloadu-boot-ee4417644c7ba40d6365fc8e18ce0e8570544314.tar.gz
sandbox: Add a debug UART
Add support for the debug UART so that sandbox provides build testing for this feature. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--configs/sandbox_defconfig2
-rw-r--r--drivers/serial/Kconfig11
-rw-r--r--drivers/serial/sandbox.c17
3 files changed, 30 insertions, 0 deletions
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 1c4a3330b4..2ce336fc81 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -1,5 +1,6 @@
CONFIG_SYS_TEXT_BASE=0
CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_DEBUG_UART=y
CONFIG_DISTRO_DEFAULTS=y
CONFIG_NR_DRAM_BANKS=1
CONFIG_ANDROID_BOOT_IMAGE=y
@@ -173,6 +174,7 @@ CONFIG_REMOTEPROC_SANDBOX=y
CONFIG_DM_RESET=y
CONFIG_SANDBOX_RESET=y
CONFIG_DM_RTC=y
+CONFIG_DEBUG_UART_SANDBOX=y
CONFIG_SANDBOX_SERIAL=y
CONFIG_SMEM=y
CONFIG_SANDBOX_SMEM=y
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 5fa27254e3..83f8c94d02 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -324,6 +324,15 @@ config DEBUG_UART_MXC
will need to provide parameters to make this work. The driver will
be available until the real driver model serial is running.
+config DEBUG_UART_SANDBOX
+ bool "sandbox"
+ depends on SANDBOX_SERIAL
+ help
+ Select this to enable the debug UART using the sandbox driver. This
+ provides basic serial output from the console without needing to
+ start up driver model. The driver will be available until the real
+ driver model serial is running.
+
config DEBUG_UART_STM32
bool "STMicroelectronics STM32"
depends on STM32_SERIAL
@@ -354,6 +363,7 @@ endchoice
config DEBUG_UART_BASE
hex "Base address of UART"
depends on DEBUG_UART
+ default 0 if DEBUG_UART_SANDBOX
help
This is the base address of your UART for memory-mapped UARTs.
@@ -363,6 +373,7 @@ config DEBUG_UART_BASE
config DEBUG_UART_CLOCK
int "UART input clock"
depends on DEBUG_UART
+ default 0 if DEBUG_UART_SANDBOX
help
The UART input clock determines the speed of the internal UART
circuitry. The baud rate is derived from this by dividing the input
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index 94b4fdfb17..4fbc5956b7 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -143,6 +143,23 @@ static int sandbox_serial_getc(struct udevice *dev)
return result;
}
+#ifdef CONFIG_DEBUG_UART_SANDBOX
+
+#include <debug_uart.h>
+
+static inline void _debug_uart_init(void)
+{
+}
+
+static inline void _debug_uart_putc(int ch)
+{
+ os_putc(ch);
+}
+
+DEBUG_UART_FUNCS
+
+#endif /* CONFIG_DEBUG_UART_SANDBOX */
+
static int sandbox_serial_setconfig(struct udevice *dev, uint serial_config)
{
u8 parity = SERIAL_GET_PARITY(serial_config);