mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
usb: dwc2: return correct frame counts with high-speed host
The HFNUM register increments on every microframe in HS mode, and USB device drivers expect the returned frame count to relate to the overall frame. Right-shift the returned value by 3 to drop the microframe bits. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
This commit is contained in:
committed by
Dom Cobley
parent
8f6355e73c
commit
c60aeaf2e6
@@ -3775,11 +3775,16 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user