tty/8250 Add support for Commtech's Fastcom Async-335 and Fastcom Async-PCIe cards
authorMatt Schulte <matts@commtech-fastcom.com>
Wed, 21 Nov 2012 16:35:15 +0000 (10:35 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Nov 2012 00:31:17 +0000 (16:31 -0800)
Add support for Commtech's Fastcom Async-335 and Fastcom Async-PCIe cards

Signed-off-by: Matt Schulte <matts@commtech-fastcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_pci.c
include/linux/pci_ids.h

index 089fd43e378416ceccd7de42632378afa74b27d3..a795bd971eaa8efe532e4810fba02f18ef3027d2 100644 (file)
@@ -1201,6 +1201,55 @@ pci_xr17v35x_setup(struct serial_private *priv,
        return pci_default_setup(priv, board, port, idx);
 }
 
+#define PCI_DEVICE_ID_COMMTECH_4222PCI335 0x0004
+#define PCI_DEVICE_ID_COMMTECH_4224PCI335 0x0002
+#define PCI_DEVICE_ID_COMMTECH_2324PCI335 0x000a
+#define PCI_DEVICE_ID_COMMTECH_2328PCI335 0x000b
+
+static int
+pci_fastcom335_setup(struct serial_private *priv,
+                 const struct pciserial_board *board,
+                 struct uart_8250_port *port, int idx)
+{
+       u8 __iomem *p;
+
+       p = pci_ioremap_bar(priv->dev, 0);
+       if (p == NULL)
+               return -ENOMEM;
+
+       port->port.flags |= UPF_EXAR_EFR;
+
+       /*
+        * Setup Multipurpose Input/Output pins.
+        */
+       if (idx == 0) {
+               switch (priv->dev->device) {
+               case PCI_DEVICE_ID_COMMTECH_4222PCI335:
+               case PCI_DEVICE_ID_COMMTECH_4224PCI335:
+                       writeb(0x78, p + 0x90); /* MPIOLVL[7:0] */
+                       writeb(0x00, p + 0x92); /* MPIOINV[7:0] */
+                       writeb(0x00, p + 0x93); /* MPIOSEL[7:0] */
+                       break;
+               case PCI_DEVICE_ID_COMMTECH_2324PCI335:
+               case PCI_DEVICE_ID_COMMTECH_2328PCI335:
+                       writeb(0x00, p + 0x90); /* MPIOLVL[7:0] */
+                       writeb(0xc0, p + 0x92); /* MPIOINV[7:0] */
+                       writeb(0xc0, p + 0x93); /* MPIOSEL[7:0] */
+                       break;
+               }
+               writeb(0x00, p + 0x8f); /* MPIOINT[7:0] */
+               writeb(0x00, p + 0x91); /* MPIO3T[7:0] */
+               writeb(0x00, p + 0x94); /* MPIOOD[7:0] */
+       }
+       writeb(0x00, p + UART_EXAR_8XMODE);
+       writeb(UART_FCTR_EXAR_TRGD, p + UART_EXAR_FCTR);
+       writeb(32, p + UART_EXAR_TXTRG);
+       writeb(32, p + UART_EXAR_RXTRG);
+       iounmap(p);
+
+       return pci_default_setup(priv, board, port, idx);
+}
+
 static int
 pci_wch_ch353_setup(struct serial_private *priv,
                     const struct pciserial_board *board,
@@ -1250,6 +1299,10 @@ pci_wch_ch353_setup(struct serial_private *priv,
 #define PCI_VENDOR_ID_AGESTAR          0x5372
 #define PCI_DEVICE_ID_AGESTAR_9375     0x6872
 #define PCI_VENDOR_ID_ASIX             0x9710
+#define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0019
+#define PCI_DEVICE_ID_COMMTECH_4224PCIE        0x0020
+#define PCI_DEVICE_ID_COMMTECH_4228PCIE        0x0021
+
 
 /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584        0x1584
@@ -1845,6 +1898,59 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
                .subdevice      = PCI_ANY_ID,
                .setup          = pci_asix_setup,
        },
+       /*
+        * Commtech, Inc. Fastcom adapters
+        *
+        */
+       {
+               .vendor = PCI_VENDOR_ID_COMMTECH,
+               .device = PCI_DEVICE_ID_COMMTECH_4222PCI335,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = pci_fastcom335_setup,
+       },
+       {
+               .vendor = PCI_VENDOR_ID_COMMTECH,
+               .device = PCI_DEVICE_ID_COMMTECH_4224PCI335,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = pci_fastcom335_setup,
+       },
+       {
+               .vendor = PCI_VENDOR_ID_COMMTECH,
+               .device = PCI_DEVICE_ID_COMMTECH_2324PCI335,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = pci_fastcom335_setup,
+       },
+       {
+               .vendor = PCI_VENDOR_ID_COMMTECH,
+               .device = PCI_DEVICE_ID_COMMTECH_2328PCI335,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = pci_fastcom335_setup,
+       },
+       {
+               .vendor = PCI_VENDOR_ID_COMMTECH,
+               .device = PCI_DEVICE_ID_COMMTECH_4222PCIE,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = pci_xr17v35x_setup,
+       },
+       {
+               .vendor = PCI_VENDOR_ID_COMMTECH,
+               .device = PCI_DEVICE_ID_COMMTECH_4224PCIE,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = pci_xr17v35x_setup,
+       },
+       {
+               .vendor = PCI_VENDOR_ID_COMMTECH,
+               .device = PCI_DEVICE_ID_COMMTECH_4228PCIE,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = pci_xr17v35x_setup,
+       },
        /*
         * Default "match everything" terminator entry
         */
@@ -1921,6 +2027,10 @@ enum pci_board_num_t {
 
        pbn_b0_4_1152000,
 
+       pbn_b0_2_1152000_200,
+       pbn_b0_4_1152000_200,
+       pbn_b0_8_1152000_200,
+
        pbn_b0_2_1843200,
        pbn_b0_4_1843200,
 
@@ -2118,6 +2228,27 @@ static struct pciserial_board pci_boards[] = {
                .uart_offset    = 8,
        },
 
+       [pbn_b0_2_1152000_200] = {
+               .flags          = FL_BASE0,
+               .num_ports      = 2,
+               .base_baud      = 1152000,
+               .uart_offset    = 0x200,
+       },
+
+       [pbn_b0_4_1152000_200] = {
+               .flags          = FL_BASE0,
+               .num_ports      = 4,
+               .base_baud      = 1152000,
+               .uart_offset    = 0x200,
+       },
+
+       [pbn_b0_8_1152000_200] = {
+               .flags          = FL_BASE0,
+               .num_ports      = 2,
+               .base_baud      = 1152000,
+               .uart_offset    = 0x200,
+       },
+
        [pbn_b0_2_1843200] = {
                .flags          = FL_BASE0,
                .num_ports      = 2,
@@ -4356,6 +4487,38 @@ static struct pci_device_id serial_pci_tbl[] = {
                PCI_ANY_ID, PCI_ANY_ID,
                0, 0, pbn_b0_bt_2_115200 },
 
+       /*
+        * Commtech, Inc. Fastcom adapters
+        */
+       {       PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4222PCI335,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0,
+               0, pbn_b0_2_1152000_200 },
+       {       PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4224PCI335,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0,
+               0, pbn_b0_4_1152000_200 },
+       {       PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_2324PCI335,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0,
+               0, pbn_b0_4_1152000_200 },
+       {       PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_2328PCI335,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0,
+               0, pbn_b0_8_1152000_200 },
+       {       PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4222PCIE,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0,
+               0, pbn_exar_XR17V352 },
+       {       PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4224PCIE,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0,
+               0, pbn_exar_XR17V354 },
+       {       PCI_VENDOR_ID_COMMTECH, PCI_DEVICE_ID_COMMTECH_4228PCIE,
+               PCI_ANY_ID, PCI_ANY_ID,
+               0,
+               0, pbn_exar_XR17V358 },
+
        /*
         * These entries match devices with class COMMUNICATION_SERIAL,
         * COMMUNICATION_MODEM or COMMUNICATION_MULTISERIAL
index 0199a7a76fcb5cf5115e5969cc9acc56e8c0bb83..0f8447376ddbf1dc7177924438076645d34e2671 100644 (file)
 
 #define PCI_VENDOR_ID_TOPSPIN          0x1867
 
+#define PCI_VENDOR_ID_COMMTECH         0x18f7
+
 #define PCI_VENDOR_ID_SILAN            0x1904
 
 #define PCI_VENDOR_ID_RENESAS          0x1912