]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "8250: add support for ASIX devices with a FIFO bug"
authorJiaqing Zhao <jiaqing.zhao@linux.intel.com>
Mon, 19 Jun 2023 15:57:44 +0000 (15:57 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2023 09:33:46 +0000 (11:33 +0200)
commit a82d62f708545d22859584e0e0620da8e3759bbc upstream.

This reverts commit eb26dfe8aa7eeb5a5aa0b7574550125f8aa4c3b3.

Commit eb26dfe8aa7e ("8250: add support for ASIX devices with a FIFO
bug") merged on Jul 13, 2012 adds a quirk for PCI_VENDOR_ID_ASIX
(0x9710). But that ID is the same as PCI_VENDOR_ID_NETMOS defined in
1f8b061050c7 ("[PATCH] Netmos parallel/serial/combo support") merged
on Mar 28, 2005. In pci_serial_quirks array, the NetMos entry always
takes precedence over the ASIX entry even since it was initially
merged, code in that commit is always unreachable.

In my tests, adding the FIFO workaround to pci_netmos_init() makes no
difference, and the vendor driver also does not have such workaround.
Given that the code was never used for over a decade, it's safe to
revert it.

Also, the real PCI_VENDOR_ID_ASIX should be 0x125b, which is used on
their newer AX99100 PCIe serial controllers released on 2016. The FIFO
workaround should not be intended for these newer controllers, and it
was never implemented in vendor driver.

Fixes: eb26dfe8aa7e ("8250: add support for ASIX devices with a FIFO bug")
Cc: stable <stable@kernel.org>
Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230619155743.827859-1-jiaqing.zhao@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250.h
drivers/tty/serial/8250/8250_pci.c
drivers/tty/serial/8250/8250_port.c
include/linux/serial_8250.h

index 6e8a54eb98427053c648ea932a0c7e4658065206..5caedf2f19892e1b7cc721297bdce0076d5da7ed 100644 (file)
@@ -89,7 +89,6 @@ struct serial8250_config {
 #define UART_BUG_TXEN  (1 << 1)        /* UART has buggy TX IIR status */
 #define UART_BUG_NOMSR (1 << 2)        /* UART has buggy MSR status bits (Au1x00) */
 #define UART_BUG_THRE  (1 << 3)        /* UART has buggy THRE reassertion */
-#define UART_BUG_PARITY        (1 << 4)        /* UART mishandles parity if FIFO enabled */
 
 
 #ifdef CONFIG_SERIAL_8250_SHARE_IRQ
index e80d7429324473a62f2d06b83ad3173933ea3637..51d3859f8f912c195632ccc1a4b38e129abdd9fc 100644 (file)
@@ -1052,14 +1052,6 @@ static int pci_oxsemi_tornado_init(struct pci_dev *dev)
        return number_uarts;
 }
 
-static int pci_asix_setup(struct serial_private *priv,
-                 const struct pciserial_board *board,
-                 struct uart_8250_port *port, int idx)
-{
-       port->bugs |= UART_BUG_PARITY;
-       return pci_default_setup(priv, board, port, idx);
-}
-
 /* Quatech devices have their own extra interface features */
 
 struct quatech_feature {
@@ -1686,7 +1678,6 @@ pci_wch_ch38x_setup(struct serial_private *priv,
 #define PCI_DEVICE_ID_WCH_CH355_4S     0x7173
 #define PCI_VENDOR_ID_AGESTAR          0x5372
 #define PCI_DEVICE_ID_AGESTAR_9375     0x6872
-#define PCI_VENDOR_ID_ASIX             0x9710
 #define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a
 #define PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800 0x818e
 
@@ -2466,16 +2457,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
                .subdevice      = PCI_ANY_ID,
                .setup          = pci_wch_ch38x_setup,
        },
-       /*
-        * ASIX devices with FIFO bug
-        */
-       {
-               .vendor         = PCI_VENDOR_ID_ASIX,
-               .device         = PCI_ANY_ID,
-               .subvendor      = PCI_ANY_ID,
-               .subdevice      = PCI_ANY_ID,
-               .setup          = pci_asix_setup,
-       },
        /*
         * Broadcom TruManage (NetXtreme)
         */
index 78af258111e580305d81febca852e32fd1f1d257..d3083f19d21369c11abb9794e81d2bca8fcf0182 100644 (file)
@@ -2609,11 +2609,8 @@ static unsigned char serial8250_compute_lcr(struct uart_8250_port *up,
 
        if (c_cflag & CSTOPB)
                cval |= UART_LCR_STOP;
-       if (c_cflag & PARENB) {
+       if (c_cflag & PARENB)
                cval |= UART_LCR_PARITY;
-               if (up->bugs & UART_BUG_PARITY)
-                       up->fifo_bug = true;
-       }
        if (!(c_cflag & PARODD))
                cval |= UART_LCR_EPAR;
 #ifdef CMSPAR
@@ -2702,8 +2699,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
        up->lcr = cval;                                 /* Save computed LCR */
 
        if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) {
-               /* NOTE: If fifo_bug is not set, a user can set RX_trigger. */
-               if ((baud < 2400 && !up->dma) || up->fifo_bug) {
+               if (baud < 2400 && !up->dma) {
                        up->fcr &= ~UART_FCR_TRIGGER_MASK;
                        up->fcr |= UART_FCR_TRIGGER_1;
                }
@@ -3039,8 +3035,7 @@ static int do_set_rxtrig(struct tty_port *port, unsigned char bytes)
        struct uart_8250_port *up = up_to_u8250p(uport);
        int rxtrig;
 
-       if (!(up->capabilities & UART_CAP_FIFO) || uport->fifosize <= 1 ||
-           up->fifo_bug)
+       if (!(up->capabilities & UART_CAP_FIFO) || uport->fifosize <= 1)
                return -EINVAL;
 
        rxtrig = bytes_to_fcr_rxtrig(up, bytes);
index 791a6be0e3949000a196566b507c85be0670ff03..f539d91ffd3acd856864c3195ab4e35aa19d1760 100644 (file)
@@ -99,7 +99,6 @@ struct uart_8250_port {
        struct list_head        list;           /* ports on this IRQ */
        u32                     capabilities;   /* port capabilities */
        unsigned short          bugs;           /* port bugs */
-       bool                    fifo_bug;       /* min RX trigger if enabled */
        unsigned int            tx_loadsz;      /* transmit fifo load size */
        unsigned char           acr;
        unsigned char           fcr;