[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 2/6] hw/char: cadence_uart: Disable transmit when input clock
From: |
Bin Meng |
Subject: |
[PATCH v3 2/6] hw/char: cadence_uart: Disable transmit when input clock is disabled |
Date: |
Wed, 1 Sep 2021 20:45:17 +0800 |
At present when input clock is disabled, any character transmitted
to tx fifo can still show on the serial line, which is wrong.
Fixes: b636db306e06 ("hw/char/cadence_uart: add clock support")
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
(no changes since v1)
hw/char/cadence_uart.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index b4b5e8a3ee..154be34992 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -327,6 +327,11 @@ static gboolean cadence_uart_xmit(void *do_not_use,
GIOCondition cond,
static void uart_write_tx_fifo(CadenceUARTState *s, const uint8_t *buf,
int size)
{
+ /* ignore characters when unclocked or in reset */
+ if (!clock_is_enabled(s->refclk) || device_is_in_reset(DEVICE(s))) {
+ return;
+ }
+
if ((s->r[R_CR] & UART_CR_TX_DIS) || !(s->r[R_CR] & UART_CR_TX_EN)) {
return;
}
--
2.25.1
- [PATCH v3 0/6] hw/arm: xilinx_zynq: Fix upstream U-Boot boot failure, Bin Meng, 2021/09/01
- [PATCH v3 1/6] hw/misc: zynq_slcr: Correctly compute output clocks in the reset exit phase, Bin Meng, 2021/09/01
- [PATCH v3 2/6] hw/char: cadence_uart: Disable transmit when input clock is disabled,
Bin Meng <=
- [PATCH v3 3/6] hw/char: cadence_uart: Move clock/reset check to uart_can_receive(), Bin Meng, 2021/09/01
- [PATCH v3 4/6] hw/char: cadence_uart: Convert to memop_with_attrs() ops, Bin Meng, 2021/09/01
- [PATCH v3 5/6] hw/char: cadence_uart: Ignore access when unclocked or in reset for uart_{read, write}(), Bin Meng, 2021/09/01
- [PATCH v3 6/6] hw/char: cadence_uart: Log a guest error when device is unclocked or in reset, Bin Meng, 2021/09/01
- Re: [PATCH v3 0/6] hw/arm: xilinx_zynq: Fix upstream U-Boot boot failure, Edgar E. Iglesias, 2021/09/02