From patchwork Fri Apr 30 07:15:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 12232775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA2C1C433ED for ; Fri, 30 Apr 2021 07:26:01 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0369C613C5 for ; Fri, 30 Apr 2021 07:26:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0369C613C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=MzBxYaO0PoaadC15HfFWkbxvJ4pi4VlaMaWVHQt8F0I=; b=DkEDvgigcvfBk1LmuFfR7DtHoP WTcmNq47DGp8tuA1jLgaEwqjZriAB21byQV1ZfJ/DJvw4WPuo3D18PaabEdtIu9/qnjXVQH/SvjjY QYBEil1CvFXEoE08bSFBi84PBTrUZnNFS+GddMHODP2MiZ55475LO3Xw4yvUpSDqy5DMnOWaGmnF6 yxgeQLF04Ctlqnvk7QhX+10p3vyaqEg1jH7KYjMkfDwVG7MzegufEmSiG87LdzUwhSxaZoecfBgfa dcfLYFyjUjHaB+b/m9hclydtM0msThyQvjPqaaEno5kBQU0cS6BFsfXmX1Ae5erl69w/UmODdY3NZ 2IVLTqwQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lcNWx-007QI6-Cm; Fri, 30 Apr 2021 07:25:43 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcNWu-007QHt-VJ; Fri, 30 Apr 2021 07:25:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=Q6kkVaO0Suo0QcWoZWChfLM6oJRhCi0AbJsj0Xs2rRw=; b=4iyjRkreZZTk2nquj4qfssRlOs NYGmq+Z1hZ2QGeos23lWS5Re4bIgDsSHWckpEk47gqcNBeZ1ipx0HeRntHlCejQ6SVNbZ+cpm+Q3W j88QUJCDCf3KKl39UQDBVU8YrqafybfxhYbTVMdEB6Ti+xucvZPiMRpN7L3nSWHr+5C3xsUmAuOLN 7cdHExFrlKRUKeEfw1ZMdKo16da1Je+qSxXqfYJ9XUXwFZsDVhrJLdgRmygQz6HKEGAIlmEIOT1/Y Art1jKSwmSwsx/AAn9uTzI0NGL8gtKpT/cVe1ss36lT5nCYpl+dbng4mw2tUGtlQCRCKbG+wlueU3 9hzyByYQ==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcNWr-001CIr-Vq; Fri, 30 Apr 2021 07:25:39 +0000 X-UUID: 1c9ae189a70347949c4a0144aaece030-20210430 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=Q6kkVaO0Suo0QcWoZWChfLM6oJRhCi0AbJsj0Xs2rRw=; b=rAVqdm3LKCNUV7Qp2Sd73uro6nVoA7gRY4U8GtIuJd+II4uqVDCnvaK9vidmafW8tqYv36/rb2FvTbxOx9VdB8EKwifz6kqP3y3tIyIcxnr1BhhzuRIqeye7RsYUfYgyOdMM3FhAJ/i998JmlpaHUoVEBOSiomUgC0bysARH1QU=; X-UUID: 1c9ae189a70347949c4a0144aaece030-20210430 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1837405656; Fri, 30 Apr 2021 00:25:37 -0700 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Apr 2021 00:15:34 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Apr 2021 15:15:33 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 30 Apr 2021 15:15:33 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , "Ikjoon Jang" , Eddie Hung Subject: [PATCH 1/3] usb: xhci-mtk: use bitfield instead of bool Date: Fri, 30 Apr 2021 15:15:30 +0800 Message-ID: <20210430071532.51794-1-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210430_002538_053337_6F96DACF X-CRM114-Status: GOOD ( 12.94 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Use bitfield instead of bool in struct Signed-off-by: Chunfeng Yun --- drivers/usb/host/xhci-mtk.c | 2 -- drivers/usb/host/xhci-mtk.h | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c index b2058b3bc834..2548976bcf05 100644 --- a/drivers/usb/host/xhci-mtk.c +++ b/drivers/usb/host/xhci-mtk.c @@ -495,8 +495,6 @@ static int xhci_mtk_probe(struct platform_device *pdev) goto put_usb2_hcd; } mtk->has_ippc = true; - } else { - mtk->has_ippc = false; } device_init_wakeup(dev, true); diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h index cd3a37bb73e6..94a59b3d178f 100644 --- a/drivers/usb/host/xhci-mtk.h +++ b/drivers/usb/host/xhci-mtk.h @@ -138,17 +138,17 @@ struct xhci_hcd_mtk { struct mu3h_sch_bw_info *sch_array; struct list_head bw_ep_chk_list; struct mu3c_ippc_regs __iomem *ippc_regs; - bool has_ippc; int num_u2_ports; int num_u3_ports; int u3p_dis_msk; struct regulator *vusb33; struct regulator *vbus; struct clk_bulk_data clks[BULK_CLKS_NUM]; - bool lpm_support; - bool u2_lpm_disable; + unsigned int has_ippc:1; + unsigned int lpm_support:1; + unsigned int u2_lpm_disable:1; /* usb remote wakeup */ - bool uwk_en; + unsigned int uwk_en:1; struct regmap *uwk; u32 uwk_reg_base; u32 uwk_vers; From patchwork Fri Apr 30 07:15:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 12232751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0CE5C433B4 for ; Fri, 30 Apr 2021 07:16:11 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4D08A6142A for ; Fri, 30 Apr 2021 07:16:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D08A6142A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bOkD6odW5CRjHgVMhAi4cnVUJ4PnRLiBdrIRZeUuJWE=; b=TSiq5RtwWtquQ0SnJEO+Jwzz+ 7sxouaZx3+8Zwf8vGDQ2FxE5tgpeB0GF/I6tVWEZiesiKUccpVg5RoBwyoQOpeVKHaB6QvnYVR4iV PFK3cJK8QiOFxxLTMKjcGYGDdUkmOxCATONbwOv6P48VtWRoIhg7foqyr6XviXsUe6LfdDeKwnq/W FV23Fbz6to8enrT72dyldxIUYoMrb+QruthX/N6eB4Kikc0t7TgOT70qskZ8/VnuY7VTzaNnCiC6Y DHzJ+MQ6P0UNopnVLS+tOUmg4W4rYcR8Sbj5A3BvX1BKPdDozwR30E4jtc3JhGaX0NJIvjdPHZ5nF fq3ZcbqHA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNS-007PNw-QQ; Fri, 30 Apr 2021 07:15:54 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNP-007PNN-Qv; Fri, 30 Apr 2021 07:15:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=Y6p/N2IMKgTVs8mPSuLOuxZ5NAQHWn+tSEJ0GJfZpqI=; b=siPeqlR2qByqCKcmEXhrUCfw3H ml27eEGJzqU0xHul8QOpiphD/Su7ChpgDQH0kOJVUdg3YJKgVNfm7szEpod26n/xkeIINj6xcf0aF nxQODqBp44p2Oa3FPysfy3HdEnsfokxioKUuwDs8iRzxSlCw+8lGQqQedB+RzGxI0A7eROUvC25GC Ai2LyAv9DovsEjqnMKVNNMf/7NNnsUl8t5zTFDAFu/+J7t6UrpA6bfmr8K80q/h4q8kvwMi6c/dRz FlJ6qbPg0ieJptYH37iuJm/J9T9xyP7etj2EEU5XjaN6SgO5LtxCU1khbS4E4wvkMZtBV1AZT7tr4 kixnXSFg==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNM-001C2U-4k; Fri, 30 Apr 2021 07:15:50 +0000 X-UUID: 4ed6b260b323458f894865969c6d1502-20210430 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=Y6p/N2IMKgTVs8mPSuLOuxZ5NAQHWn+tSEJ0GJfZpqI=; b=qjfqghnJNaPE6fLiCO1jqYckzKmzCdDBxI/B7rCW04yH1ZjTARXmvCiKtyBONoVp172OWidP14dOhfqDoyymHk9L8CCt2vwmFygXhsuBarR1yUHI68gOunKbKqBDlchpcSdLL5J47Vci8xbC5JK+Od/ZXqfnx5imoI5oKDyqhKE=; X-UUID: 4ed6b260b323458f894865969c6d1502-20210430 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1186803886; Fri, 30 Apr 2021 00:15:43 -0700 Received: from MTKMBS06N2.mediatek.inc (172.21.101.130) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Apr 2021 00:15:42 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Apr 2021 15:15:40 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 30 Apr 2021 15:15:33 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , "Ikjoon Jang" , Eddie Hung Subject: [PATCH 2/3] usb: xhci-mtk: remove unnecessary assignments in periodic TT scheduler Date: Fri, 30 Apr 2021 15:15:31 +0800 Message-ID: <20210430071532.51794-2-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210430071532.51794-1-chunfeng.yun@mediatek.com> References: <20210430071532.51794-1-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 3B889F7DC6F4CC29E02595BDB4B5B9FBE3C2A6CAC0E4967797B6CB878464D79C2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210430_001549_111233_605D7402 X-CRM114-Status: GOOD ( 13.53 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: Ikjoon Jang Remove unnecessary variables in check_sch_bw(). No functional changes, just for better readability. Signed-off-by: Ikjoon Jang Signed-off-by: Chunfeng Yun --- drivers/usb/host/xhci-mtk-sch.c | 37 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c index 8b90da5a6ed1..9fb75085e40f 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -476,6 +476,9 @@ static int check_sch_tt(struct mu3h_sch_ep_info *sch_ep, u32 offset) u32 start_cs, last_cs; int i; + if (!sch_ep->sch_tt) + return 0; + start_ss = offset % 8; if (sch_ep->ep_type == ISOC_OUT_EP) { @@ -603,54 +606,42 @@ static u32 get_esit_boundary(struct mu3h_sch_ep_info *sch_ep) static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw, struct mu3h_sch_ep_info *sch_ep) { + const u32 esit_boundary = get_esit_boundary(sch_ep); + const u32 bw_boundary = get_bw_boundary(sch_ep->speed); u32 offset; - u32 min_bw; - u32 min_index; u32 worst_bw; - u32 bw_boundary; - u32 esit_boundary; - u32 min_num_budget; - u32 min_cs_count; + u32 min_bw = ~0; + int min_index = -1; int ret = 0; /* * Search through all possible schedule microframes. * and find a microframe where its worst bandwidth is minimum. */ - min_bw = ~0; - min_index = 0; - min_cs_count = sch_ep->cs_count; - min_num_budget = sch_ep->num_budget_microframes; - esit_boundary = get_esit_boundary(sch_ep); for (offset = 0; offset < sch_ep->esit; offset++) { - if (sch_ep->sch_tt) { - ret = check_sch_tt(sch_ep, offset); - if (ret) - continue; - } + ret = check_sch_tt(sch_ep, offset); + if (ret) + continue; if ((offset + sch_ep->num_budget_microframes) > esit_boundary) break; worst_bw = get_max_bw(sch_bw, sch_ep, offset); + if (worst_bw > bw_boundary) + continue; + if (min_bw > worst_bw) { min_bw = worst_bw; min_index = offset; - min_cs_count = sch_ep->cs_count; - min_num_budget = sch_ep->num_budget_microframes; } if (min_bw == 0) break; } - bw_boundary = get_bw_boundary(sch_ep->speed); - /* check bandwidth */ - if (min_bw > bw_boundary) + if (min_index < 0) return ret ? ret : -ESCH_BW_OVERFLOW; sch_ep->offset = min_index; - sch_ep->cs_count = min_cs_count; - sch_ep->num_budget_microframes = min_num_budget; return load_ep_bw(sch_bw, sch_ep, true); } From patchwork Fri Apr 30 07:15:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2h1bmZlbmcgWXVuICjkupHmmKXls7Ap?= X-Patchwork-Id: 12232753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC950C433ED for ; Fri, 30 Apr 2021 07:16:13 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 717546142A for ; Fri, 30 Apr 2021 07:16:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 717546142A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eAVHqZFvZxkfV2+LLLu6nhchTrrKtiZDIuDupMp8C3c=; b=eiSp0XgYdRAUQBfu03TQD5Adb n/yMMGd3bvUzDfxxXqd72bbBjp7DKBNlCE7zhlgVdxS//HmMqKooXYHPb+zDh64ZurtzpfelNpfDm Uw38p+wWZ9qMn75cxSXP6NVBk2HmVnU3DfjfUfrhzxb8ZODbNMwK0RjRUKJYFO8M3kZpByy+fwfgQ z/FQq6tMW98cu6tYn1RNO60v/u7r0vkPS/fTXOuYCkaxUD3Zh7vg9Hb2jTCkFj69VVE5sPFvZijAs cXY34LT1rukf6WmhTnLEqPy5GfnXIdwYWIzlCscOEb/gXvTnjoo4YvjpsDhPGSv+Gv2AEQ8uZoLU6 EhpYS1BjQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNV-007PPD-5w; Fri, 30 Apr 2021 07:15:57 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNP-007PNK-OZ; Fri, 30 Apr 2021 07:15:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC: To:From:Sender:Reply-To:Content-ID:Content-Description; bh=BrTRvIcjOW2USUQ1ERoFwNBIKEQKiqJ7JvuIGfNxJfw=; b=u9w2gbCL+gWOIpQcQeHTvqyw/w 0hqt7YgaAZIRwQbsMfWxR7d1X403+/IFSj1EiRc/1aDc+48eHr3qxx9B3U93Fe0hS/CG2LaugKP+M O/jVrl1iqew+/Z5DSRGSq1xBsYG4xVLN92EkYf1RRhC2tG+pMJVs+bPS0O3fxMcLruRNKt4cLABvL +Tu60GxPzSk+VsYyP8XzK0SHCK+mM1mYCW+zfl0IUn57f+F0raGzh/5eTlVsKtHeearFsebRRb65X 4BvEwtTkKBzkY/S9PAkBjRewBRWa5BvKHgrWd+ij45/arRxerTvwtFjyNnh9Ms1pKdA6SMAIlPRSe 3RBFzdxg==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lcNNL-001C2Q-KM; Fri, 30 Apr 2021 07:15:50 +0000 X-UUID: c7587361e948482885f7d83136cb1efd-20210430 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=BrTRvIcjOW2USUQ1ERoFwNBIKEQKiqJ7JvuIGfNxJfw=; b=YsxS+Vyfk6V1y7FPk9I6/LgvRHfbx/j7CazyL2ggkSBOyq88ivGESex2bfxxBqxd27bz+71N8lIP48I/nQRIhuDUQ4P4uucur8p4pMiU72GeINONqF3zRifsUQgfvwdkbV2VTTHvNhcusONbZx6Lz4lRuhQBSsVgEH8znF5mNMc=; X-UUID: c7587361e948482885f7d83136cb1efd-20210430 Received: from mtkcas67.mediatek.inc [(172.29.193.45)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 329610806; Fri, 30 Apr 2021 00:15:43 -0700 Received: from MTKMBS06N1.mediatek.inc (172.21.101.129) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Apr 2021 00:15:41 -0700 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Apr 2021 15:15:40 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 30 Apr 2021 15:15:40 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , "Ikjoon Jang" , Eddie Hung Subject: [PATCH 3/3] usb: xhci-mtk: use first-fit for LS/FS Date: Fri, 30 Apr 2021 15:15:32 +0800 Message-ID: <20210430071532.51794-3-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210430071532.51794-1-chunfeng.yun@mediatek.com> References: <20210430071532.51794-1-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210430_001549_108561_CA489566 X-CRM114-Status: GOOD ( 10.98 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Use first-fit instead of best-fit for LS/FS devices under TT, we found that best-fit will consume more bandwidth for some cases. Signed-off-by: Chunfeng Yun --- drivers/usb/host/xhci-mtk-sch.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c index 9fb75085e40f..c07411d9b16f 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -634,6 +634,11 @@ static int check_sch_bw(struct mu3h_sch_bw_info *sch_bw, min_bw = worst_bw; min_index = offset; } + + /* use first-fit for LS/FS */ + if (sch_ep->sch_tt && min_index >= 0) + break; + if (min_bw == 0) break; }