Commit e60d06435abf1607227a1ee09e1e8dfe5ad58d3a

Authored by George Cherian
Committed by Sekhar Nori
1 parent 22f2e3d2b2

usb: dwc3: core: Add dwc3_drd_helper function

This helper function, facilitates to re-initialize the event buffers.
It re-initilizes the event buffers while switching role from
HOST to DEVICE mode.

The DWC3 IP shares internal RAM for both HOST and Device specific registers.
So while switching roles from HOST to Device modes, it's required to
re-initialize the EVENT buffer registers for the Device mode to continue
work properly. dwc3_event_buffers_setup() is exported out from core.c via
wrapper dwc3_core_gadget_helper() which will be invoked from dwc3 otg driver.

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>

Showing 2 changed files with 6 additions and 0 deletions Side-by-side Diff

drivers/usb/dwc3/core.c
... ... @@ -254,6 +254,11 @@
254 254 }
255 255 }
256 256  
  257 +int dwc3_core_gadget_helper(struct dwc3 *dwc)
  258 +{
  259 + return dwc3_event_buffers_setup(dwc);
  260 +}
  261 +
257 262 static int dwc3_alloc_scratch_buffers(struct dwc3 *dwc)
258 263 {
259 264 if (!dwc->has_hibernation)
drivers/usb/dwc3/core.h
... ... @@ -912,6 +912,7 @@
912 912 /* prototypes */
913 913 void dwc3_set_mode(struct dwc3 *dwc, u32 mode);
914 914 int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc);
  915 +int dwc3_core_gadget_helper(struct dwc3 *dwc);
915 916  
916 917 #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
917 918 int dwc3_host_init(struct dwc3 *dwc);