From: Simon Glass Date: Mon, 12 Jun 2017 12:21:58 +0000 (-0600) Subject: dm: serial: Add livetree support X-Git-Tag: v2017.09-rc1~214^2~10 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f93472a0221b6e1eb7acce8aee6c2eb335904f58;p=oweals%2Fu-boot.git dm: serial: Add livetree support Add support for a live device tree to the core serial uclass. Signed-off-by: Simon Glass Tested-by: Marcel Ziswiler Tested-on: Beaver, Jetson-TK1 --- diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 7e4290684c..f360534683 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -14,6 +14,7 @@ #include #include #include +#include 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) {