Skip to content

Commit e368cc6

Browse files
l1kgregkh
authored andcommitted
serial: pl011: Drop CR register reset on set_termios
pl011_set_termios() briefly resets the CR register to zero, thereby glitching DTR/RTS signals. With rs485 this may result in the bus being occupied for no reason. Where does this register write originate from? The PL011 driver was forked from the PL010 driver in 2004: https://git.kernel.org/history/history/c/157c0342e591 Until this commit, the PL010 driver's IRQ handler ambauart_int() modified the CR register without holding the port spinlock. ambauart_set_termios() also modified that register. To prevent concurrent read-modify-writes by the IRQ handler and to prevent transmission while changing baudrate, ambauart_set_termios() had to disable interrupts. On the PL010, that is achieved by writing zero to the CR register. However, on the PL011, interrupts are disabled in the IMSC register, not in the CR register. Additionally, the commit amended both the PL010 and PL011 driver to acquire the port spinlock in the IRQ handler, obviating the need to disable interrupts in ->set_termios(). So the CR register write is obsolete for two reasons. Drop it. Cc: Russell King <[email protected]> Signed-off-by: Lukas Wunner <[email protected]> Link: https://lore.kernel.org/r/f49f945375f5ccb979893c49f1129f51651ac738.1641129062.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 08a0c6d commit e368cc6

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/tty/serial/amba-pl011.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,9 +2073,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
20732073
if (port->rs485.flags & SER_RS485_ENABLED)
20742074
termios->c_cflag &= ~CRTSCTS;
20752075

2076-
/* first, disable everything */
20772076
old_cr = pl011_read(uap, REG_CR);
2078-
pl011_write(0, uap, REG_CR);
20792077

20802078
if (termios->c_cflag & CRTSCTS) {
20812079
if (old_cr & UART011_CR_RTS)

0 commit comments

Comments
 (0)