[cherryusb][ehci] Fix missing SETUP buffer cache clean

Backport cherry-embedded/CherryUSB@41f5796:
https://github.com/cherry-embedded/CherryUSB/commit/41f57964cc442145099250f0190eb71e9d1d9d5a

The fix is already merged in CherryUSB upstream but is not included in
the v1.6.1 copy integrated in RT-Thread.  The EHCI port cleans qTD/QH
descriptors and the transfer buffer for DMA, but not the SETUP packet,
so on a non-coherent platform the controller can read a stale packet and
a device may never enumerate.

Apply the upstream change: clean the SETUP buffer in ehci_qh_add_head()
before the QH is linked into the asynchronous or periodic list.
This commit is contained in:
boa-z authored and Rbb666 committed 2026-11-09 10:30:27 +08:00
1 parent cc533832d3
commit bd6c9fbfc9
1 file changed
+4
@@ -137,6 +137,10 @@ static inline void ehci_qh_add_head(struct ehci_qh_hw *head, struct ehci_qh_hw *
n->hw.hlp = head->hw.hlp;
usb_ehci_qh_qtd_flush(n);
if (n->urb->setup) {
usb_dcache_clean((uintptr_t)n->urb->setup, USB_ALIGN_UP(8, CONFIG_USB_ALIGN_SIZE));
}
usb_dcache_flush((uintptr_t)n->urb->transfer_buffer, USB_ALIGN_UP(n->urb->transfer_buffer_length, CONFIG_USB_ALIGN_SIZE));
head->hw.hlp = QH_HLP_QH(n);