Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull tty / serial fixes from Greg KH:
"Here are some small remaining tty/serial driver fixes. Included in
here is fixes for:

- vt unicode buffer corruption fix

- imx serial driver fixes, again

- port suspend fix

- 8250_dw driver fix

- fsl_lpuart driver fix

- revert for the qcom_geni_serial driver to fix a reported regression

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

* tag 'tty-6.8-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
Revert "tty: serial: simplify qcom_geni_serial_send_chunk_fifo()"
tty: serial: fsl_lpuart: avoid idle preamble pending if CTS is enabled
vt: fix unicode buffer corruption when deleting characters
serial: port: Don't suspend if the port is still busy
serial: 8250_dw: Do not reclock if already at correct rate
tty: serial: imx: Fix broken RS485

+57 -15
+3 -3
drivers/tty/serial/8250/8250_dw.c
··· 357 357 long rate; 358 358 int ret; 359 359 360 - clk_disable_unprepare(d->clk); 361 360 rate = clk_round_rate(d->clk, newrate); 362 - if (rate > 0) { 361 + if (rate > 0 && p->uartclk != rate) { 362 + clk_disable_unprepare(d->clk); 363 363 /* 364 364 * Note that any clock-notifer worker will block in 365 365 * serial8250_update_uartclk() until we are done. ··· 367 367 ret = clk_set_rate(d->clk, newrate); 368 368 if (!ret) 369 369 p->uartclk = rate; 370 + clk_prepare_enable(d->clk); 370 371 } 371 - clk_prepare_enable(d->clk); 372 372 373 373 dw8250_do_set_termios(p, termios, old); 374 374 }
+5 -2
drivers/tty/serial/fsl_lpuart.c
··· 2345 2345 2346 2346 lpuart32_write(&sport->port, bd, UARTBAUD); 2347 2347 lpuart32_serial_setbrg(sport, baud); 2348 - lpuart32_write(&sport->port, modem, UARTMODIR); 2349 - lpuart32_write(&sport->port, ctrl, UARTCTRL); 2348 + /* disable CTS before enabling UARTCTRL_TE to avoid pending idle preamble */ 2349 + lpuart32_write(&sport->port, modem & ~UARTMODIR_TXCTSE, UARTMODIR); 2350 2350 /* restore control register */ 2351 + lpuart32_write(&sport->port, ctrl, UARTCTRL); 2352 + /* re-enable the CTS if needed */ 2353 + lpuart32_write(&sport->port, modem, UARTMODIR); 2351 2354 2352 2355 if ((ctrl & (UARTCTRL_PE | UARTCTRL_M)) == UARTCTRL_PE) 2353 2356 sport->is_cs7 = true;
+18 -4
drivers/tty/serial/imx.c
··· 462 462 } 463 463 } 464 464 465 - /* called with port.lock taken and irqs off */ 466 - static void imx_uart_stop_rx(struct uart_port *port) 465 + static void imx_uart_stop_rx_with_loopback_ctrl(struct uart_port *port, bool loopback) 467 466 { 468 467 struct imx_port *sport = (struct imx_port *)port; 469 468 u32 ucr1, ucr2, ucr4, uts; ··· 484 485 /* See SER_RS485_ENABLED/UTS_LOOP comment in imx_uart_probe() */ 485 486 if (port->rs485.flags & SER_RS485_ENABLED && 486 487 port->rs485.flags & SER_RS485_RTS_ON_SEND && 487 - sport->have_rtscts && !sport->have_rtsgpio) { 488 + sport->have_rtscts && !sport->have_rtsgpio && loopback) { 488 489 uts = imx_uart_readl(sport, imx_uart_uts_reg(sport)); 489 490 uts |= UTS_LOOP; 490 491 imx_uart_writel(sport, uts, imx_uart_uts_reg(sport)); ··· 494 495 } 495 496 496 497 imx_uart_writel(sport, ucr2, UCR2); 498 + } 499 + 500 + /* called with port.lock taken and irqs off */ 501 + static void imx_uart_stop_rx(struct uart_port *port) 502 + { 503 + /* 504 + * Stop RX and enable loopback in order to make sure RS485 bus 505 + * is not blocked. Se comment in imx_uart_probe(). 506 + */ 507 + imx_uart_stop_rx_with_loopback_ctrl(port, true); 497 508 } 498 509 499 510 /* called with port.lock taken and irqs off */ ··· 691 682 imx_uart_rts_inactive(sport, &ucr2); 692 683 imx_uart_writel(sport, ucr2, UCR2); 693 684 685 + /* 686 + * Since we are about to transmit we can not stop RX 687 + * with loopback enabled because that will make our 688 + * transmitted data being just looped to RX. 689 + */ 694 690 if (!(port->rs485.flags & SER_RS485_RX_DURING_TX) && 695 691 !port->rs485_rx_during_tx_gpio) 696 - imx_uart_stop_rx(port); 692 + imx_uart_stop_rx_with_loopback_ctrl(port, false); 697 693 698 694 sport->tx_state = WAIT_AFTER_RTS; 699 695
+6 -4
drivers/tty/serial/qcom_geni_serial.c
··· 851 851 } 852 852 853 853 static void qcom_geni_serial_send_chunk_fifo(struct uart_port *uport, 854 - unsigned int remaining) 854 + unsigned int chunk) 855 855 { 856 856 struct qcom_geni_serial_port *port = to_dev_port(uport); 857 857 struct circ_buf *xmit = &uport->state->xmit; 858 - unsigned int tx_bytes; 858 + unsigned int tx_bytes, c, remaining = chunk; 859 859 u8 buf[BYTES_PER_FIFO_WORD]; 860 860 861 861 while (remaining) { 862 862 memset(buf, 0, sizeof(buf)); 863 863 tx_bytes = min(remaining, BYTES_PER_FIFO_WORD); 864 864 865 - memcpy(buf, &xmit->buf[xmit->tail], tx_bytes); 866 - uart_xmit_advance(uport, tx_bytes); 865 + for (c = 0; c < tx_bytes ; c++) { 866 + buf[c] = xmit->buf[xmit->tail]; 867 + uart_xmit_advance(uport, 1); 868 + } 867 869 868 870 iowrite32_rep(uport->membase + SE_GENI_TX_FIFOn, buf, 1); 869 871
+24 -1
drivers/tty/serial/serial_port.c
··· 46 46 return 0; 47 47 } 48 48 49 + static int serial_port_runtime_suspend(struct device *dev) 50 + { 51 + struct serial_port_device *port_dev = to_serial_base_port_device(dev); 52 + struct uart_port *port = port_dev->port; 53 + unsigned long flags; 54 + bool busy; 55 + 56 + if (port->flags & UPF_DEAD) 57 + return 0; 58 + 59 + uart_port_lock_irqsave(port, &flags); 60 + busy = __serial_port_busy(port); 61 + if (busy) 62 + port->ops->start_tx(port); 63 + uart_port_unlock_irqrestore(port, flags); 64 + 65 + if (busy) 66 + pm_runtime_mark_last_busy(dev); 67 + 68 + return busy ? -EBUSY : 0; 69 + } 70 + 49 71 static DEFINE_RUNTIME_DEV_PM_OPS(serial_port_pm, 50 - NULL, serial_port_runtime_resume, NULL); 72 + serial_port_runtime_suspend, 73 + serial_port_runtime_resume, NULL); 51 74 52 75 static int serial_port_probe(struct device *dev) 53 76 {
+1 -1
drivers/tty/vt/vt.c
··· 381 381 u32 *ln = vc->vc_uni_lines[vc->state.y]; 382 382 unsigned int x = vc->state.x, cols = vc->vc_cols; 383 383 384 - memcpy(&ln[x], &ln[x + nr], (cols - x - nr) * sizeof(*ln)); 384 + memmove(&ln[x], &ln[x + nr], (cols - x - nr) * sizeof(*ln)); 385 385 memset32(&ln[cols - nr], ' ', nr); 386 386 } 387 387 }