Skip to content

Commit 12bbabd

Browse files
andy-shevgregkh
authored andcommitted
usb: cdns3: Synchronise PCI IDs via common data base
There are a few places in the kernel where PCI IDs for different Cadence USB controllers are being used. Besides different naming, they duplicate each other. Make this all in order by providing common definitions via PCI IDs database and use in all users. While doing that, rename definitions as Roger suggested. Suggested-by: Roger Quadros <[email protected]> Suggested-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent ce25e2a commit 12bbabd

File tree

5 files changed

+18
-24
lines changed

5 files changed

+18
-24
lines changed

drivers/usb/cdns3/cdns3-pci-wrap.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ struct cdns3_wrap {
3737
#define PCI_DRIVER_NAME "cdns3-pci-usbss"
3838
#define PLAT_DRIVER_NAME "cdns-usb3"
3939

40-
#define PCI_DEVICE_ID_CDNS_USB3 0x0100
41-
4240
static struct pci_dev *cdns3_get_second_fun(struct pci_dev *pdev)
4341
{
4442
struct pci_dev *func;
@@ -189,7 +187,7 @@ static void cdns3_pci_remove(struct pci_dev *pdev)
189187
}
190188

191189
static const struct pci_device_id cdns3_pci_ids[] = {
192-
{ PCI_VDEVICE(CDNS, PCI_DEVICE_ID_CDNS_USB3) },
190+
{ PCI_VDEVICE(CDNS, PCI_DEVICE_ID_CDNS_USBSS) },
193191
{ 0, }
194192
};
195193

drivers/usb/cdns3/cdnsp-pci.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,17 @@
2828
#define PCI_DRIVER_NAME "cdns-pci-usbssp"
2929
#define PLAT_DRIVER_NAME "cdns-usbssp"
3030

31-
#define PCI_DEVICE_ID_CDNS_USB3 0x0100
32-
#define PCI_DEVICE_ID_CDNS_UDC 0x0200
33-
34-
#define PCI_CLASS_SERIAL_USB_CDNS_USB3 (PCI_CLASS_SERIAL_USB << 8 | 0x80)
35-
#define PCI_CLASS_SERIAL_USB_CDNS_UDC PCI_CLASS_SERIAL_USB_DEVICE
36-
3731
static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev)
3832
{
3933
/*
4034
* Gets the second function.
4135
* Platform has two function. The fist keeps resources for
4236
* Host/Device while the secon keeps resources for DRD/OTG.
4337
*/
44-
if (pdev->device == PCI_DEVICE_ID_CDNS_UDC)
45-
return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USB3, NULL);
46-
if (pdev->device == PCI_DEVICE_ID_CDNS_USB3)
47-
return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_UDC, NULL);
38+
if (pdev->device == PCI_DEVICE_ID_CDNS_USBSSP)
39+
return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USBSS, NULL);
40+
if (pdev->device == PCI_DEVICE_ID_CDNS_USBSS)
41+
return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USBSSP, NULL);
4842

4943
return NULL;
5044
}
@@ -221,12 +215,12 @@ static const struct dev_pm_ops cdnsp_pci_pm_ops = {
221215
};
222216

223217
static const struct pci_device_id cdnsp_pci_ids[] = {
224-
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_UDC),
225-
.class = PCI_CLASS_SERIAL_USB_CDNS_UDC },
226-
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_UDC),
227-
.class = PCI_CLASS_SERIAL_USB_CDNS_USB3 },
228-
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USB3),
229-
.class = PCI_CLASS_SERIAL_USB_CDNS_USB3 },
218+
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSSP),
219+
.class = PCI_CLASS_SERIAL_USB_DEVICE },
220+
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSSP),
221+
.class = PCI_CLASS_SERIAL_USB_CDNS },
222+
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSS),
223+
.class = PCI_CLASS_SERIAL_USB_CDNS },
230224
{ 0, }
231225
};
232226

drivers/usb/gadget/udc/cdns2/cdns2-pci.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "cdns2-gadget.h"
1616

1717
#define PCI_DRIVER_NAME "cdns-pci-usbhs"
18-
#define PCI_DEVICE_ID_CDNS_USB2 0x0120
1918
#define PCI_BAR_DEV 0
2019
#define PCI_DEV_FN_DEVICE 0
2120

@@ -113,7 +112,7 @@ static const struct dev_pm_ops cdns2_pci_pm_ops = {
113112
};
114113

115114
static const struct pci_device_id cdns2_pci_ids[] = {
116-
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USB2),
115+
{ PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USB),
117116
.class = PCI_CLASS_SERIAL_USB_DEVICE },
118117
{ 0, }
119118
};

drivers/usb/host/xhci-pci.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@
8282
#define PCI_DEVICE_ID_ASMEDIA_3042_XHCI 0x3042
8383
#define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242
8484

85-
#define PCI_DEVICE_ID_CDNS_SSP 0x0200
86-
8785
static const char hcd_name[] = "xhci_hcd";
8886

8987
static struct hc_driver __read_mostly xhci_pci_hc_driver;
@@ -475,8 +473,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
475473
if (pdev->device == 0x9203)
476474
xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH;
477475
}
476+
478477
if (pdev->vendor == PCI_VENDOR_ID_CDNS &&
479-
pdev->device == PCI_DEVICE_ID_CDNS_SSP)
478+
pdev->device == PCI_DEVICE_ID_CDNS_USBSSP)
480479
xhci->quirks |= XHCI_CDNS_SCTX_QUIRK;
481480

482481
/* xHC spec requires PCI devices to support D3hot and D3cold */

include/linux/pci_ids.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
#define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310
122122
#define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320
123123
#define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330
124+
#define PCI_CLASS_SERIAL_USB_CDNS 0x0c0380
124125
#define PCI_CLASS_SERIAL_USB_DEVICE 0x0c03fe
125126
#define PCI_CLASS_SERIAL_FIBER 0x0c04
126127
#define PCI_CLASS_SERIAL_SMBUS 0x0c05
@@ -2421,6 +2422,9 @@
24212422
#define PCI_VENDOR_ID_QCOM 0x17cb
24222423

24232424
#define PCI_VENDOR_ID_CDNS 0x17cd
2425+
#define PCI_DEVICE_ID_CDNS_USBSS 0x0100
2426+
#define PCI_DEVICE_ID_CDNS_USB 0x0120
2427+
#define PCI_DEVICE_ID_CDNS_USBSSP 0x0200
24242428

24252429
#define PCI_VENDOR_ID_ARECA 0x17d3
24262430
#define PCI_DEVICE_ID_ARECA_1110 0x1110

0 commit comments

Comments
 (0)