summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang, Zhenjiang <[email protected]>2026-06-25 10:00:57 +0800
committerZhang, Zhenjiang <[email protected]>2026-06-25 10:00:57 +0800
commite95d6b3932f64d59ce2979743b063fbea779a9b9 (patch)
treebadaaea282bce78ff7e744970a5414a21e50b0a2
parent94d5e74f63d49131d733cc847f1aa71c558101ac (diff)
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
-rw-r--r--src/portable/synopsys/dwc2/hcd_dwc2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/portable/synopsys/dwc2/hcd_dwc2.c b/src/portable/synopsys/dwc2/hcd_dwc2.c
index 84a0c6afd..8265700c0 100644
--- a/src/portable/synopsys/dwc2/hcd_dwc2.c
+++ b/src/portable/synopsys/dwc2/hcd_dwc2.c
@@ -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 {