drivers: dwc2: don't use shifted frame number internally

Shift it in the wrapper function, or scheduling periodic transfers breaks.

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
This commit is contained in:
Jonathan Bell
2025-06-18 10:22:18 +01:00
committed by Dom Cobley
parent fd494377e8
commit b5d497fc54

View File

@@ -3780,16 +3780,11 @@ static int dwc2_hcd_is_status_changed(struct dwc2_hsotg *hsotg, int port)
int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg)
{
u32 hfnum = dwc2_readl(hsotg, HFNUM);
u32 hprt0 = dwc2_readl(hsotg, HPRT0);
#ifdef DWC2_DEBUG_SOF
dev_vdbg(hsotg->dev, "DWC OTG HCD GET FRAME NUMBER %d\n",
(hfnum & HFNUM_FRNUM_MASK) >> HFNUM_FRNUM_SHIFT);
#endif
/* HS root port counts microframes, not frames */
if ((hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT == HPRT0_SPD_HIGH_SPEED)
return (hfnum & HFNUM_FRNUM_MASK) >> (3 + HFNUM_FRNUM_SHIFT);
else
return (hfnum & HFNUM_FRNUM_MASK) >> HFNUM_FRNUM_SHIFT;
}
@@ -4536,7 +4531,12 @@ unlock:
static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd)
{
struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
u32 hprt0 = dwc2_readl(hsotg, HPRT0);
/* HS root port counts microframes, not frames */
if ((hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT == HPRT0_SPD_HIGH_SPEED)
return dwc2_hcd_get_frame_number(hsotg) >> 3;
else
return dwc2_hcd_get_frame_number(hsotg);
}