Commit 27b3b160 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'tty-4.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial fixes from Greg KH:
 "Here are a small number (5) of patches for some reported TTY and
  serial issues. Nothing major, a documentation update, timing fix,
  error handling fix, name reporting fix, and a timeout issue resolved.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'tty-4.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  serial: sccnxp: Fix error handling in sccnxp_probe()
  tty: serial: lpuart: avoid report NULL interrupt
  serial: bcm63xx: fix timing issue.
  mxser: fix timeout calculation for low rates
  serial: sh-sci: document R8A77970 bindings
parents 08bbc4fc c9126143
...@@ -41,6 +41,8 @@ Required properties: ...@@ -41,6 +41,8 @@ Required properties:
- "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART. - "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART.
- "renesas,scif-r8a7796" for R8A7796 (R-Car M3-W) SCIF compatible UART. - "renesas,scif-r8a7796" for R8A7796 (R-Car M3-W) SCIF compatible UART.
- "renesas,hscif-r8a7796" for R8A7796 (R-Car M3-W) HSCIF compatible UART. - "renesas,hscif-r8a7796" for R8A7796 (R-Car M3-W) HSCIF compatible UART.
- "renesas,scif-r8a77970" for R8A77970 (R-Car V3M) SCIF compatible UART.
- "renesas,hscif-r8a77970" for R8A77970 (R-Car V3M) HSCIF compatible UART.
- "renesas,scif-r8a77995" for R8A77995 (R-Car D3) SCIF compatible UART. - "renesas,scif-r8a77995" for R8A77995 (R-Car D3) SCIF compatible UART.
- "renesas,hscif-r8a77995" for R8A77995 (R-Car D3) HSCIF compatible UART. - "renesas,hscif-r8a77995" for R8A77995 (R-Car D3) HSCIF compatible UART.
- "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART. - "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART.
......
...@@ -246,11 +246,11 @@ struct mxser_port { ...@@ -246,11 +246,11 @@ struct mxser_port {
unsigned char err_shadow; unsigned char err_shadow;
struct async_icount icount; /* kernel counters for 4 input interrupts */ struct async_icount icount; /* kernel counters for 4 input interrupts */
int timeout; unsigned int timeout;
int read_status_mask; int read_status_mask;
int ignore_status_mask; int ignore_status_mask;
int xmit_fifo_size; unsigned int xmit_fifo_size;
int xmit_head; int xmit_head;
int xmit_tail; int xmit_tail;
int xmit_cnt; int xmit_cnt;
...@@ -572,8 +572,9 @@ static void mxser_dtr_rts(struct tty_port *port, int on) ...@@ -572,8 +572,9 @@ static void mxser_dtr_rts(struct tty_port *port, int on)
static int mxser_set_baud(struct tty_struct *tty, long newspd) static int mxser_set_baud(struct tty_struct *tty, long newspd)
{ {
struct mxser_port *info = tty->driver_data; struct mxser_port *info = tty->driver_data;
int quot = 0, baud; unsigned int quot = 0, baud;
unsigned char cval; unsigned char cval;
u64 timeout;
if (!info->ioaddr) if (!info->ioaddr)
return -1; return -1;
...@@ -594,8 +595,13 @@ static int mxser_set_baud(struct tty_struct *tty, long newspd) ...@@ -594,8 +595,13 @@ static int mxser_set_baud(struct tty_struct *tty, long newspd)
quot = 0; quot = 0;
} }
info->timeout = ((info->xmit_fifo_size * HZ * 10 * quot) / info->baud_base); /*
info->timeout += HZ / 50; /* Add .02 seconds of slop */ * worst case (128 * 1000 * 10 * 18432) needs 35 bits, so divide in the
* u64 domain
*/
timeout = (u64)info->xmit_fifo_size * HZ * 10 * quot;
do_div(timeout, info->baud_base);
info->timeout = timeout + HZ / 50; /* Add .02 seconds of slop */
if (quot) { if (quot) {
info->MCR |= UART_MCR_DTR; info->MCR |= UART_MCR_DTR;
......
...@@ -507,9 +507,14 @@ static void bcm_uart_set_termios(struct uart_port *port, ...@@ -507,9 +507,14 @@ static void bcm_uart_set_termios(struct uart_port *port,
{ {
unsigned int ctl, baud, quot, ier; unsigned int ctl, baud, quot, ier;
unsigned long flags; unsigned long flags;
int tries;
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
/* Drain the hot tub fully before we power it off for the winter. */
for (tries = 3; !bcm_uart_tx_empty(port) && tries; tries--)
mdelay(10);
/* disable uart while changing speed */ /* disable uart while changing speed */
bcm_uart_disable(port); bcm_uart_disable(port);
bcm_uart_flush(port); bcm_uart_flush(port);
......
...@@ -1276,7 +1276,6 @@ static void rx_dma_timer_init(struct lpuart_port *sport) ...@@ -1276,7 +1276,6 @@ static void rx_dma_timer_init(struct lpuart_port *sport)
static int lpuart_startup(struct uart_port *port) static int lpuart_startup(struct uart_port *port)
{ {
struct lpuart_port *sport = container_of(port, struct lpuart_port, port); struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
int ret;
unsigned long flags; unsigned long flags;
unsigned char temp; unsigned char temp;
...@@ -1291,11 +1290,6 @@ static int lpuart_startup(struct uart_port *port) ...@@ -1291,11 +1290,6 @@ static int lpuart_startup(struct uart_port *port)
sport->rxfifo_size = 0x1 << (((temp >> UARTPFIFO_RXSIZE_OFF) & sport->rxfifo_size = 0x1 << (((temp >> UARTPFIFO_RXSIZE_OFF) &
UARTPFIFO_FIFOSIZE_MASK) + 1); UARTPFIFO_FIFOSIZE_MASK) + 1);
ret = devm_request_irq(port->dev, port->irq, lpuart_int, 0,
DRIVER_NAME, sport);
if (ret)
return ret;
spin_lock_irqsave(&sport->port.lock, flags); spin_lock_irqsave(&sport->port.lock, flags);
lpuart_setup_watermark(sport); lpuart_setup_watermark(sport);
...@@ -1333,7 +1327,6 @@ static int lpuart_startup(struct uart_port *port) ...@@ -1333,7 +1327,6 @@ static int lpuart_startup(struct uart_port *port)
static int lpuart32_startup(struct uart_port *port) static int lpuart32_startup(struct uart_port *port)
{ {
struct lpuart_port *sport = container_of(port, struct lpuart_port, port); struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
int ret;
unsigned long flags; unsigned long flags;
unsigned long temp; unsigned long temp;
...@@ -1346,11 +1339,6 @@ static int lpuart32_startup(struct uart_port *port) ...@@ -1346,11 +1339,6 @@ static int lpuart32_startup(struct uart_port *port)
sport->rxfifo_size = 0x1 << (((temp >> UARTFIFO_RXSIZE_OFF) & sport->rxfifo_size = 0x1 << (((temp >> UARTFIFO_RXSIZE_OFF) &
UARTFIFO_FIFOSIZE_MASK) - 1); UARTFIFO_FIFOSIZE_MASK) - 1);
ret = devm_request_irq(port->dev, port->irq, lpuart32_int, 0,
DRIVER_NAME, sport);
if (ret)
return ret;
spin_lock_irqsave(&sport->port.lock, flags); spin_lock_irqsave(&sport->port.lock, flags);
lpuart32_setup_watermark(sport); lpuart32_setup_watermark(sport);
...@@ -1380,8 +1368,6 @@ static void lpuart_shutdown(struct uart_port *port) ...@@ -1380,8 +1368,6 @@ static void lpuart_shutdown(struct uart_port *port)
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
devm_free_irq(port->dev, port->irq, sport);
if (sport->lpuart_dma_rx_use) { if (sport->lpuart_dma_rx_use) {
del_timer_sync(&sport->lpuart_timer); del_timer_sync(&sport->lpuart_timer);
lpuart_dma_rx_free(&sport->port); lpuart_dma_rx_free(&sport->port);
...@@ -1400,7 +1386,6 @@ static void lpuart_shutdown(struct uart_port *port) ...@@ -1400,7 +1386,6 @@ static void lpuart_shutdown(struct uart_port *port)
static void lpuart32_shutdown(struct uart_port *port) static void lpuart32_shutdown(struct uart_port *port)
{ {
struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
unsigned long temp; unsigned long temp;
unsigned long flags; unsigned long flags;
...@@ -1413,8 +1398,6 @@ static void lpuart32_shutdown(struct uart_port *port) ...@@ -1413,8 +1398,6 @@ static void lpuart32_shutdown(struct uart_port *port)
lpuart32_write(port, temp, UARTCTRL); lpuart32_write(port, temp, UARTCTRL);
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
devm_free_irq(port->dev, port->irq, sport);
} }
static void static void
...@@ -2212,16 +2195,22 @@ static int lpuart_probe(struct platform_device *pdev) ...@@ -2212,16 +2195,22 @@ static int lpuart_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, &sport->port); platform_set_drvdata(pdev, &sport->port);
if (lpuart_is_32(sport)) if (lpuart_is_32(sport)) {
lpuart_reg.cons = LPUART32_CONSOLE; lpuart_reg.cons = LPUART32_CONSOLE;
else ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart32_int, 0,
DRIVER_NAME, sport);
} else {
lpuart_reg.cons = LPUART_CONSOLE; lpuart_reg.cons = LPUART_CONSOLE;
ret = devm_request_irq(&pdev->dev, sport->port.irq, lpuart_int, 0,
DRIVER_NAME, sport);
}
if (ret)
goto failed_irq_request;
ret = uart_add_one_port(&lpuart_reg, &sport->port); ret = uart_add_one_port(&lpuart_reg, &sport->port);
if (ret) { if (ret)
clk_disable_unprepare(sport->clk); goto failed_attach_port;
return ret;
}
sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx"); sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx");
if (!sport->dma_tx_chan) if (!sport->dma_tx_chan)
...@@ -2240,6 +2229,11 @@ static int lpuart_probe(struct platform_device *pdev) ...@@ -2240,6 +2229,11 @@ static int lpuart_probe(struct platform_device *pdev)
} }
return 0; return 0;
failed_attach_port:
failed_irq_request:
clk_disable_unprepare(sport->clk);
return ret;
} }
static int lpuart_remove(struct platform_device *pdev) static int lpuart_remove(struct platform_device *pdev)
......
...@@ -889,7 +889,16 @@ static int sccnxp_probe(struct platform_device *pdev) ...@@ -889,7 +889,16 @@ static int sccnxp_probe(struct platform_device *pdev)
goto err_out; goto err_out;
uartclk = 0; uartclk = 0;
} else { } else {
clk_prepare_enable(clk); ret = clk_prepare_enable(clk);
if (ret)
goto err_out;
ret = devm_add_action_or_reset(&pdev->dev,
(void(*)(void *))clk_disable_unprepare,
clk);
if (ret)
goto err_out;
uartclk = clk_get_rate(clk); uartclk = clk_get_rate(clk);
} }
...@@ -988,7 +997,7 @@ static int sccnxp_probe(struct platform_device *pdev) ...@@ -988,7 +997,7 @@ static int sccnxp_probe(struct platform_device *pdev)
uart_unregister_driver(&s->uart); uart_unregister_driver(&s->uart);
err_out: err_out:
if (!IS_ERR(s->regulator)) if (!IS_ERR(s->regulator))
return regulator_disable(s->regulator); regulator_disable(s->regulator);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment