Patch "serial: pl011: Drop CR register reset on set_termios" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    serial: pl011: Drop CR register reset on set_termios

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     serial-pl011-drop-cr-register-reset-on-set_termios.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d5647f19f4712e3d808b59ce2ecd90cc8e6403f0
Author: Lukas Wunner <lukas@xxxxxxxxx>
Date:   Sun Jan 2 18:45:44 2022 +0100

    serial: pl011: Drop CR register reset on set_termios
    
    [ Upstream commit e368cc656fd6d0075f1c3ab9676e2001451e3e04 ]
    
    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 <rmk+kernel@xxxxxxxxxxxxxxx>
    Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx>
    Link: https://lore.kernel.org/r/f49f945375f5ccb979893c49f1129f51651ac738.1641129062.git.lukas@xxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index b831d4d64c0a2..6ec34260d6b18 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -2105,9 +2105,7 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
 	if (port->rs485.flags & SER_RS485_ENABLED)
 		termios->c_cflag &= ~CRTSCTS;
 
-	/* first, disable everything */
 	old_cr = pl011_read(uap, REG_CR);
-	pl011_write(0, uap, REG_CR);
 
 	if (termios->c_cflag & CRTSCTS) {
 		if (old_cr & UART011_CR_RTS)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux