Skip to content

Commit c0c6b5c

Browse files
committed
Merge tag 'tty-6.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial driver fixes from Greg KH: "Here are some small tty and serial driver fixes for 6.9-rc5 that resolve a bunch of reported problems. Included in here are: - MAINTAINERS and .mailmap update for Richard Genoud - serial core regression fixes from 6.9-rc1 changes - pci id cleanups - serial core crash fix - stm32 driver fixes - 8250 driver fixes All of these have been in linux-next for a while with no reported problems" * tag 'tty-6.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: serial: stm32: Reset .throttled state in .startup() serial: stm32: Return IRQ_NONE in the ISR if no handling happend serial: core: Fix missing shutdown and startup for serial base port serial: core: Clearing the circular buffer before NULLifying it MAINTAINERS: mailmap: update Richard Genoud's email address serial/pmac_zilog: Remove flawed mitigation for rx irq flood serial: 8250_pci: Remove redundant PCI IDs serial: core: Fix regression when runtime PM is not enabled serial: mxs-auart: add spinlock around changing cts state serial: 8250_dw: Revert: Do not reclock if already at correct rate serial: 8250_lpc18xx: disable clks on error in probe()
2 parents 5fa0ab4 + ea2624b commit c0c6b5c

File tree

12 files changed

+81
-34
lines changed

12 files changed

+81
-34
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ Rémi Denis-Courmont <rdenis@simphalempin.com>
525525
Ricardo Ribalda <ribalda@kernel.org> <ricardo@ribalda.com>
526526
Ricardo Ribalda <ribalda@kernel.org> Ricardo Ribalda Delgado <ribalda@kernel.org>
527527
Ricardo Ribalda <ribalda@kernel.org> <ricardo.ribalda@gmail.com>
528+
Richard Genoud <richard.genoud@bootlin.com> <richard.genoud@gmail.com>
528529
Richard Leitner <richard.leitner@linux.dev> <dev@g0hl1n.net>
529530
Richard Leitner <richard.leitner@linux.dev> <me@g0hl1n.net>
530531
Richard Leitner <richard.leitner@linux.dev> <richard.leitner@skidata.com>

Documentation/devicetree/bindings/serial/atmel,at91-usart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
88
title: Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
99

1010
maintainers:
11-
- Richard Genoud <richard.genoud@gmail.com>
11+
- Richard Genoud <richard.genoud@bootlin.com>
1212

1313
properties:
1414
compatible:

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14356,7 +14356,7 @@ F: drivers/dma/at_xdmac.c
1435614356
F: include/dt-bindings/dma/at91.h
1435714357

1435814358
MICROCHIP AT91 SERIAL DRIVER
14359-
M: Richard Genoud <richard.genoud@gmail.com>
14359+
M: Richard Genoud <richard.genoud@bootlin.com>
1436014360
S: Maintained
1436114361
F: Documentation/devicetree/bindings/serial/atmel,at91-usart.yaml
1436214362
F: drivers/tty/serial/atmel_serial.c

drivers/tty/serial/8250/8250_dw.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,18 +356,18 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios,
356356
long rate;
357357
int ret;
358358

359+
clk_disable_unprepare(d->clk);
359360
rate = clk_round_rate(d->clk, newrate);
360-
if (rate > 0 && p->uartclk != rate) {
361-
clk_disable_unprepare(d->clk);
361+
if (rate > 0) {
362362
/*
363363
* Note that any clock-notifer worker will block in
364364
* serial8250_update_uartclk() until we are done.
365365
*/
366366
ret = clk_set_rate(d->clk, newrate);
367367
if (!ret)
368368
p->uartclk = rate;
369-
clk_prepare_enable(d->clk);
370369
}
370+
clk_prepare_enable(d->clk);
371371

372372
dw8250_do_set_termios(p, termios, old);
373373
}

drivers/tty/serial/8250/8250_lpc18xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static int lpc18xx_serial_probe(struct platform_device *pdev)
151151

152152
ret = uart_read_port_properties(&uart.port);
153153
if (ret)
154-
return ret;
154+
goto dis_uart_clk;
155155

