linux-stable/drivers/usb/chipidea
Peter Chen 2590118de9 usb: chipidea: udc: don't do hardware access if gadget has stopped
commit cbe85c88ce upstream.

After _gadget_stop_activity is executed, we can consider the hardware
operation for gadget has finished, and the udc can be stopped and enter
low power mode. So, any later hardware operations (from usb_ep_ops APIs
or usb_gadget_ops APIs) should be considered invalid, any deinitializatons
has been covered at _gadget_stop_activity.

I meet this problem when I plug out usb cable from PC using mass_storage
gadget, my callstack like: vbus interrupt->.vbus_session->
composite_disconnect ->pm_runtime_put_sync(&_gadget->dev),
the composite_disconnect will call fsg_disable, but fsg_disable calls
usb_ep_disable using async way, there are register accesses for
usb_ep_disable. So sometimes, I get system hang due to visit register
without clock, sometimes not.

The Linux Kernel USB maintainer Alan Stern suggests this kinds of solution.
See: http://marc.info/?l=linux-usb&m=138541769810983&w=2.

Cc: <stable@vger.kernel.org> #v4.9+
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Link: https://lore.kernel.org/r/20190820020503.27080-2-peter.chen@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-06 10:20:56 +02:00
..
bits.h
ci.h
ci_hdrc_imx.c
ci_hdrc_imx.h
ci_hdrc_msm.c
ci_hdrc_pci.c
ci_hdrc_tegra.c
ci_hdrc_usb2.c
ci_hdrc_zevio.c
core.c usb: chipidea: Grab the (legacy) USB PHY by phandle first 2019-04-05 22:31:29 +02:00
debug.c
host.c
host.h
Kconfig
Makefile
otg.c
otg.h
otg_fsm.c
otg_fsm.h
udc.c usb: chipidea: udc: don't do hardware access if gadget has stopped 2019-09-06 10:20:56 +02:00
udc.h
ulpi.c
usbmisc_imx.c