aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Meyer <dmeyer@gigaio.com>2018-05-23 16:18:05 -0400
committerBjorn Helgaas <bhelgaas@google.com>2018-06-29 21:16:44 -0400
commitcfdfc14e7fb8ae77290e9d5afaeecc0a234a3846 (patch)
tree31f4479c396f95dea770e8e3992fdc8abaa65342
parentce397d215ccd07b8ae3f71db689aedb85d56ab40 (diff)
switchtec: Use generic PCI Vendor ID and Class Code
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>
-rw-r--r--drivers/ntb/hw/mscc/ntb_hw_switchtec.c3
-rw-r--r--drivers/pci/switch/switchtec.c14
-rw-r--r--include/linux/pci_ids.h1
-rw-r--r--include/linux/switchtec.h4
4 files changed, 10 insertions, 12 deletions
diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
index f624ae27eabe..5ee5f40b4dfc 100644
--- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
+++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c
@@ -19,6 +19,7 @@
19#include <linux/kthread.h> 19#include <linux/kthread.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/ntb.h> 21#include <linux/ntb.h>
22#include <linux/pci.h>
22 23
23MODULE_DESCRIPTION("Microsemi Switchtec(tm) NTB Driver"); 24MODULE_DESCRIPTION("Microsemi Switchtec(tm) NTB Driver");
24MODULE_VERSION("0.1"); 25MODULE_VERSION("0.1");
@@ -1487,7 +1488,7 @@ static int switchtec_ntb_add(struct device *dev,
1487 1488
1488 stdev->sndev = NULL; 1489 stdev->sndev = NULL;
1489 1490
1490 if (stdev->pdev->class != MICROSEMI_NTB_CLASSCODE) 1491 if (stdev->pdev->class != (PCI_CLASS_BRIDGE_OTHER << 8))
1491 return -ENODEV; 1492 return -ENODEV;
1492 1493
1493 sndev = kzalloc_node(sizeof(*sndev), GFP_KERNEL, dev_to_node(dev)); 1494 sndev = kzalloc_node(sizeof(*sndev), GFP_KERNEL, dev_to_node(dev));
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 47cd0c037433..9940cc70f38b 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -641,7 +641,7 @@ static int ioctl_event_summary(struct switchtec_dev *stdev,
641 641
642 for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) { 642 for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) {
643 reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id); 643 reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id);
644 if (reg != MICROSEMI_VENDOR_ID) 644 if (reg != PCI_VENDOR_ID_MICROSEMI)
645 break; 645 break;
646 646
647 reg = ioread32(&stdev->mmio_pff_csr[i].pff_event_summary); 647 reg = ioread32(&stdev->mmio_pff_csr[i].pff_event_summary);
@@ -1203,7 +1203,7 @@ static void init_pff(struct switchtec_dev *stdev)
1203 1203
1204 for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) { 1204 for (i = 0; i < SWITCHTEC_MAX_PFF_CSR; i++) {
1205 reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id); 1205 reg = ioread16(&stdev->mmio_pff_csr[i].vendor_id);
1206 if (reg != MICROSEMI_VENDOR_ID) 1206 if (reg != PCI_VENDOR_ID_MICROSEMI)
1207 break; 1207 break;
1208 } 1208 }
1209 1209
@@ -1267,7 +1267,7 @@ static int switchtec_pci_probe(struct pci_dev *pdev,
1267 struct switchtec_dev *stdev; 1267 struct switchtec_dev *stdev;
1268 int rc; 1268 int rc;
1269 1269
1270 if (pdev->class == MICROSEMI_NTB_CLASSCODE) 1270 if (pdev->class == (PCI_CLASS_BRIDGE_OTHER << 8))
1271 request_module_nowait("ntb_hw_switchtec"); 1271 request_module_nowait("ntb_hw_switchtec");
1272 1272
1273 stdev = stdev_create(pdev); 1273 stdev = stdev_create(pdev);
@@ -1321,19 +1321,19 @@ static void switchtec_pci_remove(struct pci_dev *pdev)
1321 1321
1322#define SWITCHTEC_PCI_DEVICE(device_id) \ 1322#define SWITCHTEC_PCI_DEVICE(device_id) \
1323 { \ 1323 { \
1324 .vendor = MICROSEMI_VENDOR_ID, \ 1324 .vendor = PCI_VENDOR_ID_MICROSEMI, \
1325 .device = device_id, \ 1325 .device = device_id, \
1326 .subvendor = PCI_ANY_ID, \ 1326 .subvendor = PCI_ANY_ID, \
1327 .subdevice = PCI_ANY_ID, \ 1327 .subdevice = PCI_ANY_ID, \
1328 .class = MICROSEMI_MGMT_CLASSCODE, \ 1328 .class = (PCI_CLASS_MEMORY_OTHER << 8), \
1329 .class_mask = 0xFFFFFFFF, \ 1329 .class_mask = 0xFFFFFFFF, \
1330 }, \ 1330 }, \
1331 { \ 1331 { \
1332 .vendor = MICROSEMI_VENDOR_ID, \ 1332 .vendor = PCI_VENDOR_ID_MICROSEMI, \
1333 .device = device_id, \ 1333 .device = device_id, \
1334 .subvendor = PCI_ANY_ID, \ 1334 .subvendor = PCI_ANY_ID, \
1335 .subdevice = PCI_ANY_ID, \ 1335 .subdevice = PCI_ANY_ID, \
1336 .class = MICROSEMI_NTB_CLASSCODE, \ 1336 .class = (PCI_CLASS_BRIDGE_OTHER << 8), \
1337 .class_mask = 0xFFFFFFFF, \ 1337 .class_mask = 0xFFFFFFFF, \
1338 } 1338 }
1339 1339
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 29502238e510..80aec5b9a6c1 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1668,6 +1668,7 @@
1668#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112 1668#define PCI_DEVICE_ID_COMPEX_ENET100VG4 0x0112
1669 1669
1670#define PCI_VENDOR_ID_PMC_Sierra 0x11f8 1670#define PCI_VENDOR_ID_PMC_Sierra 0x11f8
1671#define PCI_VENDOR_ID_MICROSEMI 0x11f8
1671 1672
1672#define PCI_VENDOR_ID_RP 0x11fe 1673#define PCI_VENDOR_ID_RP 0x11fe
1673#define PCI_DEVICE_ID_RP32INTF 0x0001 1674#define PCI_DEVICE_ID_RP32INTF 0x0001
diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h
index ec93e93371fa..ab400af6f0ce 100644
--- a/include/linux/switchtec.h
+++ b/include/linux/switchtec.h
@@ -19,10 +19,6 @@
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/cdev.h> 20#include <linux/cdev.h>
21 21
22#define MICROSEMI_VENDOR_ID 0x11f8
23#define MICROSEMI_NTB_CLASSCODE 0x068000
24#define MICROSEMI_MGMT_CLASSCODE 0x058000
25
26#define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024 22#define SWITCHTEC_MRPC_PAYLOAD_SIZE 1024
27#define SWITCHTEC_MAX_PFF_CSR 48 23#define SWITCHTEC_MAX_PFF_CSR 48
28 24