diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-09 03:02:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-10-09 03:02:35 -0400 |
commit | 1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee (patch) | |
tree | 47da3feee8e263e8c9352c85cf518e624be3c211 /drivers/tty | |
parent | 750b1a6894ecc9b178c6e3d0a1170122971b2036 (diff) | |
parent | 8a5776a5f49812d29fe4b2d0a2d71675c3facf3f (diff) |
Merge 4.14-rc4 into staging-next
We want the staging/iio fixes in here as well to handle merge issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/mxser.c | 16 | ||||
-rw-r--r-- | drivers/tty/serial/bcm63xx_uart.c | 5 | ||||
-rw-r--r-- | drivers/tty/serial/fsl_lpuart.c | 40 | ||||
-rw-r--r-- | drivers/tty/serial/sccnxp.c | 13 |
4 files changed, 44 insertions, 30 deletions
diff --git a/drivers/tty/mxser.c b/drivers/tty/mxser.c index 1c0c9553bc05..7dd38047ba23 100644 --- a/drivers/tty/mxser.c +++ b/drivers/tty/mxser.c | |||
@@ -246,11 +246,11 @@ struct mxser_port { | |||
246 | unsigned char err_shadow; | 246 | unsigned char err_shadow; |
247 | 247 | ||
248 | struct async_icount icount; /* kernel counters for 4 input interrupts */ | 248 | struct async_icount icount; /* kernel counters for 4 input interrupts */ |
249 | int timeout; | 249 | unsigned int timeout; |
250 | 250 | ||
251 | int read_status_mask; | 251 | int read_status_mask; |
252 | int ignore_status_mask; | 252 | int ignore_status_mask; |
253 | int xmit_fifo_size; | 253 | unsigned int xmit_fifo_size; |
254 | int xmit_head; | 254 | int xmit_head; |
255 | int xmit_tail; | 255 | int xmit_tail; |
256 | int xmit_cnt; | 256 | int xmit_cnt; |
@@ -572,8 +572,9 @@ static void mxser_dtr_rts(struct tty_port *port, int on) | |||
572 | static int mxser_set_baud(struct tty_struct *tty, long newspd) | 572 | static int mxser_set_baud(struct tty_struct *tty, long newspd) |
573 | { | 573 | { |
574 | struct mxser_port *info = tty->driver_data; | 574 | struct mxser_port *info = tty->driver_data; |
575 | int quot = 0, baud; | 575 | unsigned int quot = 0, baud; |
576 | unsigned char cval; | 576 | unsigned char cval; |
577 | u64 timeout; | ||
577 | 578 | ||
578 | if (!info->ioaddr) | 579 | if (!info->ioaddr) |
579 | return -1; | 580 | return -1; |
@@ -594,8 +595,13 @@ static int mxser_set_baud(struct tty_struct *tty, long newspd) | |||
594 | quot = 0; | 595 | quot = 0; |
595 | } | 596 | } |
596 | 597 | ||
597 | info->timeout = ((info->xmit_fifo_size * HZ * 10 * quot) / info->baud_base); | 598 | /* |
598 | info->timeout += HZ / 50; /* Add .02 seconds of slop */ | 599 | * worst case (128 * 1000 * 10 * 18432) needs 35 bits, so divide in the |
600 | * u64 domain | ||
601 | */ | ||
602 | timeout = (u64)info->xmit_fifo_size * HZ * 10 * quot; | ||
603 | do_div(timeout, info->baud_base); | ||
604 | info->timeout = timeout + HZ / 50; /* Add .02 seconds of slop */ | ||
599 | 605 | ||
600 | if (quot) { | 606 | if (quot) { |
601 | info->MCR |= UART_MCR_DTR; | 607 | info->MCR |= UART_MCR_DTR; |
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index 583c9a0c7ecc..8c48c3784831 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c | |||
@@ -507,9 +507,14 @@ static void bcm_uart_set_termios(struct uart_port *port, | |||
507 | { | 507 | { |
508 | unsigned int ctl, baud, quot, ier; | 508 | unsigned int ctl, baud, quot, ier; |
509 | unsigned long flags; | 509 | unsigned long flags; |
510 | int tries; | ||
510 | 511 | ||
511 | spin_lock_irqsave(&port->lock, flags); | 512 | spin_lock_irqsave(&port->lock, flags); |
512 | 513 | ||
514 | /* Drain the hot tub fully before we power it off for the winter. */ | ||
515 | for (tries = 3; !bcm_uart_tx_empty(port) && tries; tries--) | ||
516 | mdelay(10); | ||
517 | |||
513 | /* disable uart while changing speed */ | 518 | /* disable uart while changing speed */ |
514 | bcm_uart_disable(port); | 519 | bcm_uart_disable(port); |
515 | bcm_uart_flush(port); | 520 | bcm_uart_flush(port); |
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 849c1f9991ce..f0252184291e 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c | |||
@@ -1276,7 +1276,6 @@ static void rx_dma_timer_init(struct lpuart_port *sport) | |||
1276 | static int lpuart_startup(struct uart_port *port) | 1276 | static int lpuart_startup(struct uart_port *port) |
1277 | { | 1277 | { |
1278 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); | 1278 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); |
1279 | int ret; | ||
1280 | unsigned long flags; | 1279 | unsigned long flags; |
1281 | unsigned char temp; | 1280 | unsigned char temp; |
1282 | 1281 | ||
@@ -1291,11 +1290,6 @@ static int lpuart_startup(struct uart_port *port) | |||
1291 | sport->rxfifo_size = 0x1 << (((temp >> UARTPFIFO_RXSIZE_OFF) & | 1290 | sport->rxfifo_size = 0x1 << (((temp >> UARTPFIFO_RXSIZE_OFF) & |
1292 | UARTPFIFO_FIFOSIZE_MASK) + 1); | 1291 | UARTPFIFO_FIFOSIZE_MASK) + 1); |
1293 | 1292 | ||
1294 | ret = devm_request_irq(port->dev, port->irq, lpuart_int, 0, | ||
1295 | DRIVER_NAME, sport); | ||
1296 | if (ret) | ||
1297 | return ret; | ||
1298 | |||
1299 | spin_lock_irqsave(&sport->port.lock, flags); | 1293 | spin_lock_irqsave(&sport->port.lock, flags); |
1300 | 1294 | ||
1301 | lpuart_setup_watermark(sport); | 1295 | lpuart_setup_watermark(sport); |
@@ -1333,7 +1327,6 @@ static int lpuart_startup(struct uart_port *port) | |||
1333 | static int lpuart32_startup(struct uart_port *port) | 1327 | static int lpuart32_startup(struct uart_port *port) |
1334 | { | 1328 | { |
1335 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); | 1329 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); |
1336 | int ret; | ||
1337 | unsigned long flags; | 1330 | unsigned long flags; |
1338 | unsigned long temp; | 1331 | unsigned long temp; |
1339 | 1332 | ||
@@ -1346,11 +1339,6 @@ static int lpuart32_startup(struct uart_port *port) | |||
1346 | sport->rxfifo_size = 0x1 << (((temp >> UARTFIFO_RXSIZE_OFF) & | 1339 | sport->rxfifo_size = 0x1 << (((temp >> UARTFIFO_RXSIZE_OFF) & |
1347 | UARTFIFO_FIFOSIZE_MASK) - 1); | 1340 | UARTFIFO_FIFOSIZE_MASK) - 1); |
1348 | 1341 | ||
1349 | ret = devm_request_irq(port->dev, port->irq, lpuart32_int, 0, | ||
1350 | DRIVER_NAME, sport); | ||
1351 | if (ret) | ||
1352 | return ret; | ||
1353 | |||
1354 | spin_lock_irqsave(&sport->port.lock, flags); | 1342 | spin_lock_irqsave(&sport->port.lock, flags); |
1355 | 1343 | ||
1356 | lpuart32_setup_watermark(sport); | 1344 | lpuart32_setup_watermark(sport); |
@@ -1380,8 +1368,6 @@ static void lpuart_shutdown(struct uart_port *port) | |||
1380 | 1368 | ||
1381 | spin_unlock_irqrestore(&port->lock, flags); | 1369 | spin_unlock_irqrestore(&port->lock, flags); |
1382 | 1370 | ||
1383 | devm_free_irq(port->dev, port->irq, sport); | ||
1384 | |||
1385 | if (sport->lpuart_dma_rx_use) { | 1371 | if (sport->lpuart_dma_rx_use) { |
1386 | del_timer_sync(&sport->lpuart_timer); | 1372 | del_timer_sync(&sport->lpuart_timer); |
1387 | lpuart_dma_rx_free(&sport->port); | 1373 | lpuart_dma_rx_free(&sport->port); |
@@ -1400,7 +1386,6 @@ static void lpuart_shutdown(struct uart_port *port) | |||
1400 | 1386 | ||
1401 | static void lpuart32_shutdown(struct uart_port *port) | 1387 | static void lpuart32_shutdown(struct uart_port *port) |
1402 | { | 1388 | { |
1403 | struct lpuart_port *sport = container_of(port, struct lpuart_port, port); | ||
1404 | unsigned long temp; | 1389 | unsigned long temp; |
1405 | unsigned long flags; | 1390 | unsigned long flags; |
1406 | 1391 | ||
@@ -1413,8 +1398,6 @@ static void lpuart32_shutdown(struct uart_port *port) | |||
1413 | lpuart32_write(port, temp, UARTCTRL); | 1398 | lpuart32_write(port, temp, UARTCTRL); |
1414 | 1399 | ||
1415 | spin_unlock_irqrestore(&port->lock, flags); | 1400 | spin_unlock_irqrestore(&port->lock, flags); |
1416 | |||
1417 | devm_free_irq(port->dev, port->irq, sport); | ||
1418 | } | 1401 | } |
1419 | 1402 | ||
1420 | static void | 1403 | static void |
@@ -2212,16 +2195,22 @@ static int lpuart_probe(struct platform_device *pdev) | |||
2212 | 2195 | ||
2213 | platform_set_drvdata(pdev, &sport->port); | 2196 | platform_set_drvdata(pdev, &sport->port); |
2214 | 2197 | ||
2215 | if (lpuart_is_32(sport)) | 2198 | if (lpuart_is_32(sport)) { |
2216 | lpuart_reg.cons = LPUART32_CONSOLE; | 2199 | lpuart_reg.cons = LPUART32_CONSOLE; |
2217 | else | 2200 | ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart32_int, 0, |
2201 | DRIVER_NAME, sport); | ||
2202 | } else { | ||
2218 | lpuart_reg.cons = LPUART_CONSOLE; | 2203 | lpuart_reg.cons = LPUART_CONSOLE; |
2204 | ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart_int, 0, | ||
2205 | DRIVER_NAME, sport); | ||
2206 | } | ||
2207 | |||
2208 | if (ret) | ||
2209 | goto failed_irq_request; | ||
2219 | 2210 | ||
2220 | ret = uart_add_one_port(&lpuart_reg, &sport->port); | 2211 | ret = uart_add_one_port(&lpuart_reg, &sport->port); |
2221 | if (ret) { | 2212 | if (ret) |
2222 | clk_disable_unprepare(sport->clk); | 2213 | goto failed_attach_port; |
2223 | return ret; | ||
2224 | } | ||
2225 | 2214 | ||
2226 | sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx"); | 2215 | sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx"); |
2227 | if (!sport->dma_tx_chan) | 2216 | if (!sport->dma_tx_chan) |
@@ -2240,6 +2229,11 @@ static int lpuart_probe(struct platform_device *pdev) | |||
2240 | } | 2229 | } |
2241 | 2230 | ||
2242 | return 0; | 2231 | return 0; |
2232 | |||
2233 | failed_attach_port: | ||
2234 | failed_irq_request: | ||
2235 | clk_disable_unprepare(sport->clk); | ||
2236 | return ret; | ||
2243 | } | 2237 | } |
2244 | 2238 | ||
2245 | static int lpuart_remove(struct platform_device *pdev) | 2239 | static int lpuart_remove(struct platform_device *pdev) |
diff --git a/drivers/tty/serial/sccnxp.c b/drivers/tty/serial/sccnxp.c index cdd2f942317c..b9c7a904c1ea 100644 --- a/drivers/tty/serial/sccnxp.c +++ b/drivers/tty/serial/sccnxp.c | |||
@@ -889,7 +889,16 @@ static int sccnxp_probe(struct platform_device *pdev) | |||
889 | goto err_out; | 889 | goto err_out; |
890 | uartclk = 0; | 890 | uartclk = 0; |
891 | } else { | 891 | } else { |
892 | clk_prepare_enable(clk); | 892 | ret = clk_prepare_enable(clk); |
893 | if (ret) | ||
894 | goto err_out; | ||
895 | |||
896 | ret = devm_add_action_or_reset(&pdev->dev, | ||
897 | (void(*)(void *))clk_disable_unprepare, | ||
898 | clk); | ||
899 | if (ret) | ||
900 | goto err_out; | ||
901 | |||
893 | uartclk = clk_get_rate(clk); | 902 | uartclk = clk_get_rate(clk); |
894 | } | 903 | } |
895 | 904 | ||
@@ -988,7 +997,7 @@ static int sccnxp_probe(struct platform_device *pdev) | |||
988 | uart_unregister_driver(&s->uart); | 997 | uart_unregister_driver(&s->uart); |
989 | err_out: | 998 | err_out: |
990 | if (!IS_ERR(s->regulator)) | 999 | if (!IS_ERR(s->regulator)) |
991 | return regulator_disable(s->regulator); | 1000 | regulator_disable(s->regulator); |
992 | 1001 | ||
993 | return ret; | 1002 | return ret; |
994 | } | 1003 | } |