]> git.itanic.dy.fi Git - linux-stable/commit
usb: dwc3: gadget: Fix START_TRANSFER link state check
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Tue, 20 Apr 2021 02:11:12 +0000 (19:11 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 May 2021 12:47:39 +0000 (14:47 +0200)
commitb624b32584ac44f4f7e0c53878b22da7cea6f2e4
treef0ee2ccd8848e7d6b86d86f36fd99bc2f313ba12
parentf9ddfaa9703c5c0efff8b828bb45a0612d5bf466
usb: dwc3: gadget: Fix START_TRANSFER link state check

commit c560e76319a94a3b9285bc426c609903408e4826 upstream.

The START_TRANSFER command needs to be executed while in ON/U0 link
state (with an exception during register initialization). Don't use
dwc->link_state to check this since the driver only tracks the link
state when the link state change interrupt is enabled. Check the link
state from DSTS register instead.

Note that often the host already brings the device out of low power
before it sends/requests the next transfer. So, the user won't see any
issue when the device starts transfer then. This issue is more
noticeable in cases when the device delays starting transfer, which can
happen during delayed control status after the host put the device in
low power.

Fixes: 799e9dc82968 ("usb: dwc3: gadget: conditionally disable Link State change events")
Cc: <stable@vger.kernel.org>
Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/bcefaa9ecbc3e1936858c0baa14de6612960e909.1618884221.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c