This patch set fixes and improves hibernation mode for dwc2 core. It adds support for the following cases 1. Hibernation entering/exiting flow by system suspend/resume. 2. Exiting hibernation mode before removing driver and urb enqueue. 3. Exiting hibernation from gpwrdn rst detect. It updates the implementation of dwc2 entering and exiting hibernation mode when a port is suspended or resumed or reset asserted. It fixes hibernation issues between host and device mode when core enters to hibernation in host mode and mode change happens. Also, a fix is introduced for remote wakeup flow. The patch set also improves implementation of entering to hibernation from dwc2_handle_usb_suspend_intr() handler. Changes since V1: Updated bellow patches. Moved duplicated error checking *if* conditions from innermost to outside if. 1. usb: dwc2: Add exit hibernation mode before removing drive 2. usb: dwc2: Allow exit hibernation in urb enqueue Fixed an uninitialized pointer variable which was reported by kernel test robot in "usb: dwc2: Add exit hibernation mode before removing drive" patch. After fixing added Reported-by tags for kernel test robot and Dan Carpenter. Also removed some text from cover letter because I think that is why vger.kernel.org was rejecting it. Artur Petrosyan (15): usb: dwc2: Update exit hibernation when port reset is asserted usb: dwc2: Reset DEVADDR after exiting gadget hibernation. usb: dwc2: Fix host mode hibernation exit with remote wakeup flow. usb: dwc2: Fix hibernation between host and device modes. usb: dwc2: Allow exiting hibernation from gpwrdn rst detect usb: dwc2: Clear fifo_map when resetting core. usb: dwc2: Clear GINTSTS_RESTOREDONE bit after restore is generated. usb: dwc2: Move enter hibernation to dwc2_port_suspend() function usb: dwc2: Move exit hibernation to dwc2_port_resume() function usb: dwc2: Allow exit hibernation in urb enqueue usb: dwc2: Add hibernation entering flow by system suspend usb: dwc2: Add hibernation exiting flow by system resume usb: dwc2: Add exit hibernation mode before removing drive usb: dwc2: Update dwc2_handle_usb_suspend_intr function. usb: dwc2: Get rid of useless error checks in suspend interrupt drivers/usb/dwc2/core.c | 25 ++++- drivers/usb/dwc2/core.h | 3 + drivers/usb/dwc2/core_intr.c | 205 +++++++++++++++++++---------------- drivers/usb/dwc2/gadget.c | 4 + drivers/usb/dwc2/hcd.c | 92 +++++++++++++--- drivers/usb/dwc2/platform.c | 15 +++ 6 files changed, 233 insertions(+), 111 deletions(-) base-commit: 4b853c236c7b5161a2e444bd8b3c76fe5aa5ddcb -- 2.25.1