qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] imx_serial: set wake bit when we receive a data byte
@ 2023-06-08 15:41 Martin Kaiser
  2023-06-12 13:23 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Martin Kaiser @ 2023-06-08 15:41 UTC (permalink / raw)
  To: Peter Maydell, Marc-André Lureau, Paolo Bonzini
  Cc: qemu-arm, qemu-devel, Martin Kaiser

The linux kernel added a flood check for rx data recently in commmit
496a4471b7c3 ("serial: imx: work-around for hardware RX flood"). This
check uses the wake bit in the uart status register 2. The wake bit
indicates that the receiver detected a start bit. If the kernel sees a
number of rx interrupts without the wake bit being set, it treats this as
spurious data and resets the uart port. imx_serial does never set the
wake bit and triggers the kernel's flood check.

This patch adds support for the wake bit. wake is set when we receive a
new character (it's not set for break events). It seems that wake is
cleared by the kernel driver, the hardware does not have to clear it
automatically after data was read.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 hw/char/imx_serial.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index ee1375e26d..44125d5f47 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -321,6 +321,9 @@ static void imx_put_data(void *opaque, uint32_t value)
 
 static void imx_receive(void *opaque, const uint8_t *buf, int size)
 {
+    IMXSerialState *s = (IMXSerialState *)opaque;
+
+    s->usr2 |= USR2_WAKE;
     imx_put_data(opaque, *buf);
 }
 
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-19 13:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-08 15:41 [PATCH] imx_serial: set wake bit when we receive a data byte Martin Kaiser
2023-06-12 13:23 ` Philippe Mathieu-Daudé
2023-06-15  9:27   ` Martin Kaiser
2023-06-15  9:30 ` [PATCH v2] " Martin Kaiser
2023-06-15 10:25   ` Philippe Mathieu-Daudé
2023-06-15 14:22 ` [PATCH v3] " Martin Kaiser
2023-06-19 10:36   ` Peter Maydell
2023-06-19 13:09     ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).