Skip to content

Commit 27b3b16

Browse files
committed
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
2 parents 08bbc4f + c912614 commit 27b3b16

File tree

5 files changed

+46
-30
lines changed

5 files changed

+46
-30
lines changed

Documentation/devicetree/bindings/serial/renesas,sci-serial.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Required properties:
4141
- "renesas,hscif-r8a7795" for R8A7795 (R-Car H3) HSCIF compatible UART.
4242
- "renesas,scif-r8a7796" for R8A7796 (R-Car M3-W) SCIF compatible UART.
4343
- "renesas,hscif-r8a7796" for R8A7796 (R-Car M3-W) HSCIF compatible UART.
44+
- "renesas,scif-r8a77970" for R8A77970 (R-Car V3M) SCIF compatible UART.
45+
- "renesas,hscif-r8a77970" for R8A77970 (R-Car V3M) HSCIF compatible UART.
4446
- "renesas,scif-r8a77995" for R8A77995 (R-Car D3) SCIF compatible UART.
4547
- "renesas,hscif-r8a77995" for R8A77995 (R-Car D3) HSCIF compatible UART.
4648
- "renesas,scifa-sh73a0" for SH73A0 (SH-Mobile AG5) SCIFA compatible UART.

drivers/tty/mxser.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ struct mxser_port {
246246
unsigned char err_shadow;
247247

248248
struct async_icount icount; /* kernel counters for 4 input interrupts */
249-
int timeout;
249+
unsigned int timeout;
250250

251251
int read_status_mask;
252252
int ignore_status_mask;
253-
int xmit_fifo_size;
253+
unsigned int xmit_fifo_size;
254254
int xmit_head;
255255
int xmit_tail;
256256
int xmit_cnt;
@@ -572,8 +572,9 @@ static void mxser_dtr_rts(struct tty_port *port, int on)
572572
static int mxser_set_baud(struct tty_struct *tty, long newspd)
573573
{
574574
struct mxser_port *info = tty->driver_data;
575-
int quot = 0, baud;
575+
unsigned int quot = 0, baud;
576576
unsigned char cval;
577+
u64 timeout;
577578

578579
if (!info->ioaddr)
579580
return -1;
@@ -594,8 +595,13 @@ static int mxser_set_baud(struct tty_struct *tty, long newspd)
594595
quot = 0;
595596
}
596597

597-
info->timeout = ((info->xmit_fifo_size * HZ * 10 * quot) / info->baud_base);
598-
info->timeout += HZ / 50; /* Add .02 seconds of slop */
598+
/*
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 */
599605

600606
if (quot) {
601607
info->MCR |= UART_MCR_DTR;

drivers/tty/serial/bcm63xx_uart.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,14 @@ static void bcm_uart_set_termios(struct uart_port *port,
507507
{
508508
unsigned int ctl, baud, quot, ier;
509509
unsigned long flags;
510+
int tries;
510511

511512
spin_lock_irqsave(&port->lock, flags);
512513

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+
513518
/* disable uart while changing speed */
514519
bcm_uart_disable(port);
515520
bcm_uart_flush(port);

drivers/tty/serial/fsl_lpuart.c

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,6 @@ static void rx_dma_timer_init(struct lpuart_port *sport)
12761276
static int lpuart_startup(struct uart_port *port)
12771277
{
12781278
struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
1279-
int ret;
12801279
unsigned long flags;
12811280
unsigned char temp;
12821281

@@ -1291,11 +1290,6 @@ static int lpuart_startup(struct uart_port *port)
12911290
sport->rxfifo_size = 0x1 << (((temp >> UARTPFIFO_RXSIZE_OFF) &
12921291
UARTPFIFO_FIFOSIZE_MASK) + 1);
12931292

1294-
ret = devm_request_irq(port->dev, port->irq, lpuart_int, 0,
1295-
DRIVER_NAME, sport);
1296-
if (ret)
1297-
return ret;
1298-
12991293
spin_lock_irqsave(&sport->port.lock, flags);
13001294

13011295
lpuart_setup_watermark(sport);
@@ -1333,7 +1327,6 @@ static int lpuart_startup(struct uart_port *port)
13331327
static int lpuart32_startup(struct uart_port *port)
13341328
{
13351329
struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
1336-
int ret;
13371330
unsigned long flags;
13381331
unsigned long temp;
13391332

@@ -1346,11 +1339,6 @@ static int lpuart32_startup(struct uart_port *port)
13461339
sport->rxfifo_size = 0x1 << (((temp >> UARTFIFO_RXSIZE_OFF) &
13471340
UARTFIFO_FIFOSIZE_MASK) - 1);
13481341

1349-
ret = devm_request_irq(port->dev, port->irq, lpuart32_int, 0,
1350-
DRIVER_NAME, sport);
1351-
if (ret)
1352-
return ret;
1353-
13541342
spin_lock_irqsave(&sport->port.lock, flags);
13551343

13561344
lpuart32_setup_watermark(sport);
@@ -1380,8 +1368,6 @@ static void lpuart_shutdown(struct uart_port *port)
13801368

13811369
spin_unlock_irqrestore(&port->lock, flags);
13821370

1383-
devm_free_irq(port->dev, port->irq, sport);
1384-
13851371
if (sport->lpuart_dma_rx_use) {
13861372
del_timer_sync(&sport->lpuart_timer);
13871373
lpuart_dma_rx_free(&sport->port);
@@ -1400,7 +1386,6 @@ static void lpuart_shutdown(struct uart_port *port)
14001386

14011387
static void lpuart32_shutdown(struct uart_port *port)
14021388
{
1403-
struct lpuart_port *sport = container_of(port, struct lpuart_port, port);
14041389
unsigned long temp;
14051390
unsigned long flags;
14061391

@@ -1413,8 +1398,6 @@ static void lpuart32_shutdown(struct uart_port *port)
14131398
lpuart32_write(port, temp, UARTCTRL);
14141399

14151400
spin_unlock_irqrestore(&port->lock, flags);
1416-
1417-
devm_free_irq(port->dev, port->irq, sport);
14181401
}
14191402

14201403
static void
@@ -2212,16 +2195,22 @@ static int lpuart_probe(struct platform_device *pdev)
22122195

22132196
platform_set_drvdata(pdev, &sport->port);
22142197

2215-
if (lpuart_is_32(sport))
2198+
if (lpuart_is_32(sport)) {
22162199
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 {
22182203
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;
22192210

22202211
ret = uart_add_one_port(&lpuart_reg, &sport->port);
2221-
if (ret) {
2222-
clk_disable_unprepare(sport->clk);
2223-
return ret;
2224-
}
2212+
if (ret)
2213+
goto failed_attach_port;
22252214

22262215
sport->dma_tx_chan = dma_request_slave_channel(sport->port.dev, "tx");
22272216
if (!sport->dma_tx_chan)
@@ -2240,6 +2229,11 @@ static int lpuart_probe(struct platform_device *pdev)
22402229
}
22412230

22422231
return 0;
2232+
2233+
failed_attach_port:
2234+
failed_irq_request:
2235+
clk_disable_unprepare(sport->clk);
2236+
return ret;
22432237
}
22442238

22452239
static int lpuart_remove(struct platform_device *pdev)

drivers/tty/serial/sccnxp.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,16 @@ static int sccnxp_probe(struct platform_device *pdev)
889889
goto err_out;
890890
uartclk = 0;
891891
} 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+
893902
uartclk = clk_get_rate(clk);
894903
}
895904

@@ -988,7 +997,7 @@ static int sccnxp_probe(struct platform_device *pdev)
988997
uart_unregister_driver(&s->uart);
989998
err_out:
990999
if (!IS_ERR(s->regulator))
991-
return regulator_disable(s->regulator);
1000+
regulator_disable(s->regulator);
9921001

9931002
return ret;
9941003
}

0 commit comments

Comments
 (0)