From b6cd77fbddf020d4dad23476b286fbeb22d4c334 Mon Sep 17 00:00:00 2001 From: Bernhard Beschow Date: Sat, 11 Jan 2025 19:37:00 +0100 Subject: hw/char/imx_serial: Fix reset value of UFCR register The value of the UCFR register is respected when echoing characters to the terminal, but its reset value is reserved. Fix the reset value to the one documented in the datasheet. While at it move the related attribute out of the section of unimplemented registers since its value is actually respected. Signed-off-by: Bernhard Beschow Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/char/imx_serial.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw/char/imx_serial.c') diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index 7c353fde50..cb6761d40e 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -160,6 +160,7 @@ static void imx_serial_reset(IMXSerialState *s) s->ucr3 = 0x700; s->ubmr = 0; s->ubrc = 4; + s->ufcr = BIT(11) | BIT(0); fifo32_reset(&s->rx_fifo); timer_del(&s->ageing_timer); -- cgit 1.4.1 From a451cc11c47903242123def2717a86a56e5fb390 Mon Sep 17 00:00:00 2001 From: Bernhard Beschow Date: Sat, 11 Jan 2025 19:37:01 +0100 Subject: hw/char/imx_serial: Update all state before restarting ageing timer Fixes characters to be "echoed" after each keystroke rather than after every other since imx_serial_rx_fifo_ageing_timer_restart() would see ~UTS1_RXEMPTY only after every other keystroke. Signed-off-by: Bernhard Beschow Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/char/imx_serial.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hw/char/imx_serial.c') diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index cb6761d40e..38b4865157 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -401,14 +401,14 @@ static void imx_put_data(void *opaque, uint32_t value) if (fifo32_num_used(&s->rx_fifo) >= rxtl) { s->usr1 |= USR1_RRDY; } - - imx_serial_rx_fifo_ageing_timer_restart(s); - s->usr2 |= USR2_RDR; s->uts1 &= ~UTS1_RXEMPTY; if (value & URXD_BRK) { s->usr2 |= USR2_BRCD; } + + imx_serial_rx_fifo_ageing_timer_restart(s); + imx_update(s); } -- cgit 1.4.1