]> git.baikalelectronics.ru Git - kernel.git/commit
usb: cdns3: fix race condition before setting doorbell
authorPawel Laszczak <pawell@cadence.com>
Thu, 30 Sep 2021 09:42:17 +0000 (11:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Oct 2021 13:42:30 +0000 (15:42 +0200)
commit63173abf2e9d7e6bd977d217e92ae0587f668bfe
treec0cf7572077f84088c620710b9b885ac6c8587df
parent3127751d49d400d45a291869cc0b9f2f441ee53e
usb: cdns3: fix race condition before setting doorbell

commit b69ec50b3e55c4b2a85c8bc46763eaf33060584 upstream

For DEV_VER_V3 version there exist race condition between clearing
ep_sts.EP_STS_TRBERR and setting ep_cmd.EP_CMD_DRDY bit.
Setting EP_CMD_DRDY will be ignored by controller when
EP_STS_TRBERR is set. So, between these two instructions we have
a small time gap in which the EP_STS_TRBERR can be set. In such case
the transfer will not start after setting doorbell.

Fixes: 1eebf7f048fa ("usb: cdns3: Add Cadence USB3 DRD Driver")
cc: <stable@vger.kernel.org> # 5.4.x
Tested-by: Aswath Govindraju <a-govindraju@ti.com>
Reviewed-by: Aswath Govindraju <a-govindraju@ti.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/cdns3/gadget.c