Skip to content

Commit a66d21d

Browse files
vinodkoulgregkh
authored andcommitted
usb: xhci: Add support for Renesas controller with memory
Some rensas controller like uPD720201 and uPD720202 need firmware to be loaded. Add these devices in table and invoke renesas firmware loader functions to check and load the firmware into device memory when required. Signed-off-by: Vinod Koul <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8bd5741 commit a66d21d

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

drivers/usb/host/xhci-pci.c

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "xhci.h"
1717
#include "xhci-trace.h"
18+
#include "xhci-pci.h"
1819

1920
#define SSIC_PORT_NUM 2
2021
#define SSIC_PORT_CFG2 0x880c
@@ -87,7 +88,16 @@ static int xhci_pci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev)
8788

8889
static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
8990
{
90-
struct pci_dev *pdev = to_pci_dev(dev);
91+
struct pci_dev *pdev = to_pci_dev(dev);
92+
struct xhci_driver_data *driver_data;
93+
const struct pci_device_id *id;
94+
95+
id = pci_match_id(pdev->driver->id_table, pdev);
96+
97+
if (id && id->driver_data) {
98+
driver_data = (struct xhci_driver_data *)id->driver_data;
99+
xhci->quirks |= driver_data->quirks;
100+
}
91101

92102
/* Look for vendor-specific quirks */
93103
if (pdev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
@@ -328,6 +338,14 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
328338
int retval;
329339
struct xhci_hcd *xhci;
330340
struct usb_hcd *hcd;
341+
struct xhci_driver_data *driver_data;
342+
343+
driver_data = (struct xhci_driver_data *)id->driver_data;
344+
if (driver_data && driver_data->quirks & XHCI_RENESAS_FW_QUIRK) {
345+
retval = renesas_xhci_check_request_fw(dev, id);
346+
if (retval)
347+
return retval;
348+
}
331349

332350
/* Prevent runtime suspending between USB-2 and USB-3 initialization */
333351
pm_runtime_get_noresume(&dev->dev);
@@ -389,6 +407,9 @@ static void xhci_pci_remove(struct pci_dev *dev)
389407
struct xhci_hcd *xhci;
390408

391409
xhci = hcd_to_xhci(pci_get_drvdata(dev));
410+
if (xhci->quirks & XHCI_RENESAS_FW_QUIRK)
411+
renesas_xhci_pci_exit(dev);
412+
392413
xhci->xhc_state |= XHCI_STATE_REMOVING;
393414

394415
if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW)
@@ -540,14 +561,26 @@ static void xhci_pci_shutdown(struct usb_hcd *hcd)
540561

541562
/*-------------------------------------------------------------------------*/
542563

564+
static const struct xhci_driver_data reneses_data = {
565+
.quirks = XHCI_RENESAS_FW_QUIRK,
566+
.firmware = "renesas_usb_fw.mem",
567+
};
568+
543569
/* PCI driver selection metadata; PCI hotplugging uses this */
544570
static const struct pci_device_id pci_ids[] = {
571+
{ PCI_DEVICE(0x1912, 0x0014),
572+
.driver_data = (unsigned long)&reneses_data,
573+
},
574+
{ PCI_DEVICE(0x1912, 0x0015),
575+
.driver_data = (unsigned long)&reneses_data,
576+
},
545577
/* handle any USB 3.0 xHCI controller */
546578
{ PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_XHCI, ~0),
547579
},
548580
{ /* end: all zeroes */ }
549581
};
550582
MODULE_DEVICE_TABLE(pci, pci_ids);
583+
MODULE_FIRMWARE("renesas_usb_fw.mem");
551584

552585
/* pci driver glue; this is a "new style" PCI driver module */
553586
static struct pci_driver xhci_pci_driver = {

drivers/usb/host/xhci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,6 +1873,7 @@ struct xhci_hcd {
18731873
#define XHCI_DEFAULT_PM_RUNTIME_ALLOW BIT_ULL(33)
18741874
#define XHCI_RESET_PLL_ON_DISCONNECT BIT_ULL(34)
18751875
#define XHCI_SNPS_BROKEN_SUSPEND BIT_ULL(35)
1876+
#define XHCI_RENESAS_FW_QUIRK BIT_ULL(36)
18761877

18771878
unsigned int num_active_eps;
18781879
unsigned int limit_active_eps;

0 commit comments

Comments
 (0)