190-usb-xhci-plat-fix-adding-usb3-lpm-capable-quirk.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 1420e53fc88673683f8990aa5342e7b2640ce165 Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <hauke@hauke-m.de>
  3. Date: Sun, 18 Oct 2015 19:13:27 +0200
  4. Subject: [PATCH v3 1/6] usb: xhci: plat: fix adding usb3-lpm-capable quirk
  5. The xhci->quirks member is overwritten in xhci_gen_setup() with the
  6. quirks given through the module load parameter. Without this patch the
  7. usb3-lpm-capable quirk will be over written before it gets used. This
  8. patch moves the quirks code to the xhci_plat_quirks() callback function
  9. which gets called directly after the quirks member variable is
  10. overwritten with the module load parameter.
  11. I do not have any hardware which is using usb3-lpm-capabls so I can not
  12. test this on real hardware.
  13. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  14. ---
  15. drivers/usb/host/xhci-plat.c | 14 ++++++++------
  16. 1 file changed, 8 insertions(+), 6 deletions(-)
  17. --- a/drivers/usb/host/xhci-plat.c
  18. +++ b/drivers/usb/host/xhci-plat.c
  19. @@ -28,12 +28,20 @@ static struct hc_driver __read_mostly xh
  20. static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
  21. {
  22. + struct platform_device *pdev = to_platform_device(dev);
  23. + struct device_node *node = pdev->dev.of_node;
  24. + struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev);
  25. +
  26. /*
  27. * As of now platform drivers don't provide MSI support so we ensure
  28. * here that the generic code does not try to make a pci_dev from our
  29. * dev struct in order to setup MSI
  30. */
  31. xhci->quirks |= XHCI_PLAT;
  32. +
  33. + if ((node && of_property_read_bool(node, "usb3-lpm-capable")) ||
  34. + (pdata && pdata->usb3_lpm_capable))
  35. + xhci->quirks |= XHCI_LPM_SUPPORT;
  36. }
  37. /* called during probe() after chip reset completes */
  38. @@ -65,8 +73,6 @@ static int xhci_plat_start(struct usb_hc
  39. static int xhci_plat_probe(struct platform_device *pdev)
  40. {
  41. - struct device_node *node = pdev->dev.of_node;
  42. - struct usb_xhci_pdata *pdata = dev_get_platdata(&pdev->dev);
  43. const struct hc_driver *driver;
  44. struct xhci_hcd *xhci;
  45. struct resource *res;
  46. @@ -144,9 +150,6 @@ static int xhci_plat_probe(struct platfo
  47. goto dealloc_usb2_hcd;
  48. }
  49. - if ((node && of_property_read_bool(node, "usb3-lpm-capable")) ||
  50. - (pdata && pdata->usb3_lpm_capable))
  51. - xhci->quirks |= XHCI_LPM_SUPPORT;
  52. /*
  53. * Set the xHCI pointer before xhci_plat_setup() (aka hcd_driver.reset)
  54. * is called by usb_add_hcd().