Skip to content

Commit 37cc6bb

Browse files
committed
Merge tag 'tty-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver fixes from Greg KH: "Here are a number of small tty and serial driver fixes for reported issues for 4.9-rc3. Nothing major, but they do resolve a bunch of problems with the tty core changes that are in 4.9-rc1, and finally the atmel serial driver is back working properly. All have been in linux-next with no reported issues" * tag 'tty-4.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: tty: serial_core: fix NULL struct tty pointer access in uart_write_wakeup tty: serial_core: Fix serial console crash on port shutdown tty/serial: at91: fix hardware handshake on Atmel platforms vt: clear selection before resizing sc16is7xx: always write state when configuring GPIO as an output sh-sci: document R8A7743/5 support tty: serial: 8250: 8250_core: NXP SC16C2552 workaround tty: limit terminal size to 4M chars tty: serial: fsl_lpuart: Fix Tx DMA edge case serial: 8250_lpss: enable MSI for sure serial: core: fix console problems on uart_close serial: 8250_uniphier: fix clearing divisor latch access bit serial: 8250_uniphier: fix more unterminated string serial: pch_uart: add terminate entry for dmi_system_id tables devicetree: bindings: uart: Add new compatible string for ZynqMP serial: xuartps: Add new compatible string for ZynqMP serial: SERIAL_STM32 should depend on HAS_DMA serial: stm32: Fix comparisons with undefined register tty: vt, fix bogus division in csi_J
2 parents 9af6f26 + d0f4bce commit 37cc6bb

14 files changed

Lines changed: 60 additions & 19 deletions

File tree

Documentation/devicetree/bindings/serial/cdns,uart.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
Binding for Cadence UART Controller
22

33
Required properties:
4-
- compatible : should be "cdns,uart-r1p8", or "xlnx,xuartps"
4+
- compatible :
5+
Use "xlnx,xuartps","cdns,uart-r1p8" for Zynq-7xxx SoC.
6+
Use "xlnx,zynqmp-uart","cdns,uart-r1p12" for Zynq Ultrascale+ MPSoC.
57
- reg: Should contain UART controller registers location and length.
68
- interrupts: Should contain UART controller interrupts.
79
- clocks: Must contain phandles to the UART clocks

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ Required properties:
99
- "renesas,scifb-r8a73a4" for R8A73A4 (R-Mobile APE6) SCIFB compatible UART.
1010
- "renesas,scifa-r8a7740" for R8A7740 (R-Mobile A1) SCIFA compatible UART.
1111
- "renesas,scifb-r8a7740" for R8A7740 (R-Mobile A1) SCIFB compatible UART.
12+
- "renesas,scif-r8a7743" for R8A7743 (RZ/G1M) SCIF compatible UART.
13+
- "renesas,scifa-r8a7743" for R8A7743 (RZ/G1M) SCIFA compatible UART.
14+
- "renesas,scifb-r8a7743" for R8A7743 (RZ/G1M) SCIFB compatible UART.
15+
- "renesas,hscif-r8a7743" for R8A7743 (RZ/G1M) HSCIF compatible UART.
16+
- "renesas,scif-r8a7745" for R8A7745 (RZ/G1E) SCIF compatible UART.
17+
- "renesas,scifa-r8a7745" for R8A7745 (RZ/G1E) SCIFA compatible UART.
18+
- "renesas,scifb-r8a7745" for R8A7745 (RZ/G1E) SCIFB compatible UART.
19+
- "renesas,hscif-r8a7745" for R8A7745 (RZ/G1E) HSCIF compatible UART.
1220
- "renesas,scif-r8a7778" for R8A7778 (R-Car M1) SCIF compatible UART.
1321
- "renesas,scif-r8a7779" for R8A7779 (R-Car H1) SCIF compatible UART.
1422
- "renesas,scif-r8a7790" for R8A7790 (R-Car H2) SCIF compatible UART.

drivers/tty/serial/8250/8250_lpss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static int qrk_serial_setup(struct lpss8250 *lpss, struct uart_port *port)
213213
struct pci_dev *pdev = to_pci_dev(port->dev);
214214
int ret;
215215

216-
ret = pci_alloc_irq_vectors(pdev, 1, 1, 0);
216+
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
217217
if (ret < 0)
218218
return ret;
219219

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ static const struct serial8250_config uart_config[] = {
8383
.name = "16550A",
8484
.fifo_size = 16,
8585
.tx_loadsz = 16,
86-
.fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
86+
.fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 |
87+
UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
8788
.rxtrig_bytes = {1, 4, 8, 14},
8889
.flags = UART_CAP_FIFO,
8990
},

