fix(dwc2_hcd): correct HFIR for Low-Speed devices via internal FS PHY

When a Low-Speed device is connected through the internal FS PHY,
the effective PHY clock is 6MHz (HCFG_FSLS_PHYCLK_SEL_6MHZ),
but phy_clock was incorrectly left at 48. This caused HFIR to be
calculated as 47999 (~8ms SOF interval) instead of the correct 5999
(1ms SOF interval), breaking periodic endpoint scheduling.

Fixes: LS mouse only receiving first HID report on OTG_HS + FS PHY
This commit is contained in:
Zhang, Zhenjiang
2026-06-25 10:00:57 +08:00
parent 94d5e74f63
commit e95d6b3932

View File

@ -1427,10 +1427,11 @@ static void port0_enable(dwc2_regs_t* dwc2, tusb_speed_t speed) {
uint32_t phy_clock;
if (gusbcfg.phy_sel == GUSBCFG_PHYSEL_FULLSPEED) {
phy_clock = 48; // dedicated FS is 48Mhz
if (speed == TUSB_SPEED_LOW) {
phy_clock = 6; // LS via FS PHY: effective clock is 6MHz
hcfg |= HCFG_FSLS_PHYCLK_SEL_6MHZ;
} else {
phy_clock = 48; // dedicated FS is 48Mhz
hcfg |= HCFG_FSLS_PHYCLK_SEL_48MHZ;
}
} else {