lib: utils/serial: Skip initialize serial when dt is not enabled
authorXiang W <wxjstz@126.com>
Tue, 11 Jun 2024 11:19:31 +0000 (19:19 +0800)
committerAnup Patel <anup@brainfault.org>
Thu, 13 Jun 2024 13:06:49 +0000 (18:36 +0530)
When the dt node has a status property and the value is not ok or
okay, skip initializing serial.

Signed-off-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
lib/utils/serial/fdt_serial.c

index 0baa722811741dc254223bf612bd166770c1bad4..8b6e6b9774287f8c1f71ae015058196bf7758eb3 100644 (file)
@@ -40,6 +40,10 @@ int fdt_serial_init(void)
                        else
                                noff = fdt_path_offset(fdt, prop);
                }
+               if (-1 < noff) {
+                       if (!fdt_node_is_enabled(fdt, noff))
+                               noff = -1;
+               }
        }
 
        /* First check DT node pointed by stdout-path */
@@ -68,6 +72,9 @@ int fdt_serial_init(void)
                if (noff < 0)
                        continue;
 
+               if (!fdt_node_is_enabled(fdt, noff))
+                       continue;
+
                /* drv->init must not be NULL */
                if (drv->init == NULL)
                        return SBI_EFAIL;