summaryrefslogtreecommitdiff
path: root/src/portable/chipidea/ci_hs
AgeCommit message (Collapse)Author
11 daysdcd(ci_hs): stage the device address before priming the status stagehathach
IMXRT1060RM 42.7.23 and UM10503 Table 478 both ask for the DEVICEADDR write with USBADRA=1 to happen after the SET_ADDRESS data phase and before the prime of the status stage, so the controller loads USBADR from its holding register when the status stage is ACKed. The driver did it the other way round, leaving a window between the ENDPTPRIME store and the DEVICEADDR store: an IN answered inside that window ACKs with USBADRA still 0, so the holding register is never consulted and the device keeps answering on address 0 while the host has moved to the new one. Instruction timing alone cannot open that window, but dcd_set_address() runs in task context, so any interrupt landing between the two stores stretches it past a microframe. Hardware discards a staged address on a SETUP or OUT to endpoint 0 and zeroes USBADR on a bus reset, which covers a superseded SET_ADDRESS. What it cannot cover is a SETUP latched before this write and still unconsumed after the full CI_HS_BUSY_SPIN spin, which refuses the prime: condition 2 already fired for that earlier SETUP, so the stage would survive and load USBADR on the next EP0 IN ACK of an unrelated transfer. USB 2.0 9.4.6 is explicit that "the USB device does not change its device address until after the Status stage of this request is completed successfully", so the refused-prime path restores the previous USBADR rather than leaving a stage armed. Restoring the previous value rather than writing zero keeps 9.4.6's Address-state row correct, where a device already at a non-zero address must stay there; on Linux that write is always a no-op, since hub_set_address only issues SET_ADDRESS from USB_STATE_DEFAULT. Cast dev_addr before the shift: it is uint8_t, promoted to int, so an address of 64 or more reached the sign bit of a 32-bit int. No errata applies: IMXRT1060CE_A Rev 1.3 lists only ERR050101 and ERR010661 for USB, IMXRT1060CE_B Rev 1.1 only ERR010661. Validated on mimxrt1064_evk: 18/19 device+host tests, 6x usbtest 30/30, and a 100-iteration forced re-enumeration A/B that is clean on both this change and its parent (0/100 each). All 19 ci_hs boards build; unit tests 63/63; PVS drops one diagnostic (the sign-bit shift) and adds none.
12 daysdcd(ci_hs): rework bus reset handling and bound the register waitshathach
A bus reset was detected only from the port change that ends it, which is late: the manual asks the DCD to clear the endpoint semaphores, cancel every prime and free the dTDs while the reset is still being driven. Enable the reset interrupt and do all of that there, in the manual's order (IMXRT1060RM 42.5.6.2.1, p.2394), including the two steps that were missing - confirming the port is still being reset, and freeing the dTDs. A failed check means the cleanup arrived late and the controller may be in an undefined state, so the manual's remedy is carried out rather than noted: a controller reset, followed by the full re-initialisation it then requires, since the reset detaches the device. The port change that ends the reset is left with what the manual gives it, the negotiated speed, which the new BUS_RESET_END event carries. A port change is classified by the interrupt that preceded it: a suspend raises no port change of its own, the resume that ends it does. Every unbounded register spin is now bounded. They waited on bits the hardware clears within a frame, but each could hang an interrupt handler outright on a controller that had stopped responding. The endpoint flush follows all three steps of IMXRT1060RM 42.5.6.6.5 (p.2413), repeating a flush the controller refuses while a packet is in progress - previously reported as success. EP0 setup handling is hardened alongside: the payload is copied out of the queue head through the volatile qualifier before ENDPTSETUPSTAT is cleared, since that clear releases the setup lockout and a back-to-back setup can overwrite the buffer immediately after, and C orders volatile accesses only against each other, so a plain memcpy may legally be sunk past the store. There is deliberately no unplug detection. IMXRT1060RM 42.7.31 (p.2470) states a zero Current Connect Status means the device "did not attach successfully or was forcibly disconnected by the software writing a zero to the Run bit ... It does not state the device being disconnected or suspended", so a cable pull raises no port change at all; VBUS via OTGSC is the manual's disconnect indicator and is board dependent. Verified on mimxrt1064_evk: 30 forced bus resets each re-enumerating at high speed with no descriptor errors, plus repeated full usbtest batteries at 30/30 across the series.
13 daysportable/chipidea: name SBUSCFG in ci_hs_regs_t, unify AHB burst hookhathach
Replace the duplicated per-MCU dispatch in dcd_init/hcd_init and the two helper flavors (USB_Type access on iMX RT, raw offset 0x90 on LPC18/43) with one SBUSCFG register field plus a per-header CI_HS_SET_AHB_BURST() hook, compiled only where defined. The LPC USB0-only policy is now visible at the macro definition.
2026-07-27portable/chipidea: configure i.MX RT AHB burstsZixun LI
2026-07-27portable/chipidea: configure LPC USB0 AHB burstsZixun LI
2026-07-14dcd(ci_hs): stale overlay fix; run usbtest on lpcxpresso43s67hathach
- dcd_edpt_stall flushes the primed buffer (ENDPTFLUSH), but the aborted transfer's dQH overlay can be left ACTIVE with mid-transfer state; the next prime after clear-halt then resumes the stale overlay instead of loading the fresh qtd, so post-halt IN reads return mid-buffer data (usbtest case 13 'buf[32] = 56 (not 0)', with case 18 failing downstream of the same corruption in the full battery). qhd_start_xfer now clears overlay.active alongside overlay.halted before linking the new qtd. - test/hil(hfp): drop lpcxpresso43s67's device/usbtest skip - the historical first-case wedge no longer reproduces on this branch, and with the overlay fix the board runs 30/30 on its Fresco xHCI host (previously 28/30 with deterministic case 13/18 failures). mimxrt1064_evk (imxrt dcache path) 30/30 regression-clean. - docs(hil skill): document the external hifiphile rig - pool test/hil/hfp.json, SSH-reachable from htpc/ci with no outbound SSH, exercised by the CI hil-tinyusb (hfp.json) job; never run HIL against it during development unless the user explicitly asks. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_017TQZrFfU3K4Y198aLsUpBC
2026-07-02license: use SPDX identifiers for src/ headers (#3749)Ha Thach
* license: use SPDX identifiers for src/ headers Replace the full ~20-line MIT license boilerplate on every src/ file with a two-line SPDX tag (SPDX-FileCopyrightText + SPDX-License-Identifier), following the REUSE convention used by CircuitPython and the Linux kernel. Removes ~3500 lines of duplicated boilerplate.
2026-03-07Fix ep_ctrl_mask() corrupting opposite direction's ENDPTCTRL bitsgab-k
2026-03-06Merge pull request #3528 from hathach/improve-iar-warningsHa Thach
Add IAR warning flags to CMake build and resolve warnings
2026-03-06fix warningshathach
2026-03-05update PORTSC1Zixun LI
Signed-off-by: Zixun LI <[email protected]>
2026-03-05ci_hs: add deinit supportZixun LI
Signed-off-by: Zixun LI <[email protected]>
2025-12-16Merge remote-tracking branch 'tinyusb/master' into support-nxp-rw612HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-12-16support hpmicro chipsZhihong Chen
Signed-off-by: Zhihong Chen <[email protected]>
2025-12-14bsp: nxp: add support for RW612 (FRDM-RW612)gab-k
- Added `rw61x` family support. - Added `frdm_rw612` board support. - Update `get_deps.py` to include mcux-sdk for RW61x. - Add ci_hs_rw61x include to ChipIdea HS driver and enable host examples.
2025-12-10hw/mcu: add support for NXP RW612gab-k
2025-11-26change tu_fifo_buffer_info_t layouthathach
2025-11-19Merge remote-tracking branch 'tinyusb/master' into ↵HiFiPhile
copilot/fix-dcd-edpt-xfer-issue Signed-off-by: HiFiPhile <[email protected]>
2025-11-17make TUP_DCD_EDPT_ISO_ALLOC i.e dcd_edpt_iso_alloc()/dcd_edpt_iso_activate() ↵hathach
as default driver implementation. dcd_edpt_close() is deprecated and will be removed from all driver in the future.
2025-10-22Apply suggestions from code reviewZixun LI
Co-authored-by: Copilot <[email protected]>
2025-10-22Add is_isr parameter to dcd_edpt_xfer and dcd_edpt_xfer_fifocopilot-swe-agent[bot]
Co-authored-by: HiFiPhile <[email protected]>
2025-05-04dcd/ci_hs: add vbus charge option.HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-04-29attach debouncing fixed issue with port1 highspeed on imxrthathach
2025-04-23rename and expose tuh_bus_info_get() to applicationhathach
2024-11-30Fix HCD build.HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2024-11-30Fix typo.HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2024-11-30Restore DCache clean/invalidate.HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2024-11-30Merge branch 'master' into rt1170HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2024-11-25change dcd_dcache_*() API return type from void to boolhathach
2024-11-02Replace cache clean/invalidate by MPU config.HiFiPhile
2024-10-14change dcd_init() return from void to boolhathach
2024-10-14change the tusb_rhport_init_t struct, exclude the rhport to make API more ↵hathach
consistent
2024-10-11hcd_init() take init structhathach
2024-10-11change dcd_init() to take rhport structhathach
2024-05-27chipidea/mimxrt: Add support for dcd_sof_enable().Andrew Leech
2023-08-07Add tuh_rhport_is_active() and tuh_rhport_reset_bus()hathach
- also improve ehci bus reset - seperate bus reset delay and contact debouncing delay in enumeration
2023-08-03add lpc43 familyhathach
2023-07-24Merge pull request #2173 from hathach/imxrt-dcache-alignHa Thach
change dcache clean/invalidate return type to bool
2023-07-24change dcache clean/invalidate return type to boolhathach
add tu_assert() check for aligned 32byte address for imxrt
2023-07-24rename CFG_TUSB_MEM_SECTION to CFG_TUD_MEM_SECTION in device stackhathach
CFG_TUD_MEM_SECTION is default to CFG_TUSB_MEM_SECTION
2023-07-14Fix host buffer alignment settingScott Shawcroft
2023-06-16fix build warningshathach
2023-06-16renam OPT_MCU_MIMXRT to OPT_MCU_MIMXRT1XXXhathach
fix build util with makefile
2023-05-23Enhance chipidea (#2075)Ha Thach
* update chipidea dcd, remove manual ep_count and use DCCPARAMS to get number of endpoint instead * add dcd dcache for chipidea * add cmake for lpc18 * add makefile build for mcx * use fork of mcu sdk * fix ci build with nrf * flash rp2040 with openocd
2023-05-19only clean/invalidate dcache on imxrt if memory is not in DTCMhathach
2023-05-18EHCI adding dcahe support, passing enumertaionhathach
2023-05-17adding hcd_dcache_clean/hcd_dcache_invalidatehathach
2023-05-16usbd: fix control transfer issue for chipidea hs when previous status and ↵hathach
new setup complete in the same isr frame change usbd edpt busy/stalled/claimed value to 0/1 instead of (true/false) since they are 1-bit field.
2023-05-10allow imxrt build with dual exmapleshathach
2023-04-06Handle iMX RT 1042 usb namingScott Shawcroft