[PATCH 16/20] usb: xhci: introduce a PCI specific ->reset function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The PCI specific function does the "normal" xhci work plus the PCI
specific quirks. Those need to be done reset as they need to be in the
xhci struct before the usb core calls ->run().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
---
 drivers/usb/host/xhci-pci.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 0036f35..13996a9 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -55,8 +55,10 @@ static void xhci_reinit(struct xhci_hcd *xhci, struct pci_dev *pdev)
 
 static int xhci_pci_plat_reset(struct usb_hcd *hcd)
 {
-	struct platform_device  *plat_dev;
-	struct pci_dev          *pci_dev;
+	struct platform_device		*plat_dev;
+	struct pci_dev			*pci_dev;
+	struct xhci_platform_data	*data;
+	struct xhci_hcd			*xhci;
 	int ret;
 
 	ret = xhci_setup(hcd);
@@ -66,7 +68,12 @@ static int xhci_pci_plat_reset(struct usb_hcd *hcd)
 	if (!usb_hcd_is_primary_hcd(hcd))
 		return 0;
 
+	xhci = hcd_to_xhci(hcd);
 	plat_dev = to_platform_device(hcd->self.controller);
+	data = plat_dev->dev.platform_data;
+	xhci->quirks |= data->quirks;
+	xhci->limit_active_eps = data->limit_active_eps;
+
 	pci_dev = to_pci_dev(plat_dev->dev.parent);
 	/* Find any debug ports */
 	xhci_reinit(hcd_to_xhci(hcd), pci_dev);
@@ -104,13 +111,15 @@ static void xhci_put_unique_id(int id)
 
 static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	struct xhci_platform_data	*data;
+	struct xhci_platform_data	*org_data;
+	struct xhci_platform_data	data;
 	struct platform_device		*xhci_pdev;
 	struct resource			res[2];
 	int				dev_id;
 	int				ret;
 
-	data = (struct xhci_platform_data *) id->driver_data;
+	org_data = (struct xhci_platform_data *) id->driver_data;
+	data = *org_data;
 
 	ret = pci_enable_device(dev);
 	if (ret) {
@@ -122,7 +131,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	if (dev->vendor == PCI_VENDOR_ID_FRESCO_LOGIC &&
 			dev->device == PCI_DEVICE_ID_FRESCO_LOGIC_PDK) {
 		if (dev->revision == 0x0)
-			data->quirks |= XHCI_RESET_EP_QUIRK;
+			data.quirks |= XHCI_RESET_EP_QUIRK;
 	}
 
 	pci_set_power_state(dev, PCI_D0);
@@ -163,7 +172,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	xhci_pdev->dev.dma_parms = dev->dev.dma_parms;
 	xhci_pdev->dev.parent = &dev->dev;
 
-	ret = platform_device_add_data(xhci_pdev, data, sizeof(*data));
+	ret = platform_device_add_data(xhci_pdev, &data, sizeof(data));
 	if (ret) {
 		dev_err(&dev->dev, "failed to add platform data\n");
 		goto err3;
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux