mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
usb: xhci-mtk: add a member of num_esit
Add a member num_esit to save the number of esit, then no need caculate it in some functions. Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1629189389-18779-8-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
614c8c67a0
commit
82799c80b4
2 changed files with 9 additions and 13 deletions
|
@ -297,6 +297,7 @@ static void setup_sch_info(struct xhci_ep_ctx *ep_ctx,
|
|||
CTX_TO_MAX_ESIT_PAYLOAD(le32_to_cpu(ep_ctx->tx_info));
|
||||
|
||||
sch_ep->esit = get_esit(ep_ctx);
|
||||
sch_ep->num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
|
||||
sch_ep->ep_type = ep_type;
|
||||
sch_ep->maxpkt = maxpkt;
|
||||
sch_ep->offset = 0;
|
||||
|
@ -401,14 +402,12 @@ static void setup_sch_info(struct xhci_ep_ctx *ep_ctx,
|
|||
static u32 get_max_bw(struct mu3h_sch_bw_info *sch_bw,
|
||||
struct mu3h_sch_ep_info *sch_ep, u32 offset)
|
||||
{
|
||||
u32 num_esit;
|
||||
u32 max_bw = 0;
|
||||
u32 bw;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
|
||||
for (i = 0; i < num_esit; i++) {
|
||||
for (i = 0; i < sch_ep->num_esit; i++) {
|
||||
u32 base = offset + i * sch_ep->esit;
|
||||
|
||||
for (j = 0; j < sch_ep->num_budget_microframes; j++) {
|
||||
|
@ -424,13 +423,11 @@ static u32 get_max_bw(struct mu3h_sch_bw_info *sch_bw,
|
|||
static void update_bus_bw(struct mu3h_sch_bw_info *sch_bw,
|
||||
struct mu3h_sch_ep_info *sch_ep, bool used)
|
||||
{
|
||||
u32 num_esit;
|
||||
u32 base;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
|
||||
for (i = 0; i < num_esit; i++) {
|
||||
for (i = 0; i < sch_ep->num_esit; i++) {
|
||||
base = sch_ep->offset + i * sch_ep->esit;
|
||||
for (j = 0; j < sch_ep->num_budget_microframes; j++) {
|
||||
if (used)
|
||||
|
@ -446,12 +443,11 @@ static void update_bus_bw(struct mu3h_sch_bw_info *sch_bw,
|
|||
static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset)
|
||||
{
|
||||
struct mu3h_sch_tt *tt = sch_ep->sch_tt;
|
||||
u32 num_esit, tmp;
|
||||
u32 tmp;
|
||||
int base;
|
||||
int i, j;
|
||||
|
||||
num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
|
||||
for (i = 0; i < num_esit; i++) {
|
||||
for (i = 0; i < sch_ep->num_esit; i++) {
|
||||
base = offset + i * sch_ep->esit;
|
||||
|
||||
/*
|
||||
|
@ -533,12 +529,10 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset)
|
|||
static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used)
|
||||
{
|
||||
struct mu3h_sch_tt *tt = sch_ep->sch_tt;
|
||||
u32 base, num_esit;
|
||||
u32 base;
|
||||
int i, j;
|
||||
|
||||
num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit;
|
||||
|
||||
for (i = 0; i < num_esit; i++) {
|
||||
for (i = 0; i < sch_ep->num_esit; i++) {
|
||||
base = sch_ep->offset + i * sch_ep->esit;
|
||||
|
||||
for (j = 0; j < sch_ep->num_budget_microframes; j++)
|
||||
|
|
|
@ -50,6 +50,7 @@ struct mu3h_sch_bw_info {
|
|||
* struct mu3h_sch_ep_info: schedule information for endpoint
|
||||
*
|
||||
* @esit: unit is 125us, equal to 2 << Interval field in ep-context
|
||||
* @num_esit: number of @esit in a period
|
||||
* @num_budget_microframes: number of continuous uframes
|
||||
* (@repeat==1) scheduled within the interval
|
||||
* @bw_cost_per_microframe: bandwidth cost per microframe
|
||||
|
@ -79,6 +80,7 @@ struct mu3h_sch_bw_info {
|
|||
*/
|
||||
struct mu3h_sch_ep_info {
|
||||
u32 esit;
|
||||
u32 num_esit;
|
||||
u32 num_budget_microframes;
|
||||
u32 bw_cost_per_microframe;
|
||||
struct list_head endpoint;
|
||||
|
|
Loading…
Reference in a new issue