]> git.sur5r.net Git - u-boot/commitdiff
dm: serial: Add livetree support
authorSimon Glass <sjg@chromium.org>
Mon, 12 Jun 2017 12:21:58 +0000 (06:21 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 11 Jul 2017 16:08:20 +0000 (10:08 -0600)
Add support for a live device tree to the core serial uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1

drivers/serial/serial-uclass.c

index 7e4290684c5e41384f35601006b9764dfe930df5..f360534683961c2e3391face53d5931b1b5bd984 100644 (file)
@@ -14,6 +14,7 @@
 #include <watchdog.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
+#include <dm/of_access.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -81,9 +82,20 @@ static void serial_find_console_or_panic(void)
                        return;
                }
        } else if (CONFIG_IS_ENABLED(OF_CONTROL) && blob) {
-               if (!serial_check_stdout(blob, &dev)) {
-                       gd->cur_serial_dev = dev;
-                       return;
+               /* Live tree has support for stdout */
+               if (of_live_active()) {
+                       struct device_node *np = of_get_stdout();
+
+                       if (np && !uclass_get_device_by_ofnode(UCLASS_SERIAL,
+                                       np_to_ofnode(np), &dev)) {
+                               gd->cur_serial_dev = dev;
+                               return;
+                       }
+               } else {
+                       if (!serial_check_stdout(blob, &dev)) {
+                               gd->cur_serial_dev = dev;
+                               return;
+                       }
                }
        }
        if (!SPL_BUILD || !CONFIG_IS_ENABLED(OF_CONTROL) || !blob) {