Lines Matching refs:sch_ep

68 		struct xhci_ep_ctx *ep_ctx, struct mu3h_sch_ep_info *sch_ep)  in setup_sch_info()  argument
83 sch_ep->esit = 1 << ep_interval; in setup_sch_info()
84 sch_ep->offset = 0; in setup_sch_info()
85 sch_ep->burst_mode = 0; in setup_sch_info()
88 sch_ep->cs_count = 0; in setup_sch_info()
95 sch_ep->num_budget_microframes = 1; in setup_sch_info()
96 sch_ep->repeat = 0; in setup_sch_info()
103 sch_ep->pkts = max_burst + 1; in setup_sch_info()
104 sch_ep->bw_cost_per_microframe = max_packet_size * sch_ep->pkts; in setup_sch_info()
107 sch_ep->cs_count = 0; in setup_sch_info()
110 sch_ep->pkts = esit_pkts; in setup_sch_info()
111 sch_ep->num_budget_microframes = 1; in setup_sch_info()
112 sch_ep->repeat = 0; in setup_sch_info()
116 if (esit_pkts <= sch_ep->esit) in setup_sch_info()
117 sch_ep->pkts = 1; in setup_sch_info()
119 sch_ep->pkts = roundup_pow_of_two(esit_pkts) in setup_sch_info()
120 / sch_ep->esit; in setup_sch_info()
122 sch_ep->num_budget_microframes = in setup_sch_info()
123 DIV_ROUND_UP(esit_pkts, sch_ep->pkts); in setup_sch_info()
125 if (sch_ep->num_budget_microframes > 1) in setup_sch_info()
126 sch_ep->repeat = 1; in setup_sch_info()
128 sch_ep->repeat = 0; in setup_sch_info()
130 sch_ep->bw_cost_per_microframe = max_packet_size * sch_ep->pkts; in setup_sch_info()
137 sch_ep->repeat = 0; in setup_sch_info()
138 sch_ep->pkts = 1; /* at most one packet for each microframe */ in setup_sch_info()
140 sch_ep->cs_count = 3; /* at most need 3 CS*/ in setup_sch_info()
142 sch_ep->num_budget_microframes = sch_ep->cs_count + 2; in setup_sch_info()
143 sch_ep->bw_cost_per_microframe = max_packet_size; in setup_sch_info()
151 sch_ep->num_budget_microframes = DIV_ROUND_UP( in setup_sch_info()
153 sch_ep->bw_cost_per_microframe = FS_PAYLOAD_MAX; in setup_sch_info()
154 sch_ep->cs_count = sch_ep->num_budget_microframes; in setup_sch_info()
158 sch_ep->cs_count = DIV_ROUND_UP( in setup_sch_info()
160 sch_ep->num_budget_microframes = sch_ep->cs_count + 2; in setup_sch_info()
161 sch_ep->bw_cost_per_microframe = FS_PAYLOAD_MAX; in setup_sch_info()
168 struct mu3h_sch_ep_info *sch_ep, u32 offset) in get_max_bw() argument
175 num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit; in get_max_bw()
177 u32 base = offset + i * sch_ep->esit; in get_max_bw()
179 for (j = 0; j < sch_ep->num_budget_microframes; j++) { in get_max_bw()
188 struct mu3h_sch_ep_info *sch_ep, int bw_cost) in update_bus_bw() argument
195 num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit; in update_bus_bw()
197 base = sch_ep->offset + i * sch_ep->esit; in update_bus_bw()
198 for (j = 0; j < sch_ep->num_budget_microframes; j++) in update_bus_bw()
204 struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep) in check_sch_bw() argument
214 if (sch_ep->esit > XHCI_MTK_MAX_ESIT) in check_sch_bw()
215 sch_ep->esit = XHCI_MTK_MAX_ESIT; in check_sch_bw()
217 esit = sch_ep->esit; in check_sch_bw()
218 num_budget_microframes = sch_ep->num_budget_microframes; in check_sch_bw()
227 if ((offset + num_budget_microframes) > sch_ep->esit) in check_sch_bw()
237 worst_bw = get_max_bw(sch_bw, sch_ep, offset); in check_sch_bw()
245 sch_ep->offset = min_index; in check_sch_bw()
251 if (min_bw + sch_ep->bw_cost_per_microframe > bw_boundary) in check_sch_bw()
255 update_bus_bw(sch_bw, sch_ep, sch_ep->bw_cost_per_microframe); in check_sch_bw()
317 struct mu3h_sch_ep_info *sch_ep; in xhci_mtk_add_ep_quirk() local
350 sch_ep = kzalloc(sizeof(struct mu3h_sch_ep_info), GFP_NOIO); in xhci_mtk_add_ep_quirk()
351 if (!sch_ep) in xhci_mtk_add_ep_quirk()
354 setup_sch_info(udev, ep_ctx, sch_ep); in xhci_mtk_add_ep_quirk()
356 ret = check_sch_bw(udev, sch_bw, sch_ep); in xhci_mtk_add_ep_quirk()
359 kfree(sch_ep); in xhci_mtk_add_ep_quirk()
363 list_add_tail(&sch_ep->endpoint, &sch_bw->bw_ep_list); in xhci_mtk_add_ep_quirk()
364 sch_ep->ep = ep; in xhci_mtk_add_ep_quirk()
366 ep_ctx->reserved[0] |= cpu_to_le32(EP_BPKTS(sch_ep->pkts) in xhci_mtk_add_ep_quirk()
367 | EP_BCSCOUNT(sch_ep->cs_count) | EP_BBM(sch_ep->burst_mode)); in xhci_mtk_add_ep_quirk()
368 ep_ctx->reserved[1] |= cpu_to_le32(EP_BOFFSET(sch_ep->offset) in xhci_mtk_add_ep_quirk()
369 | EP_BREPEAT(sch_ep->repeat)); in xhci_mtk_add_ep_quirk()
372 sch_ep->pkts, sch_ep->cs_count, sch_ep->burst_mode, in xhci_mtk_add_ep_quirk()
373 sch_ep->offset, sch_ep->repeat); in xhci_mtk_add_ep_quirk()
388 struct mu3h_sch_ep_info *sch_ep; in xhci_mtk_drop_ep_quirk() local
407 list_for_each_entry(sch_ep, &sch_bw->bw_ep_list, endpoint) { in xhci_mtk_drop_ep_quirk()
408 if (sch_ep->ep == ep) { in xhci_mtk_drop_ep_quirk()
409 update_bus_bw(sch_bw, sch_ep, in xhci_mtk_drop_ep_quirk()
410 -sch_ep->bw_cost_per_microframe); in xhci_mtk_drop_ep_quirk()
411 list_del(&sch_ep->endpoint); in xhci_mtk_drop_ep_quirk()
412 kfree(sch_ep); in xhci_mtk_drop_ep_quirk()