]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ENGR00289645 usb: chipidea: udc: don't do hardware access if gadget has stopped
authorPeter Chen <peter.chen@freescale.com>
Tue, 26 Nov 2013 05:33:21 +0000 (13:33 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Wed, 20 Aug 2014 08:06:46 +0000 (10:06 +0200)
commit582079abb5be1398535f2aa0f8466c8652a3ec97
tree764b519e04dbf43fdeced7162173e9f995c0ba7a
parent39f113b1e1b7f776dc00b4569c493a20dbafee1a
ENGR00289645 usb: chipidea: udc: don't do hardware access if gadget has stopped

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 g_mass_storage),
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.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
(cherry picked from commit ac760d29366f19eb1a4d4c37899b33019570a447)
drivers/usb/chipidea/udc.c