aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-04-29 13:01:28 -0400
committerMark Brown <broonie@linaro.org>2014-04-29 13:01:28 -0400
commit3e93457b45a1a8c69227ce596ee2005fa06f20dd (patch)
tree248c27e432533b1af80a9b2240eaa8e48e3b87cc /drivers/tty
parent290414499cf94284a97cc3c33214d13ccfcd896a (diff)
parentc42ba72ec3a7a1b6aa30122931f1f4b91b601c31 (diff)
Merge tag 'ib-mfd-regulator-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into regulator-tps65090
Immutable branch between MFD and Regulator due for v3.16 merge-window.
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/Kconfig1
-rw-r--r--drivers/tty/serial/amba-pl011.c8
-rw-r--r--drivers/tty/serial/clps711x.c20
-rw-r--r--drivers/tty/serial/efm32-uart.c3
-rw-r--r--drivers/tty/serial/omap-serial.c30
-rw-r--r--drivers/tty/serial/serial_core.c5
-rw-r--r--drivers/tty/serial/st-asc.c4
-rw-r--r--drivers/tty/tty_io.c4
8 files changed, 41 insertions, 34 deletions
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 2e6d8ddc4425..5d9b01aa54f4 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1226,6 +1226,7 @@ config SERIAL_BFIN_SPORT3_UART_CTSRTS
1226config SERIAL_TIMBERDALE 1226config SERIAL_TIMBERDALE
1227 tristate "Support for timberdale UART" 1227 tristate "Support for timberdale UART"
1228 select SERIAL_CORE 1228 select SERIAL_CORE
1229 depends on X86_32 || COMPILE_TEST
1229 ---help--- 1230 ---help---
1230 Add support for UART controller on timberdale. 1231 Add support for UART controller on timberdale.
1231 1232
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index d4eda24aa68b..dacf0a09ab24 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -318,7 +318,7 @@ static void pl011_dma_probe_initcall(struct device *dev, struct uart_amba_port *
318 .src_addr = uap->port.mapbase + UART01x_DR, 318 .src_addr = uap->port.mapbase + UART01x_DR,
319 .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, 319 .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE,
320 .direction = DMA_DEV_TO_MEM, 320 .direction = DMA_DEV_TO_MEM,
321 .src_maxburst = uap->fifosize >> 1, 321 .src_maxburst = uap->fifosize >> 2,
322 .device_fc = false, 322 .device_fc = false,
323 }; 323 };
324 324
@@ -2176,6 +2176,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
2176static int pl011_remove(struct amba_device *dev) 2176static int pl011_remove(struct amba_device *dev)
2177{ 2177{
2178 struct uart_amba_port *uap = amba_get_drvdata(dev); 2178 struct uart_amba_port *uap = amba_get_drvdata(dev);
2179 bool busy = false;
2179 int i; 2180 int i;
2180 2181
2181 uart_remove_one_port(&amba_reg, &uap->port); 2182 uart_remove_one_port(&amba_reg, &uap->port);
@@ -2183,9 +2184,12 @@ static int pl011_remove(struct amba_device *dev)
2183 for (i = 0; i < ARRAY_SIZE(amba_ports); i++) 2184 for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
2184 if (amba_ports[i] == uap) 2185 if (amba_ports[i] == uap)
2185 amba_ports[i] = NULL; 2186 amba_ports[i] = NULL;
2187 else if (amba_ports[i])
2188 busy = true;
2186 2189
2187 pl011_dma_remove(uap); 2190 pl011_dma_remove(uap);
2188 uart_unregister_driver(&amba_reg); 2191 if (!busy)
2192 uart_unregister_driver(&amba_reg);
2189 return 0; 2193 return 0;
2190} 2194}
2191 2195
diff --git a/drivers/tty/serial/clps711x.c b/drivers/tty/serial/clps711x.c
index 5e6fdb1ea73b..14aaea0d4131 100644
--- a/drivers/tty/serial/clps711x.c
+++ b/drivers/tty/serial/clps711x.c
@@ -368,16 +368,12 @@ static const struct uart_ops uart_clps711x_ops = {
368static void uart_clps711x_console_putchar(struct uart_port *port, int ch) 368static void uart_clps711x_console_putchar(struct uart_port *port, int ch)
369{ 369{
370 struct clps711x_port *s = dev_get_drvdata(port->dev); 370 struct clps711x_port *s = dev_get_drvdata(port->dev);
371 u32 sysflg = 0;
371 372
372 /* Wait for FIFO is not full */ 373 /* Wait for FIFO is not full */
373 while (1) { 374 do {
374 u32 sysflg = 0;
375
376 regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg); 375 regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg);
377 if (!(sysflg & SYSFLG_UTXFF)) 376 } while (sysflg & SYSFLG_UTXFF);
378 break;
379 cond_resched();
380 }
381 377
382 writew(ch, port->membase + UARTDR_OFFSET); 378 writew(ch, port->membase + UARTDR_OFFSET);
383} 379}
@@ -387,18 +383,14 @@ static void uart_clps711x_console_write(struct console *co, const char *c,
387{ 383{
388 struct uart_port *port = clps711x_uart.state[co->index].uart_port; 384 struct uart_port *port = clps711x_uart.state[co->index].uart_port;
389 struct clps711x_port *s = dev_get_drvdata(port->dev); 385 struct clps711x_port *s = dev_get_drvdata(port->dev);
386 u32 sysflg = 0;
390 387
391 uart_console_write(port, c, n, uart_clps711x_console_putchar); 388 uart_console_write(port, c, n, uart_clps711x_console_putchar);
392 389
393 /* Wait for transmitter to become empty */ 390 /* Wait for transmitter to become empty */
394 while (1) { 391 do {
395 u32 sysflg = 0;
396
397 regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg); 392 regmap_read(s->syscon, SYSFLG_OFFSET, &sysflg);
398 if (!(sysflg & SYSFLG_UBUSY)) 393 } while (sysflg & SYSFLG_UBUSY);
399 break;
400 cond_resched();
401 }
402} 394}
403 395
404static int uart_clps711x_console_setup(struct console *co, char *options) 396static int uart_clps711x_console_setup(struct console *co, char *options)
diff --git a/drivers/tty/serial/efm32-uart.c b/drivers/tty/serial/efm32-uart.c
index 028582e924a5..c167a710dc39 100644
--- a/drivers/tty/serial/efm32-uart.c
+++ b/drivers/tty/serial/efm32-uart.c
@@ -798,6 +798,9 @@ static int efm32_uart_remove(struct platform_device *pdev)
798 798
799static const struct of_device_id efm32_uart_dt_ids[] = { 799static const struct of_device_id efm32_uart_dt_ids[] = {
800 { 800 {
801 .compatible = "energymicro,efm32-uart",
802 }, {
803 /* doesn't follow the "vendor,device" scheme, don't use */
801 .compatible = "efm32,uart", 804 .compatible = "efm32,uart",
802 }, { 805 }, {
803 /* sentinel */ 806 /* sentinel */
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index dd8b1a5458ff..08b6b9419f0d 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -225,14 +225,19 @@ static inline void serial_omap_enable_wakeirq(struct uart_omap_port *up,
225 if (enable) 225 if (enable)
226 enable_irq(up->wakeirq); 226 enable_irq(up->wakeirq);
227 else 227 else
228 disable_irq(up->wakeirq); 228 disable_irq_nosync(up->wakeirq);
229} 229}
230 230
231static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable) 231static void serial_omap_enable_wakeup(struct uart_omap_port *up, bool enable)
232{ 232{
233 struct omap_uart_port_info *pdata = dev_get_platdata(up->dev); 233 struct omap_uart_port_info *pdata = dev_get_platdata(up->dev);
234 234
235 if (enable == up->wakeups_enabled)
236 return;
237
235 serial_omap_enable_wakeirq(up, enable); 238 serial_omap_enable_wakeirq(up, enable);
239 up->wakeups_enabled = enable;
240
236 if (!pdata || !pdata->enable_wakeup) 241 if (!pdata || !pdata->enable_wakeup)
237 return; 242 return;
238 243
@@ -1495,6 +1500,11 @@ static int serial_omap_suspend(struct device *dev)
1495 uart_suspend_port(&serial_omap_reg, &up->port); 1500 uart_suspend_port(&serial_omap_reg, &up->port);
1496 flush_work(&up->qos_work); 1501 flush_work(&up->qos_work);
1497 1502
1503 if (device_may_wakeup(dev))
1504 serial_omap_enable_wakeup(up, true);
1505 else
1506 serial_omap_enable_wakeup(up, false);
1507
1498 return 0; 1508 return 0;
1499} 1509}
1500 1510
@@ -1502,6 +1512,9 @@ static int serial_omap_resume(struct device *dev)
1502{ 1512{
1503 struct uart_omap_port *up = dev_get_drvdata(dev); 1513 struct uart_omap_port *up = dev_get_drvdata(dev);
1504 1514
1515 if (device_may_wakeup(dev))
1516 serial_omap_enable_wakeup(up, false);
1517
1505 uart_resume_port(&serial_omap_reg, &up->port); 1518 uart_resume_port(&serial_omap_reg, &up->port);
1506 1519
1507 return 0; 1520 return 0;
@@ -1789,6 +1802,7 @@ static int serial_omap_remove(struct platform_device *dev)
1789 pm_runtime_disable(up->dev); 1802 pm_runtime_disable(up->dev);
1790 uart_remove_one_port(&serial_omap_reg, &up->port); 1803 uart_remove_one_port(&serial_omap_reg, &up->port);
1791 pm_qos_remove_request(&up->pm_qos_request); 1804 pm_qos_remove_request(&up->pm_qos_request);
1805 device_init_wakeup(&dev->dev, false);
1792 1806
1793 return 0; 1807 return 0;
1794} 1808}
@@ -1877,17 +1891,7 @@ static int serial_omap_runtime_suspend(struct device *dev)
1877 1891
1878 up->context_loss_cnt = serial_omap_get_context_loss_count(up); 1892 up->context_loss_cnt = serial_omap_get_context_loss_count(up);
1879 1893
1880 if (device_may_wakeup(dev)) { 1894 serial_omap_enable_wakeup(up, true);
1881 if (!up->wakeups_enabled) {
1882 serial_omap_enable_wakeup(up, true);
1883 up->wakeups_enabled = true;
1884 }
1885 } else {
1886 if (up->wakeups_enabled) {
1887 serial_omap_enable_wakeup(up, false);
1888 up->wakeups_enabled = false;
1889 }
1890 }
1891 1895
1892 up->latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE; 1896 up->latency = PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE;
1893 schedule_work(&up->qos_work); 1897 schedule_work(&up->qos_work);
@@ -1901,6 +1905,8 @@ static int serial_omap_runtime_resume(struct device *dev)
1901 1905
1902 int loss_cnt = serial_omap_get_context_loss_count(up); 1906 int loss_cnt = serial_omap_get_context_loss_count(up);
1903 1907
1908 serial_omap_enable_wakeup(up, false);
1909
1904 if (loss_cnt < 0) { 1910 if (loss_cnt < 0) {
1905 dev_dbg(dev, "serial_omap_get_context_loss_count failed : %d\n", 1911 dev_dbg(dev, "serial_omap_get_context_loss_count failed : %d\n",
1906 loss_cnt); 1912 loss_cnt);
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 2cf5649a6dc0..f26834d262b3 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -89,8 +89,7 @@ static void __uart_start(struct tty_struct *tty)
89 struct uart_state *state = tty->driver_data; 89 struct uart_state *state = tty->driver_data;
90 struct uart_port *port = state->uart_port; 90 struct uart_port *port = state->uart_port;
91 91
92 if (!uart_circ_empty(&state->xmit) && state->xmit.buf && 92 if (!tty->stopped && !tty->hw_stopped)
93 !tty->stopped && !tty->hw_stopped)
94 port->ops->start_tx(port); 93 port->ops->start_tx(port);
95} 94}
96 95
@@ -1452,6 +1451,8 @@ static void uart_hangup(struct tty_struct *tty)
1452 clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); 1451 clear_bit(ASYNCB_NORMAL_ACTIVE, &port->flags);
1453 spin_unlock_irqrestore(&port->lock, flags); 1452 spin_unlock_irqrestore(&port->lock, flags);
1454 tty_port_tty_set(port, NULL); 1453 tty_port_tty_set(port, NULL);
1454 if (!uart_console(state->uart_port))
1455 uart_change_pm(state, UART_PM_STATE_OFF);
1455 wake_up_interruptible(&port->open_wait); 1456 wake_up_interruptible(&port->open_wait);
1456 wake_up_interruptible(&port->delta_msr_wait); 1457 wake_up_interruptible(&port->delta_msr_wait);
1457 } 1458 }
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 21e6e84c0df8..dd3a96e07026 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -295,7 +295,7 @@ static void asc_receive_chars(struct uart_port *port)
295 status & ASC_STA_OE) { 295 status & ASC_STA_OE) {
296 296
297 if (c & ASC_RXBUF_FE) { 297 if (c & ASC_RXBUF_FE) {
298 if (c == ASC_RXBUF_FE) { 298 if (c == (ASC_RXBUF_FE | ASC_RXBUF_DUMMY_RX)) {
299 port->icount.brk++; 299 port->icount.brk++;
300 if (uart_handle_break(port)) 300 if (uart_handle_break(port))
301 continue; 301 continue;
@@ -325,7 +325,7 @@ static void asc_receive_chars(struct uart_port *port)
325 flag = TTY_FRAME; 325 flag = TTY_FRAME;
326 } 326 }
327 327
328 if (uart_handle_sysrq_char(port, c)) 328 if (uart_handle_sysrq_char(port, c & 0xff))
329 continue; 329 continue;
330 330
331 uart_insert_char(port, c, ASC_RXBUF_DUMMY_OE, c & 0xff, flag); 331 uart_insert_char(port, c, ASC_RXBUF_DUMMY_OE, c & 0xff, flag);
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index d3448a90f0f9..34110719fe03 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -878,9 +878,8 @@ void disassociate_ctty(int on_exit)
878 spin_lock_irq(&current->sighand->siglock); 878 spin_lock_irq(&current->sighand->siglock);
879 put_pid(current->signal->tty_old_pgrp); 879 put_pid(current->signal->tty_old_pgrp);
880 current->signal->tty_old_pgrp = NULL; 880 current->signal->tty_old_pgrp = NULL;
881 spin_unlock_irq(&current->sighand->siglock);
882 881
883 tty = get_current_tty(); 882 tty = tty_kref_get(current->signal->tty);
884 if (tty) { 883 if (tty) {
885 unsigned long flags; 884 unsigned long flags;
886 spin_lock_irqsave(&tty->ctrl_lock, flags); 885 spin_lock_irqsave(&tty->ctrl_lock, flags);
@@ -897,6 +896,7 @@ void disassociate_ctty(int on_exit)
897#endif 896#endif
898 } 897 }
899 898
899 spin_unlock_irq(&current->sighand->siglock);
900 /* Now clear signal->tty under the lock */ 900 /* Now clear signal->tty under the lock */
901 read_lock(&tasklist_lock); 901 read_lock(&tasklist_lock);
902 session_clear_tty(task_session(current)); 902 session_clear_tty(task_session(current));