fix(plat/marvell/a3720/uart): do external reset during initialization

Sometimes when changing UART clock from TBG to XTAL, UART HW enters into
some broken state. It does not transit characters from TX FIFO anymore
and TX FIFO stays always empty. TX FIFO reset does not recover UART HW
from this broken state.

Experiments show that external reset can fix UART HW from this broken
state.

TF-A fatal error handler calls console_a3700_core_init() function to
initialize UART HW. This handler may be called anytime during CPU
runtime, also when kernel is running.

U-Boot or Linux kernel may change UART clock to TBG to achieve higher
baudrates. During initialization, console_a3700_core_init() resets UART
configuration to default settings, which means that it also changes
UART clock from TBG to XTAL.

Do an external reset of UART via North Bridge Peripheral reset register
to prevent this UART hangup.

Signed-off-by: Pali Rohár <pali@kernel.org>
Change-Id: I8990bce24d1a6fd8ccc47a2cd0a5ff932fcfcf14
This commit is contained in:
Pali Rohár 2021-11-15 12:24:56 +01:00 committed by Manish Pandey
parent a4d35ff381
commit 0ee80f35a2
2 changed files with 9 additions and 0 deletions

View File

@ -69,6 +69,14 @@ func console_a3700_core_init
b.ne 2b
4:
/* Reset UART via North Bridge Peripheral */
mov_imm x4, MVEBU_NB_RESET_REG
ldr w3, [x4]
bic w3, w3, #MVEBU_NB_RESET_UART_N
str w3, [x4]
orr w3, w3, #MVEBU_NB_RESET_UART_N
str w3, [x4]
/* Reset FIFO */
mov w3, #UART_CTRL_RXFIFO_RESET
orr w3, w3, #UART_CTRL_TXFIFO_RESET

View File

@ -9,6 +9,7 @@
#define A3700_CONSOLE_H
#include <drivers/console.h>
#include <platform_def.h>
/* MVEBU UART Registers */
#define UART_RX_REG 0x00