110-ehci_hcd_ignore_oc.patch 2.8 KB

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