From ec2a4064fbe872c499f9e9e87e5d63240289ce50 Mon Sep 17 00:00:00 2001 From: Mingcong Bai Date: Thu, 14 Nov 2024 18:28:12 +0800 Subject: [PATCH] Revert "crypto: montage: tsse_vuart: drop unused vuart_wait_for_xmitr()" This reverts commit 355d3399495499a1386b9c1f26ba86c06e1fcb13. Signed-off-by: Mingcong Bai --- drivers/crypto/montage/tsse/tsse_vuart.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/crypto/montage/tsse/tsse_vuart.c b/drivers/crypto/montage/tsse/tsse_vuart.c index c6163c8831ca9..f49d4ffc9f3c7 100644 --- a/drivers/crypto/montage/tsse/tsse_vuart.c +++ b/drivers/crypto/montage/tsse/tsse_vuart.c @@ -74,6 +74,24 @@ static void vuart_serial_out(struct uart_port *port, int offset, int value) writel(value, port->membase + offset); } +static void vuart_wait_for_xmitr(struct uart_port *port) +{ + unsigned int status, tmout = 10000; + + for (;;) { + status = vuart_serial_in(port, VUART_FSR); + if (FIELD_GET(VUART_FSR_TXFIFOE, status)) + break; + if (--tmout == 0) { + pr_err("%s:timeout(10ms), TX is not empty.\n", + __func__); + break; + } + udelay(1); + touch_nmi_watchdog(); + } +} + static unsigned int vuart_tx_empty(struct uart_port *port) { unsigned long flags;