diff mbox

[U-Boot,v3,24/62] dm: serial: Add support for of-platdata

Message ID 1467655123-29441-25-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass July 4, 2016, 5:58 p.m. UTC
When this feature is enabled, we cannot access the device tree to find out
which serial device to use. Just use the first serial driver we find.

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

Changes in v3: None
Changes in v2: None

 drivers/serial/serial-uclass.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Simon Glass July 15, 2016, 3:58 a.m. UTC | #1
On 4 July 2016 at 11:58, Simon Glass <sjg@chromium.org> wrote:
> When this feature is enabled, we cannot access the device tree to find out
> which serial device to use. Just use the first serial driver we find.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/serial/serial-uclass.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Applied to u-boot-dm
diff mbox

Patch

diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 0ce5c44..19f38e1 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -33,7 +33,13 @@  static void serial_find_console_or_panic(void)
 	struct udevice *dev;
 	int node;
 
-	if (CONFIG_IS_ENABLED(OF_CONTROL) && blob) {
+	if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
+		uclass_first_device(UCLASS_SERIAL, &dev);
+		if (dev) {
+			gd->cur_serial_dev = dev;
+			return;
+		}
+	} else if (CONFIG_IS_ENABLED(OF_CONTROL) && blob) {
 		/* Check for a chosen console */
 		node = fdtdec_get_chosen_node(blob, "stdout-path");
 		if (node < 0) {