206-USB-EHCI-allow-limiting-ports-for-ehci-platform.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From 6ac09efa8f0e189ffe7dd7b0889289de56ee44cc Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Sun, 19 Jan 2014 12:18:03 +0100
  4. Subject: [PATCH] USB: EHCI: allow limiting ports for ehci-platform
  5. In the same way as the ohci platform driver allows limiting ports,
  6. enable the same for ehci. This prevents a mismatch in the available
  7. ports between ehci/ohci on USB 2.0 controllers.
  8. This is needed if the USB host controller always reports the maximum
  9. number of ports regardless of the number of available ports (because
  10. one might be set to be usb device).
  11. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  12. ---
  13. drivers/usb/host/ehci-hcd.c | 4 ++++
  14. drivers/usb/host/ehci-platform.c | 2 ++
  15. drivers/usb/host/ehci.h | 1 +
  16. include/linux/usb/ehci_pdriver.h | 1 +
  17. 4 files changed, 8 insertions(+)
  18. --- a/drivers/usb/host/ehci-hcd.c
  19. +++ b/drivers/usb/host/ehci-hcd.c
  20. @@ -666,6 +666,10 @@ int ehci_setup(struct usb_hcd *hcd)
  21. /* cache this readonly data; minimize chip reads */
  22. ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
  23. + if (ehci->num_ports) {
  24. + ehci->hcs_params &= ~0xf; /* bits 3:0, ports on HC */
  25. + ehci->hcs_params |= ehci->num_ports;
  26. + }
  27. ehci->sbrn = HCD_USB2;
  28. --- a/drivers/usb/host/ehci-platform.c
  29. +++ b/drivers/usb/host/ehci-platform.c
  30. @@ -60,6 +60,9 @@ static int ehci_platform_reset(struct us
  31. ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug;
  32. + if (pdata->num_ports && pdata->num_ports <= 15)
  33. + ehci->num_ports = pdata->num_ports;
  34. +
  35. if (pdata->pre_setup) {
  36. retval = pdata->pre_setup(hcd);
  37. if (retval < 0)
  38. --- a/drivers/usb/host/ehci.h
  39. +++ b/drivers/usb/host/ehci.h
  40. @@ -213,6 +213,7 @@ struct ehci_hcd { /* one per controlle
  41. u32 command;
  42. /* SILICON QUIRKS */
  43. + unsigned int num_ports;
  44. unsigned no_selective_suspend:1;
  45. unsigned has_fsl_port_bug:1; /* FreeScale */
  46. unsigned has_fsl_hs_errata:1; /* Freescale HS quirk */
  47. --- a/include/linux/usb/ehci_pdriver.h
  48. +++ b/include/linux/usb/ehci_pdriver.h
  49. @@ -42,6 +42,7 @@ struct usb_hcd;
  50. */
  51. struct usb_ehci_pdata {
  52. int caps_offset;
  53. + unsigned int num_ports;
  54. unsigned has_tt:1;
  55. unsigned has_synopsys_hc_bug:1;
  56. unsigned big_endian_desc:1;