usb: dwc2: Force mode optimizations
PATCH v2 2/49 usb: dwc2: Force mode optimizations
Quoted 24 lines · Grigor Tovmasyan
From: Vardan Mikayelyan <[email protected]>
If the
dr_modeisUSB_DR_MODE_OTG, forcing the mode is needed during driver probe to get the host and device specific HW parameters. Then we clear the force mode bits so that the core operates in OTG mode.The force mode bits should not be touched at any other time during the driver lifetime and they should be preserved whenever the GUSBCFG register is written to. The force mode bit values will persist across soft resets of the core.
If the
dr_modeis eitherUSB_DR_MODE_HOSTorUSB_DR_MODE_PERIPHERAL, the force mode is set just once at probe to configure the core as either a host or peripheral.Given the above, we no longer need any other reset delays, force delays, or any forced modes anywhere else in the driver. So replace all calls to
dwc2_core_reset_and_force_dr_mode()withdwc2_core_reset()and remove all other unnecessary delays.Also remove the
dwc2_force_mode_if_needed()function since the "if needed" part is already taken care of by the polling indwc2_force_mode().
Quoted 6 lines
Finally, remove all other calls to
dwc2_clear_force_mode().Tested-by Stefan Wahren <[email protected]>Signed-off-by John Youn <[email protected]>Signed-off-by Vardan Mikayelyan <[email protected]>Signed-off-by Grigor Tovmasyan <[email protected]>
Only patch #1 applied to testing/next.
checking file drivers/usb/dwc2/core.c
checking file drivers/usb/dwc2/core.h
Hunk #1 succeeded at 1106 (offset 6 lines).
checking file drivers/usb/dwc2/hcd.c
Hunk #3 succeeded at 2261 (offset 5 lines).
checking file drivers/usb/dwc2/params.c
Hunk #1 succeeded at 579 (offset -1 lines).
Hunk #2 FAILED at 603.
1 out of 2 hunks FAILED
checking file drivers/usb/dwc2/platform.c
Hunk #1 succeeded at 425 (offset 10 lines).
please rebase