Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 3e33448

Browse files
committed
Merge tag 'tty-6.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty / serial / console fixes from Greg KH: "Here are a bunch of fixes/reverts for 6.10-rc6. Include in here are: - revert the bunch of tty/serial/console changes that landed in -rc1 that didn't quite work properly yet. Everyone agreed to just revert them for now and will work on making them better for a future release instead of trying to quick fix the existing changes this late in the release cycle - 8250 driver port count bugfix - Other tiny serial port bugfixes for reported issues All of these have been in linux-next this week with no reported issues" * tag 'tty-6.10-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: Revert "printk: Save console options for add_preferred_console_match()" Revert "printk: Don't try to parse DEVNAME:0.0 console options" Revert "printk: Flag register_console() if console is set on command line" Revert "serial: core: Add support for DEVNAME:0.0 style naming for kernel console" Revert "serial: core: Handle serial console options" Revert "serial: 8250: Add preferred console in serial8250_isa_init_ports()" Revert "Documentation: kernel-parameters: Add DEVNAME:0.0 format for serial ports" Revert "serial: 8250: Fix add preferred console for serial8250_isa_init_ports()" Revert "serial: core: Fix ifdef for serial base console functions" serial: bcm63xx-uart: fix tx after conversion to uart_port_tx_limited() serial: core: introduce uart_port_tx_limited_flags() Revert "serial: core: only stop transmit when HW fifo is empty" serial: imx: set receiver level before starting uart tty: mcf: MCF54418 has 10 UARTS serial: 8250_omap: Implementation of Errata i2310 tty: serial: 8250: Fix port count mismatch with the device
2 parents 2c01c3d + cc8d5a2 commit 3e33448

File tree

16 files changed

+65
-374
lines changed

16 files changed

+65
-374
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -788,25 +788,6 @@
788788
Documentation/networking/netconsole.rst for an
789789
alternative.
790790

791-
<DEVNAME>:<n>.<n>[,options]
792-
Use the specified serial port on the serial core bus.
793-
The addressing uses DEVNAME of the physical serial port
794-
device, followed by the serial core controller instance,
795-
and the serial port instance. The options are the same
796-
as documented for the ttyS addressing above.
797-
798-
The mapping of the serial ports to the tty instances
799-
can be viewed with:
800-
801-
$ ls -d /sys/bus/serial-base/devices/*:*.*/tty/*
802-
/sys/bus/serial-base/devices/00:04:0.0/tty/ttyS0
803-
804-
In the above example, the console can be addressed with
805-
console=00:04:0.0. Note that a console addressed this
806-
way will only get added when the related device driver
807-
is ready. The use of an earlycon parameter in addition to
808-
the console may be desired for console output early on.
809-
810791
uart[8250],io,<addr>[,options]
811792
uart[8250],mmio,<addr>[,options]
812793
uart[8250],mmio16,<addr>[,options]

drivers/tty/serial/8250/8250_core.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
#include <linux/acpi.h>
18-
#include <linux/cleanup.h>
1918
#include <linux/module.h>
2019
#include <linux/moduleparam.h>
2120
#include <linux/ioport.h>
@@ -42,8 +41,6 @@
4241

4342
#include <asm/irq.h>
4443

45-
#include "../serial_base.h" /* For serial_base_add_isa_preferred_console() */
46-
4744
#include "8250.h"
4845

4946
/*
@@ -563,8 +560,6 @@ static void __init serial8250_isa_init_ports(void)
563560
port->irqflags |= irqflag;
564561
if (serial8250_isa_config != NULL)
565562
serial8250_isa_config(i, &up->port, &up->capabilities);
566-
567-
serial_base_add_isa_preferred_console(serial8250_reg.dev_name, i);
568563
}
569564
}
570565

drivers/tty/serial/8250/8250_omap.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@
115115
/* RX FIFO occupancy indicator */
116116
#define UART_OMAP_RX_LVL 0x19
117117

