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

File tree

14 files changed

+60
-19
lines changed

14 files changed

+60
-19
lines changed

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

drivers/tty/serial/serial_core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void uart_write_wakeup(struct uart_port *port)
111111
* closed. No cookie for you.
112112
*/
113113
BUG_ON(!state);
114-
tty_wakeup(state->port.tty);
114+
tty_port_tty_wakeup(&state->port);
115115
}
116116

117117
static void uart_stop(struct tty_struct *tty)
@@ -632,7 +632,7 @@ static void uart_flush_buffer(struct tty_struct *tty)
632632
if (port->ops->flush_buffer)
633633
port->ops->flush_buffer(port);
634634
uart_port_unlock(port, flags);
635-
tty_wakeup(tty);
635+
tty_port_tty_wakeup(&state->port);
636636
}
637637

638638
/*
@@ -2746,8 +2746,6 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
27462746
uport->cons = drv->cons;
27472747
uport->minor = drv->tty_driver->minor_start + uport->line;
27482748

2749-
port->console = uart_console(uport);
2750-
27512749
/*
27522750
* If this port is a console, then the spinlock is already
27532751
* initialised.
@@ -2761,6 +2759,8 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport)
27612759

27622760
uart_configure_port(drv, state, uport);
27632761

2762+
port->console = uart_console(uport);
2763+
27642764
num_groups = 2;
27652765
if (uport->attr_group)
27662766
num_groups++;

drivers/tty/serial/stm32-usart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct stm32_usart_info {
3131
struct stm32_usart_config cfg;
3232
};
3333

34-
#define UNDEF_REG ~0
34+
#define UNDEF_REG 0xff
3535

3636
/* Register offsets */
3737
struct stm32_usart_info stm32f4_info = {

drivers/tty/serial/xilinx_uartps.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,7 @@ static int __init cdns_early_console_setup(struct earlycon_device *device,
12001200
OF_EARLYCON_DECLARE(cdns, "xlnx,xuartps", cdns_early_console_setup);
12011201
OF_EARLYCON_DECLARE(cdns, "cdns,uart-r1p8", cdns_early_console_setup);
12021202
OF_EARLYCON_DECLARE(cdns, "cdns,uart-r1p12", cdns_early_console_setup);
1203+
OF_EARLYCON_DECLARE(cdns, "xlnx,zynqmp-uart", cdns_early_console_setup);
12031204

12041205
/**
12051206
* cdns_uart_console_write - perform write operation
@@ -1438,6 +1439,7 @@ static const struct of_device_id cdns_uart_of_match[] = {
14381439
{ .compatible = "xlnx,xuartps", },
14391440
{ .compatible = "cdns,uart-r1p8", },
14401441
{ .compatible = "cdns,uart-r1p12", .data = &zynqmp_uart_def },
1442+
{ .compatible = "xlnx,zynqmp-uart", .data = &zynqmp_uart_def },
14411443
{}
14421444
};
14431445
MODULE_DEVICE_TABLE(of, cdns_uart_of_match);

drivers/tty/vt/vt.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,10 +870,15 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
870870
if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
871871
return 0;
872872

873+
if (new_screen_size > (4 << 20))
874+
return -EINVAL;
873875
newscreen = kmalloc(new_screen_size, GFP_USER);
874876
if (!newscreen)
875877
return -ENOMEM;
876878

879+
if (vc == sel_cons)
880+
clear_selection();
881+
877882
old_rows = vc->vc_rows;
878883
old_row_size = vc->vc_size_row;
879884

@@ -1176,7 +1181,7 @@ static void csi_J(struct vc_data *vc, int vpar)
11761181
break;
11771182
case 3: /* erase scroll-back buffer (and whole display) */
11781183
scr_memsetw(vc->vc_screenbuf, vc->vc_video_erase_char,
1179-
vc->vc_screenbuf_size >> 1);
1184+
vc->vc_screenbuf_size);
11801185
set_origin(vc);
11811186
if (con_is_visible(vc))
11821187
update_screen(vc);

0 commit comments

Comments
 (0)