[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/33] imx_serial: set wake bit when we receive a data byte
From: |
Peter Maydell |
Subject: |
[PULL 28/33] imx_serial: set wake bit when we receive a data byte |
Date: |
Mon, 19 Jun 2023 15:29:09 +0100 |
From: Martin Kaiser <martin@kaiser.cx>
The Linux kernel added a flood check for RX data recently in commit
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 on the RX line. 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.
The wake bit can be configured as an interrupt source. Support this
mechanism as well.
Co-developed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/char/imx_serial.h | 1 +
hw/char/imx_serial.c | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
index 91c9894ad55..b823f945195 100644
--- a/include/hw/char/imx_serial.h
+++ b/include/hw/char/imx_serial.h
@@ -71,6 +71,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(IMXSerialState, IMX_SERIAL)
#define UCR4_DREN BIT(0) /* Receive Data Ready interrupt enable */
#define UCR4_TCEN BIT(3) /* TX complete interrupt enable */
+#define UCR4_WKEN BIT(7) /* WAKE interrupt enable */
#define UTS1_TXEMPTY (1<<6)
#define UTS1_RXEMPTY (1<<5)
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
index ee1375e26d7..1b75a895881 100644
--- a/hw/char/imx_serial.c
+++ b/hw/char/imx_serial.c
@@ -80,7 +80,7 @@ static void imx_update(IMXSerialState *s)
* TCEN and TXDC are both bit 3
* RDR and DREN are both bit 0
*/
- mask |= s->ucr4 & (UCR4_TCEN | UCR4_DREN);
+ mask |= s->ucr4 & (UCR4_WKEN | UCR4_TCEN | UCR4_DREN);
usr2 = s->usr2 & mask;
@@ -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.34.1
- [PULL 15/33] target/arm: Convert ld/st reg+imm9 insns to decodetree, (continued)
- [PULL 15/33] target/arm: Convert ld/st reg+imm9 insns to decodetree, Peter Maydell, 2023/06/19
- [PULL 14/33] target/arm: Convert load/store-pair to decodetree, Peter Maydell, 2023/06/19
- [PULL 16/33] target/arm: Convert LDR/STR with 12-bit immediate to decodetree, Peter Maydell, 2023/06/19
- [PULL 18/33] target/arm: Convert atomic memory ops to decodetree, Peter Maydell, 2023/06/19
- [PULL 25/33] hw/sd/allwinner-sdhost: Don't send non-boolean IRQ line levels, Peter Maydell, 2023/06/19
- [PULL 19/33] target/arm: Convert load (pointer auth) insns to decodetree, Peter Maydell, 2023/06/19
- [PULL 31/33] hw/misc/bcm2835_property: Use 'raspberrypi-fw-defs.h' definitions, Peter Maydell, 2023/06/19
- [PULL 22/33] target/arm: Convert load/store single structure to decodetree, Peter Maydell, 2023/06/19
- [PULL 23/33] target/arm: Convert load/store tags insns to decodetree, Peter Maydell, 2023/06/19
- [PULL 30/33] hw/arm/raspi: Import Linux raspi definitions as 'raspberrypi-fw-defs.h', Peter Maydell, 2023/06/19
- [PULL 28/33] imx_serial: set wake bit when we receive a data byte,
Peter Maydell <=
- [PULL 29/33] docs: sbsa: document board to firmware interface, Peter Maydell, 2023/06/19
- [PULL 33/33] hw/misc/bcm2835_property: Handle CORE_CLK_ID firmware property, Peter Maydell, 2023/06/19
- [PULL 17/33] target/arm: Convert LDR/STR reg+reg to decodetree, Peter Maydell, 2023/06/19
- [PULL 24/33] hw/intc/allwinner-a10-pic: Handle IRQ levels other than 0 or 1, Peter Maydell, 2023/06/19
- [PULL 20/33] target/arm: Convert LDAPR/STLR (imm) to decodetree, Peter Maydell, 2023/06/19
- [PULL 21/33] target/arm: Convert load/store (multiple structures) to decodetree, Peter Maydell, 2023/06/19
- [PULL 27/33] hw/arm/Kconfig: sbsa-ref uses Bochs display, Peter Maydell, 2023/06/19
- [PULL 26/33] hw/timer/nrf51_timer: Don't lose time when timer is queried in tight loop, Peter Maydell, 2023/06/19
- [PULL 32/33] hw/misc/bcm2835_property: Replace magic frequency values by definitions, Peter Maydell, 2023/06/19
- Re: [PULL 00/33] target-arm queue, Richard Henderson, 2023/06/19