Skip to content

Commit 6463e54

Browse files
committed
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
2 parents 6a65554 + 341abd6 commit 6463e54

File tree

10 files changed

+63
-14
lines changed

10 files changed

+63
-14
lines changed

arch/mips/mti-malta/malta-platform.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ static struct plat_serial8250_port uart8250_data[] = {
4848
.mapbase = 0x1f000900, /* The CBUS UART */
4949
.irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2,
5050
.uartclk = 3686400, /* Twice the usual clk! */
51-
.iotype = UPIO_MEM32,
51+
.iotype = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) ?
52+
UPIO_MEM32BE : UPIO_MEM32,
5253
.flags = CBUS_UART_FLAGS,
5354
.regshift = 3,
5455
},

drivers/tty/serial/8250/8250_aspeed_vuart.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,15 @@ static int aspeed_vuart_handle_irq(struct uart_port *port)
329329
{
330330
struct uart_8250_port *up = up_to_u8250p(port);
331331
unsigned int iir, lsr;
332+
unsigned long flags;
332333
unsigned int space, count;
333334

334335
iir = serial_port_in(port, UART_IIR);
335336

336337
if (iir & UART_IIR_NO_INT)
337338
return 0;
338339

339-
spin_lock(&port->lock);
340+
spin_lock_irqsave(&port->lock, flags);
340341

341342
lsr = serial_port_in(port, UART_LSR);
342343

@@ -370,7 +371,7 @@ static int aspeed_vuart_handle_irq(struct uart_port *port)
370371
if (lsr & UART_LSR_THRE)
371372
serial8250_tx_chars(up);
372373

373-
uart_unlock_and_check_sysrq(port);
374+
uart_unlock_and_check_sysrq_irqrestore(port, flags);
374375

375376
return 1;
376377
}

