Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: 8250_pci: Add WCH384_8S 8 port serial device

Add PCI id for WCH384_8S 8 port PCI-E serial card.
because this card has so many ports, you may have
to check these two options before use it:
CONFIG_SERIAL_8250_RUNTIME_UARTS
CONFIG_SERIAL_8250_NR_UARTS

Signed-off-by: Du Huanpeng <u74147@gmail.com>
Link: https://lore.kernel.org/r/1598060848-27807-1-git-send-email-u74147@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Du Huanpeng and committed by
Greg Kroah-Hartman
04b6ff5f c7ac46da

+56
+56
drivers/tty/serial/8250/8250_pci.c
··· 1776 1776 return pci_default_setup(priv, board, port, idx); 1777 1777 } 1778 1778 1779 + 1780 + #define CH384_XINT_ENABLE_REG 0xEB 1781 + #define CH384_XINT_ENABLE_BIT 0x02 1782 + 1783 + static int pci_wch_ch38x_init(struct pci_dev *dev) 1784 + { 1785 + int max_port; 1786 + unsigned long iobase; 1787 + 1788 + 1789 + switch (dev->device) { 1790 + case 0x3853: /* 8 ports */ 1791 + max_port = 8; 1792 + break; 1793 + default: 1794 + return -EINVAL; 1795 + } 1796 + 1797 + iobase = pci_resource_start(dev, 0); 1798 + outb(CH384_XINT_ENABLE_BIT, iobase + CH384_XINT_ENABLE_REG); 1799 + 1800 + return max_port; 1801 + } 1802 + 1803 + static void pci_wch_ch38x_exit(struct pci_dev *dev) 1804 + { 1805 + unsigned long iobase; 1806 + 1807 + iobase = pci_resource_start(dev, 0); 1808 + outb(0x0, iobase + CH384_XINT_ENABLE_REG); 1809 + } 1810 + 1811 + 1779 1812 static int 1780 1813 pci_sunix_setup(struct serial_private *priv, 1781 1814 const struct pciserial_board *board, ··· 1900 1867 #define PCIE_VENDOR_ID_WCH 0x1c00 1901 1868 #define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 1902 1869 #define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470 1870 + #define PCIE_DEVICE_ID_WCH_CH384_8S 0x3853 1903 1871 #define PCIE_DEVICE_ID_WCH_CH382_2S 0x3253 1904 1872 1905 1873 #define PCI_VENDOR_ID_ACCESIO 0x494f ··· 2676 2642 .subdevice = PCI_ANY_ID, 2677 2643 .setup = pci_wch_ch38x_setup, 2678 2644 }, 2645 + /* WCH CH384 8S card (16850 clone) */ 2646 + { 2647 + .vendor = PCIE_VENDOR_ID_WCH, 2648 + .device = PCIE_DEVICE_ID_WCH_CH384_8S, 2649 + .subvendor = PCI_ANY_ID, 2650 + .subdevice = PCI_ANY_ID, 2651 + .init = pci_wch_ch38x_init, 2652 + .exit = pci_wch_ch38x_exit, 2653 + .setup = pci_wch_ch38x_setup, 2654 + }, 2679 2655 /* 2680 2656 * ASIX devices with FIFO bug 2681 2657 */ ··· 2957 2913 pbn_fintek_F81512A, 2958 2914 pbn_wch382_2, 2959 2915 pbn_wch384_4, 2916 + pbn_wch384_8, 2960 2917 pbn_pericom_PI7C9X7951, 2961 2918 pbn_pericom_PI7C9X7952, 2962 2919 pbn_pericom_PI7C9X7954, ··· 3694 3649 .base_baud = 115200, 3695 3650 .uart_offset = 8, 3696 3651 .first_offset = 0xC0, 3652 + }, 3653 + [pbn_wch384_8] = { 3654 + .flags = FL_BASE0, 3655 + .num_ports = 8, 3656 + .base_baud = 115200, 3657 + .uart_offset = 8, 3658 + .first_offset = 0x00, 3697 3659 }, 3698 3660 /* 3699 3661 * Pericom PI7C9X795[1248] Uno/Dual/Quad/Octal UART ··· 5617 5565 { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_4S, 5618 5566 PCI_ANY_ID, PCI_ANY_ID, 5619 5567 0, 0, pbn_wch384_4 }, 5568 + 5569 + { PCIE_VENDOR_ID_WCH, PCIE_DEVICE_ID_WCH_CH384_8S, 5570 + PCI_ANY_ID, PCI_ANY_ID, 5571 + 0, 0, pbn_wch384_8 }, 5620 5572 5621 5573 /* Fintek PCI serial cards */ 5622 5574 { PCI_DEVICE(0x1c29, 0x1104), .driver_data = pbn_fintek_4 },