• John Stultz's avatar
    usb: dwc2: Improve gadget state disconnection handling · d2471d4a
    John Stultz authored
    In the earlier commit dad3f793 ("usb: dwc2: Make sure we
    disconnect the gadget state"), I was trying to fix up the
    fact that we somehow weren't disconnecting the gadget state,
    so that when the OTG port was plugged in the second time we
    would get warnings about the state tracking being wrong.
    
    (This seems to be due to a quirk of the HiKey board where
    we do not ever get any otg interrupts, particularly the session
    end detected signal. Instead we only see status change
    interrupt.)
    
    The fix there was somewhat simple, as it just made sure to
    call dwc2_hsotg_disconnect() before we connected things up
    in OTG mode, ensuring the state handling didn't throw errors.
    
    But in looking at a different issue I was seeing with UDC
    state handling, I realized that it would be much better
    to call dwc2_hsotg_disconnect when we get the state change
    signal moving to host mode.
    
    Thus, this patch removes the earlier disconnect call I added
    and moves it (and the needed locking) to the host mode
    transition.
    
    Cc: Wei Xu <xuwei5@hisilicon.com>
    Cc: Guodong Xu <guodong.xu@linaro.org>
    Cc: Amit Pundir <amit.pundir@linaro.org>
    Cc: YongQin Liu <yongqin.liu@linaro.org>
    Cc: John Youn <johnyoun@synopsys.com>
    Cc: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
    Cc: Douglas Anderson <dianders@chromium.org>
    Cc: Chen Yu <chenyu56@huawei.com>
    Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: linux-usb@vger.kernel.org
    Acked-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
    Tested-by: default avatarMinas Harutyunyan <hminas@synopsys.com>
    Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
    Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
    d2471d4a
hcd.c 152 KB