serial: bfin_uart: Don't switch baud rate untill the transfer buffer is empty.
PATCH 1/1 serial: bfin_uart: Don't switch baud rate untill the transfer buffer is empty.
From: Sonic Zhang <[email protected]>
set_termios may be invoked before the former data transfer is completed. Block until the tranfer is done.
--- drivers/tty/serial/bfin_uart.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/tty/serial/bfin_uart.c +4 -0
@@ -869,6 +869,10 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,UART_SET_ANOMALY_THRESHOLD (uart,USEC_PER_SEC / baud *15 ); +/* Wait till the transfer buffer is empty */ +while (UART_GET_GCTL (uart) &UCEN && !(UART_GET_LSR (uart) &TEMT )) +barrier (); +/* Disable UART */ ier =UART_GET_IER (uart);UART_PUT_GCTL (uart,UART_GET_GCTL (uart) & ~UCEN );
Signature · 1 line
1.7.0.4
Greg Kroah-Hartman
maintainerQuoted 15 lines · Sonic Zhang
From: Sonic Zhang <[email protected]>
set_termiosmay be invoked before the former data transfer is completed. Block until the tranfer is done.Signed-off-by Sonic Zhang <[email protected]>--- drivers/tty/serial/bfin_uart.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)drivers/tty/serial/bfin_uart.c +0
-0
drivers/tty/serial/bfin_uart.c bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, · line 874
Quoted 6 lines
drivers/tty/serial/bfin_uart.c +3
-0@@ -869,6 +869,10 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,UART_SET_ANOMALY_THRESHOLD (uart,USEC_PER_SEC / baud *15 ); +/* Wait till the transfer buffer is empty */ +while (UART_GET_GCTL (uart) &UCEN && !(UART_GET_LSR (uart) &TEMT )) +barrier ();
Where is the "the hardware is hung" break out of this loop?
And why "barrier()"?
thanks,
greg k-h
Quoted 29 lines
-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Friday, November 16, 2012 9:00 AM
To: Sonic Zhang
Cc: [email protected]; [email protected]; Zhang, Sonic
Subject: Re: [PATCH] serial:bfin_uart: Don't switch baud rate untill the transfer buffer is empty.Quoted 17 lines · Sonic Zhang
From: Sonic Zhang <[email protected]>
set_termiosmay be invoked before the former data transfer is completed. Block until the tranfer is done.Signed-off-by Sonic Zhang <[email protected]>--- drivers/tty/serial/bfin_uart.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/drivers/tty/serial/bfin_uart.cindex 9242d56..71c0c09 100644drivers/tty/serial/bfin_uart.c +0
-0@@ -869,6 +869,10 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
Quoted 9 lines
drivers/tty/serial/bfin_uart.c bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
Quoted 4 lines
drivers/tty/serial/bfin_uart.c +2
-0UART_SET_ANOMALY_THRESHOLD (uart,USEC_PER_SEC / baud *15 ); +/* Wait till the transfer buffer is empty */ + while (UART_GET_GCTL(uart) & UCEN && !(UART_GET_LSR(uart) &TEMT))
drivers/tty/serial/bfin_uart.c bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios, · line 874
Quoted 1 line
drivers/tty/serial/bfin_uart.c +1
-0+barrier ();Where is the "the hardware is hung" break out of this loop?
Sorry, I will add time_after check soon.
Regards,
Sonic
Quoted 5 lines
And why "
barrier()"?thanks,
greg k-h