diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index b410d1e7c53b..fae72ea5aacd 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -3780,17 +3780,12 @@ 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; + return (hfnum & HFNUM_FRNUM_MASK) >> HFNUM_FRNUM_SHIFT; } int dwc2_hcd_get_future_frame_number(struct dwc2_hsotg *hsotg, int us) @@ -4536,8 +4531,13 @@ 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); - return dwc2_hcd_get_frame_number(hsotg); + /* 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); } static void dwc2_dump_urb_info(struct usb_hcd *hcd, struct urb *urb,