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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. @@ -38,12 +38,20 @@ static const struct xhci_driver_override
  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. @@ -75,8 +83,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. @@ -155,10 +161,6 @@ static int xhci_plat_probe(struct platfo
  47. goto disable_clk;
  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. if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
  54. xhci->shared_hcd->can_do_streams = 1;