Commit 51639539 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull tty/serial fixes from Greg KH:
 "Here are some small TTY and Serial driver fixes for 5.16-rc4 to
  resolve a number of reported problems.

  They include:

   - liteuart serial driver fixes

   - 8250_pci serial driver fixes for pericom devices

   - 8250 RTS line control fix while in RS-485 mode

   - tegra serial driver fix

   - msm_serial driver fix

   - pl011 serial driver new id

   - fsl_lpuart revert of broken change

   - 8250_bcm7271 serial driver fix

   - MAINTAINERS file update for rpmsg tty driver that came in 5.16-rc1

   - vgacon fix for reported problem

  All of these, except for the 8250_bcm7271 fix have been in linux-next
  with no reported problem. The 8250_bcm7271 fix was added to the tree
  on Friday so no chance to be linux-next yet. But it should be fine as
  the affected developers submitted it"

* tag 'tty-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  serial: 8250_bcm7271: UART errors after resuming from S2
  serial: 8250_pci: rewrite pericom_do_set_divisor()
  serial: 8250_pci: Fix ACCES entries in pci_serial_quirks array
  serial: 8250: Fix RTS modem control while in rs485 mode
  Revert "tty: serial: fsl_lpuart: drop earlycon entry for i.MX8QXP"
  serial: tegra: Change lower tolerance baud rate limit for tegra20 and tegra30
  serial: liteuart: relax compile-test dependencies
  serial: liteuart: fix minor-number leak on probe errors
  serial: liteuart: fix use-after-free and memleak on unbind
  serial: liteuart: Fix NULL pointer dereference in ->remove()
  vgacon: Propagate console boot parameters before calling `vc_resize'
  tty: serial: msm_serial: Deactivate RX DMA for polling support
  serial: pl011: Add ACPI SBSA UART match id
  serial: core: fix transmit-buffer reset and memleak
  MAINTAINERS: Add rpmsg tty driver maintainer
parents 7587a4a5 9cabe26e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -16502,6 +16502,12 @@ T: git git://linuxtv.org/media_tree.git
F:	Documentation/devicetree/bindings/media/allwinner,sun8i-a83t-de2-rotate.yaml
F:	drivers/media/platform/sunxi/sun8i-rotate/
RPMSG TTY DRIVER
M:	Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
L:	linux-remoteproc@vger.kernel.org
S:	Maintained
F:	drivers/tty/rpmsg_tty.c
RTL2830 MEDIA DRIVER
M:	Antti Palosaari <crope@iki.fi>
L:	linux-media@vger.kernel.org
+13 −0
Original line number Diff line number Diff line
@@ -237,6 +237,7 @@ struct brcmuart_priv {
	u32		rx_err;
	u32		rx_timeout;
	u32		rx_abort;
	u32		saved_mctrl;
};

static struct dentry *brcmuart_debugfs_root;
@@ -1133,16 +1134,27 @@ static int brcmuart_remove(struct platform_device *pdev)
static int __maybe_unused brcmuart_suspend(struct device *dev)
{
	struct brcmuart_priv *priv = dev_get_drvdata(dev);
	struct uart_8250_port *up = serial8250_get_port(priv->line);
	struct uart_port *port = &up->port;

	serial8250_suspend_port(priv->line);
	clk_disable_unprepare(priv->baud_mux_clk);

	/*
	 * This will prevent resume from enabling RTS before the
	 *  baud rate has been resored.
	 */
	priv->saved_mctrl = port->mctrl;
	port->mctrl = 0;

	return 0;
}

static int __maybe_unused brcmuart_resume(struct device *dev)
{
	struct brcmuart_priv *priv = dev_get_drvdata(dev);
	struct uart_8250_port *up = serial8250_get_port(priv->line);
	struct uart_port *port = &up->port;
	int ret;

	ret = clk_prepare_enable(priv->baud_mux_clk);
@@ -1165,6 +1177,7 @@ static int __maybe_unused brcmuart_resume(struct device *dev)
		start_rx_dma(serial8250_get_port(priv->line));
	}
	serial8250_resume_port(priv->line);
	port->mctrl = priv->saved_mctrl;
	return 0;
}

+25 −14
Original line number Diff line number Diff line
@@ -1324,29 +1324,33 @@ pericom_do_set_divisor(struct uart_port *port, unsigned int baud,
{
	int scr;
	int lcr;
	int actual_baud;
	int tolerance;

	for (scr = 5 ; scr <= 15 ; scr++) {
		actual_baud = 921600 * 16 / scr;
		tolerance = actual_baud / 50;
	for (scr = 16; scr > 4; scr--) {
		unsigned int maxrate = port->uartclk / scr;
		unsigned int divisor = max(maxrate / baud, 1U);
		int delta = maxrate / divisor - baud;

		if ((baud < actual_baud + tolerance) &&
			(baud > actual_baud - tolerance)) {
		if (baud > maxrate + baud / 50)
			continue;

		if (delta > baud / 50)
			divisor++;

		if (divisor > 0xffff)
			continue;

		/* Update delta due to possible divisor change */
		delta = maxrate / divisor - baud;
		if (abs(delta) < baud / 50) {
			lcr = serial_port_in(port, UART_LCR);
			serial_port_out(port, UART_LCR, lcr | 0x80);

			serial_port_out(port, UART_DLL, 1);
			serial_port_out(port, UART_DLM, 0);
			serial_port_out(port, UART_DLL, divisor & 0xff);
			serial_port_out(port, UART_DLM, divisor >> 8 & 0xff);
			serial_port_out(port, 2, 16 - scr);
			serial_port_out(port, UART_LCR, lcr);
			return;
		} else if (baud > actual_baud) {
			break;
		}
	}
	serial8250_do_set_divisor(port, baud, quot, quot_frac);
}
static int pci_pericom_setup(struct serial_private *priv,
		  const struct pciserial_board *board,
@@ -2291,12 +2295,19 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
		.setup      = pci_pericom_setup_four_at_eight,
	},
	{
		.vendor     = PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S,
		.vendor     = PCI_VENDOR_ID_ACCESIO,
		.device     = PCI_DEVICE_ID_ACCESIO_PCIE_ICM232_4,
		.subvendor  = PCI_ANY_ID,
		.subdevice  = PCI_ANY_ID,
		.setup      = pci_pericom_setup_four_at_eight,
	},
	{
		.vendor     = PCI_VENDOR_ID_ACCESIO,
		.device     = PCI_DEVICE_ID_ACCESIO_PCIE_ICM_4S,
		.subvendor  = PCI_ANY_ID,
		.subdevice  = PCI_ANY_ID,
		.setup      = pci_pericom_setup_four_at_eight,
	},
	{
		.vendor     = PCI_VENDOR_ID_ACCESIO,
		.device     = PCI_DEVICE_ID_ACCESIO_MPCIE_ICM232_4,
+0 −7
Original line number Diff line number Diff line
@@ -2024,13 +2024,6 @@ void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl)
	struct uart_8250_port *up = up_to_u8250p(port);
	unsigned char mcr;

	if (port->rs485.flags & SER_RS485_ENABLED) {
		if (serial8250_in_MCR(up) & UART_MCR_RTS)
			mctrl |= TIOCM_RTS;
		else
			mctrl &= ~TIOCM_RTS;
	}

	mcr = serial8250_TIOCM_to_MCR(mctrl);

	mcr = (mcr & up->mcr_mask) | up->mcr_force | up->mcr;
+1 −1
Original line number Diff line number Diff line
@@ -1533,7 +1533,7 @@ config SERIAL_LITEUART
	tristate "LiteUART serial port support"
	depends on HAS_IOMEM
	depends on OF || COMPILE_TEST
	depends on LITEX
	depends on LITEX || COMPILE_TEST
	select SERIAL_CORE
	help
	  This driver is for the FPGA-based LiteUART serial controller from LiteX
Loading