From patchwork Tue Mar 31 22:35:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 237059 List-Id: U-Boot discussion From: pali at kernel.org (=?UTF-8?q?Pali=20Roh=C3=A1r?=) Date: Wed, 1 Apr 2020 00:35:14 +0200 Subject: [PATCH 07/11] Nokia RX-51: Remember setup_console_atag option In-Reply-To: <20200331223518.10936-1-pali@kernel.org> References: <20200331223518.10936-1-pali@kernel.org> Message-ID: <20200331223518.10936-8-pali@kernel.org> When variable setup_console_atag is unset then read default value from OMAP atags which passed NOLO bootloader to U-Boot. This would allow to boot Maemo Linux kernel from U-Boot with serial console settings configured in NOLO bootloader (which loads U-Boot). So serial console needs to be enabled only at one place, globally in NOLO. Signed-off-by: Pali Roh?r --- board/nokia/rx51/rx51.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c index c8ef26f940..a282fe68a6 100644 --- a/board/nokia/rx51/rx51.c +++ b/board/nokia/rx51/rx51.c @@ -87,6 +87,7 @@ static char *boot_reason_ptr; static char *hw_build_ptr; static char *nolo_version_ptr; static char *boot_mode_ptr; +static int serial_was_console_enabled; /* * Routine: init_omap_tags @@ -143,6 +144,13 @@ static void reuse_omap_atags(struct tag_omap *t) strcpy(boot_mode_ptr, version); } break; + case OMAP_TAG_UART: + if (!t->u.uart.enabled_uarts) + serial_was_console_enabled = 1; + break; + case OMAP_TAG_SERIAL_CONSOLE: + serial_was_console_enabled = 1; + break; default: break; } @@ -233,10 +241,17 @@ void setup_board_tags(struct tag **in_params) return; str = env_get("setup_console_atag"); - if (str && str[0] == '1') - setup_console_atag = 1; - else - setup_console_atag = 0; + if (str && str[0]) { + if (str[0] == '1') + setup_console_atag = 1; + else + setup_console_atag = 0; + } else { + if (serial_was_console_enabled) + setup_console_atag = 1; + else + setup_console_atag = 0; + } setup_boot_reason_atag = env_get("setup_boot_reason_atag"); setup_boot_mode_atag = env_get("setup_boot_mode_atag");