118+
/* Timeout low and High */
119+
#define UART_OMAP_TO_L 0x26
120+
#define UART_OMAP_TO_H 0x27
121+
118122
/*
119123
* Copy of the genpd flags for the console.
120124
* Only used if console suspend is disabled
@@ -663,13 +667,24 @@ static irqreturn_t omap8250_irq(int irq, void *dev_id)
663667

664668
/*
665669
* On K3 SoCs, it is observed that RX TIMEOUT is signalled after
666-
* FIFO has been drained, in which case a dummy read of RX FIFO
667-
* is required to clear RX TIMEOUT condition.
670+
* FIFO has been drained or erroneously.
671+
* So apply solution of Errata i2310 as mentioned in
672+
* https://www.ti.com/lit/pdf/sprz536
668673
*/
669674
if (priv->habit & UART_RX_TIMEOUT_QUIRK &&
670-
(iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT &&
671-
serial_port_in(port, UART_OMAP_RX_LVL) == 0) {
672-
serial_port_in(port, UART_RX);
675+
(iir & UART_IIR_RX_TIMEOUT) == UART_IIR_RX_TIMEOUT) {
676+
unsigned char efr2, timeout_h, timeout_l;
677+
678+
efr2 = serial_in(up, UART_OMAP_EFR2);
679+
timeout_h = serial_in(up, UART_OMAP_TO_H);
680+
timeout_l = serial_in(up, UART_OMAP_TO_L);
681+
serial_out(up, UART_OMAP_TO_H, 0xFF);
682+
serial_out(up, UART_OMAP_TO_L, 0xFF);
683+
serial_out(up, UART_OMAP_EFR2, UART_OMAP_EFR2_TIMEOUT_BEHAVE);
684+
serial_in(up, UART_IIR);
685+
serial_out(up, UART_OMAP_EFR2, efr2);
686+
serial_out(up, UART_OMAP_TO_H, timeout_h);
687+
serial_out(up, UART_OMAP_TO_L, timeout_l);
673688
}
674689

675690
/* Stop processing interrupts on input overrun */

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,17 @@ enum {
19851985
MOXA_SUPP_RS485 = BIT(2),
19861986
};
19871987

1988+
static unsigned short moxa_get_nports(unsigned short device)
1989+
{
1990+
switch (device) {
1991+
case PCI_DEVICE_ID_MOXA_CP116E_A_A:
1992+
case PCI_DEVICE_ID_MOXA_CP116E_A_B:
1993+
return 8;
1994+
}
1995+
1996+
return FIELD_GET(0x00F0, device);
1997+
}
1998+
19881999
static bool pci_moxa_is_mini_pcie(unsigned short device)
19892000
{
19902001
if (device == PCI_DEVICE_ID_MOXA_CP102N ||
@@ -2038,7 +2049,7 @@ static int pci_moxa_init(struct pci_dev *dev)
20382049
{
20392050
unsigned short device = dev->device;
20402051
resource_size_t iobar_addr = pci_resource_start(dev, 2);
2041-
unsigned int num_ports = (device & 0x00F0) >> 4, i;
2052+
unsigned int i, num_ports = moxa_get_nports(device);
20422053
u8 val, init_mode = MOXA_RS232;
20432054

20442055
if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) {

drivers/tty/serial/bcm63xx_uart.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ static void bcm_uart_do_tx(struct uart_port *port)
308308

309309
val = bcm_uart_readl(port, UART_MCTL_REG);
310310
val = (val & UART_MCTL_TXFIFOFILL_MASK) >> UART_MCTL_TXFIFOFILL_SHIFT;
311-
312-
pending = uart_port_tx_limited(port, ch, port->fifosize - val,
311+
pending = uart_port_tx_limited_flags(port, ch, UART_TX_NOSTOP,
312+
port->fifosize - val,
313313
true,
314314
bcm_uart_writel(port, ch, UART_FIFO_REG),
315315
({}));
@@ -320,6 +320,9 @@ static void bcm_uart_do_tx(struct uart_port *port)
320320
val = bcm_uart_readl(port, UART_IR_REG);
321321
val &= ~UART_TX_INT_MASK;
322322
bcm_uart_writel(port, val, UART_IR_REG);
323+
324+
if (uart_tx_stopped(port))
325+
bcm_uart_stop_tx(port);
323326
}
324327

325328
/*

drivers/tty/serial/imx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1952,8 +1952,10 @@ static int imx_uart_rs485_config(struct uart_port *port, struct ktermios *termio
19521952

19531953
/* Make sure Rx is enabled in case Tx is active with Rx disabled */
19541954
if (!(rs485conf->flags & SER_RS485_ENABLED) ||
1955-
rs485conf->flags & SER_RS485_RX_DURING_TX)
1955+
rs485conf->flags & SER_RS485_RX_DURING_TX) {
1956+
imx_uart_setup_ufcr(sport, TXTL_DEFAULT, RXTL_DEFAULT);
19561957
imx_uart_start_rx(port);
1958+
}
19571959

19581960
return 0;
19591961
}

drivers/tty/serial/mcf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ static const struct uart_ops mcf_uart_ops = {
462462
.verify_port = mcf_verify_port,
463463
};
464464

465-
static struct mcf_uart mcf_ports[4];
465+
static struct mcf_uart mcf_ports[10];
466466

467467
#define MCF_MAXPORTS ARRAY_SIZE(mcf_ports)
468468

drivers/tty/serial/serial_base.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -49,33 +49,3 @@ void serial_ctrl_unregister_port(struct uart_driver *drv, struct uart_port *port
4949

5050
int serial_core_register_port(struct uart_driver *drv, struct uart_port *port);
5151
void serial_core_unregister_port(struct uart_driver *drv, struct uart_port *port);
52-
53-
#ifdef CONFIG_SERIAL_CORE_CONSOLE
54-
55-
int serial_base_add_preferred_console(struct uart_driver *drv,
56-
struct uart_port *port);
57-
58-
#else
59-
60-
static inline
61-
int serial_base_add_preferred_console(struct uart_driver *drv,
62-
struct uart_port *port)
63-
{
64-
return 0;
65-
}
66-
67-
#endif
68-
69-
#ifdef CONFIG_SERIAL_8250_CONSOLE
70-
71-
int serial_base_add_isa_preferred_console(const char *name, int idx);
72-
73-
#else
74-
75-
static inline
76-
int serial_base_add_isa_preferred_console(const char *name, int idx)
77-
{
78-
return 0;
79-
}
80-
81-
#endif

drivers/tty/serial/serial_base_bus.c

Lines changed: 0 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
* The serial core bus manages the serial core controller instances.
99
*/
1010

11-
#include <linux/cleanup.h>
1211
#include <linux/container_of.h>
1312
#include <linux/device.h>
1413
#include <linux/idr.h>
@@ -205,134 +204,6 @@ void serial_base_port_device_remove(struct serial_port_device *port_dev)
205204
put_device(&port_dev->dev);
206205
}
207206

208-
#ifdef CONFIG_SERIAL_CORE_CONSOLE
209-
210-
static int serial_base_add_one_prefcon(const char *match, const char *dev_name,
211-
int port_id)
212-
{
213-
int ret;
214-
215-
ret = add_preferred_console_match(match, dev_name, port_id);
216-
if (ret == -ENOENT)
217-
return 0;
218-
219-
return ret;
220-
}
221-
222-
#ifdef __sparc__
223-
224-
/* Handle Sparc ttya and ttyb options as done in console_setup() */
225-
static int serial_base_add_sparc_console(const char *dev_name, int idx)
226-
{
227-
const char *name;
228-
229-
switch (idx) {
230-
case 0:
231-
name = "ttya";
232-
break;
233-
case 1:
234-
name = "ttyb";
235-
break;
236-
default:
237-
return 0;
238-
}
239-
240-
return serial_base_add_one_prefcon(name, dev_name, idx);
241-
}
242-
243-
#else
244-
245-
static inline int serial_base_add_sparc_console(const char *dev_name, int idx)
246-
{
247-
return 0;
248-
}
249-
250-
#endif
251-
252-
static int serial_base_add_prefcon(const char *name, int idx)
253-
{
254-
const char *char_match __free(kfree) = NULL;
255-
const char *nmbr_match __free(kfree) = NULL;
256-
int ret;
257-
258-
/* Handle ttyS specific options */
259-
if (strstarts(name, "ttyS")) {
260-
/* No name, just a number */
261-
nmbr_match = kasprintf(GFP_KERNEL, "%i", idx);
262-
if (!nmbr_match)
263-
return -ENODEV;
264-
265-
ret = serial_base_add_one_prefcon(nmbr_match, name, idx);
266-
if (ret)
267-
return ret;
268-
269-
/* Sparc ttya and ttyb */
270-
ret = serial_base_add_sparc_console(name, idx);
271-
if (ret)
272-
return ret;
273-
}
274-
275-
/* Handle the traditional character device name style console=ttyS0 */
276-
char_match = kasprintf(GFP_KERNEL, "%s%i", name, idx);
277-
if (!char_match)
278-
return -ENOMEM;
279-
280-
return serial_base_add_one_prefcon(char_match, name, idx);
281-
}
282-
283-
/**
284-
* serial_base_add_preferred_console - Adds a preferred console
285-
* @drv: Serial port device driver
286-
* @port: Serial port instance
287-
*
288-
* Tries to add a preferred console for a serial port if specified in the
289-
* kernel command line. Supports both the traditional character device such
290-
* as console=ttyS0, and a hardware addressing based console=DEVNAME:0.0
291-
* style name.
292-
*
293-
* Translates the kernel command line option using a hardware based addressing
294-
* console=DEVNAME:0.0 to the serial port character device such as ttyS0.
295-
* Cannot be called early for ISA ports, depends on struct device.
296-
*
297-
* Note that duplicates are ignored by add_preferred_console().
298-
*
299-
* Return: 0 on success, negative error code on failure.
300-
*/
301-
int serial_base_add_preferred_console(struct uart_driver *drv,
302-
struct uart_port *port)
303-
{
304-
const char *port_match __free(kfree) = NULL;
305-
int ret;
306-
307-
ret = serial_base_add_prefcon(drv->dev_name, port->line);
308-
if (ret)
309-
return ret;
310-
311-
port_match = kasprintf(GFP_KERNEL, "%s:%i.%i", dev_name(port->dev),
312-
port->ctrl_id, port->port_id);
313-
if (!port_match)
314-
return -ENOMEM;
315-
316-
/* Translate a hardware addressing style console=DEVNAME:0.0 */
317-
return serial_base_add_one_prefcon(port_match, drv->dev_name, port->line);
318-
}
319-
320-
#endif
321-
322-
#ifdef CONFIG_SERIAL_8250_CONSOLE
323-
324-
/*
325-
* Early ISA ports initialize the console before there is no struct device.
326-
* This should be only called from serial8250_isa_init_preferred_console(),
327-
* other callers are likely wrong and should rely on earlycon instead.
328-
*/
329-
int serial_base_add_isa_preferred_console(const char *name, int idx)
330-
{
331-
return serial_base_add_prefcon(name, idx);
332-
}
333-
334-
#endif
335-
336207
static int serial_base_init(void)
337208
{
338209
int ret;

drivers/tty/serial/serial_core.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,10 +3422,6 @@ int serial_core_register_port(struct uart_driver *drv, struct uart_port *port)
34223422
if (ret)
34233423
goto err_unregister_ctrl_dev;
34243424

3425-
ret = serial_base_add_preferred_console(drv, port);
3426-
if (ret)
3427-
goto err_unregister_port_dev;
3428-
34293425
ret = serial_core_add_one_port(drv, port);
34303426
if (ret)
34313427
goto err_unregister_port_dev;

0 commit comments

Comments
 (0)