[U-Boot] [PATCH 03/14] sandbox: Move CONFIG_SANDBOX_SERIAL to Kconfig

Simon Glass sjg at chromium.org
Fri Mar 6 21:19:03 CET 2015


Move this over to Kconfig and tidy up.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 configs/sandbox_defconfig      |  1 +
 drivers/serial/Kconfig         | 20 ++++++++++++++++++++
 drivers/serial/serial-uclass.c |  5 +++--
 include/configs/sandbox.h      |  1 -
 include/fdtdec.h               |  6 ++++++
 5 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index a6c3252..72740ef 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -15,3 +15,4 @@ CONFIG_CMD_CROS_EC=y
 CONFIG_BOOTSTAGE=y
 CONFIG_SANDBOX_GPIO=y
 CONFIG_SYS_VSNPRINTF=y
+CONFIG_SANDBOX_SERIAL=y
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 2e87199..13b0582 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -85,6 +85,26 @@ config ROCKCHIP_SERIAL
 	  your board config header. The clock input is automatically set to
 	  use the oscillator (24MHz).
 
+config SANDBOX_SERIAL
+	bool "Sandbox UART support"
+	depends on SANDBOX && DM
+	help
+	  Select this to enable a seral UART for sandbox. This is required to
+	  operate correctly, otherwise you will see no serial output from
+	  sandbox. The emulated UART will display to the console and console
+	  input will be fed into the UART. This allows you to interact with
+	  U-Boot.
+
+	  The operation of the console is controlled by the -t command-line
+	  flag. In raw mode, U-Boot sees all characters from the terminal
+	  before they are processed, including Ctrl-C. In cooked mode, Ctrl-C
+	  is processed by the terminal, and terminates U-Boot. Valid options
+	  are:
+
+	     -t raw-with-sigs	Raw mode, Ctrl-C will terminate U-Boot
+	     -t raw		Raw mode, Ctrl-C is processed by U-Boot
+	     -t cooked		Cooked mode, Ctrl-C terminates
+
 config UNIPHIER_SERIAL
 	bool "UniPhier on-chip UART support"
 	depends on ARCH_UNIPHIER && DM_SERIAL
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 6531841..400629e 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -34,7 +34,7 @@ static void serial_find_console_or_panic(void)
 	struct udevice *dev;
 	int node;
 
-	if (OF_CONTROL) {
+	if (OF_CONTROL && gd->fdt_blob) {
 		/* Check for a chosen console */
 		node = fdtdec_get_chosen_node(gd->fdt_blob, "stdout-path");
 		if (node < 0)
@@ -56,7 +56,8 @@ static void serial_find_console_or_panic(void)
 				return;
 			}
 		}
-	} else {
+	}
+	if (!SPL_BUILD || !OF_CONTROL || !gd->fdt_blob) {
 		/*
 		* Try to use CONFIG_CONS_INDEX if available (it is numbered
 		* from 1!).
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 8d96999..3b3e1f4 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -114,7 +114,6 @@
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{4800, 9600, 19200, 38400, 57600,\
 					115200}
-#define CONFIG_SANDBOX_SERIAL
 
 #define CONFIG_SYS_NO_FLASH
 
diff --git a/include/fdtdec.h b/include/fdtdec.h
index bec2ee9..32a857a 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -41,6 +41,12 @@ struct fdt_memory {
 	fdt_addr_t end;
 };
 
+#ifdef CONFIG_SPL_BUILD
+#define SPL_BUILD	1
+#else
+#define SPL_BUILD	0
+#endif
+
 #ifdef CONFIG_OF_CONTROL
 # if defined(CONFIG_SPL_BUILD) && defined(SPL_DISABLE_OF_CONTROL)
 #  define OF_CONTROL 0
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list