From e95d6b3932f64d59ce2979743b063fbea779a9b9 Mon Sep 17 00:00:00 2001 From: "Zhang, Zhenjiang" Date: Thu, 25 Jun 2026 10:00:57 +0800 Subject: [PATCH] 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 --- src/portable/synopsys/dwc2/hcd_dwc2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 {