Skip to content

Commit

Permalink
serial: pl011: set UART011_CR_RXE in pl011_set_termios after port shu…
Browse files Browse the repository at this point in the history
…tdown

UART011_CR_RXE is set in pl011_startup() during normal initialization, and
cleared by pl011_disable_uart() during port shutdown.

You can use a none-console port in poll mode like kgdboc does with
tty_find_polling_driver() after a port shutdown. But pl011_startup() is not
called in tty_find_polling_driver(). So you need to set UART011_CR_RXE to
reenable receive function.

Not sure setting UART011_CR_RXE in pl011_set_termios() is a good idea
through.

Signed-off-by: Hongyu Xie <xiehongyu1@kylinos.cn>
Link: https://lore.kernel.org/r/20230501070909.1144547-1-xiehongyu1@kylinos.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Hongyu Xie authored and Greg Kroah-Hartman committed May 13, 2023
1 parent cf9aa72 commit 6d8c1fc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/tty/serial/amba-pl011.c
Original file line number Diff line number Diff line change
Expand Up @@ -2166,6 +2166,13 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios,
* ----------^----------^----------^----------^-----
*/
pl011_write_lcr_h(uap, lcr_h);

/*
* Receive was disabled by pl011_disable_uart during shutdown.
* Need to reenable receive if you need to use a tty_driver
* returns from tty_find_polling_driver() after a port shutdown.
*/
old_cr |= UART011_CR_RXE;
pl011_write(old_cr, uap, REG_CR);

spin_unlock_irqrestore(&port->lock, flags);
Expand Down

0 comments on commit 6d8c1fc

Please sign in to comment.