Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6773062pxv; Fri, 30 Jul 2021 01:53:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7lUyztHdO6fi+l2B94lGczJUhpHAyYCr10aSTZrQ0ZXXhAbXCJAD8Q56Tp5FGTgVAEDJ9 X-Received: by 2002:a92:c504:: with SMTP id r4mr1127821ilg.131.1627635238453; Fri, 30 Jul 2021 01:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627635238; cv=none; d=google.com; s=arc-20160816; b=qVxFHloia3jJky14Bu0bBMnyPwdpF8ZxXhqmUEvXstNkKmynhSVJLHUDq8Qebr+AWh Yb4mQt0OU8zahuHNrUMI5qWaD6i5ukB9IFpp5OpWTxcbVvyLYUb3mPXnW19CQFICU7Fd q87n7sklgzaSR/yIEtuZAIf30CrJWOSerVdsbSr9bXtJ0f/bDwxBcf2lN+yEe05exCph /wgPkK4CGNM5oDBgna4TwEbprUZsnYsFN6QFQh6qpEGUsEIkA4HVbR39k7HQdxzpIRHW htuOSkvBsKJca5jSUROCPbeNfo4LXlQOzigoPsGzbTIKeRtKdsKEMT8S90zcn7BDDQFL F2DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=iaqHJToLlG21laL0HxQhOHg9ht+nOv/pu4CNE5Ev19U=; b=Qr+1Tef6UJctTSe3HbatICw9f218IlT8uq7ZcYbm2XDRfTMwOgzDnyZnH3tjLCc/O1 DwNO5fY0EGBMiKa2LMfXKI6E4aQCHGlouzIgBrhazfqnjxOHxzRN8r5CWKr18apeIJOd o2BdZUu9iczJD0/ogvRF5IC8IlJRDg2nGiy4Mr3El2s8JKfzmth/BReMB6UCebtVJbQA WiXv5o5HjERhIHQRsbsvwt3QZbT01hfWWsrFWIQ9LJbsXzXnOz6IPhivmKWzVrPe7PJD JRCSq1OIBQMM5HAM16iabBMO8V6UrTo9sal/bctAH0UdgoF86rj5hvgvKJatESo1TJfV tZWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w4si1138608ioa.95.2021.07.30.01.53.46; Fri, 30 Jul 2021 01:53:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230335AbhG3IvV (ORCPT + 99 others); Fri, 30 Jul 2021 04:51:21 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:35966 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S238017AbhG3Iut (ORCPT ); Fri, 30 Jul 2021 04:50:49 -0400 X-UUID: 8b07a5fd1a9347cf8ca4fe39069f2f59-20210730 X-UUID: 8b07a5fd1a9347cf8ca4fe39069f2f59-20210730 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1188815040; Fri, 30 Jul 2021 16:50:44 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Jul 2021 16:50:43 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 30 Jul 2021 16:50:42 +0800 From: Chunfeng Yun To: Rob Herring , Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , , Eddie Hung Subject: [PATCH 08/11] usb: xhci-mtk: update fs bus bandwidth by bw_budget_table Date: Fri, 30 Jul 2021 16:49:59 +0800 Message-ID: <1627635002-24521-8-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1627635002-24521-1-git-send-email-chunfeng.yun@mediatek.com> References: <1627635002-24521-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use @bw_budget_table[] to update fs bus bandwidth due to not all microframes consume @bw_cost_per_microframe, see setup_sch_info(). Signed-off-by: Chunfeng Yun --- drivers/usb/host/xhci-mtk-sch.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c index 0bb1a6295d64..10c0f0f6461f 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -458,8 +458,8 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset) * Compared with hs bus, no matter what ep type, * the hub will always delay one uframe to send data */ - for (j = 0; j < sch_ep->cs_count; j++) { - tmp = tt->fs_bus_bw[base + j] + sch_ep->bw_cost_per_microframe; + for (j = 0; j < sch_ep->num_budget_microframes; j++) { + tmp = tt->fs_bus_bw[base + j] + sch_ep->bw_budget_table[j]; if (tmp > FS_PAYLOAD_MAX) return -ESCH_BW_OVERFLOW; } @@ -534,21 +534,18 @@ 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; - int bw_updated; int i, j; num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit; - if (used) - bw_updated = sch_ep->bw_cost_per_microframe; - else - bw_updated = -sch_ep->bw_cost_per_microframe; - for (i = 0; i < num_esit; i++) { base = sch_ep->offset + i * sch_ep->esit; - for (j = 0; j < sch_ep->cs_count; j++) - tt->fs_bus_bw[base + j] += bw_updated; + for (j = 0; j < sch_ep->num_budget_microframes; j++) + if (used) + tt->fs_bus_bw[base + j] += sch_ep->bw_budget_table[j]; + else + tt->fs_bus_bw[base + j] -= sch_ep->bw_budget_table[j]; } if (used) -- 2.18.0