Skip to content

Commit

Permalink
serial: blackfin: Fix CTS flow control
Browse files Browse the repository at this point in the history
blackfin uart port drivers mistakenly set the struct uart_port
flags bit UPF_BUG_THRE (which only has meaning to the 8250 core)
while trying to set ASYNC_CTS_FLOW.

Uart port drivers can override termios settings based on actual
hardware support in their .set_termios method; the serial core
sets the appropriate port flags based on the overrides.
Overriding only the initial termios settings is accomplished
by only perform those overrides if the old termios parameter is
NULL.

CC: Sonic Zhang <sonic.zhang@analog.com>
CC: adi-buildroot-devel@lists.sourceforge.net
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Jul 10, 2014
1 parent c18b55f commit 8bd67d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
11 changes: 8 additions & 3 deletions drivers/tty/serial/bfin_sport_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ static void sport_set_termios(struct uart_port *port,

pr_debug("%s enter, c_cflag:%08x\n", __func__, termios->c_cflag);

#ifdef CONFIG_SERIAL_BFIN_SPORT_CTSRTS
if (old == NULL && up->cts_pin != -1)
termios->c_cflag |= CRTSCTS;
else if (up->cts_pin == -1)
termios->c_cflag &= ~CRTSCTS;
#endif

switch (termios->c_cflag & CSIZE) {
case CS8:
up->csize = 8;
Expand Down Expand Up @@ -807,10 +814,8 @@ static int sport_uart_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
if (res == NULL)
sport->cts_pin = -1;
else {
else
sport->cts_pin = res->start;
sport->port.flags |= ASYNC_CTS_FLOW;
}

res = platform_get_resource(pdev, IORESOURCE_IO, 1);
if (res == NULL)
Expand Down
13 changes: 8 additions & 5 deletions drivers/tty/serial/bfin_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,13 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
unsigned int ier, lcr = 0;
unsigned long timeout;

#ifdef CONFIG_SERIAL_BFIN_CTSRTS
if (old == NULL && uart->cts_pin != -1)
termios->c_cflag |= CRTSCTS;
else if (uart->cts_pin == -1)
termios->c_cflag &= ~CRTSCTS;
#endif

switch (termios->c_cflag & CSIZE) {
case CS8:
lcr = WLS(8);
Expand Down Expand Up @@ -1316,12 +1323,8 @@ static int bfin_serial_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_IO, 0);
if (res == NULL)
uart->cts_pin = -1;
else {
else
uart->cts_pin = res->start;
#ifdef CONFIG_SERIAL_BFIN_CTSRTS
uart->port.flags |= ASYNC_CTS_FLOW;
#endif
}

res = platform_get_resource(pdev, IORESOURCE_IO, 1);
if (res == NULL)
Expand Down

0 comments on commit 8bd67d7

Please sign in to comment.