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-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial fixes from Greg KH:
"Here are some small TTY and Serial driver fixes for 5.16-rc4 to
resolve a number of reported problems.

They include:

- liteuart serial driver fixes

- 8250_pci serial driver fixes for pericom devices

- 8250 RTS line control fix while in RS-485 mode

- tegra serial driver fix

- msm_serial driver fix

- pl011 serial driver new id

- fsl_lpuart revert of broken change

- 8250_bcm7271 serial driver fix

- MAINTAINERS file update for rpmsg tty driver that came in 5.16-rc1

- vgacon fix for reported problem

All of these, except for the 8250_bcm7271 fix have been in linux-next
with no reported problem. The 8250_bcm7271 fix was added to the tree
on Friday so no chance to be linux-next yet. But it should be fine as
the affected developers submitted it"

* tag 'tty-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
serial: 8250_bcm7271: UART errors after resuming from S2
serial: 8250_pci: rewrite pericom_do_set_divisor()
serial: 8250_pci: Fix ACCES entries in pci_serial_quirks array
serial: 8250: Fix RTS modem control while in rs485 mode
Revert "tty: serial: fsl_lpuart: drop earlycon entry for i.MX8QXP"
serial: tegra: Change lower tolerance baud rate limit for tegra20 and tegra30
serial: liteuart: relax compile-test dependencies
serial: liteuart: fix minor-number leak on probe errors
serial: liteuart: fix use-after-free and memleak on unbind
serial: liteuart: Fix NULL pointer dereference in ->remove()
vgacon: Propagate console boot parameters before calling `vc_resize'
tty: serial: msm_serial: Deactivate RX DMA for polling support
serial: pl011: Add ACPI SBSA UART match id
serial: core: fix transmit-buffer reset and memleak
MAINTAINERS: Add rpmsg tty driver maintainer

+95 -33
+6
MAINTAINERS
··· 16502 16502 F: Documentation/devicetree/bindings/media/allwinner,sun8i-a83t-de2-rotate.yaml 16503 16503 F: drivers/media/platform/sunxi/sun8i-rotate/ 16504 16504 16505 + RPMSG TTY DRIVER 16506 + M: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com> 16507 + L: linux-remoteproc@vger.kernel.org 16508 + S: Maintained 16509 + F: drivers/tty/rpmsg_tty.c 16510 + 16505 16511 RTL2830 MEDIA DRIVER 16506 16512 M: Antti Palosaari <crope@iki.fi> 16507 16513 L: linux-media@vger.kernel.org
+13
drivers/tty/serial/8250/8250_bcm7271.c
··· 237 237 u32 rx_err; 238 238 u32 rx_timeout; 239 239 u32 rx_abort; 240 + u32 saved_mctrl; 240 241 }; 241 242 242 243 static struct dentry *brcmuart_debugfs_root; ··· 1134 1133 static int __maybe_unused brcmuart_suspend(struct device *dev) 1135 1134 { 1136 1135 struct brcmuart_priv *priv = dev_get_drvdata(dev); 1136 + struct uart_8250_port *up = serial8250_get_port(priv->line); 1137 + struct uart_port *port = &up->port; 1137 1138 1138 1139 serial8250_suspend_port(priv->line); 1139 1140 clk_disable_unprepare(priv->baud_mux_clk); 1141 + 1142 + /* 1143 + * This will prevent resume from enabling RTS before the 1144 + * baud rate has been resored. 1145 + */ 1146 + priv->saved_mctrl = port->mctrl; 1147 + port->mctrl = 0; 1140 1148 1141 1149 return 0; 1142 1150 } ··· 1153 1143 static int __maybe_unused brcmuart_resume(struct device *dev) 1154 1144 { 1155 1145 struct brcmuart_priv *priv = dev_get_drvdata(dev); 1146 + struct uart_8250_port *up = serial8250_get_port(priv->line); 1147 + struct uart_port *port = &up->port; 1156 1148 int ret; 1157 1149 1158 1150 ret = clk_prepare_enable(priv->baud_mux_clk); ··· 1177 1165 start_rx_dma(serial8250_get_port(priv->line)); 1178 1166 } 1179 1167 serial8250_resume_port(priv->line); 1168 + port->mctrl = priv->saved_mctrl; 1180 1169 return 0; 1181 1170 } 1182 1171
+25 -14
drivers/tty/serial/8250/8250_pci.c
··· 1324 1324 { 1325 1325 int scr; 1326 1326 int lcr; 1327 - int actual_baud; 1328 - int tolerance; 1329 1327 1330 - for (scr = 5 ; scr <= 15 ; scr++) { 1331 - actual_baud = 921600 * 16 / scr; 1332 - tolerance = actual_baud / 50; 1328 + for (scr = 16; scr > 4; scr--) { 1329 + unsigned int maxrate = port->uartclk / scr; 1330 + unsigned int divisor = max(maxrate / baud, 1U); 1331 + int delta = maxrate / divisor - baud; 1333 1332 1334 - if ((baud < actual_baud + tolerance) && 1335 - (baud > actual_baud - tolerance)) { 1333 + if (baud > maxrate + baud / 50) 1334 + continue; 1336 1335 1336 + if (delta > baud / 50) 1337 + divisor++; 1338 + 1339 + if (divisor > 0xffff) 1340 + continue; 1341 + 1342 + /* Update delta due to possible divisor change */ 1343 + delta = maxrate / divisor - baud; 1344 + if (abs(delta) < baud / 50) { 1337 1345 lcr = serial_port_in(port, UART_LCR); 1338 1346 serial_port_out(port, UART_LCR, lcr | 0x80); 1339 - 1340 - serial_port_out(port, UART_DLL, 1); 1341 - serial_port_out(port, UART_DLM, 0); 1347 + serial_port_out(port, UART_DLL, divisor & 0xff); 1348 + serial_port_out(port, UART_DLM, divisor >> 8 & 0xff); 1342 1349 serial_port_out(port, 2, 16 - scr); 1343 1350 serial_port_out(port, UART_LCR, lcr); 1344 1351 return; 1345 - } else if (baud > actual_baud) { 1346 - break; 1347 1352 } 1348 1353 } 1349 - serial8250_do_set_divisor(port, baud, quot, quot_frac); 1350 1354 } 1351 1355 static int pci_pericom_setup(struct serial_private *priv, 1352 1356 const struct pciserial_board *board, ··· 2295 2291 .setup = pci_pericom_setup_four_at_eight, 2296 2292 }, 2297 2293 { 2298 - .vendor = PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S, 2294 + .vendor = PCI_VENDOR_ID_ACCESIO, 2299 2295 .device = PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4, 2296 + .subvendor = PCI_ANY_ID, 2297 + .subdevice = PCI_ANY_ID, 2298 + .setup = pci_pericom_setup_four_at_eight, 2299 + }, 2300 + { 2301 + .vendor = PCI_VENDOR_ID_ACCESIO, 2302 + .device = PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S, 2300 2303 .subvendor = PCI_ANY_ID, 2301 2304 .subdevice = PCI_ANY_ID, 2302 2305 .setup = pci_pericom_setup_four_at_eight,
-7
drivers/tty/serial/8250/8250_port.c
··· 2024 2024 struct uart_8250_port *up = up_to_u8250p(port); 2025 2025 unsigned char mcr; 2026 2026 2027 - if (port->rs485.flags & SER_RS485_ENABLED) { 2028 - if (serial8250_in_MCR(up) & UART_MCR_RTS) 2029 - mctrl |= TIOCM_RTS; 2030 - else 2031 - mctrl &= ~TIOCM_RTS; 2032 - } 2033 - 2034 2027 mcr = serial8250_TIOCM_to_MCR(mctrl); 2035 2028 2036 2029 mcr = (mcr & up->mcr_mask) | up->mcr_force | up->mcr;
+1 -1
drivers/tty/serial/Kconfig
··· 1533 1533 tristate "LiteUART serial port support" 1534 1534 depends on HAS_IOMEM 1535 1535 depends on OF || COMPILE_TEST 1536 - depends on LITEX 1536 + depends on LITEX || COMPILE_TEST 1537 1537 select SERIAL_CORE 1538 1538 help 1539 1539 This driver is for the FPGA-based LiteUART serial controller from LiteX
+1
drivers/tty/serial/amba-pl011.c
··· 2947 2947 2948 2948 static const struct acpi_device_id __maybe_unused sbsa_uart_acpi_match[] = { 2949 2949 { "ARMH0011", 0 }, 2950 + { "ARMHB000", 0 }, 2950 2951 {}, 2951 2952 }; 2952 2953 MODULE_DEVICE_TABLE(acpi, sbsa_uart_acpi_match);
+1
drivers/tty/serial/fsl_lpuart.c
··· 2625 2625 OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup); 2626 2626 OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1028a-lpuart", ls1028a_early_console_setup); 2627 2627 OF_EARLYCON_DECLARE(lpuart32, "fsl,imx7ulp-lpuart", lpuart32_imx_early_console_setup); 2628 + OF_EARLYCON_DECLARE(lpuart32, "fsl,imx8qxp-lpuart", lpuart32_imx_early_console_setup); 2628 2629 EARLYCON_DECLARE(lpuart, lpuart_early_console_setup); 2629 2630 EARLYCON_DECLARE(lpuart32, lpuart32_early_console_setup); 2630 2631
+17 -3
drivers/tty/serial/liteuart.c
··· 270 270 271 271 /* get membase */ 272 272 port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); 273 - if (IS_ERR(port->membase)) 274 - return PTR_ERR(port->membase); 273 + if (IS_ERR(port->membase)) { 274 + ret = PTR_ERR(port->membase); 275 + goto err_erase_id; 276 + } 275 277 276 278 /* values not from device tree */ 277 279 port->dev = &pdev->dev; ··· 287 285 port->line = dev_id; 288 286 spin_lock_init(&port->lock); 289 287 290 - return uart_add_one_port(&liteuart_driver, &uart->port); 288 + platform_set_drvdata(pdev, port); 289 + 290 + ret = uart_add_one_port(&liteuart_driver, &uart->port); 291 + if (ret) 292 + goto err_erase_id; 293 + 294 + return 0; 295 + 296 + err_erase_id: 297 + xa_erase(&liteuart_array, uart->id); 298 + 299 + return ret; 291 300 } 292 301 293 302 static int liteuart_remove(struct platform_device *pdev) ··· 306 293 struct uart_port *port = platform_get_drvdata(pdev); 307 294 struct liteuart_port *uart = to_liteuart_port(port); 308 295 296 + uart_remove_one_port(&liteuart_driver, port); 309 297 xa_erase(&liteuart_array, uart->id); 310 298 311 299 return 0;
+3
drivers/tty/serial/msm_serial.c
··· 598 598 u32 val; 599 599 int ret; 600 600 601 + if (IS_ENABLED(CONFIG_CONSOLE_POLL)) 602 + return; 603 + 601 604 if (!dma->chan) 602 605 return; 603 606
+2 -2
drivers/tty/serial/serial-tegra.c
··· 1506 1506 .fifo_mode_enable_status = false, 1507 1507 .uart_max_port = 5, 1508 1508 .max_dma_burst_bytes = 4, 1509 - .error_tolerance_low_range = 0, 1509 + .error_tolerance_low_range = -4, 1510 1510 .error_tolerance_high_range = 4, 1511 1511 }; 1512 1512 ··· 1517 1517 .fifo_mode_enable_status = false, 1518 1518 .uart_max_port = 5, 1519 1519 .max_dma_burst_bytes = 4, 1520 - .error_tolerance_low_range = 0, 1520 + .error_tolerance_low_range = -4, 1521 1521 .error_tolerance_high_range = 4, 1522 1522 }; 1523 1523
+17 -1
drivers/tty/serial/serial_core.c
··· 1075 1075 goto out; 1076 1076 1077 1077 if (!tty_io_error(tty)) { 1078 + if (uport->rs485.flags & SER_RS485_ENABLED) { 1079 + set &= ~TIOCM_RTS; 1080 + clear &= ~TIOCM_RTS; 1081 + } 1082 + 1078 1083 uart_update_mctrl(uport, set, clear); 1079 1084 ret = 0; 1080 1085 } ··· 1554 1549 { 1555 1550 struct uart_state *state = container_of(port, struct uart_state, port); 1556 1551 struct uart_port *uport = uart_port_check(state); 1552 + char *buf; 1557 1553 1558 1554 /* 1559 1555 * At this point, we stop accepting input. To do this, we ··· 1576 1570 */ 1577 1571 tty_port_set_suspended(port, 0); 1578 1572 1579 - uart_change_pm(state, UART_PM_STATE_OFF); 1573 + /* 1574 + * Free the transmit buffer. 1575 + */ 1576 + spin_lock_irq(&uport->lock); 1577 + buf = state->xmit.buf; 1578 + state->xmit.buf = NULL; 1579 + spin_unlock_irq(&uport->lock); 1580 1580 1581 + if (buf) 1582 + free_page((unsigned long)buf); 1583 + 1584 + uart_change_pm(state, UART_PM_STATE_OFF); 1581 1585 } 1582 1586 1583 1587 static void uart_wait_until_sent(struct tty_struct *tty, int timeout)
+9 -5
drivers/video/console/vgacon.c
··· 366 366 struct uni_pagedir *p; 367 367 368 368 /* 369 - * We cannot be loaded as a module, therefore init is always 1, 370 - * but vgacon_init can be called more than once, and init will 371 - * not be 1. 369 + * We cannot be loaded as a module, therefore init will be 1 370 + * if we are the default console, however if we are a fallback 371 + * console, for example if fbcon has failed registration, then 372 + * init will be 0, so we need to make sure our boot parameters 373 + * have been copied to the console structure for vgacon_resize 374 + * ultimately called by vc_resize. Any subsequent calls to 375 + * vgacon_init init will have init set to 0 too. 372 376 */ 373 377 c->vc_can_do_color = vga_can_do_color; 378 + c->vc_scan_lines = vga_scan_lines; 379 + c->vc_font.height = c->vc_cell_height = vga_video_font_height; 374 380 375 381 /* set dimensions manually if init != 0 since vc_resize() will fail */ 376 382 if (init) { ··· 385 379 } else 386 380 vc_resize(c, vga_video_num_columns, vga_video_num_lines); 387 381 388 - c->vc_scan_lines = vga_scan_lines; 389 - c->vc_font.height = c->vc_cell_height = vga_video_font_height; 390 382 c->vc_complement_mask = 0x7700; 391 383 if (vga_512_chars) 392 384 c->vc_hi_font_mask = 0x0800;