156156
uart.port.iotype = UPIO_MEM32;
157157
uart.port.regshift = 2;

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5010,12 +5010,6 @@ static const struct pci_device_id serial_pci_tbl[] = {
50105010
{ PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B,
50115011
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
50125012
pbn_b0_bt_2_115200 },
5013-
{ PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_A,
5014-
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5015-
pbn_b0_bt_2_115200 },
5016-
{ PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATTRO_B,
5017-
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
5018-
pbn_b0_bt_2_115200 },
50195013
{ PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A,
50205014
PCI_ANY_ID, PCI_ANY_ID, 0, 0,
50215015
pbn_b0_bt_4_460800 },

drivers/tty/serial/mxs-auart.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,11 +1086,13 @@ static void mxs_auart_set_ldisc(struct uart_port *port,
10861086

10871087
static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
10881088
{
1089-
u32 istat;
1089+
u32 istat, stat;
10901090
struct mxs_auart_port *s = context;
10911091
u32 mctrl_temp = s->mctrl_prev;
1092-
u32 stat = mxs_read(s, REG_STAT);
10931092

1093+
uart_port_lock(&s->port);
1094+
1095+
stat = mxs_read(s, REG_STAT);
10941096
istat = mxs_read(s, REG_INTR);
10951097

10961098
/* ack irq */
@@ -1126,6 +1128,8 @@ static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
11261128
istat &= ~AUART_INTR_TXIS;
11271129
}
11281130

1131+
uart_port_unlock(&s->port);
1132+
11291133
return IRQ_HANDLED;
11301134
}
11311135

drivers/tty/serial/pmac_zilog.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ static bool pmz_receive_chars(struct uart_pmac_port *uap)
210210
{
211211
struct tty_port *port;
212212
unsigned char ch, r1, drop, flag;
213-
int loops = 0;
214213

215214
/* Sanity check, make sure the old bug is no longer happening */
216215
if (uap->port.state == NULL) {
@@ -291,24 +290,11 @@ static bool pmz_receive_chars(struct uart_pmac_port *uap)
291290
if (r1 & Rx_OVR)
292291
tty_insert_flip_char(port, 0, TTY_OVERRUN);
293292
next_char:
294-
/* We can get stuck in an infinite loop getting char 0 when the
295-
* line is in a wrong HW state, we break that here.
296-
* When that happens, I disable the receive side of the driver.
297-
* Note that what I've been experiencing is a real irq loop where
298-
* I'm getting flooded regardless of the actual port speed.
299-
* Something strange is going on with the HW
300-
*/
301-
if ((++loops) > 1000)
302-
goto flood;
303293
ch = read_zsreg(uap, R0);
304294
if (!(ch & Rx_CH_AV))
305295
break;
306296
}
307297

308-
return true;
309-
flood:
310-
pmz_interrupt_control(uap, 0);
311-
pmz_error("pmz: rx irq flood !\n");
312298
return true;
313299
}
314300

drivers/tty/serial/serial_base.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct serial_ctrl_device {
2222
struct serial_port_device {
2323
struct device dev;
2424
struct uart_port *port;
25+
unsigned int tx_enabled:1;
2526
};
2627

2728
int serial_base_ctrl_init(void);
@@ -30,6 +31,9 @@ void serial_base_ctrl_exit(void);
3031
int serial_base_port_init(void);
3132
void serial_base_port_exit(void);
3233

34+
void serial_base_port_startup(struct uart_port *port);
35+
void serial_base_port_shutdown(struct uart_port *port);
36+
3337
int serial_base_driver_register(struct device_driver *driver);
3438
void serial_base_driver_unregister(struct device_driver *driver);
3539

drivers/tty/serial/serial_core.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void __uart_start(struct uart_state *state)
156156
* enabled, serial_port_runtime_resume() calls start_tx() again
157157
* after enabling the device.
158158
*/
159-
if (pm_runtime_active(&port_dev->dev))
159+
if (!pm_runtime_enabled(port->dev) || pm_runtime_active(&port_dev->dev))
160160
port->ops->start_tx(port);
161161
pm_runtime_mark_last_busy(&port_dev->dev);
162162
pm_runtime_put_autosuspend(&port_dev->dev);
@@ -323,16 +323,26 @@ static int uart_startup(struct tty_struct *tty, struct uart_state *state,
323323
bool init_hw)
324324
{
325325
struct tty_port *port = &state->port;
326+
struct uart_port *uport;
326327
int retval;
327328

328329
if (tty_port_initialized(port))
329-
return 0;
330+
goto out_base_port_startup;
330331

331332
retval = uart_port_startup(tty, state, init_hw);
332-
if (retval)
333+
if (retval) {
333334
set_bit(TTY_IO_ERROR, &tty->flags);
335+
return retval;
336+
}
334337

335-
return retval;
338+
out_base_port_startup:
339+
uport = uart_port_check(state);
340+
if (!uport)
341+
return -EIO;
342+
343+
serial_base_port_startup(uport);
344+
345+
return 0;
336346
}
337347

338348
/*
@@ -355,6 +365,9 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)
355365
if (tty)
356366
set_bit(TTY_IO_ERROR, &tty->flags);
357367

368+
if (uport)
369+
serial_base_port_shutdown(uport);
370+
358371
if (tty_port_initialized(port)) {
359372
tty_port_set_initialized(port, false);
360373

@@ -1775,6 +1788,7 @@ static void uart_tty_port_shutdown(struct tty_port *port)
17751788
uport->ops->stop_rx(uport);
17761789
uart_port_unlock_irq(uport);
17771790

1791+
serial_base_port_shutdown(uport);
17781792
uart_port_shutdown(port);
17791793

17801794
/*
@@ -1788,6 +1802,7 @@ static void uart_tty_port_shutdown(struct tty_port *port)
17881802
* Free the transmit buffer.
17891803
*/
17901804
uart_port_lock_irq(uport);
1805+
uart_circ_clear(&state->xmit);
17911806
buf = state->xmit.buf;
17921807
state->xmit.buf = NULL;
17931808
uart_port_unlock_irq(uport);

0 commit comments

Comments
 (0)