From 6049db06a8bdd68722fc8c07fc06c613f0840315 Mon Sep 17 00:00:00 2001 From: joysing Date: Tue, 26 Apr 2022 13:51:05 +0800 Subject: [PATCH] patch(kernel/serial): add rk patch that deal serial data receive subcontract Problem: 200Byte will be divided into multiple receptions, but customer need receive them once. --- kernel/drivers/tty/serial/rk_serial.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/drivers/tty/serial/rk_serial.c b/kernel/drivers/tty/serial/rk_serial.c index 1772858..09a740a 100755 --- a/kernel/drivers/tty/serial/rk_serial.c +++ b/kernel/drivers/tty/serial/rk_serial.c @@ -88,7 +88,7 @@ #define UART_SFE 0x26 /* Shadow FIFO Enable */ #define UART_RESET 0x01 - +#define UART_RFL 0x21 //#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) #define UART_NR 5 //uart port number @@ -818,6 +818,12 @@ receive_chars(struct uart_rk_port *up, unsigned int *status) int max_count = 256; char flag; + if ((up->iir & 0x0f) == 0x0c) + max_count = serial_in(up, UART_RFL); + else + max_count = serial_in(up, UART_RFL) - 2; + + do { if (likely(lsr & UART_LSR_DR)){ ch = serial_in(up, UART_RX); @@ -883,7 +889,10 @@ ignore_char: lsr = serial_in(up, UART_LSR); } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0)); spin_unlock(&up->port.lock); - tty_flip_buffer_push(tty->port); + + if ((up->iir & 0x0f) == 0x0c) + tty_flip_buffer_push(tty->port); + spin_lock(&up->port.lock); *status = lsr; } @@ -1464,7 +1473,7 @@ else if (termios->c_cflag & CRTSCTS) fcr |= UART_FCR_R_TRIG_11; else - fcr |= UART_FCR_R_TRIG_00; + fcr |= UART_FCR_R_TRIG_10; } } -- 1.9.1