Skip to content

Commit 4459c6d

Browse files
P33Mpelwell
authored andcommitted
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>
1 parent a5f5dc5 commit 4459c6d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/usb/dwc2/hcd.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3804,17 +3804,12 @@ static int dwc2_hcd_is_status_changed(struct dwc2_hsotg *hsotg, int port)
38043804
int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg)
38053805
{
38063806
u32 hfnum = dwc2_readl(hsotg, HFNUM);
3807-
u32 hprt0 = dwc2_readl(hsotg, HPRT0);
38083807

38093808
#ifdef DWC2_DEBUG_SOF
38103809
dev_vdbg(hsotg->dev, "DWC OTG HCD GET FRAME NUMBER %d\n",
38113810
(hfnum & HFNUM_FRNUM_MASK) >> HFNUM_FRNUM_SHIFT);
38123811
#endif
3813-
/* HS root port counts microframes, not frames */
3814-
if ((hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT == HPRT0_SPD_HIGH_SPEED)
3815-
return (hfnum & HFNUM_FRNUM_MASK) >> (3 + HFNUM_FRNUM_SHIFT);
3816-
else
3817-
return (hfnum & HFNUM_FRNUM_MASK) >> HFNUM_FRNUM_SHIFT;
3812+
return (hfnum & HFNUM_FRNUM_MASK) >> HFNUM_FRNUM_SHIFT;
38183813
}
38193814

38203815
int dwc2_hcd_get_future_frame_number(struct dwc2_hsotg *hsotg, int us)
@@ -4560,8 +4555,13 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd)
45604555
static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd)
45614556
{
45624557
struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
4558+
u32 hprt0 = dwc2_readl(hsotg, HPRT0);
45634559

4564-
return dwc2_hcd_get_frame_number(hsotg);
4560+
/* HS root port counts microframes, not frames */
4561+
if ((hprt0 & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT == HPRT0_SPD_HIGH_SPEED)
4562+
return dwc2_hcd_get_frame_number(hsotg) >> 3;
4563+
else
4564+
return dwc2_hcd_get_frame_number(hsotg);
45654565
}
45664566

45674567
static void dwc2_dump_urb_info(struct usb_hcd *hcd, struct urb *urb,

0 commit comments

Comments
 (0)