Skip to content

Commit 61d2cf0

Browse files
Chunfeng Yungregkh
authored andcommitted
usb: xhci-mtk: fix in-ep's start-split check failure
It's wrong to use the data length in a CS (in uframe x) to check whether there is a SS (in uframe x-2), because for a isoc-in ep, it may need some CS to receive data; Save the count of SS in a uframe for isoc/intr in-eps to fix the issue. Fixes: 5c954e0 ("usb: xhci-mtk: improve split scheduling by separate IN/OUT budget") Signed-off-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 8bbae28 commit 61d2cf0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/usb/host/xhci-mtk-sch.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,8 @@ static int check_isoc_ss_overlap(struct mu3h_sch_ep_info *sch_ep, u32 offset)
650650

651651
if (sch_ep->ep_type == ISOC_OUT_EP) {
652652
for (j = 0; j < sch_ep->num_budget_microframes; j++) {
653-
k = XHCI_MTK_BW_INDEX(base + j + CS_OFFSET);
654-
/* use cs to indicate existence of in-ss @(base+j) */
655-
if (tt->fs_bus_bw_in[k])
653+
k = XHCI_MTK_BW_INDEX(base + j);
654+
if (tt->in_ss_cnt[k])
656655
return -ESCH_SS_OVERLAP;
657656
}
658657
} else if (sch_ep->ep_type == ISOC_IN_EP || sch_ep->ep_type == INT_IN_EP) {
@@ -769,6 +768,14 @@ static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used)
769768
tt->fs_frame_bw[f] -= (u16)sch_ep->bw_budget_table[j];
770769
}
771770
}
771+
772+
if (sch_ep->ep_type == ISOC_IN_EP || sch_ep->ep_type == INT_IN_EP) {
773+
k = XHCI_MTK_BW_INDEX(base);
774+
if (used)
775+
tt->in_ss_cnt[k]++;
776+
else
777+
tt->in_ss_cnt[k]--;
778+
}
772779
}
773780

774781
if (used)

drivers/usb/host/xhci-mtk.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@
3838
* @fs_bus_bw_in: save bandwidth used by FS/LS IN eps in each uframes
3939
* @ls_bus_bw: save bandwidth used by LS eps in each uframes
4040
* @fs_frame_bw: save bandwidth used by FS/LS eps in each FS frames
41+
* @in_ss_cnt: the count of Start-Split for IN eps
4142
* @ep_list: Endpoints using this TT
4243
*/
4344
struct mu3h_sch_tt {
4445
u16 fs_bus_bw_out[XHCI_MTK_MAX_ESIT];
4546
u16 fs_bus_bw_in[XHCI_MTK_MAX_ESIT];
4647
u8 ls_bus_bw[XHCI_MTK_MAX_ESIT];
4748
u16 fs_frame_bw[XHCI_MTK_FRAMES_CNT];
49+
u8 in_ss_cnt[XHCI_MTK_MAX_ESIT];
4850
struct list_head ep_list;
4951
};
5052

0 commit comments

Comments
 (0)