switchtec: Use generic PCI Vendor ID and Class Code
authorDoug Meyer <dmeyer@gigaio.com>
Wed, 23 May 2018 20:18:05 +0000 (13:18 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Sat, 30 Jun 2018 01:16:44 +0000 (20:16 -0500)
Move the Microsemi Switchtec PCI Vendor ID (same as
PCI_VENDOR_ID_PMC_Sierra) to pci_ids.h.   Also, replace Microsemi class
constants with the standard PCI definitions.

Signed-off-by: Doug Meyer <dmeyer@gigaio.com>
[bhelgaas: restore SPDX (I assume it was removed by mistake), remove
device ID definitions]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
drivers/ntb/hw/mscc/ntb_hw_switchtec.c
drivers/pci/switch/switchtec.c
include/linux/pci_ids.h
include/linux/switchtec.h

index f624ae27eabeea8036c43f421b831685b607e127..5ee5f40b4dfc3fba0ca2c3c8ddf824f4cd5b0f05 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/kthread.h>
 #include <linux/interrupt.h>
 #include <linux/ntb.h>
+#include <linux/pci.h>
 
 MODULE_DESCRIPTION("Microsemi Switchtec(tm) NTB Driver");
 MODULE_VERSION("0.1");
@@ -1487,7 +1488,7 @@ static int switchtec_ntb_add(struct device *dev,
 
        stdev->sndev = NULL;
 
-       if (stdev->pdev->class != MICROSEMI_NTB_CLASSCODE)
+       if (stdev->pdev->class != (PCI_CLASS_BRIDGE_OTHER << 8))
                return -ENODEV;
 
        sndev = kzalloc_node(sizeof(*sndev), GFP_KERNEL, dev_to_node(dev));
index 47cd0c037433d1e4795a901b2ca3df4f58ee5cb6..9940cc70f38b0c6a92c1f1381c401ea395b36d1a 100644 (file)
@@ -641,7 +641,7 @@ static int ioctl_event_summary(struct switchtec_dev *stdev,
 
        for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) {
                reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id);
-               if (reg != MICROSEMI_VENDOR_ID)
+               if (reg != PCI_VENDOR_ID_MICROSEMI)
                        break;
 
                reg = ioread32(&stdev->mmio_pff_csr[i].pff_event_summary);
@@ -1203,7 +1203,7 @@ static void init_pff(struct switchtec_dev *stdev)
 
        for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) {
                reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id);
-               if (reg != MICROSEMI_VENDOR_ID)
+               if (reg != PCI_VENDOR_ID_MICROSEMI)
                        break;
        }
 
@@ -1267,7 +1267,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
        struct switchtec_dev *stdev;
        int rc;
 
-       if (pdev->class == MICROSEMI_NTB_CLASSCODE)
+       if (pdev->class == (PCI_CLASS_BRIDGE_OTHER << 8))
                request_module_nowait("ntb_hw_switchtec");
 
        stdev = stdev_create(pdev);
@@ -1321,19 +1321,19 @@ static void switchtec_pci_remove(struct pci_dev *pdev)
 
 #define SWITCHTEC_PCI_DEVICE(device_id) \
        { \
-               .vendor     = MICROSEMI_VENDOR_ID, \
+               .vendor     = PCI_VENDOR_ID_MICROSEMI, \
                .device     = device_id, \
                .subvendor  = PCI_ANY_ID, \
                .subdevice  = PCI_ANY_ID, \
-               .class      = MICROSEMI_MGMT_CLASSCODE, \
+               .class      = (PCI_CLASS_MEMORY_OTHER << 8), \
                .class_mask = 0xFFFFFFFF, \
        }, \
        { \
-               .vendor     = MICROSEMI_VENDOR_ID, \
+               .vendor     = PCI_VENDOR_ID_MICROSEMI, \
                .device     = device_id, \
                .subvendor  = PCI_ANY_ID, \
                .subdevice  = PCI_ANY_ID, \
-               .class      = MICROSEMI_NTB_CLASSCODE, \
+               .class      = (PCI_CLASS_BRIDGE_OTHER << 8), \
                .class_mask = 0xFFFFFFFF, \
        }
 
index 29502238e5107345e824d97222eddd46e68cd5b5..80aec5b9a6c1015938375cca0244807d189edc19 100644 (file)
 #define PCI_DEVICE_ID_COMPEX_ENET100VG4        0x0112
 
 #define PCI_VENDOR_ID_PMC_Sierra       0x11f8
+#define PCI_VENDOR_ID_MICROSEMI                0x11f8
 
 #define PCI_VENDOR_ID_RP               0x11fe
 #define PCI_DEVICE_ID_RP32INTF         0x0001
index ec93e93371fa35f2bf78f79e97a603cd2e2c710b..ab400af6f0ce369ce073b7c75d05fbd64e355cef 100644 (file)
 #include <linux/pci.h>
 #include <linux/cdev.h>
 
-#define MICROSEMI_VENDOR_ID         0x11f8
-#define MICROSEMI_NTB_CLASSCODE     0x068000
-#define MICROSEMI_MGMT_CLASSCODE    0x058000
-
 #define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024
 #define SWITCHTEC_MAX_PFF_CSR 48