Commit 7c986fbc authored by Chunfeng Yun's avatar Chunfeng Yun Committed by Greg Kroah-Hartman

usb: xhci-mtk: get the microframe boundary for ESIT

Tune the boundary for FS/LS ESIT due to CS:
For ISOC out-ep, the controller starts transfer data after
the first SS; for others, the data is already transferred
before the last CS.
Signed-off-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/49e5a269a47984f3126a70c3fb471b0c2874b8c2.1615170625.git.chunfeng.yun@mediatek.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e19ee44a
...@@ -513,22 +513,35 @@ static void update_sch_tt(struct usb_device *udev, ...@@ -513,22 +513,35 @@ static void update_sch_tt(struct usb_device *udev,
list_del(&sch_ep->tt_endpoint); list_del(&sch_ep->tt_endpoint);
} }
static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep)
{
u32 boundary = sch_ep->esit;
if (sch_ep->sch_tt) { /* LS/FS with TT */
/* tune for CS */
if (sch_ep->ep_type != ISOC_OUT_EP)
boundary++;
else if (boundary > 1) /* normally esit >= 8 for FS/LS */
boundary--;
}
return boundary;
}
static int check_sch_bw(struct usb_device *udev, static int check_sch_bw(struct usb_device *udev,
struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep) struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep)
{ {
u32 offset; u32 offset;
u32 esit;
u32 min_bw; u32 min_bw;
u32 min_index; u32 min_index;
u32 worst_bw; u32 worst_bw;
u32 bw_boundary; u32 bw_boundary;
u32 esit_boundary;
u32 min_num_budget; u32 min_num_budget;
u32 min_cs_count; u32 min_cs_count;
bool tt_offset_ok = false; bool tt_offset_ok = false;
int ret; int ret;
esit = sch_ep->esit;
/* /*
* Search through all possible schedule microframes. * Search through all possible schedule microframes.
* and find a microframe where its worst bandwidth is minimum. * and find a microframe where its worst bandwidth is minimum.
...@@ -537,7 +550,8 @@ static int check_sch_bw(struct usb_device *udev, ...@@ -537,7 +550,8 @@ static int check_sch_bw(struct usb_device *udev,
min_index = 0; min_index = 0;
min_cs_count = sch_ep->cs_count; min_cs_count = sch_ep->cs_count;
min_num_budget = sch_ep->num_budget_microframes; min_num_budget = sch_ep->num_budget_microframes;
for (offset = 0; offset < esit; offset++) { esit_boundary = get_esit_boundary(sch_ep);
for (offset = 0; offset < sch_ep->esit; offset++) {
if (is_fs_or_ls(udev->speed)) { if (is_fs_or_ls(udev->speed)) {
ret = check_sch_tt(udev, sch_ep, offset); ret = check_sch_tt(udev, sch_ep, offset);
if (ret) if (ret)
...@@ -546,7 +560,7 @@ static int check_sch_bw(struct usb_device *udev, ...@@ -546,7 +560,7 @@ static int check_sch_bw(struct usb_device *udev,
tt_offset_ok = true; tt_offset_ok = true;
} }
if ((offset + sch_ep->num_budget_microframes) > sch_ep->esit) if ((offset + sch_ep->num_budget_microframes) > esit_boundary)
break; break;
worst_bw = get_max_bw(sch_bw, sch_ep, offset); worst_bw = get_max_bw(sch_bw, sch_ep, offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment