0014-usb-dwc2-gadget-Add-handler-for-WkupAlert-interrupt.patch 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. From 187c5298a12292eab55e3eb09e70e2b145646bcc Mon Sep 17 00:00:00 2001
  2. From: Grigor Tovmasyan <Grigor.Tovmasyan@synopsys.com>
  3. Date: Wed, 29 Aug 2018 21:02:57 +0400
  4. Subject: [PATCH 14/53] usb: dwc2: gadget: Add handler for WkupAlert interrupt
  5. Added interrupt handler for WkupAlert interrupt.
  6. This interrupt should initiate Remote Wake up.
  7. Acked-by: Minas Harutyunyan <hminas@synopsys.com>
  8. Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
  9. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
  10. ---
  11. drivers/usb/dwc2/gadget.c | 25 +++++++++++++++++++++++++
  12. 1 file changed, 25 insertions(+)
  13. diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
  14. index 24bd9fdabc67..2d6d2c8244de 100644
  15. --- a/drivers/usb/dwc2/gadget.c
  16. +++ b/drivers/usb/dwc2/gadget.c
  17. @@ -246,6 +246,27 @@ int dwc2_hsotg_tx_fifo_total_depth(struct dwc2_hsotg *hsotg)
  18. }
  19. /**
  20. + * dwc2_gadget_wkup_alert_handler - Handler for WKUP_ALERT interrupt
  21. + *
  22. + * @hsotg: Programming view of the DWC_otg controller
  23. + *
  24. + */
  25. +static void dwc2_gadget_wkup_alert_handler(struct dwc2_hsotg *hsotg)
  26. +{
  27. + u32 gintsts2;
  28. + u32 gintmsk2;
  29. +
  30. + gintsts2 = dwc2_readl(hsotg, GINTSTS2);
  31. + gintmsk2 = dwc2_readl(hsotg, GINTMSK2);
  32. +
  33. + if (gintsts2 & GINTSTS2_WKUP_ALERT_INT) {
  34. + dev_dbg(hsotg->dev, "%s: Wkup_Alert_Int\n", __func__);
  35. + dwc2_clear_bit(hsotg, GINTSTS2, GINTSTS2_WKUP_ALERT_INT);
  36. + dwc2_set_bit(hsotg, DCFG, DCTL_RMTWKUPSIG);
  37. + }
  38. +}
  39. +
  40. +/**
  41. * dwc2_hsotg_tx_fifo_average_depth - returns average depth of device mode
  42. * TX FIFOs
  43. *
  44. @@ -3730,6 +3751,10 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
  45. if (gintsts & IRQ_RETRY_MASK && --retry_count > 0)
  46. goto irq_retry;
  47. + /* Check WKUP_ALERT interrupt*/
  48. + if (hsotg->params.service_interval)
  49. + dwc2_gadget_wkup_alert_handler(hsotg);
  50. +
  51. spin_unlock(&hsotg->lock);
  52. return IRQ_HANDLED;
  53. --
  54. 2.11.0