fix uart rx issue

This commit is contained in:
xiaoheng 2018-12-11 19:56:25 +08:00
parent 401be2fa50
commit d9bb8986ca
3 changed files with 13 additions and 2 deletions

View File

@ -286,7 +286,6 @@ static int __init cpld_r311_probe(struct platform_device *pdev) {
if (gpio_is_valid(gpionum)) {
gpio_request(gpionum, "3v_ldo_en");
gpio_direction_output(gpionum, 1);
gpio_free(gpionum);
printk("Set 3v_ldo_en(%d) success\n", gpionum);
} else {
printk("Set 3v_ldo_en fail\n");

12
lichee/linux-4.9/drivers/tty/serial/sunxi-uart.c Normal file → Executable file
View File

@ -225,6 +225,8 @@ static unsigned int sw_uart_handle_rx(struct sw_uart_port *sw_uport, unsigned in
*/
if (uart_handle_break(&sw_uport->port))
goto ignore_char;
if (lsr & SUNXI_UART_LSR_RXFIFOE)
goto ignore_char;
} else if (lsr & SUNXI_UART_LSR_PE)
sw_uport->port.icount.parity++;
else if (lsr & SUNXI_UART_LSR_FE)
@ -1150,12 +1152,22 @@ static void sw_uart_set_termios(struct uart_port *port, struct ktermios *termios
sw_uport->fcr = SUNXI_UART_FCR_RXTRG_1_2 | SUNXI_UART_FCR_TXTRG_1_2
| SUNXI_UART_FCR_FIFO_EN;
serial_out(port, sw_uport->fcr, SUNXI_UART_FCR);
/*
* if lcr & baud are changed, reset controller to disable transfer
*/
if (lcr != sw_uport->lcr || dll != sw_uport->dll || dlh != sw_uport->dlh) {
/*SERIAL_DBG("LCR & BAUD changed, reset controller...\n");*/
sw_uart_reset(sw_uport);
}
sw_uport->lcr = lcr;
sw_uport->dll = dll;
sw_uport->dlh = dlh;
sw_uart_force_lcr(sw_uport, 50);
/* clear rxfifo after set lcr & baud to discard redundant data */
serial_out(port, sw_uport->fcr|SUNXI_UART_FCR_RXFIFO_RST, SUNXI_UART_FCR);
port->ops->set_mctrl(port, port->mctrl);
sw_uport->ier = SUNXI_UART_IER_RLSI | SUNXI_UART_IER_RDI;

@ -1 +1 @@
Subproject commit d2c397aa21c5fccf9a621f893ca8441c450e893b
Subproject commit cbf96ef8d15ebcc710d6f50c67c58484d3de9e3b