From 3fb7e40a21b1570a8ce1cd1708134fa7a05d94fb Mon Sep 17 00:00:00 2001 From: Stephan Gerhold Date: Tue, 23 Aug 2022 22:33:11 +0200 Subject: fix(msm8916): print \r before \n on UART console UART drivers in TF-A are expected to print \r before \n. Some terminal emulators expect \r\n as line endings by default so not doing this causes broken line breaks. Change-Id: I271a35a7c6907441bc71713b0b6a1da19da96878 Signed-off-by: Stephan Gerhold --- plat/qti/msm8916/aarch64/uartdm_console.S | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plat/qti/msm8916/aarch64/uartdm_console.S b/plat/qti/msm8916/aarch64/uartdm_console.S index c69c1932a..e14217939 100644 --- a/plat/qti/msm8916/aarch64/uartdm_console.S +++ b/plat/qti/msm8916/aarch64/uartdm_console.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Stephan Gerhold + * Copyright (c) 2021-2022, Stephan Gerhold * * Based on aarch64/skeleton_console.S: * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved. @@ -113,10 +113,21 @@ endfunc console_uartdm_putc * ----------------------------------------------------------- */ func console_uartdm_core_putc + cmp w0, #'\n' + b.ne 2f + 1: /* Loop until TX FIFO has space */ ldr w2, [x1, #UART_DM_SR] tbz w2, #UART_DM_SR_TXRDY_BIT, 1b + /* Prepend '\r' to '\n' */ + mov w2, #'\r' + str w2, [x1, #UART_DM_TF] + +2: /* Loop until TX FIFO has space */ + ldr w2, [x1, #UART_DM_SR] + tbz w2, #UART_DM_SR_TXRDY_BIT, 2b + /* Write character to FIFO */ str w0, [x1, #UART_DM_TF] ret -- cgit v1.2.1