Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 3f883d7d authored by Hemant Kumar's avatar Hemant Kumar
Browse files

usb: gadget: f_gsi: Enable/Disable eps in workqueue context



For sequence of events : set_alt(1) -> bus suspend ->bus
reset->re-enumeration. Bus suspend handler queues EVT_SUSPEND
event. Between bus suspend and bus reset ipa_work_handler
runs in STATE_CONNECT_IN_PROGRESS and allocates TRB buffers.
Bus reset interrupt on same core schedules out worker thread
and performs end xfer cmd on all eps. As part of bus reset
gsi function disable queues EVT_DISCONNECT. Upon return from
bus reset handling worker thread schedules in and prepares TRBs
and starts xfer on gsi eps. Since event queue is not empty
worker thread runs again and handles EVT_SUSPEND and EVT_DISCONNECT
in STATE_CONNECT_IN_PROGRESS which calls ipa_disconnect_work_handler().
This unmaps and frees TRBs and buffers without stopping transfers on
gsi eps. Later this is resulting into SMMU page fault because
USB controller attempts to access unmapped stale buffer as gsi ep is
active. Fix this issue by disabling eps in ipa_disconnect_work_handler()
before unmap and free of TRBs and buffers instead of doing that
in gsi_disable(). Move ep config ops to ipa_work_handler() in
STATE_INITIALIZED. Return USB_GADGET_DELAYED_STATUS for data interface
to make sure ep is enabled before starting protocol specific transfers.
Add STATE_HOST_NRDY to handle RNDIS flow control enable/disable with
disconnect. As part of clean up remove unreachable state and event
handling. Also rename some states and events for clarity.

Change-Id: Iba19100fcc10addf3668b91d0a6f36c9e7aee1a8
Signed-off-by: default avatarHemant Kumar <hemantk@codeaurora.org>
parent 7b5291b3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment