aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/bfin_uart.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 17:08:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 17:08:47 -0500
commitc6bd5bcc4983f1a2d2f87a3769bf309482ee8c04 (patch)
tree2ff9c4496dc2258d601a1bcd82040470704dae3b /drivers/tty/serial/bfin_uart.c
parent8966961b31c251b854169e9886394c2a20f2cea7 (diff)
parentb0ab02361167faa82198b783a8d555eb6f58901c (diff)
Merge tag 'tty-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull TTY/Serial merge from Greg Kroah-Hartman: "Here's the big tty/serial tree set of changes for 3.8-rc1. Contained in here is a bunch more reworks of the tty port layer from Jiri and bugfixes from Alan, along with a number of other tty and serial driver updates by the various driver authors. Also, Jiri has been coerced^Wconvinced to be the co-maintainer of the TTY layer, which is much appreciated by me. All of these have been in the linux-next tree for a while. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" Fixed up some trivial conflicts in the staging tree, due to the fwserial driver having come in both ways (but fixed up a bit in the serial tree), and the ioctl handling in the dgrp driver having been done slightly differently (staging tree got that one right, and removed both TIOCGSOFTCAR and TIOCSSOFTCAR). * tag 'tty-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (146 commits) staging: sb105x: fix potential NULL pointer dereference in mp_chars_in_buffer() staging/fwserial: Remove superfluous free staging/fwserial: Use WARN_ONCE when port table is corrupted staging/fwserial: Destruct embedded tty_port on teardown staging/fwserial: Fix build breakage when !CONFIG_BUG staging: fwserial: Add TTY-over-Firewire serial driver drivers/tty/serial/serial_core.c: clean up HIGH_BITS_OFFSET usage staging: dgrp: dgrp_tty.c: Audit the return values of get/put_user() staging: dgrp: dgrp_tty.c: Remove the TIOCSSOFTCAR ioctl handler from dgrp driver serial: ifx6x60: Add modem power off function in the platform reboot process serial: mxs-auart: unmap the scatter list before we copy the data serial: mxs-auart: disable the Receive Timeout Interrupt when DMA is enabled serial: max310x: Setup missing "can_sleep" field for GPIO tty/serial: fix ifx6x60.c declaration warning serial: samsung: add devicetree properties for non-Exynos SoCs serial: samsung: fix potential soft lockup during uart write tty: vt: Remove redundant null check before kfree. tty/8250 Add check for pci_ioremap_bar failure tty/8250 Add support for Commtech's Fastcom Async-335 and Fastcom Async-PCIe cards tty/8250 Add XR17D15x devices to the exar_handle_irq override ...
Diffstat (limited to 'drivers/tty/serial/bfin_uart.c')
-rw-r--r--drivers/tty/serial/bfin_uart.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/tty/serial/bfin_uart.c b/drivers/tty/serial/bfin_uart.c
index 9242d56ba26..e6a008f4939 100644
--- a/drivers/tty/serial/bfin_uart.c
+++ b/drivers/tty/serial/bfin_uart.c
@@ -477,9 +477,9 @@ static void bfin_serial_dma_rx_chars(struct bfin_serial_port *uart)
477void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart) 477void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
478{ 478{
479 int x_pos, pos; 479 int x_pos, pos;
480 unsigned long flags;
480 481
481 dma_disable_irq_nosync(uart->rx_dma_channel); 482 spin_lock_irqsave(&uart->rx_lock, flags);
482 spin_lock_bh(&uart->rx_lock);
483 483
484 /* 2D DMA RX buffer ring is used. Because curr_y_count and 484 /* 2D DMA RX buffer ring is used. Because curr_y_count and
485 * curr_x_count can't be read as an atomic operation, 485 * curr_x_count can't be read as an atomic operation,
@@ -510,8 +510,7 @@ void bfin_serial_rx_dma_timeout(struct bfin_serial_port *uart)
510 uart->rx_dma_buf.tail = uart->rx_dma_buf.head; 510 uart->rx_dma_buf.tail = uart->rx_dma_buf.head;
511 } 511 }
512 512
513 spin_unlock_bh(&uart->rx_lock); 513 spin_unlock_irqrestore(&uart->rx_lock, flags);
514 dma_enable_irq(uart->rx_dma_channel);
515 514
516 mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES); 515 mod_timer(&(uart->rx_dma_timer), jiffies + DMA_RX_FLUSH_JIFFIES);
517} 516}
@@ -800,6 +799,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
800 unsigned long flags; 799 unsigned long flags;
801 unsigned int baud, quot; 800 unsigned int baud, quot;
802 unsigned int ier, lcr = 0; 801 unsigned int ier, lcr = 0;
802 unsigned long timeout;
803 803
804 switch (termios->c_cflag & CSIZE) { 804 switch (termios->c_cflag & CSIZE) {
805 case CS8: 805 case CS8:
@@ -869,6 +869,14 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
869 869
870 UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15); 870 UART_SET_ANOMALY_THRESHOLD(uart, USEC_PER_SEC / baud * 15);
871 871
872 /* Wait till the transfer buffer is empty */
873 timeout = jiffies + msecs_to_jiffies(10);
874 while (UART_GET_GCTL(uart) & UCEN && !(UART_GET_LSR(uart) & TEMT))
875 if (time_after(jiffies, timeout)) {
876 dev_warn(port->dev, "timeout waiting for TX buffer empty\n");
877 break;
878 }
879
872 /* Disable UART */ 880 /* Disable UART */
873 ier = UART_GET_IER(uart); 881 ier = UART_GET_IER(uart);
874 UART_PUT_GCTL(uart, UART_GET_GCTL(uart) & ~UCEN); 882 UART_PUT_GCTL(uart, UART_GET_GCTL(uart) & ~UCEN);
@@ -1390,7 +1398,7 @@ out_error_free_mem:
1390 return ret; 1398 return ret;
1391} 1399}
1392 1400
1393static int __devexit bfin_serial_remove(struct platform_device *pdev) 1401static int bfin_serial_remove(struct platform_device *pdev)
1394{ 1402{
1395 struct bfin_serial_port *uart = platform_get_drvdata(pdev); 1403 struct bfin_serial_port *uart = platform_get_drvdata(pdev);
1396 1404
@@ -1410,7 +1418,7 @@ static int __devexit bfin_serial_remove(struct platform_device *pdev)
1410 1418
1411static struct platform_driver bfin_serial_driver = { 1419static struct platform_driver bfin_serial_driver = {
1412 .probe = bfin_serial_probe, 1420 .probe = bfin_serial_probe,
1413 .remove = __devexit_p(bfin_serial_remove), 1421 .remove = bfin_serial_remove,
1414 .suspend = bfin_serial_suspend, 1422 .suspend = bfin_serial_suspend,
1415 .resume = bfin_serial_resume, 1423 .resume = bfin_serial_resume,
1416 .driver = { 1424 .driver = {