• Thinh Nguyen's avatar
    usb: dwc3: core: Prevent phy suspend during init · 6d735722
    Thinh Nguyen authored
    GUSB3PIPECTL.SUSPENDENABLE and GUSB2PHYCFG.SUSPHY should be cleared
    during initialization. Suspend during initialization can result in
    undefined behavior due to clock synchronization failure, which often
    seen as core soft reset timeout.
    
    The programming guide recommended these bits to be cleared during
    initialization for DWC_usb3.0 version 1.94 and above (along with
    DWC_usb31 and DWC_usb32). The current check in the driver does not
    account if it's set by default setting from coreConsultant.
    
    This is especially the case for DRD when switching mode to ensure the
    phy clocks are available to change mode. Depending on the
    platforms/design, some may be affected more than others. This is noted
    in the DWC_usb3x programming guide under the above registers.
    
    Let's just disable them during driver load and mode switching. Restore
    them when the controller initialization completes.
    
    Note that some platforms workaround this issue by disabling phy suspend
    through "snps,dis_u3_susphy_quirk" and "snps,dis_u2_susphy_quirk" when
    they should not need to.
    
    Cc: stable@vger.kernel.org
    Fixes: 9ba3aca8 ("usb: dwc3: Disable phy suspend after power-on reset")
    Signed-off-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
    Link: https://lore.kernel.org/r/20da4e5a0c4678c9587d3da23f83bdd6d77353e9.1713394973.git.Thinh.Nguyen@synopsys.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    6d735722
host.c 5.27 KB