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

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 <rogerq@kernel.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20241112160125.2340972-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
12bbabd3 ce25e2a8

+18 -24
+1 -3
drivers/usb/cdns3/cdns3-pci-wrap.c
··· 37 37 #define PCI_DRIVER_NAME "cdns3-pci-usbss" 38 38 #define PLAT_DRIVER_NAME "cdns-usb3" 39 39 40 - #define PCI_DEVICE_ID_CDNS_USB3 0x0100 41 - 42 40 static struct pci_dev *cdns3_get_second_fun(struct pci_dev *pdev) 43 41 { 44 42 struct pci_dev *func; ··· 187 189 } 188 190 189 191 static const struct pci_device_id cdns3_pci_ids[] = { 190 - { PCI_VDEVICE(CDNS, PCI_DEVICE_ID_CDNS_USB3) }, 192 + { PCI_VDEVICE(CDNS, PCI_DEVICE_ID_CDNS_USBSS) }, 191 193 { 0, } 192 194 }; 193 195
+10 -16
drivers/usb/cdns3/cdnsp-pci.c
··· 28 28 #define PCI_DRIVER_NAME "cdns-pci-usbssp" 29 29 #define PLAT_DRIVER_NAME "cdns-usbssp" 30 30 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 - 37 31 static struct pci_dev *cdnsp_get_second_fun(struct pci_dev *pdev) 38 32 { 39 33 /* ··· 35 41 * Platform has two function. The fist keeps resources for 36 42 * Host/Device while the secon keeps resources for DRD/OTG. 37 43 */ 38 - if (pdev->device == PCI_DEVICE_ID_CDNS_UDC) 39 - return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USB3, NULL); 40 - if (pdev->device == PCI_DEVICE_ID_CDNS_USB3) 41 - return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_UDC, NULL); 44 + if (pdev->device == PCI_DEVICE_ID_CDNS_USBSSP) 45 + return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USBSS, NULL); 46 + if (pdev->device == PCI_DEVICE_ID_CDNS_USBSS) 47 + return pci_get_device(pdev->vendor, PCI_DEVICE_ID_CDNS_USBSSP, NULL); 42 48 43 49 return NULL; 44 50 } ··· 215 221 }; 216 222 217 223 static const struct pci_device_id cdnsp_pci_ids[] = { 218 - { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_UDC), 219 - .class = PCI_CLASS_SERIAL_USB_CDNS_UDC }, 220 - { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_UDC), 221 - .class = PCI_CLASS_SERIAL_USB_CDNS_USB3 }, 222 - { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USB3), 223 - .class = PCI_CLASS_SERIAL_USB_CDNS_USB3 }, 224 + { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSSP), 225 + .class = PCI_CLASS_SERIAL_USB_DEVICE }, 226 + { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSSP), 227 + .class = PCI_CLASS_SERIAL_USB_CDNS }, 228 + { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USBSS), 229 + .class = PCI_CLASS_SERIAL_USB_CDNS }, 224 230 { 0, } 225 231 }; 226 232
+1 -2
drivers/usb/gadget/udc/cdns2/cdns2-pci.c
··· 15 15 #include "cdns2-gadget.h" 16 16 17 17 #define PCI_DRIVER_NAME "cdns-pci-usbhs" 18 - #define PCI_DEVICE_ID_CDNS_USB2 0x0120 19 18 #define PCI_BAR_DEV 0 20 19 #define PCI_DEV_FN_DEVICE 0 21 20 ··· 112 113 }; 113 114 114 115 static const struct pci_device_id cdns2_pci_ids[] = { 115 - { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USB2), 116 + { PCI_DEVICE(PCI_VENDOR_ID_CDNS, PCI_DEVICE_ID_CDNS_USB), 116 117 .class = PCI_CLASS_SERIAL_USB_DEVICE }, 117 118 { 0, } 118 119 };
+2 -3
drivers/usb/host/xhci-pci.c
··· 82 82 #define PCI_DEVICE_ID_ASMEDIA_3042_XHCI 0x3042 83 83 #define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242 84 84 85 - #define PCI_DEVICE_ID_CDNS_SSP 0x0200 86 - 87 85 static const char hcd_name[] = "xhci_hcd"; 88 86 89 87 static struct hc_driver __read_mostly xhci_pci_hc_driver; ··· 473 475 if (pdev->device == 0x9203) 474 476 xhci->quirks |= XHCI_ZHAOXIN_TRB_FETCH; 475 477 } 478 + 476 479 if (pdev->vendor == PCI_VENDOR_ID_CDNS && 477 - pdev->device == PCI_DEVICE_ID_CDNS_SSP) 480 + pdev->device == PCI_DEVICE_ID_CDNS_USBSSP) 478 481 xhci->quirks |= XHCI_CDNS_SCTX_QUIRK; 479 482 480 483 /* xHC spec requires PCI devices to support D3hot and D3cold */
+4
include/linux/pci_ids.h
··· 121 121 #define PCI_CLASS_SERIAL_USB_OHCI 0x0c0310 122 122 #define PCI_CLASS_SERIAL_USB_EHCI 0x0c0320 123 123 #define PCI_CLASS_SERIAL_USB_XHCI 0x0c0330 124 + #define PCI_CLASS_SERIAL_USB_CDNS 0x0c0380 124 125 #define PCI_CLASS_SERIAL_USB_DEVICE 0x0c03fe 125 126 #define PCI_CLASS_SERIAL_FIBER 0x0c04 126 127 #define PCI_CLASS_SERIAL_SMBUS 0x0c05 ··· 2422 2421 #define PCI_VENDOR_ID_QCOM 0x17cb 2423 2422 2424 2423 #define PCI_VENDOR_ID_CDNS 0x17cd 2424 + #define PCI_DEVICE_ID_CDNS_USBSS 0x0100 2425 + #define PCI_DEVICE_ID_CDNS_USB 0x0120 2426 + #define PCI_DEVICE_ID_CDNS_USBSSP 0x0200 2425 2427 2426 2428 #define PCI_VENDOR_ID_ARECA 0x17d3 2427 2429 #define PCI_DEVICE_ID_ARECA_1110 0x1110