From patchwork Thu May 6 06:31:14 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: 12241693 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.4 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 A575AC433B4 for ; Thu, 6 May 2021 06:41:12 +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 E88CD613FC for ; Thu, 6 May 2021 06:41:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E88CD613FC 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=bE+7BU+cu0pxPrweZUVf4W7YROydEvmsc4ej5C1rozc=; b=Eawa+PVi+BE/eRMWUNDP2jLcj4 CtZDhQ9C3k4Y/PLcHxQqWSbUM3FDMXKkaB6mLHS4YqdvgcsblDZZs/Ea0rM0rfKPHpEqvyRSMYPtj t+KisD87XAURF0nrF3dLdc1L8R+4swKFeS8y/yu43vs7WJx5OUX8uczuJSooJQsPHk7/yRIgfnRZI gzIewytOHWVgNFpnpP+UdBN8pga0Jp+nT2Kfe+tUnkXsZeN6eZKFhWZiWEzAXImvYePH4XEFu5auU mHABslIJlynGLiGQn8HwVLD53DXjiRjmx8gkzBHTFuo2lMMQCBGDjfNYObnVxZPG+rMTPL4vbwrsU pmtw5VUA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leXgv-003Ndp-I2; Thu, 06 May 2021 06:40: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 1leXgt-003Nd8-5c; Thu, 06 May 2021 06:40:55 +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=Hc2YI+k0mZJeZmLULqDvLIblaEdxyUoLhtz9yHbho8g=; b=4a34wn1IK25hVg7I4EVJbXtAFJ v+vq2FFpvjF7D2mG8nYviqePykiRPAl9biNbwhaSZTnHYe54ou0NJK+lZiTMwDL8LXn7quyZ6914o Ps6om2GEjzXGl/9Nr1J9ArXU5s6rADBZ6A62nYx2E0Fhk8YzTAsNzD4lq8EJ/XWt8FQyokxJ9E13K 3Fm3QmMepBKLHeDAtwXOpeQAj9B+WEAqq8+0xcEdw7v8Z1oD9zNNtuGAuxplkAAi8O14zYo9HxO9v VR5VSHJAl6INyxL6ZO9lHEK7E7trOTdZvzycmBDKPkWhcHWluQ4idizB/pkLKMB/CrJwUOT/s5VCM VVCV9Y8w==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leXgp-005dqK-RA; Thu, 06 May 2021 06:40:53 +0000 X-UUID: eca81e1a748749c7b4684edb1d87e9c7-20210505 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=Hc2YI+k0mZJeZmLULqDvLIblaEdxyUoLhtz9yHbho8g=; b=d6ReaiKfQKqZX2nGvsYBMbbMEbaWFQSLIsStV0CKP3y8S7NFnxGK7aSkmSZI70P11BO8wAaI0kWMtY/6IfK1Vy3Mxe6xpZxYzuTAWpbMzKCjVvXlsenWMnbJXXAv06EQXsNf7vMW09CMkptl8plJ/9lRQnqf4P5FgmaW3OJ4vbc=; X-UUID: eca81e1a748749c7b4684edb1d87e9c7-20210505 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 432064062; Wed, 05 May 2021 23:40:49 -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; Wed, 5 May 2021 23:31:19 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 6 May 2021 14:31:17 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 6 May 2021 14:31:17 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , "Ikjoon Jang" , Eddie Hung Subject: [PATCH v2 1/3] usb: xhci-mtk: use bitfield instead of bool Date: Thu, 6 May 2021 14:31:14 +0800 Message-ID: <20210506063116.41757-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-20210505_234051_909973_F5072EFD X-CRM114-Status: GOOD ( 13.75 ) 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 Refer to coding-style.rst 17) Using bool: "If a structure has many true/false values, consider consolidating them into a bitfield with 1 bit members, or using an appropriate fixed width type, such as u8." Due to @has_ippc's default vaule is 0, no need set it again if fail to get ippc base address Signed-off-by: Chunfeng Yun --- v2: add more changelog suggested by Greg --- 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 Thu May 6 06:31:15 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: 12241691 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.4 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 89B79C433B4 for ; Thu, 6 May 2021 06:34:07 +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 CCB3B613F0 for ; Thu, 6 May 2021 06:34:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCB3B613F0 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=XvTADVk7sZZ96IlDxta/qu2k4/piQvFKgnnCnx1+tEs=; b=rRCPU8lO3qp7GTRNyBMGjjkqQ mUJvg9rTeexBcNBCkDhPb4lzF479w/AR2PwQTtEKp8KuYlvYQV+/E7fkQOSlHKTm2bQmgSQoeX7ZH C/z4QyKnbWgeQ5u09A1ZjzKBizC65BqHE4QqwIOTWn+ey3Uac1F5Ci7R1IuymhZ/LQxtnQW1fGSuU pBu6ROWuxHfSouTWaWNEvoNtORMGSZpU+fKpffk1YcZOYgJoVPYvvGUUj2aPRGDtCK+sTgRARBQSk p4OI8vRmNtuhAnMAkNQPU1BJIkKnLVfzU8PYgp35uqrnTKlEEXfm/j4Xb9TjGZzzaxlfBpyJeRLyH l4heaxsjQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leXa5-003MOM-Hz; Thu, 06 May 2021 06:33:53 +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 1leXZx-003MMV-W3; Thu, 06 May 2021 06:33:47 +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=MP0PGyz5YTtUzND2VJqFK7YRtkCiKYMQafog4a/V00M=; b=BNPEBtd8KaS1p8GL3R64SB0WwN 33j+XTsctfEBb/u8PXC8p5ioZgdUBckR77ifCtH9/pPKcGiewV0+dHLmRrba+wSyqbZejeGmvkrOZ LjcfN+gfJsyaQLaKXhnIt98xidwHtK48yGZf1TixbwoUJqvDqWtuelW0gs52N7yiwEHXvkU/eN5Xx xUKxW86eznkT7UzUqHV5Ab87PrcKxZmoqs8a3XOdUB7HmO7BMzpQ5WWIEWRDkAyJF2+xMAB8ghLlS +EOJOgiXWbG33bVQO+wvOuMoGJEGic4XiuKflpbtEw7SDJe0uQrVBihEuiU8j0WhNrWLtP0nFVXD/ qAArBMAA==; Received: from mailgw02.mediatek.com ([216.200.240.185]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leXZv-005dYT-15; Thu, 06 May 2021 06:33:44 +0000 X-UUID: b6d110111f604397b6c1cce3f4523faa-20210505 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=MP0PGyz5YTtUzND2VJqFK7YRtkCiKYMQafog4a/V00M=; b=kaF+qx1CIX/M+1WWjV8c4rsu5HMSltZxDbtPrpMuRwF1nVgwkts49jRgscfPwdBAet79lMNMNaG6LaoSoNjzvN1Aou63uXGOcmQsI9w8UtbVqxMZ3jKnoGRO8ClEpCWtaxXwsK+B8uCq+gcslf6Gz+OrzzAPnhbrqG18CdyLmyE=; X-UUID: b6d110111f604397b6c1cce3f4523faa-20210505 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1188551599; Wed, 05 May 2021 23:33:41 -0700 Received: from MTKMBS06N2.mediatek.inc (172.21.101.130) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 5 May 2021 23:31:20 -0700 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; Thu, 6 May 2021 14:31:18 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 6 May 2021 14:31:17 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , "Ikjoon Jang" , Eddie Hung Subject: [PATCH v2 2/3] usb: xhci-mtk: remove unnecessary assignments in periodic TT scheduler Date: Thu, 6 May 2021 14:31:15 +0800 Message-ID: <20210506063116.41757-2-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210506063116.41757-1-chunfeng.yun@mediatek.com> References: <20210506063116.41757-1-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 3AD3668E849FEE7EE933129F7B2DD64AFC12A0E253AB5CFDDB7F0114C4F524AB2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210505_233343_097487_896CEA13 X-CRM114-Status: GOOD ( 13.32 ) 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 --- v2: no changes --- 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 Thu May 6 06:31:16 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: 12241695 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.4 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 C4210C433ED for ; Thu, 6 May 2021 06:41: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 792FB613F6 for ; Thu, 6 May 2021 06:41:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 792FB613F6 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=+m0B0G+/AEAI7uFmEu2KuxEnoZMZYqrZNQmqHb//R1M=; b=DYTHzGs0xwNJuUVCuPNqRI2W2 fbUvh6DL8y+sERxmLCN1Wi3XuOle3Xi/9z8O+3FLJQBUY1IUskkKtvdWM2wn9PyUFFMk9YU0NK0FI ayBK4gDfPAe6Z7t9E/u2ANyFuDbzUUlbyJ4QrCH7KCh9SdfnEJoqvKJANKBaMr4wTyXp/cW7cRGuJ T1MB1H9O8lXJn1cb89alhgZkhTQPJ+w4uveciZicEl1KPSi0FhQHu+naJAkwk3Yhxjh3Fm3sIg1h6 RgKxHKTc/BoQtqG0f2LoLLjg9vFsz2jlBwQYtWCwYt3YJ55cxJHls00jzp/8vJ1qrFNK6ijZWxZO5 llX1wi+BQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leXgx-003NeB-FA; Thu, 06 May 2021 06:40:59 +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 1leXgt-003NdB-5k; Thu, 06 May 2021 06:40:55 +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=raXcjZ3WzvPOm6XVb1ur/e0/EIhGyxl0cImjeLyeEZk=; b=2hYbgAnlNTlqLA5Ub69/VowLh8 HnfcI2dxFqMRHyDX/79gUFGF1i84LdnsflIZJS+MSsFe0EnZYA4ruRL1CTHPcAw/Ad8CNgio0LdjP IksR1nv9CfS51ZLpPhMfqzSZ/CkxMRa2pTxIXO5bXFT+b+srn54GljUHv4RFLwMiDY4Csv++Rr+wV v4VDgXDHVufHXvNFy3lNL8EirBdm6wraq/O+899w0UTflD5NgD0ICBq+tR8Swk5aI3zT4FgV318iH LaCCo6kiB1O07TYVGP/7l2xf1YjD9atCatWsarIou7A5dhu9KcEW7j1HHqJ60Qbq0EYsUZpNAvVID gxYN447Q==; Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leXgq-005dqb-C4; Thu, 06 May 2021 06:40:53 +0000 X-UUID: 07a129debbef401cb280024d654e88d5-20210505 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=raXcjZ3WzvPOm6XVb1ur/e0/EIhGyxl0cImjeLyeEZk=; b=KKz387QZTG3TFi9A961K0HqXdZoJsbhc2+VzbbAtZBFSZ+sDyDenh+EauSbUB0QNMMPIkl9N3Ka0W2VzFUVinZBXXdMJpHqvzc/BgT8LbaCw5zlx3KKYRMXDdPP9D+ZZ3OCzMi7mfgArqOgFs5fY+gHBwQeopk1DH2/JcLmLqFc=; X-UUID: 07a129debbef401cb280024d654e88d5-20210505 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 241223364; Wed, 05 May 2021 23:40:49 -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; Wed, 5 May 2021 23:31:19 -0700 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 6 May 2021 14:31:18 +0800 Received: from mtkslt301.mediatek.inc (10.21.14.114) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 6 May 2021 14:31:18 +0800 From: Chunfeng Yun To: Mathias Nyman CC: Chunfeng Yun , Greg Kroah-Hartman , Matthias Brugger , , , , , "Ikjoon Jang" , Eddie Hung Subject: [PATCH v2 3/3] usb: xhci-mtk: use first-fit for LS/FS Date: Thu, 6 May 2021 14:31:16 +0800 Message-ID: <20210506063116.41757-3-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210506063116.41757-1-chunfeng.yun@mediatek.com> References: <20210506063116.41757-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-20210505_234052_434839_901A3F75 X-CRM114-Status: GOOD ( 10.58 ) 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 --- v2: no changes --- 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; }