From a5aaa1e14d47f2f12a906110bbe2edd4bd670492 Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Sat, 17 Oct 2020 12:14:11 +0800 Subject: [PATCH] common: fdt_support: remove earlycon if uart is disabled If uart is required to be disabled during power on, it would be not initialized by any pre-loader and U-Boot. If we don't remove earlycon from commandline, kernel hangs while using earlycon to putc/getc which may dead loop for waiting uart status. (It seems the root cause is baundrate is not initilalized) So let's remove earlycon from commandline. Signed-off-by: Joseph Chen Change-Id: I2edcf48cb4dd301f2e79d5e94b1477c55198708f --- common/fdt_support.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/common/fdt_support.c b/common/fdt_support.c index 1577c97c8f..948565a9da 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -22,6 +22,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + /** * fdt_getprop_u32_default_node - Return a node's property or a default * @@ -342,6 +344,22 @@ int fdt_chosen(void *fdt) * this for compatible with legacy parameter.txt */ env_delete("bootargs", "initrd=", 0); + + /* + * If uart is required to be disabled during + * power on, it would be not initialized by + * any pre-loader and U-Boot. + * + * If we don't remove earlycon from commandline, + * kernel hangs while using earlycon to putc/getc + * which may dead loop for waiting uart status. + * (It seems the root cause is baundrate is not + * initilalized) + * + * So let's remove earlycon from commandline. + */ + if (gd->flags & GD_FLG_DISABLE_CONSOLE) + env_delete("bootargs", "earlycon=", 0); } #endif }