]> git.hungrycats.org Git - linux/commit
usb: dwc3: Fix ep0 handling when getting reset while doing control transfer
authorMayank Rana <quic_mrana@quicinc.com>
Wed, 4 May 2022 19:36:41 +0000 (12:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:55:11 +0000 (08:55 +0100)
commit1ea8a2a532e96c6d1680a86932a52d1268815958
tree7f46bb99f3ae0f96d4bbd73eec91db8b00f22245
parent12c0a0804ade441f9e9cb46c3b6fe7884f9228e7
usb: dwc3: Fix ep0 handling when getting reset while doing control transfer

[ Upstream commit 9d778f0c5f95ca5aa2ff628ea281978697e8d89b ]

According to the databook ep0 should be in setup phase during reset.
If host issues reset between control transfers, ep0 will be  in an
invalid state. Fix this by issuing stall and restart on ep0 if it
is not in setup phase.

Also SW needs to complete pending control transfer and setup core for
next setup stage as per data book. Hence check ep0 state during reset
interrupt handling and make sure active transfers on ep0 out/in
endpoint are stopped by queuing ENDXFER command for that endpoint and
restart ep0 out again to receive next setup packet.

Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
Link: https://lore.kernel.org/r/1651693001-29891-1-git-send-email-quic_mrana@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 730e12fbec53 ("usb: dwc3: gadget: Handle EP0 request dequeuing properly")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c
drivers/usb/dwc3/gadget.h