Project

General

Profile

新建 #187 » 0001-patch-kernel-serial-add-rk-patch-that-deal-serial-da.patch

余 顺, 03/04/2023 06:49 AM

View differences:

kernel/drivers/tty/serial/rk_serial.c
#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
......
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);
......
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;
}
......
if (termios->c_cflag & CRTSCTS)
fcr |= UART_FCR_R_TRIG_11;
else
fcr |= UART_FCR_R_TRIG_00;
fcr |= UART_FCR_R_TRIG_10;
}
}
(7-7/7)