]> www.infradead.org Git - users/jedix/linux-maple.git/commit
usb: chipidea: udc: improve dTD link logic
authorXu Yang <xu.yang_2@nxp.com>
Thu, 26 Sep 2024 02:29:05 +0000 (10:29 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 13:14:09 +0000 (15:14 +0200)
commitb8c7f7e1884e701df977a315519739c98488345c
tree4f1c0e8e923f196d1aab00737b8d5c76747c7bae
parent548f48b66c0c5d4b9795a55f304b7298cde2a025
usb: chipidea: udc: improve dTD link logic

Currently, ATDTW semaphore is used to safety link new dTD to dQH. But this
code has a bug when the endpoint is already in error before polling ATDTW
or just met error during polling ATDTW. In that cases, ATDTW will never
turn to 1 and the cpu will busy loop there.

When the endpoint met error, ENDPTSTAT will be cleared by HW. Therefore,
ENDPTSTAT should also be considered during this process. In case of
endpoint error, the current dTD should not be pushed to the head of dQH
since some dTDs may be still not executed. Therefore, the link logic is
also improved accordingly.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Acked-by: Peter Chen <peter.chen@kernel.org>
Link: https://lore.kernel.org/r/20240926022906.473319-2-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/udc.c