drivers/tty/serial/8250/8250_fsl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ struct fsl8250_data {
3030
int fsl8250_handle_irq(struct uart_port *port)
3131
{
3232
unsigned char lsr, orig_lsr;
33+
unsigned long flags;
3334
unsigned int iir;
3435
struct uart_8250_port *up = up_to_u8250p(port);
3536

36-
spin_lock(&up->port.lock);
37+
spin_lock_irqsave(&up->port.lock, flags);
3738

3839
iir = port->serial_in(port, UART_IIR);
3940
if (iir & UART_IIR_NO_INT) {
@@ -82,7 +83,7 @@ int fsl8250_handle_irq(struct uart_port *port)
8283

8384
up->lsr_saved_flags = orig_lsr;
8485

85-
uart_unlock_and_check_sysrq(&up->port);
86+
uart_unlock_and_check_sysrq_irqrestore(&up->port, flags);
8687

8788
return 1;
8889
}

drivers/tty/serial/8250/8250_mtk.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ static void mtk8250_dma_rx_complete(void *param)
9393
struct dma_tx_state state;
9494
int copied, total, cnt;
9595
unsigned char *ptr;
96+
unsigned long flags;
9697

9798
if (data->rx_status == DMA_RX_SHUTDOWN)
9899
return;
99100

101+
spin_lock_irqsave(&up->port.lock, flags);
102+
100103
dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
101104
total = dma->rx_size - state.residue;
102105
cnt = total;
@@ -120,6 +123,8 @@ static void mtk8250_dma_rx_complete(void *param)
120123
tty_flip_buffer_push(tty_port);
121124

122125
mtk8250_rx_dma(up);
126+
127+
spin_unlock_irqrestore(&up->port.lock, flags);
123128
}
124129

125130
static void mtk8250_rx_dma(struct uart_8250_port *up)

drivers/tty/serial/8250/8250_pci.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3836,6 +3836,12 @@ static const struct pci_device_id blacklist[] = {
38363836
{ PCI_VDEVICE(INTEL, 0x0f0c), },
38373837
{ PCI_VDEVICE(INTEL, 0x228a), },
38383838
{ 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), },
38393845
{ PCI_VDEVICE(INTEL, 0x9ce3), },
38403846
{ PCI_VDEVICE(INTEL, 0x9ce4), },
38413847

@@ -3996,6 +4002,7 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board)
39964002
if (pci_match_id(pci_use_msi, dev)) {
39974003
dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n");
39984004
pci_set_master(dev);
4005+
uart.port.flags &= ~UPF_SHARE_IRQ;
39994006
rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES);
40004007
} else {
40014008
dev_dbg(&dev->dev, "Using legacy interrupts\n");

drivers/tty/serial/8250/8250_port.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,11 @@ static const struct serial8250_config uart_config[] = {
311311
/* Uart divisor latch read */
312312
static int default_serial_dl_read(struct uart_8250_port *up)
313313
{
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;
315319
}
316320

317321
/* Uart divisor latch write */
@@ -1297,9 +1301,11 @@ static void autoconfig(struct uart_8250_port *up)
12971301
serial_out(up, UART_LCR, 0);
12981302

12991303
serial_out(up, UART_FCR, UART_FCR_ENABLE_FIFO);
1300-
scratch = serial_in(up, UART_IIR) >> 6;
13011304

1302-
switch (scratch) {
1305+
/* Assign this as it is to truncate any bits above 7. */
1306+
scratch = serial_in(up, UART_IIR);
1307+
1308+
switch (scratch >> 6) {
13031309
case 0:
13041310
autoconfig_8250(up);
13051311
break;
@@ -1893,11 +1899,12 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
18931899
unsigned char status;
18941900
struct uart_8250_port *up = up_to_u8250p(port);
18951901
bool skip_rx = false;
1902+
unsigned long flags;
18961903

18971904
if (iir & UART_IIR_NO_INT)
18981905
return 0;
18991906

1900-
spin_lock(&port->lock);
1907+
spin_lock_irqsave(&port->lock, flags);
19011908

19021909
status = serial_port_in(port, UART_LSR);
19031910

@@ -1923,7 +1930,7 @@ int serial8250_handle_irq(struct uart_port *port, unsigned int iir)
19231930
(up->ier & UART_IER_THRI))
19241931
serial8250_tx_chars(up);
19251932

1926-
uart_unlock_and_check_sysrq(port);
1933+
uart_unlock_and_check_sysrq_irqrestore(port, flags);
19271934

19281935
return 1;
19291936
}

drivers/tty/serial/fsl_lpuart.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ static unsigned int lpuart_get_mctrl(struct uart_port *port)
14151415

14161416
static unsigned int lpuart32_get_mctrl(struct uart_port *port)
14171417
{
1418-
unsigned int mctrl = 0;
1418+
unsigned int mctrl = TIOCM_CAR | TIOCM_DSR | TIOCM_CTS;
14191419
u32 reg;
14201420

14211421
reg = lpuart32_read(port, UARTCTRL);

drivers/tty/serial/max310x.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,8 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
12931293
freq = uartclk;
12941294
if (freq == 0) {
12951295
dev_err(dev, "Cannot get clock rate\n");
1296-
return -EINVAL;
1296+
ret = -EINVAL;
1297+
goto out_clk;
12971298
}
12981299

12991300
if (xtal) {

drivers/tty/serial/serial-tegra.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,9 +1045,11 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
10451045

10461046
if (tup->cdata->fifo_mode_enable_status) {
10471047
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);
10501051
return ret;
1052+
}
10511053
} else {
10521054
/*
10531055
* For all tegra devices (up to t210), there is a hardware

include/linux/serial_core.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,25 @@ static inline void uart_unlock_and_check_sysrq(struct uart_port *port)
518518
if (sysrq_ch)
519519
handle_sysrq(sysrq_ch);
520520
}
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+
}
521540
#else /* CONFIG_MAGIC_SYSRQ_SERIAL */
522541
static inline int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
523542
{
@@ -531,6 +550,11 @@ static inline void uart_unlock_and_check_sysrq(struct uart_port *port)
531550
{
532551
spin_unlock(&port->lock);
533552
}
553+
static inline void uart_unlock_and_check_sysrq_irqrestore(struct uart_port *port,
554+
unsigned long flags)
555+
{
556+
spin_unlock_irqrestore(&port->lock, flags);
557+
}
534558
#endif /* CONFIG_MAGIC_SYSRQ_SERIAL */
535559

536560
/*

0 commit comments

Comments
 (0)