serial: 8250: enable Programmable THRE Interrupt for tx

Programmable THRE Interrupt mode in order to increase system
performance.

Change-Id: Ic1ef9ecae0c6feb00170ad97ee3c6245ca3bf068
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
This commit is contained in:
Huibin Hong
2019-01-25 17:25:35 +08:00
committed by Tao Huang
parent 68ae37643a
commit e480347688
3 changed files with 14 additions and 1 deletions

View File

@@ -42,6 +42,9 @@ static void __dma_tx_complete(void *param)
ret = serial8250_tx_dma(p);
if (ret) {
p->ier |= UART_IER_THRI;
#ifdef CONFIG_ARCH_ROCKCHIP
p->ier |= UART_IER_PTIME;
#endif
serial_port_out(&p->port, UART_IER, p->ier);
}
@@ -148,6 +151,9 @@ int serial8250_tx_dma(struct uart_8250_port *p)
dma->tx_err = 0;
if (p->ier & UART_IER_THRI) {
p->ier &= ~UART_IER_THRI;
#ifdef CONFIG_ARCH_ROCKCHIP
p->ier &= ~UART_IER_PTIME;
#endif
serial_out(p, UART_IER, p->ier);
}
}

View File

@@ -1504,6 +1504,9 @@ static inline void __do_stop_tx(struct uart_8250_port *p)
{
if (p->ier & UART_IER_THRI) {
p->ier &= ~UART_IER_THRI;
#ifdef CONFIG_ARCH_ROCKCHIP
p->ier &= ~UART_IER_PTIME;
#endif
serial_out(p, UART_IER, p->ier);
serial8250_rpm_put_tx(p);
}
@@ -1562,6 +1565,9 @@ static inline void __start_tx(struct uart_port *port)
if (!(up->ier & UART_IER_THRI)) {
up->ier |= UART_IER_THRI;
#ifdef CONFIG_ARCH_ROCKCHIP
up->ier |= UART_IER_PTIME;
#endif
serial_port_out(port, UART_IER, up->ier);
if (up->bugs & UART_BUG_TXEN) {
@@ -1901,7 +1907,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
#ifdef CONFIG_ARCH_ROCKCHIP
if ((!up->dma || (up->dma && (!up->dma->txchan || up->dma->tx_err))) &&
(status & UART_LSR_THRE))
((iir & 0xf) == UART_IIR_THRI))
serial8250_tx_chars(up);
#else
if ((!up->dma || (up->dma && up->dma->tx_err)) &&

View File

@@ -30,6 +30,7 @@
* Sleep mode for ST16650 and TI16750. For the ST16650, EFR[4]=1
*/
#define UART_IERX_SLEEP 0x10 /* Enable sleep mode */
#define UART_IER_PTIME 0x80 /* Enable programmable THRE Interrupt */
#define UART_IIR 2 /* In: Interrupt ID Register */
#define UART_IIR_NO_INT 0x01 /* No interrupts pending */