summaryrefslogtreecommitdiff
path: root/rust/zerocopy/src/pointer/git@git.tavy.me:linux-stable.git
diff options
context:
space:
mode:
authorXu Yang <xu.yang_2@nxp.com>2026-04-27 15:56:53 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-05-22 11:28:10 +0200
commitdd0c03d685225cb8fc60c477417d1b9c3b05ba9d (patch)
treee27dbc5e7616753393dd2771eba775c91a4f700e /rust/zerocopy/src/pointer/git@git.tavy.me:linux-stable.git
parenta3fe1408e801b3406d2786557bcea8838973c036 (diff)
usb: chipidea: udc: support dynamic gadget add/remove
An asynchronous vbus_event_work() keep running when switch the role from device to host. This affects EHCI host controller initialization. USBCMD.RUNSTOP bit is set at ehci_run() and cleared by following vbus_event_work() if bus_event_work() run after ehci_run(). The log below shows what happens: [ 87.819925] ci_hdrc ci_hdrc.0: EHCI Host Controller [ 87.819963] ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1 [ 87.955634] ci_hdrc ci_hdrc.0: USB 2.0, controller refused to start: -110 [ 87.955658] ci_hdrc ci_hdrc.0: startup error -110 [ 87.955682] ci_hdrc ci_hdrc.0: USB bus 1 deregistered The problem is that the chipidea UDC driver call usb_udc_vbus_handler() to pull down data line but it don't wait for completion before host controller starts running. Now UDC core can properly delete usb gadget device and make sure that vbus work is cancelled or completed after usb_del_gadget_udc() is returned. But the udc.c only call usb_del_gadget_udc() in ci_hdrc_gadget_destroy(). To avoid above issue, add/remove the gadget device dynamically during USB role switching. To support dynamic gadget add/remove, do below steps: - clear ci->gadget and ci->ci_hw_ep at initialization. - assign udc_[start|stop]() to rdrv->[start|stop] and properly merge the operations in udc_id_switch_for_[device|host]() to udc_[start|stop]() Adjust the order ci_handle_vbus_change() and ci_role_start() to avoid NULL pointer reference since ci_hdrc_gadget_init() doesn't add gadget anymore. Acked-by: Peter Chen <peter.chen@kernel.org> Signed-off-by: Xu Yang <xu.yang_2@nxp.com> Link: https://patch.msgid.link/20260427075653.3611180-2-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'rust/zerocopy/src/pointer/git@git.tavy.me:linux-stable.git')
0 files changed, 0 insertions, 0 deletions