usb: chipidea: udc: make controller hardware endpoint primed
authorPiyush Mehta <piyush.mehta@xilinx.com>
Mon, 13 Sep 2021 14:00:05 +0000 (19:30 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Oct 2021 13:05:24 +0000 (15:05 +0200)
commit05735f0854e1e2fc0dd266cc6f583fc79dfdd5d8
treeeb906e732a436737a4f69b6922a3203fb09536e6
parent2c52ad743fee10c0815db77a4e47f2416d407123
usb: chipidea: udc: make controller hardware endpoint primed

Root-cause:
There is an issue like endpoint is not recognized as primed, when bus
have more pressure and the add dTD tripwire semaphore (ATDTW bit in
USBCMD register) that can cause the controller to ignore a dTD that is
added to a primed endpoint.
This issue observed with the Windows10 host machine.

Workaround:
The software must implement a periodic cycle, and check for each dTD,
if the endpoint is primed. It can do this by reading the corresponding
bits in the ENDPTPRIME and ENDPTSTAT registers. If these bits are read
at 0, the software needs to re-prime the endpoint by writing 1 to the
corresponding bit in the ENDPTPRIME register.

Added conditional revision check of 2.20[CI_REVISION_22].

Link: https://lore.kernel.org/linux-usb/SJ0PR02MB8644CBBA848A0F68323F1AA5D4D99@SJ0PR02MB8644.namprd02.prod.outlook.com/
Acked-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
Link: https://lore.kernel.org/r/20210913140005.955699-1-piyush.mehta@xilinx.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/udc.c