• Vardan Mikayelyan's avatar
    usb: dwc2: Force mode optimizations · 13b1f8e2
    Vardan Mikayelyan authored
    If the dr_mode is USB_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_mode is either USB_DR_MODE_HOST or USB_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() with dwc2_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 in
    dwc2_force_mode().
    
    Finally, remove all other calls to dwc2_clear_force_mode().
    Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
    Signed-off-by: default avatarJohn Youn <johnyoun@synopsys.com>
    Signed-off-by: default avatarVardan Mikayelyan <mvardan@synopsys.com>
    Signed-off-by: default avatarGrigor Tovmasyan <tovmasya@synopsys.com>
    Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
    13b1f8e2
core.c 28.9 KB