Skip to content

Commit bfd7bd5

Browse files
committed
Merge tag 'tty-4.20-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial fix from Greg KH: "Here is a single fix, a revert, for the 8250 serial driver to resolve a reported problem. There was some attempted patches to fix the issue, but people are arguing about them, so reverting the patch to revert back to the 4.19 and older behavior is the best thing to do at this late in the release cycle. The revert has been in linux-next with no reported issues" * tag 'tty-4.20-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: Revert "serial: 8250: Fix clearing FIFOs in RS485 mode again"
2 parents 177c459 + 3c9dc27 commit bfd7bd5

File tree

1 file changed

+5
-24
lines changed

1 file changed

+5
-24
lines changed

drivers/tty/serial/8250/8250_port.c

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -552,30 +552,11 @@ static unsigned int serial_icr_read(struct uart_8250_port *up, int offset)
552552
*/
553553
static void serial8250_clear_fifos(struct uart_8250_port *p)
554554
{
555-
unsigned char fcr;
556-
unsigned char clr_mask = UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT;
557-
558555
if (p->capabilities & UART_CAP_FIFO) {
559-
/*
560-
* Make sure to avoid changing FCR[7:3] and ENABLE_FIFO bits.
561-
* In case ENABLE_FIFO is not set, there is nothing to flush
562-
* so just return. Furthermore, on certain implementations of
563-
* the 8250 core, the FCR[7:3] bits may only be changed under
564-
* specific conditions and changing them if those conditions
565-
* are not met can have nasty side effects. One such core is
566-
* the 8250-omap present in TI AM335x.
567-
*/
568-
fcr = serial_in(p, UART_FCR);
569-
570-
/* FIFO is not enabled, there's nothing to clear. */
571-
if (!(fcr & UART_FCR_ENABLE_FIFO))
572-
return;
573-
574-
fcr |= clr_mask;
575-
serial_out(p, UART_FCR, fcr);
576-
577-
fcr &= ~clr_mask;
578-
serial_out(p, UART_FCR, fcr);
556+
serial_out(p, UART_FCR, UART_FCR_ENABLE_FIFO);
557+
serial_out(p, UART_FCR, UART_FCR_ENABLE_FIFO |
558+
UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT);
559+
serial_out(p, UART_FCR, 0);
579560
}
580561
}
581562

@@ -1467,7 +1448,7 @@ static void __do_stop_tx_rs485(struct uart_8250_port *p)
14671448
* Enable previously disabled RX interrupts.
14681449
*/
14691450
if (!(p->port.rs485.flags & SER_RS485_RX_DURING_TX)) {
1470-
serial8250_clear_fifos(p);
1451+
serial8250_clear_and_reinit_fifos(p);
14711452

14721453
p->ier |= UART_IER_RLSI | UART_IER_RDI;
14731454
serial_port_out(&p->port, UART_IER, p->ier);

0 commit comments

Comments
 (0)