drivers/tty/serial/8250/8250_uniphier.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void uniphier_serial_out(struct uart_port *p, int offset, int value)
9999
case UART_LCR:
100100
valshift = UNIPHIER_UART_LCR_SHIFT;
101101
/* Divisor latch access bit does not exist. */
102-
value &= ~(UART_LCR_DLAB << valshift);
102+
value &= ~UART_LCR_DLAB;
103103
/* fall through */
104104
case UART_MCR:
105105
offset = UNIPHIER_UART_LCR_MCR;
@@ -199,7 +199,7 @@ static int uniphier_uart_probe(struct platform_device *pdev)
199199

200200
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
201201
if (!regs) {
202-
dev_err(dev, "failed to get memory resource");
202+
dev_err(dev, "failed to get memory resource\n");
203203
return -EINVAL;
204204
}
205205

drivers/tty/serial/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,7 @@ config SERIAL_SPRD_CONSOLE
16251625
config SERIAL_STM32
16261626
tristate "STMicroelectronics STM32 serial port support"
16271627
select SERIAL_CORE
1628+
depends on HAS_DMA
16281629
depends on ARM || COMPILE_TEST
16291630
help
16301631
This driver is for the on-chip Serial Controller on

drivers/tty/serial/atmel_serial.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,11 +2132,29 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios,
21322132
mode |= ATMEL_US_USMODE_RS485;
21332133
} else if (termios->c_cflag & CRTSCTS) {
21342134
/* RS232 with hardware handshake (RTS/CTS) */
2135-
if (atmel_use_dma_rx(port) && !atmel_use_fifo(port)) {
2136-
dev_info(port->dev, "not enabling hardware flow control because DMA is used");
2137-
termios->c_cflag &= ~CRTSCTS;
2138-
} else {
2135+
if (atmel_use_fifo(port) &&
2136+
!mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) {
2137+
/*
2138+
* with ATMEL_US_USMODE_HWHS set, the controller will
2139+
* be able to drive the RTS pin high/low when the RX
2140+
* FIFO is above RXFTHRES/below RXFTHRES2.
2141+
* It will also disable the transmitter when the CTS
2142+
* pin is high.
2143+
* This mode is not activated if CTS pin is a GPIO
2144+
* because in this case, the transmitter is always
2145+
* disabled (there must be an internal pull-up
2146+
* responsible for this behaviour).
2147+
* If the RTS pin is a GPIO, the controller won't be
2148+
* able to drive it according to the FIFO thresholds,
2149+
* but it will be handled by the driver.
2150+
*/
21392151
mode |= ATMEL_US_USMODE_HWHS;
2152+
} else {
2153+
/*
2154+
* For platforms without FIFO, the flow control is
2155+
* handled by the driver.
2156+
*/
2157+
mode |= ATMEL_US_USMODE_NORMAL;
21402158
}
21412159
} else {
21422160
/* RS232 without hadware handshake */

drivers/tty/serial/fsl_lpuart.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static void lpuart_dma_tx(struct lpuart_port *sport)
328328

329329
sport->dma_tx_bytes = uart_circ_chars_pending(xmit);
330330

331-
if (xmit->tail < xmit->head) {
331+
if (xmit->tail < xmit->head || xmit->head == 0) {
332332
sport->dma_tx_nents = 1;
333333
sg_init_one(sgl, xmit->buf + xmit->tail, sport->dma_tx_bytes);
334334
} else {
@@ -359,7 +359,6 @@ static void lpuart_dma_tx(struct lpuart_port *sport)
359359
sport->dma_tx_in_progress = true;
360360
sport->dma_tx_cookie = dmaengine_submit(sport->dma_tx_desc);
361361
dma_async_issue_pending(sport->dma_tx_chan);
362-
363362
}
364363

365364
static void lpuart_dma_tx_complete(void *arg)

drivers/tty/serial/pch_uart.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ static struct dmi_system_id pch_uart_dmi_table[] = {
419419
},
420420
(void *)MINNOW_UARTCLK,
421421
},
422+
{ }
422423
};
423424

424425
/* Return UART clock, checking for board specific clocks. */

drivers/tty/serial/sc16is7xx.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,9 +1130,13 @@ static int sc16is7xx_gpio_direction_output(struct gpio_chip *chip,
11301130
{
11311131
struct sc16is7xx_port *s = gpiochip_get_data(chip);
11321132
struct uart_port *port = &s->p[0].port;
1133+
u8 state = sc16is7xx_port_read(port, SC16IS7XX_IOSTATE_REG);
11331134

1134-
sc16is7xx_port_update(port, SC16IS7XX_IOSTATE_REG, BIT(offset),
1135-
val ? BIT(offset) : 0);
1135+
if (val)
1136+
state |= BIT(offset);
1137+
else
1138+
state &= ~BIT(offset);
1139+
sc16is7xx_port_write(port, SC16IS7XX_IOSTATE_REG, state);
11361140
sc16is7xx_port_update(port, SC16IS7XX_IODIR_REG, BIT(offset),
11371141
BIT(offset));
11381142

0 commit comments

Comments
 (0)