[U-Boot] [PATCH] cmd: console: Add serial devices probe command

Wilson Lee wilson.lee at ni.com
Mon Nov 6 08:50:13 UTC 2017


U-boot will only probe and register single serial device that selected
to be used as stdio device. This will cause changing of stdio devices
from one serial devices to another serial devices is not possible due
to others serial devices are not registered on the stdio list. This
command will allow user to probe others possible serial console and
register them to stdio list for stdio switching.

Signed-off-by: Wilson Lee <wilson.lee at ni.com>
Cc: Joe Hershberger <joe.hershberger at ni.com>
Cc: Keng Soon Cheah <keng.soon.cheah at ni.com>
Cc: Chen Yee Chew <chen.yee.chew at ni.com>
---
 cmd/console.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/cmd/console.c b/cmd/console.c
index 9a356ec..5bf897f 100644
--- a/cmd/console.c
+++ b/cmd/console.c
@@ -8,6 +8,7 @@
 /*
  * Boot support
  */
+#include <dm.h>
 #include <common.h>
 #include <command.h>
 #include <stdio_dev.h>
@@ -43,6 +44,22 @@ static int do_coninfo(cmd_tbl_t *cmd, int flag, int argc, char * const argv[])
 	return 0;
 }
 
+static int do_conprobe(cmd_tbl_t *cmd, int flag, int argc, char * const argv[])
+{
+	struct udevice *dev;
+	struct uclass *uc;
+
+	uclass_get(UCLASS_SERIAL, &uc);
+	uclass_foreach_dev(dev, uc) {
+		/*
+		 * Loop through all serial devices, probe and register
+		 * them with stdio services.
+		 */
+		if (device_probe(dev))
+			debug("%s: %s: PROBE FAIL\n", __func__, dev->name);
+	}
+	return 0;
+}
 
 /***************************************************/
 
@@ -51,3 +68,9 @@ U_BOOT_CMD(
 	"print console devices and information",
 	""
 );
+
+U_BOOT_CMD(
+	conprobe,	3,	1,	do_conprobe,
+	"probe serial devices and register with stdio list",
+	""
+);
-- 
2.7.4



More information about the U-Boot mailing list