• Hans de Goede's avatar
    musb: sunxi: Force session end on babble errors in host-mode · 454f83d5
    Hans de Goede authored
    The sunxi musb has a bug where sometimes it will generate a babble
    error on device disconnect instead of a disconnect irq. When this
    happens the musb-controller switches from host mode to device mode
    (it clears MUSB_DEVCTL_SESSION and sets MUSB_DEVCTL_BDEVICE) and
    gets stuck in this state.
    
    Clearing this requires reporting Vbus low for 200 or more ms, but
    on some devices Vbus is simply always high (host-only mode, no Vbus
    control).
    
    This commit adds a sunxi_musb_recover() callback which makes
    sunxi_musb_work call phy_set_mode with the current mode, which
    will force end the current session.
    
    This fixes the musb controller getting stuck in this state on systems
    without Vbus control; and also fixes the need to unplug the usb-b ->
    usb-a cable to get out of this state on systems with Vbus control.
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarBin Liu <b-liu@ti.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    454f83d5
sunxi.c 22.6 KB