aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-06-16 09:17:10 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-10 19:07:46 -0400
commit8bd67d7d2cbcea2a2371480fe3fe47f2bcd0294c (patch)
tree0d3798ff3e7e7fb0ba7f77ff1a7d7a412c06467a
parentc18b55fd1717a4c08c9f3555be63da142767e6b8 (diff)
serial: blackfin: Fix CTS flow control
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>
-rw-r--r--drivers/tty/serial/bfin_sport_uart.c11
-rw-r--r--drivers/tty/serial/bfin_uart.c13
2 files changed, 16 insertions, 8 deletions
diff --git a/drivers/tty/serial/bfin_sport_uart.c b/drivers/tty/serial/bfin_sport_uart.c
index 1174efa466a6..7810aa290edf 100644
--- a/drivers/tty/serial/bfin_sport_uart.c
+++ b/drivers/tty/serial/bfin_sport_uart.c
@@ -495,6 +495,13 @@ static void sport_set_termios(struct uart_port *port,
495 495
496 pr_debug("%s enter, c_cflag:%08x\n", __func__, termios->c_cflag); 496 pr_debug("%s enter, c_cflag:%08x\n", __func__, termios->c_cflag);
497 497
498#ifdef CONFIG_SERIAL_BFIN_SPORT_CTSRTS
499 if (old == NULL && up->cts_pin != -1)
500 termios->c_cflag |= CRTSCTS;
501 else if (up->cts_pin == -1)
502 termios->c_cflag &= ~CRTSCTS;
503#endif
504
498 switch (termios->c_cflag & CSIZE) { 505 switch (termios->c_cflag & CSIZE) {
499 case CS8: 506 case CS8:
500 up->csize = 8; 507 up->csize = 8;
@@ -807,10 +814,8 @@ static int sport_uart_probe(struct platform_device *pdev)
807 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 814 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
808 if (res == NULL) 815 if (res == NULL)
809 sport->cts_pin = -1; 816 sport->cts_pin = -1;
810 else { 817 else
811 sport->cts_pin = res->start; 818 sport->cts_pin = res->start;
812 sport->port.flags |= ASYNC_CTS_FLOW;
813 }
814 819
815 res = platform_get_resource(pdev, IORESOURCE_IO, 1); 820 res = platform_get_resource(pdev, IORESOURCE_IO, 1);
816 if (res == NULL) 821 if (res == NULL)
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index dddc081568f1..dec0fd725d80 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -785,6 +785,13 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
785 unsigned int ier, lcr = 0; 785 unsigned int ier, lcr = 0;
786 unsigned long timeout; 786 unsigned long timeout;
787 787
788#ifdef CONFIG_SERIAL_BFIN_CTSRTS
789 if (old == NULL && uart->cts_pin != -1)
790 termios->c_cflag |= CRTSCTS;
791 else if (uart->cts_pin == -1)
792 termios->c_cflag &= ~CRTSCTS;
793#endif
794
788 switch (termios->c_cflag & CSIZE) { 795 switch (termios->c_cflag & CSIZE) {
789 case CS8: 796 case CS8:
790 lcr = WLS(8); 797 lcr = WLS(8);
@@ -1316,12 +1323,8 @@ static int bfin_serial_probe(struct platform_device *pdev)
1316 res = platform_get_resource(pdev, IORESOURCE_IO, 0); 1323 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
1317 if (res == NULL) 1324 if (res == NULL)
1318 uart->cts_pin = -1; 1325 uart->cts_pin = -1;
1319 else { 1326 else
1320 uart->cts_pin = res->start; 1327 uart->cts_pin = res->start;
1321#ifdef CONFIG_SERIAL_BFIN_CTSRTS
1322 uart->port.flags |= ASYNC_CTS_FLOW;
1323#endif
1324 }
1325 1328
1326 res = platform_get_resource(pdev, IORESOURCE_IO, 1); 1329 res = platform_get_resource(pdev, IORESOURCE_IO, 1);
1327 if (res == NULL) 1330 if (res == NULL)