summary refs log tree commit diff stats
path: root/hw/char/imx_serial.c
diff options
context:
space:
mode:
authorBernhard Beschow <shentey@gmail.com>2025-01-11 19:37:01 +0100
committerPeter Maydell <peter.maydell@linaro.org>2025-01-27 13:50:14 +0000
commita451cc11c47903242123def2717a86a56e5fb390 (patch)
treece693d2a47a5e7ec408bd2302d399fcd6a8400f4 /hw/char/imx_serial.c
parentb6cd77fbddf020d4dad23476b286fbeb22d4c334 (diff)
downloadfocaccia-qemu-a451cc11c47903242123def2717a86a56e5fb390.tar.gz
focaccia-qemu-a451cc11c47903242123def2717a86a56e5fb390.zip
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 <shentey@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char/imx_serial.c')
-rw-r--r--hw/char/imx_serial.c6
1 files changed, 3 insertions, 3 deletions
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);
 }