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

Pull tty/serial fixes from Greg KH:
"Here are some small tty/serial driver fixes for 5.14-rc5 to resolve a
number of reported problems.

They include:

- mips serial driver fixes

- 8250 driver fixes for reported problems

- fsl_lpuart driver fixes

- other tiny driver fixes

All have been in linux-next for a while with no reported problems"

* tag 'tty-5.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
serial: 8250_pci: Avoid irq sharing for MSI(-X) interrupts.
serial: 8250_mtk: fix uart corruption issue when rx power off
tty: serial: fsl_lpuart: fix the wrong return value in lpuart32_get_mctrl
serial: 8250_pci: Enumerate Elkhart Lake UARTs via dedicated driver
serial: 8250: fix handle_irq locking
serial: tegra: Only print FIFO error message when an error occurs
MIPS: Malta: Do not byte-swap accesses to the CBUS UART
serial: 8250: Mask out floating 16/32-bit bus bits
serial: max310x: Unprepare and disable clock in error path

+63 -14
+2 -1
arch/mips/mti-malta/malta-platform.c
··· 48 48 .mapbase = 0x1f000900, /* The CBUS UART */ 49 49 .irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2, 50 50 .uartclk = 3686400, /* Twice the usual clk! */ 51 - .iotype = UPIO_MEM32, 51 + .iotype = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ? 52 + UPIO_MEM32BE : UPIO_MEM32, 52 53 .flags = CBUS_UART_FLAGS, 53 54 .regshift = 3, 54 55 },
+3 -2
drivers/tty/serial/8250/8250_aspeed_vuart.c
··· 329 329 { 330 330 struct uart_8250_port *up = up_to_u8250p(port); 331 331 unsigned int iir, lsr; 332 + unsigned long flags; 332 333 unsigned int space, count; 333 334 334 335 iir = serial_port_in(port, UART_IIR); ··· 337 336 if (iir & UART_IIR_NO_INT) 338 337 return 0; 339 338 340 - spin_lock(&port->lock); 339 + spin_lock_irqsave(&port->lock, flags); 341 340 342 341 lsr = serial_port_in(port, UART_LSR); 343 342 ··· 371 370 if (lsr & UART_LSR_THRE) 372 371 serial8250_tx_chars(up); 373 372 374 - uart_unlock_and_check_sysrq(port); 373 + uart_unlock_and_check_sysrq_irqrestore(port, flags); 375 374 376 375 return 1; 377 376 }
+3 -2
drivers/tty/serial/8250/8250_fsl.c
··· 30 30 int fsl8250_handle_irq(struct uart_port *port) 31 31 { 32 32 unsigned char lsr, orig_lsr; 33 + unsigned long flags; 33 34 unsigned int iir; 34 35 struct uart_8250_port *up = up_to_u8250p(port); 35 36 36 - spin_lock(&up->port.lock); 37 + spin_lock_irqsave(&up->port.lock, flags); 37 38 38 39 iir = port->serial_in(port, UART_IIR); 39 40 if (iir & UART_IIR_NO_INT) { ··· 83 82 84 83 up->lsr_saved_flags = orig_lsr; 85 84 86 - uart_unlock_and_check_sysrq(&up->port); 85 + uart_unlock_and_check_sysrq_irqrestore(&up->port, flags); 87 86 88 87 return 1; 89 88 }
+5
drivers/tty/serial/8250/8250_mtk.c
··· 93 93 struct dma_tx_state state; 94 94 int copied, total, cnt; 95 95 unsigned char *ptr; 96 + unsigned long flags; 96 97 97 98 if (data->rx_status == DMA_RX_SHUTDOWN) 98 99 return; 100 + 101 + spin_lock_irqsave(&up->port.lock, flags); 99 102 100 103 dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state); 101 104 total = dma->rx_size - state.residue; ··· 123 120 tty_flip_buffer_push(tty_port); 124 121 125 122 mtk8250_rx_dma(up); 123 + 124 + spin_unlock_irqrestore(&up->port.lock, flags); 126 125 } 127 126 128 127 static void mtk8250_rx_dma(struct uart_8250_port *up)
+7
drivers/tty/serial/8250/8250_pci.c
··· 3836 3836 { PCI_VDEVICE(INTEL, 0x0f0c), }, 3837 3837 { PCI_VDEVICE(INTEL, 0x228a), }, 3838 3838 { PCI_VDEVICE(INTEL, 0x228c), }, 3839 + { PCI_VDEVICE(INTEL, 0x4b96), }, 3840 + { PCI_VDEVICE(INTEL, 0x4b97), }, 3841 + { PCI_VDEVICE(INTEL, 0x4b98), }, 3842 + { PCI_VDEVICE(INTEL, 0x4b99), }, 3843 + { PCI_VDEVICE(INTEL, 0x4b9a), }, 3844 + { PCI_VDEVICE(INTEL, 0x4b9b), }, 3839 3845 { PCI_VDEVICE(INTEL, 0x9ce3), }, 3840 3846 { PCI_VDEVICE(INTEL, 0x9ce4), }, 3841 3847 ··· 4002 3996 if (pci_match_id(pci_use_msi, dev)) { 4003 3997 dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n"); 4004 3998 pci_set_master(dev); 3999 + uart.port.flags &= ~UPF_SHARE_IRQ; 4005 4000 rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES); 4006 4001 } else { 4007 4002 dev_dbg(&dev->dev, "Using legacy interrupts\n");
+12 -5
drivers/tty/serial/8250/8250_port.c
··· 311 311 /* Uart divisor latch read */ 312 312 static int default_serial_dl_read(struct uart_8250_port *up) 313 313 { 314 - return serial_in(up, UART_DLL) | serial_in(up, UART_DLM) << 8; 314 + /* Assign these in pieces to truncate any bits above 7. */ 315 + unsigned char dll = serial_in(up, UART_DLL); 316 + unsigned char dlm = serial_in(up, UART_DLM); 317 + 318 + return dll | dlm << 8; 315 319 } 316 320 317 321 /* Uart divisor latch write */ ··· 1301 1297 serial_out(up, UART_LCR, 0); 1302 1298 1303 1299 serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO); 1304 - scratch = serial_in(up, UART_IIR) >> 6; 1305 1300 1306 - switch (scratch) { 1301 + /* Assign this as it is to truncate any bits above 7. */ 1302 + scratch = serial_in(up, UART_IIR); 1303 + 1304 + switch (scratch >> 6) { 1307 1305 case 0: 1308 1306 autoconfig_8250(up); 1309 1307 break; ··· 1899 1893 unsigned char status; 1900 1894 struct uart_8250_port *up = up_to_u8250p(port); 1901 1895 bool skip_rx = false; 1896 + unsigned long flags; 1902 1897 1903 1898 if (iir & UART_IIR_NO_INT) 1904 1899 return 0; 1905 1900 1906 - spin_lock(&port->lock); 1901 + spin_lock_irqsave(&port->lock, flags); 1907 1902 1908 1903 status = serial_port_in(port, UART_LSR); 1909 1904 ··· 1930 1923 (up->ier & UART_IER_THRI)) 1931 1924 serial8250_tx_chars(up); 1932 1925 1933 - uart_unlock_and_check_sysrq(port); 1926 + uart_unlock_and_check_sysrq_irqrestore(port, flags); 1934 1927 1935 1928 return 1; 1936 1929 }
+1 -1
drivers/tty/serial/fsl_lpuart.c
··· 1415 1415 1416 1416 static unsigned int lpuart32_get_mctrl(struct uart_port *port) 1417 1417 { 1418 - unsigned int mctrl = 0; 1418 + unsigned int mctrl = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS; 1419 1419 u32 reg; 1420 1420 1421 1421 reg = lpuart32_read(port, UARTCTRL);
+2 -1
drivers/tty/serial/max310x.c
··· 1293 1293 freq = uartclk; 1294 1294 if (freq == 0) { 1295 1295 dev_err(dev, "Cannot get clock rate\n"); 1296 - return -EINVAL; 1296 + ret = -EINVAL; 1297 + goto out_clk; 1297 1298 } 1298 1299 1299 1300 if (xtal) {
+4 -2
drivers/tty/serial/serial-tegra.c
··· 1045 1045 1046 1046 if (tup->cdata->fifo_mode_enable_status) { 1047 1047 ret = tegra_uart_wait_fifo_mode_enabled(tup); 1048 - dev_err(tup->uport.dev, "FIFO mode not enabled\n"); 1049 - if (ret < 0) 1048 + if (ret < 0) { 1049 + dev_err(tup->uport.dev, 1050 + "Failed to enable FIFO mode: %d\n", ret); 1050 1051 return ret; 1052 + } 1051 1053 } else { 1052 1054 /* 1053 1055 * For all tegra devices (up to t210), there is a hardware
+24
include/linux/serial_core.h
··· 518 518 if (sysrq_ch) 519 519 handle_sysrq(sysrq_ch); 520 520 } 521 + 522 + static inline void uart_unlock_and_check_sysrq_irqrestore(struct uart_port *port, 523 + unsigned long flags) 524 + { 525 + int sysrq_ch; 526 + 527 + if (!port->has_sysrq) { 528 + spin_unlock_irqrestore(&port->lock, flags); 529 + return; 530 + } 531 + 532 + sysrq_ch = port->sysrq_ch; 533 + port->sysrq_ch = 0; 534 + 535 + spin_unlock_irqrestore(&port->lock, flags); 536 + 537 + if (sysrq_ch) 538 + handle_sysrq(sysrq_ch); 539 + } 521 540 #else /* CONFIG_MAGIC_SYSRQ_SERIAL */ 522 541 static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) 523 542 { ··· 549 530 static inline void uart_unlock_and_check_sysrq(struct uart_port *port) 550 531 { 551 532 spin_unlock(&port->lock); 533 + } 534 + static inline void uart_unlock_and_check_sysrq_irqrestore(struct uart_port *port, 535 + unsigned long flags) 536 + { 537 + spin_unlock_irqrestore(&port->lock, flags); 552 538 } 553 539 #endif /* CONFIG_MAGIC_SYSRQ_SERIAL */ 554 540