102-ehci_hcd_ignore_oc.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. From 1e311820ec3055e3f08e687de6564692a7cec675 Mon Sep 17 00:00:00 2001
  2. From: Florian Fainelli <florian@openwrt.org>
  3. Date: Mon, 28 Jan 2013 20:06:29 +0100
  4. Subject: [PATCH 11/12] USB: EHCI: add ignore_oc flag to disable overcurrent
  5. checking
  6. This patch adds an ignore_oc flag which can be set by EHCI controller
  7. not supporting or wanting to disable overcurrent checking. The EHCI
  8. platform data in include/linux/usb/ehci_pdriver.h is also augmented to
  9. take advantage of this new flag.
  10. Signed-off-by: Florian Fainelli <florian@openwrt.org>
  11. ---
  12. drivers/usb/host/ehci-hcd.c | 2 +-
  13. drivers/usb/host/ehci-hub.c | 4 ++--
  14. drivers/usb/host/ehci-platform.c | 1 +
  15. drivers/usb/host/ehci.h | 1 +
  16. include/linux/usb/ehci_pdriver.h | 1 +
  17. 5 files changed, 6 insertions(+), 3 deletions(-)
  18. --- a/drivers/usb/host/ehci-hcd.c
  19. +++ b/drivers/usb/host/ehci-hcd.c
  20. @@ -638,7 +638,7 @@ static int ehci_run (struct usb_hcd *hcd
  21. "USB %x.%x started, EHCI %x.%02x%s\n",
  22. ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
  23. temp >> 8, temp & 0xff,
  24. - ignore_oc ? ", overcurrent ignored" : "");
  25. + (ignore_oc || ehci->ignore_oc) ? ", overcurrent ignored" : "");
  26. ehci_writel(ehci, INTR_MASK,
  27. &ehci->regs->intr_enable); /* Turn On Interrupts */
  28. --- a/drivers/usb/host/ehci-hub.c
  29. +++ b/drivers/usb/host/ehci-hub.c
  30. @@ -633,7 +633,7 @@ ehci_hub_status_data (struct usb_hcd *hc
  31. * always set, seem to clear PORT_OCC and PORT_CSC when writing to
  32. * PORT_POWER; that's surprising, but maybe within-spec.
  33. */
  34. - if (!ignore_oc)
  35. + if (!ignore_oc && !ehci->ignore_oc)
  36. mask = PORT_CSC | PORT_PEC | PORT_OCC;
  37. else
  38. mask = PORT_CSC | PORT_PEC;
  39. @@ -995,7 +995,7 @@ int ehci_hub_control(
  40. if (temp & PORT_PEC)
  41. status |= USB_PORT_STAT_C_ENABLE << 16;
  42. - if ((temp & PORT_OCC) && !ignore_oc){
  43. + if ((temp & PORT_OCC) && (!ignore_oc && !ehci->ignore_oc)){
  44. status |= USB_PORT_STAT_C_OVERCURRENT << 16;
  45. /*
  46. --- a/drivers/usb/host/ehci-platform.c
  47. +++ b/drivers/usb/host/ehci-platform.c
  48. @@ -264,6 +264,8 @@ static int ehci_platform_probe(struct pl
  49. ehci->big_endian_desc = 1;
  50. if (pdata->big_endian_mmio)
  51. ehci->big_endian_mmio = 1;
  52. + if (pdata->ignore_oc)
  53. + ehci->ignore_oc = 1;
  54. #ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
  55. if (ehci->big_endian_mmio) {
  56. --- a/drivers/usb/host/ehci.h
  57. +++ b/drivers/usb/host/ehci.h
  58. @@ -226,6 +226,7 @@ struct ehci_hcd { /* one per controlle
  59. unsigned frame_index_bug:1; /* MosChip (AKA NetMos) */
  60. unsigned need_oc_pp_cycle:1; /* MPC834X port power */
  61. unsigned imx28_write_fix:1; /* For Freescale i.MX28 */
  62. + unsigned ignore_oc:1;
  63. /* required for usb32 quirk */
  64. #define OHCI_CTRL_HCFS (3 << 6)
  65. --- a/include/linux/usb/ehci_pdriver.h
  66. +++ b/include/linux/usb/ehci_pdriver.h
  67. @@ -49,6 +49,7 @@ struct usb_ehci_pdata {
  68. unsigned no_io_watchdog:1;
  69. unsigned reset_on_resume:1;
  70. unsigned dma_mask_64:1;
  71. + unsigned ignore_oc:1;
  72. /* Turn on all power and clocks */
  73. int (*power_on)(struct platform_device *pdev);