2023-07-10 02:43:23

by Sherry Sun

[permalink] [raw]
Subject: [PATCH 0/2] fsl_lpuart: Add IDLE interrupt support for rx_dma on imx7ulp/imx8ulp/imx8qxp

Now in the lpuart driver, we use receive dma timer to simulate the hardware EOP
event, but the timer latency is big which cause the Bluetooth Firmware download
timeout on Android platform(it has a limited FW download time window).

So here we use IDLE interrupt support for receive dma on
imx7ulp/imx8ulp/imx8qxp platforms to replace the receive dma timer, which can
reduce the BT FW download time obviously and the performance close to hardware
EOP.

Patch#1 move the lpuart32_int() below lpuart_copy_rx_to_tty() to avoid the
function declaration in Patch#2.

Sherry Sun (2):
tty: serial: fsl_lpuart: move the lpuart32_int() below
tty: serial: fsl_lpuart: add IDLE interrupt support for rx_dma on
imx7ulp/imx8ulp/imx8qxp

drivers/tty/serial/fsl_lpuart.c | 83 ++++++++++++++++++++++++---------
1 file changed, 61 insertions(+), 22 deletions(-)

--
2.17.1



2023-07-10 02:47:06

by Sherry Sun

[permalink] [raw]
Subject: [PATCH 1/2] tty: serial: fsl_lpuart: move the lpuart32_int() below

Move the lpuart32_int() below lpuart_copy_rx_to_tty(), this is a
preparation patch for the next patch to avoid the function declaration,
no actual functional changes.

Signed-off-by: Sherry Sun <[email protected]>
---
drivers/tty/serial/fsl_lpuart.c | 39 ++++++++++++++++-----------------
1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 6c652d77f566..653cf8eb5a72 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1066,26 +1066,6 @@ static irqreturn_t lpuart_int(int irq, void *dev_id)
return IRQ_HANDLED;
}

-static irqreturn_t lpuart32_int(int irq, void *dev_id)
-{
- struct lpuart_port *sport = dev_id;
- unsigned long sts, rxcount;
-
- sts = lpuart32_read(&sport->port, UARTSTAT);
- rxcount = lpuart32_read(&sport->port, UARTWATER);
- rxcount = rxcount >> UARTWATER_RXCNT_OFF;
-
- if ((sts & UARTSTAT_RDRF || rxcount > 0) && !sport->lpuart_dma_rx_use)
- lpuart32_rxint(sport);
-
- if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use)
- lpuart32_txint(sport);
-
- lpuart32_write(&sport->port, sts, UARTSTAT);
- return IRQ_HANDLED;
-}
-
-
static inline void lpuart_handle_sysrq_chars(struct uart_port *port,
unsigned char *p, int count)
{
@@ -1278,6 +1258,25 @@ static void lpuart_dma_rx_complete(void *arg)
lpuart_copy_rx_to_tty(sport);
}

+static irqreturn_t lpuart32_int(int irq, void *dev_id)
+{
+ struct lpuart_port *sport = dev_id;
+ unsigned long sts, rxcount;
+
+ sts = lpuart32_read(&sport->port, UARTSTAT);
+ rxcount = lpuart32_read(&sport->port, UARTWATER);
+ rxcount = rxcount >> UARTWATER_RXCNT_OFF;
+
+ if ((sts & UARTSTAT_RDRF || rxcount > 0) && !sport->lpuart_dma_rx_use)
+ lpuart32_rxint(sport);
+
+ if ((sts & UARTSTAT_TDRE) && !sport->lpuart_dma_tx_use)
+ lpuart32_txint(sport);
+
+ lpuart32_write(&sport->port, sts, UARTSTAT);
+ return IRQ_HANDLED;
+}
+
/*
* Timer function to simulate the hardware EOP (End Of Package) event.
* The timer callback is to check for new RX data and copy to TTY buffer.
--
2.17.1