• Ran Wang's avatar
    usb: dwc3: Add workaround for host mode VBUS glitch when boot · 2d2a3349
    Ran Wang authored
    When DWC3 is set to host mode by programming register DWC3_GCTL, VBUS
    (or its control signal) will be turned on immediately on related Root Hub
    ports. Then, the VBUS is turned off for a little while(15us) when do xhci
    reset (conducted by xhci driver) and back to normal finally, we can
    observe a negative glitch of related signal happen.
    
    This VBUS glitch might cause some USB devices enumeration fail if kernel
    boot with them connected. Such as LS1012AFWRY/LS1043ARDB/LX2160AQDS
    /LS1088ARDB with Kingston 16GB USB2.0/Kingston USB3.0/JetFlash Transcend
    4GB USB2.0 drives. The fail cases include enumerated as full-speed device
    or report wrong device descriptor, etc.
    
    One SW workaround which can fix this is by programing all xhci PORTSC[PP]
    to 0 to turn off VBUS immediately after setting host mode in DWC3 driver
    (per signal measurement result, it will be too late to do it in
    xhci-plat.c or xhci.c). Then, after xhci reset complete in xhci driver,
    PORTSC[PP]s' value will back to 1 automatically and VBUS on at that time,
    no glitch happen and normal enumeration process has no impact.
    Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
    Signed-off-by: default avatarRan Wang <ran.wang_1@nxp.com>
    Reviewed-by: default avatarPeter Chen <peter.chen@nxp.com>
    Signed-off-by: default avatarFrank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20240124152525.3910311-4-Frank.Li@nxp.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    2d2a3349
host.c 4.34 KB