printk: Keep boot console on if enabled

Without this change, the boot console has strong assumption of the state of
the "real" console, so when PM kicks in during early boot stage, resources
(l(CR) clocks, GPIOs, etc) for the boot console may be turned off if the "real"
console sharing these resources is not enabled, which will lead to malfuntion
of boot console.

Change-Id: I19a58d76c99e0fb7bff0d9dc06a2b0f9066063e2
Signed-off-by: Qing Chang <a21550@motorola.com>
Reviewed-on: https://gerrit.mot.com/1472630
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Qing Chang <qing@motorola.com>
Submit-Approved: Jira Key
Signed-off-by: Qing Chang <a21550@motorola.com>
Reviewed-on: https://gerrit.mot.com/1474157
Reviewed-on: https://gerrit.mot.com/1509725
Reviewed-by: Wang Wang <wangwang1@lenovo.com>
This commit is contained in:
Qing Chang authored and Gilberto Gambugge committed 2023-06-01 00:47:09 -03:00
1 parent 280c7b9502
commit 7b6dfedec4
1 file changed
+24 -2
+24 -2
View File
@@ -2635,14 +2635,26 @@ void register_console(struct console *newcon)
struct console *bcon = NULL;
struct console_cmdline *c;
static bool has_preferred;
bool duplicated = false;
if (console_drivers)
for_each_console(bcon)
for_each_console(bcon) {
if (WARN(bcon == newcon,
"console '%s%d' already registered\n",
bcon->name, bcon->index))
return;
if ((bcon->flags & CON_BOOT) && bcon->match &&
!bcon->match(bcon, newcon->name,
newcon->index, NULL)) {
pr_info("Duplicated console '%s%d' & '%s%d'\n",
bcon->name, bcon->index,
newcon->name, newcon->index);
duplicated = true;
}
}
/*
* before we register a new CON_BOOT console, make sure we don't
* already have a valid console
@@ -2717,8 +2729,18 @@ void register_console(struct console *newcon)
break;
}
if (!(newcon->flags & CON_ENABLED))
if (!(newcon->flags & CON_ENABLED)) {
if (duplicated) {
if (newcon->index < 0)
newcon->index = 0;
if (newcon->setup && newcon->setup(newcon, NULL))
pr_err("Failed to set up duplicated console "
"'%s%d'\n", newcon->name, newcon->index);
}
return;
}
/*
* If we have a bootconsole, and are switching to a real console,