From patchwork Mon Jul 27 07:14:50 2020 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: 11686439 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53D54138C for ; Mon, 27 Jul 2020 07:20:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 2ADA420759 for ; Mon, 27 Jul 2020 07:20:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="gYg2qcIg"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="NhbC8WoI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2ADA420759 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject: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=OOYqNwT+bK2DYDYl9l0D4c2kdNBlcST9EYoW22sN9Qk=; b=gYg2qcIgEW/oJhC+T43ymf+6aR bB0CX7M2mFMIwYvh7iCjsnyZQJhLaHn9q1jPi/DcEesi+mTdUSun1J2GCOe2jBrBEOGbKnvV2xKwD dUe+06+a23RtsO6aiuQGnLf7PT1i/sdyQD3Acr64fC9i+OYmZU4bdoRCBhWipjymqb0eZ3iLVQmLA VzP6NWBQhohBG5XiDkY7TcBbF7SYEizPGcnkxfO3n1tD4sPdi1eC96aM4kJd4bpo6gWSmyBPiszk+ KAlnLOrht4Tlxc46f2jOSfXVfnsFNYFYzHJhFIZsFWYj7dEYMqEBf2o+DLp0ktGz2Enlin+NhcrvM 6Ev9lPkg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPT-0006zU-Qk; Mon, 27 Jul 2020 07:18:55 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPP-0006we-2l; Mon, 27 Jul 2020 07:18:52 +0000 X-UUID: 3f253ffedb38491985706ff8d4a257af-20200726 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=CEB+Fd7Gn3H8VZZKWasR7hc+Jw+O8wMVPt6wPu9YgD4=; b=NhbC8WoIzbSfZfcsGRmoI/1hXw/fTejFXPXziqyJFvQJNPw+GrGIOFC1xBZ27vIOf2SdsXYwvoj/1lFstm312qnSXcYRtuI/ARn9SCgbtd2coV01Mz2g/RMK0gu1SJ3RyUHmTG2vGE17rb7MbXhaMRGgm3DQzf5ZUJBZGaod8Kw=; X-UUID: 3f253ffedb38491985706ff8d4a257af-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1493762560; Sun, 26 Jul 2020 23:18:50 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:39 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:31 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:31 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 01/11] usb: mtu3: remove unnecessary pointer checks Date: Mon, 27 Jul 2020 15:14:50 +0800 Message-ID: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_031851_275706_8CD3FAAD X-CRM114-Status: GOOD ( 12.53 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The class driver will ensure the parameters are valid pointers before call the hook function of usb_ep_ops, so no need check them again. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_gadget.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c index f93732e..6b26cb8 100644 --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -263,23 +263,15 @@ void mtu3_free_request(struct usb_ep *ep, struct usb_request *req) static int mtu3_gadget_queue(struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) { - struct mtu3_ep *mep; - struct mtu3_request *mreq; - struct mtu3 *mtu; + struct mtu3_ep *mep = to_mtu3_ep(ep); + struct mtu3_request *mreq = to_mtu3_request(req); + struct mtu3 *mtu = mep->mtu; unsigned long flags; int ret = 0; - if (!ep || !req) - return -EINVAL; - if (!req->buf) return -ENODATA; - mep = to_mtu3_ep(ep); - mtu = mep->mtu; - mreq = to_mtu3_request(req); - mreq->mtu = mtu; - if (mreq->mep != mep) return -EINVAL; @@ -303,6 +295,7 @@ static int mtu3_gadget_queue(struct usb_ep *ep, return -ESHUTDOWN; } + mreq->mtu = mtu; mreq->request.actual = 0; mreq->request.status = -EINPROGRESS; @@ -335,11 +328,11 @@ static int mtu3_gadget_dequeue(struct usb_ep *ep, struct usb_request *req) struct mtu3_ep *mep = to_mtu3_ep(ep); struct mtu3_request *mreq = to_mtu3_request(req); struct mtu3_request *r; + struct mtu3 *mtu = mep->mtu; unsigned long flags; int ret = 0; - struct mtu3 *mtu = mep->mtu; - if (!ep || !req || mreq->mep != mep) + if (mreq->mep != mep) return -EINVAL; dev_dbg(mtu->dev, "%s : req=%p\n", __func__, req); @@ -379,9 +372,6 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value) unsigned long flags; int ret = 0; - if (!ep) - return -EINVAL; - dev_dbg(mtu->dev, "%s : %s...", __func__, ep->name); spin_lock_irqsave(&mtu->lock, flags); @@ -424,9 +414,6 @@ static int mtu3_gadget_ep_set_wedge(struct usb_ep *ep) { struct mtu3_ep *mep = to_mtu3_ep(ep); - if (!ep) - return -EINVAL; - mep->wedged = 1; return usb_ep_set_halt(ep); From patchwork Mon Jul 27 07:14:51 2020 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: 11686451 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE249138C for ; Mon, 27 Jul 2020 07:20:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 91C502070B for ; Mon, 27 Jul 2020 07:20:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MtZMvZEl"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="ffJU8tt9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91C502070B 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7nP3OWlqc8aeT/1R1Jlgj+jIBiVOBnNQoB1xJc4rtZ0=; b=MtZMvZElrdcb92uHkGc6JKjCY R/L3+vyrMDifnUzGOEScwA7ESbA/qpRHqOvQKTHFWSgIIUoSLMR4KgyE7vpEgaukI1d0OWnz1dZzq FMFkhN5qL93+XKNqftU3K6uoMCtV1+MiQEq+ZaEsp+BAvVbgMLbU473nXc/KZ/BG8UroUFPT4Ir0Q StUpOWHyQRaiAcYKhPrzXvH8H5Ul40XBV4dmSQtiysIu1vryz1dXEwmIH3N+wOkN+5zW/objuW3/w 8j4+tsEEeoH2mAaXV9hzdYxqAp84P37foBiCY2XnmX/HpC56FXfbEIvhMzap7cjXfEv/DqYV3Oc/0 qWxFr5Quw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxQ7-0007Fs-Po; Mon, 27 Jul 2020 07:19:35 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPS-0006wk-00; Mon, 27 Jul 2020 07:18:55 +0000 X-UUID: 0a2bad32be37485d84fadf4c9db7a8dd-20200726 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=cT1WlsLUGadWMwBtxpHqluQ3CTv7OXKHJE51u/qqiR0=; b=ffJU8tt9gjO5ysNhJR0D0NOamzGGw6B6TJwIqkrtKGdKUQxeJ9Cp0ASmNcP8mHNpvzvLY9MUdeKj6bed/u2Ad4Q6xCQZD7zgDQBSHtKXnZC0GMKh9yT6E3FhppTdNcLg1hUiG84QtMtl5kNoya4uKJF8YPNXWaWAsvY9djN/9c4=; X-UUID: 0a2bad32be37485d84fadf4c9db7a8dd-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 2024944187; Sun, 26 Jul 2020 23:18:50 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:35 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:32 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:32 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 02/11] usb: mtu3: fix macro for maximum number of packets Date: Mon, 27 Jul 2020 15:14:51 +0800 Message-ID: <1595834101-13094-2-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: BFE475CE3B7308DA5BFF6C69C0D03ED50AC43C3E69D2EFCF840EA10C6840A9D72000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_031854_215432_339B0956 X-CRM114-Status: GOOD ( 10.14 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The bits field for maximum number of packets is 8 bits. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_hw_regs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_hw_regs.h b/drivers/usb/mtu3/mtu3_hw_regs.h index bf34f78..072db1f 100644 --- a/drivers/usb/mtu3/mtu3_hw_regs.h +++ b/drivers/usb/mtu3/mtu3_hw_regs.h @@ -134,7 +134,7 @@ #define TX_W1C_BITS (~(TX_SENTSTALL)) /* U3D_TX1CSR1 */ -#define TX_MAX_PKT_G2(x) (((x) & 0x7f) << 24) +#define TX_MAX_PKT_G2(x) (((x) & 0xff) << 24) #define TX_MULT_G2(x) (((x) & 0x7) << 21) #define TX_MULT_OG(x) (((x) & 0x3) << 22) #define TX_MAX_PKT_OG(x) (((x) & 0x3f) << 16) @@ -173,7 +173,7 @@ #define RX_W1C_BITS (~(RX_SENTSTALL | RX_RXPKTRDY)) /* U3D_RX1CSR1 */ -#define RX_MAX_PKT_G2(x) (((x) & 0x7f) << 24) +#define RX_MAX_PKT_G2(x) (((x) & 0xff) << 24) #define RX_MULT_G2(x) (((x) & 0x7) << 21) #define RX_MULT_OG(x) (((x) & 0x3) << 22) #define RX_MAX_PKT_OG(x) (((x) & 0x3f) << 16) From patchwork Mon Jul 27 07:14:52 2020 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: 11686443 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E1A0138C for ; Mon, 27 Jul 2020 07:20:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 0515420759 for ; Mon, 27 Jul 2020 07:20:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bhBKFjI7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="tIlI/pf1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0515420759 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hzrS6J7LT2E4QgvwpbZgQPEEL1DccEZMOUH7VTD5zW4=; b=bhBKFjI7Dan6r5AWZQKVKzxY3 VCHHiug/Pbr921zD8Rd1cG6RwWgkaJMHQpIiKOdv80X2WQXOv2ITtwWuAME+zzdD1CyGh047XP57U eCRylVCLskjyKbpCKD1K5HYRa/bM9ADxWsSZOChtu0H/7JB/zdJTQjTwJ677woBckwn4jTXstUpd2 CVKF/6EMdhHQlNUTv3xUJnFWxOaqq0gNjJ2KYlpiRBJ2/H1n5FJHzMQ5nmqD7SYWMAoLEShWJvQa6 1T37FOG64ETFbG1CUT/9wzbLzuNTcClkGZP+KXcx9CNnzHvrsJvRVEWNWFYfFNf9iZm2nUpD6e8nR k4aMJvksg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPj-00074c-Pw; Mon, 27 Jul 2020 07:19:11 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPQ-0006wk-Lv; Mon, 27 Jul 2020 07:18:53 +0000 X-UUID: 8f9ddceb302e442c8e64db64b0c63a3c-20200726 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=vGu82nHZ1eK7p8zu/EU5mQ5CChjnL1RrS2qg9jkymsM=; b=tIlI/pf1oi7pNPi2jOT0FQSnltxH8uVxAQ9QjtA43gxlLFjAajCju7+ynQYmQbjuseVeS6cefCdgOp5p3HeOyUHHtHt3ge56BKcFsg+DznYdgzrJfsMoUsrNZPxMud2SwaCOWED8gzhkaCSgjt7OcRLSHFIIUcpfmR5tECUldvs=; X-UUID: 8f9ddceb302e442c8e64db64b0c63a3c-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1835340423; Sun, 26 Jul 2020 23:18:50 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:40 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:33 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:33 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 03/11] usb: mtu3: reinitialize CSR registers Date: Mon, 27 Jul 2020 15:14:52 +0800 Message-ID: <1595834101-13094-3-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-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-20200727_031852_882190_51239076 X-CRM114-Status: GOOD ( 14.53 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The CSR registers will be reset as default value if the ports are disabled, so reinitialize them when the ports are enabled again. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_core.c | 61 +++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index 9dd0216..f3ad1cc 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -202,6 +202,36 @@ static void mtu3_intr_enable(struct mtu3 *mtu) mtu3_writel(mbase, U3D_DEV_LINK_INTR_ENABLE, SSUSB_DEV_SPEED_CHG_INTR); } +static void mtu3_set_speed(struct mtu3 *mtu); + +/* CSR registers will be reset to default value if port is disabled */ +static void mtu3_csr_init(struct mtu3 *mtu) +{ + void __iomem *mbase = mtu->mac_base; + + if (mtu->is_u3_ip) { + /* disable LGO_U1/U2 by default */ + mtu3_clrbits(mbase, U3D_LINK_POWER_CONTROL, + SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE); + /* enable accept LGO_U1/U2 link command from host */ + mtu3_setbits(mbase, U3D_LINK_POWER_CONTROL, + SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE); + /* device responses to u3_exit from host automatically */ + mtu3_clrbits(mbase, U3D_LTSSM_CTRL, SOFT_U3_EXIT_EN); + /* automatically build U2 link when U3 detect fail */ + mtu3_setbits(mbase, U3D_USB2_TEST_MODE, U2U3_AUTO_SWITCH); + /* auto clear SOFT_CONN when clear USB3_EN if work as HS */ + mtu3_setbits(mbase, U3D_U3U2_SWITCH_CTRL, SOFTCON_CLR_AUTO_EN); + } + + mtu3_set_speed(mtu); + + /* delay about 0.1us from detecting reset to send chirp-K */ + mtu3_clrbits(mbase, U3D_LINK_RESET_INFO, WTCHRP_MSK); + /* enable automatical HWRW from L1 */ + mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE); +} + /* reset: u2 - data toggle, u3 - SeqN, flow control status etc */ static void mtu3_ep_reset(struct mtu3_ep *mep) { @@ -267,13 +297,7 @@ void mtu3_start(struct mtu3 *mtu) mtu3_clrbits(mtu->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN); - /* - * When disable U2 port, USB2_CSR's register will be reset to - * default value after re-enable it again(HS is enabled by default). - * So if force mac to work as FS, disable HS function. - */ - if (mtu->max_speed == USB_SPEED_FULL) - mtu3_clrbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE); + mtu3_csr_init(mtu); /* Initialize the default interrupts */ mtu3_intr_enable(mtu); @@ -572,39 +596,18 @@ static void mtu3_set_speed(struct mtu3 *mtu) static void mtu3_regs_init(struct mtu3 *mtu) { - void __iomem *mbase = mtu->mac_base; /* be sure interrupts are disabled before registration of ISR */ mtu3_intr_disable(mtu); mtu3_intr_status_clear(mtu); - if (mtu->is_u3_ip) { - /* disable LGO_U1/U2 by default */ - mtu3_clrbits(mbase, U3D_LINK_POWER_CONTROL, - SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE); - /* enable accept LGO_U1/U2 link command from host */ - mtu3_setbits(mbase, U3D_LINK_POWER_CONTROL, - SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE); - /* device responses to u3_exit from host automatically */ - mtu3_clrbits(mbase, U3D_LTSSM_CTRL, SOFT_U3_EXIT_EN); - /* automatically build U2 link when U3 detect fail */ - mtu3_setbits(mbase, U3D_USB2_TEST_MODE, U2U3_AUTO_SWITCH); - /* auto clear SOFT_CONN when clear USB3_EN if work as HS */ - mtu3_setbits(mbase, U3D_U3U2_SWITCH_CTRL, SOFTCON_CLR_AUTO_EN); - } - - mtu3_set_speed(mtu); + mtu3_csr_init(mtu); - /* delay about 0.1us from detecting reset to send chirp-K */ - mtu3_clrbits(mbase, U3D_LINK_RESET_INFO, WTCHRP_MSK); /* U2/U3 detected by HW */ mtu3_writel(mbase, U3D_DEVICE_CONF, 0); /* vbus detected by HW */ mtu3_clrbits(mbase, U3D_MISC_CTRL, VBUS_FRC_EN | VBUS_ON); - /* enable automatical HWRW from L1 */ - mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, LPM_HRWE); - /* use new QMU format when HW version >= 0x1003 */ if (mtu->gen2cp) mtu3_writel(mbase, U3D_QFCR, ~0x0); From patchwork Mon Jul 27 07:14:53 2020 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: 11686473 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 021721392 for ; Mon, 27 Jul 2020 07:28:32 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 CEAAE2070B for ; Mon, 27 Jul 2020 07:28:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="uk6b7fts"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="V7YgE5Ne" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEAAE2070B 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DczALYvi53E9Q88b0pF0qydJ26MukrGFZtV5bHGxoY0=; b=uk6b7fts5F3DZmm5hANtFdbkI Fh720q3/qePEqjxIOnnXKkc/miANpq13zT1eQDkIqgKpcNs5d69u7F+0psXngGbI5RAnCzqKAdDy0 g7ia4WW7p97D0GGNJGXpNwYcgJ4XpBg/9SNLpunSjEY8h604Y5yXViUE5mMa56kulZbymlKfxQZcE TExQa2N7deTP6mTWMR3kwKpCOLHBiooNdtYDc0iVXy7g4tn4Nff8GYAlhsIWUGyWaIwwsdsl6Q+BI PzBCXjXGWhsUlzh4SjnX2aT/SoayAhJL/F5LjPurhbtjmnbeJQyZrL0jSFoPxHjJUzjRGTimJdXYb qUzGeP8TA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxXF-0001Lm-OI; Mon, 27 Jul 2020 07:26:57 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxX0-0001F3-Fc; Mon, 27 Jul 2020 07:26:45 +0000 X-UUID: 6ee2e966a14245c8971aa2c81d40cb7b-20200726 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=x6c9apllsraX6rv/6S+rjbkHnvqPnQsJAwjR+kPcEbE=; b=V7YgE5NepMNABOjRneQAGmqaJSLYTMzm9BCgDDnyMqx9bR2AD/ji6+nD1PaHqdgIz81g6YamgS897siqayAtWJ6j3sA3D7iKRrYchh0d9E5IXBDWXcBQ+gg9/ZH4bLt0OPOHzndTJE1NG8Ksupou6c9tQyqPYgisckqau+6sLuM=; X-UUID: 6ee2e966a14245c8971aa2c81d40cb7b-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1529744953; Sun, 26 Jul 2020 23:26:45 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:36 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:35 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:35 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 04/11] usb: mtu3: clear interrupts status when disable interrupts Date: Mon, 27 Jul 2020 15:14:53 +0800 Message-ID: <1595834101-13094-4-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: A8C7A88285639417D4FD77E1C46961D26AEA72226E43EB7A31F8065F0DED3D7E2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_032642_700920_13751C62 X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org When disable interrupts, will also want to clear their status, ensure it by calling mtu3_intr_status_clear() in mtu3_intr_disable(). Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_core.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index f3ad1cc..ece5b3e 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -147,17 +147,6 @@ static void mtu3_device_reset(struct mtu3 *mtu) mtu3_clrbits(ibase, U3D_SSUSB_DEV_RST_CTRL, SSUSB_DEV_SW_RST); } -/* disable all interrupts */ -static void mtu3_intr_disable(struct mtu3 *mtu) -{ - void __iomem *mbase = mtu->mac_base; - - /* Disable level 1 interrupts */ - mtu3_writel(mbase, U3D_LV1IECR, ~0x0); - /* Disable endpoint interrupts */ - mtu3_writel(mbase, U3D_EPIECR, ~0x0); -} - static void mtu3_intr_status_clear(struct mtu3 *mtu) { void __iomem *mbase = mtu->mac_base; @@ -170,6 +159,18 @@ static void mtu3_intr_status_clear(struct mtu3 *mtu) mtu3_writel(mbase, U3D_LTSSM_INTR, ~0x0); /* Clear speed change interrupt status */ mtu3_writel(mbase, U3D_DEV_LINK_INTR, ~0x0); + /* Clear QMU interrupt status */ + mtu3_writel(mbase, U3D_QISAR0, ~0x0); +} + +/* disable all interrupts */ +static void mtu3_intr_disable(struct mtu3 *mtu) +{ + /* Disable level 1 interrupts */ + mtu3_writel(mtu->mac_base, U3D_LV1IECR, ~0x0); + /* Disable endpoint interrupts */ + mtu3_writel(mtu->mac_base, U3D_EPIECR, ~0x0); + mtu3_intr_status_clear(mtu); } /* enable system global interrupt */ @@ -312,7 +313,6 @@ void mtu3_stop(struct mtu3 *mtu) dev_dbg(mtu->dev, "%s\n", __func__); mtu3_intr_disable(mtu); - mtu3_intr_status_clear(mtu); if (mtu->softconnect) mtu3_dev_on_off(mtu, 0); @@ -600,7 +600,6 @@ static void mtu3_regs_init(struct mtu3 *mtu) /* be sure interrupts are disabled before registration of ISR */ mtu3_intr_disable(mtu); - mtu3_intr_status_clear(mtu); mtu3_csr_init(mtu); From patchwork Mon Jul 27 07:14:54 2020 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: 11686447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E831138C for ; Mon, 27 Jul 2020 07:20:47 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 4657820759 for ; Mon, 27 Jul 2020 07:20:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l/svxI1X"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="eIAnJEmw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4657820759 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=EFfXRpFUlg0DYn/E9mLOUy5b2wF2hJeUBBSG5RsD0jU=; b=l/svxI1X+cQujLbZQqeQAl/cx v524WUH9/sOn6lAYvmgs21N4oDAS1GEWYRvXSl89h8RRlwaGCxEUIR/szM5HKGIIX+m34OBzfz/82 5RW7qth6Igw728VTBeqYEJoFG63HCbrjARKEMmcT/8RmTjvxa5t2z17Mfpct47gUh5lw32vmwza2C SjKRqUVovtzE4HPZQi7QwqzsvL+ifGr7z4oaRITpaIQQmD7IOF5CEkUwF5z1tQbymtYdeK1IDtX3o cUeGo7HXI4aVjtRX33Y8Su0svbwuZXdcXKmDpTJIfoYvyeqko3aEJT1VhC2b1fB+e+275/5kMpRcJ bSZ9Ujt8g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPx-00079a-Ga; Mon, 27 Jul 2020 07:19:25 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPQ-0006we-Gm; Mon, 27 Jul 2020 07:18:53 +0000 X-UUID: 830a2bea1ef64c7cbeda42cdb424e455-20200726 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=udxjwRcR6H9qN2bTMph2UQxIL1NJUT+zyNYINSQ2gPM=; b=eIAnJEmw/GsQ+kdBEAbrFuvN5VbRhl/abdWJ0aYoCSY1tKRys6Mhm4pC0+3y/NSJQzB4qi+67CVz9oSgF1vmNR8KxSB4LysIORdwVa6TbtjtmoIvQEwPxQz24P/YUCjLKUSf6rTKgBHowFO7MXLKaDTpqUGc6Zenkl6CDlPz1+I=; X-UUID: 830a2bea1ef64c7cbeda42cdb424e455-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 2030236087; Sun, 26 Jul 2020 23:18:50 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:40 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:36 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:36 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 05/11] usb: mtu3: introduce a funtion to check maximum speed Date: Mon, 27 Jul 2020 15:14:54 +0800 Message-ID: <1595834101-13094-5-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-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-20200727_031852_744850_C98AEAE5 X-CRM114-Status: GOOD ( 13.47 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The max_speed got from DTS may be not supported by the hardware, so need check it, and assign a proper default value. And make it clear by introducing a funtion. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_core.c | 48 ++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index ece5b3e..9694813 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -573,9 +573,6 @@ static void mtu3_set_speed(struct mtu3 *mtu) { void __iomem *mbase = mtu->mac_base; - if (!mtu->is_u3_ip && (mtu->max_speed > USB_SPEED_HIGH)) - mtu->max_speed = USB_SPEED_HIGH; - if (mtu->max_speed == USB_SPEED_FULL) { /* disable U3 SS function */ mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN); @@ -761,6 +758,32 @@ static irqreturn_t mtu3_irq(int irq, void *data) return IRQ_HANDLED; } +static void mtu3_check_params(struct mtu3 *mtu) +{ + /* check the max_speed parameter */ + switch (mtu->max_speed) { + case USB_SPEED_FULL: + case USB_SPEED_HIGH: + case USB_SPEED_SUPER: + case USB_SPEED_SUPER_PLUS: + break; + default: + dev_err(mtu->dev, "invalid max_speed: %s\n", + usb_speed_string(mtu->max_speed)); + fallthrough; + case USB_SPEED_UNKNOWN: + /* default as SSP */ + mtu->max_speed = USB_SPEED_SUPER_PLUS; + break; + } + + if (!mtu->is_u3_ip && (mtu->max_speed > USB_SPEED_HIGH)) + mtu->max_speed = USB_SPEED_HIGH; + + dev_info(mtu->dev, "max_speed: %s\n", + usb_speed_string(mtu->max_speed)); +} + static int mtu3_hw_init(struct mtu3 *mtu) { u32 value; @@ -776,6 +799,8 @@ static int mtu3_hw_init(struct mtu3 *mtu) dev_info(mtu->dev, "IP version 0x%x(%s IP)\n", mtu->hw_version, mtu->is_u3_ip ? "U3" : "U2"); + mtu3_check_params(mtu); + mtu3_device_reset(mtu); ret = mtu3_device_enable(mtu); @@ -857,23 +882,6 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb) mtu->ssusb = ssusb; mtu->max_speed = usb_get_maximum_speed(dev); - /* check the max_speed parameter */ - switch (mtu->max_speed) { - case USB_SPEED_FULL: - case USB_SPEED_HIGH: - case USB_SPEED_SUPER: - case USB_SPEED_SUPER_PLUS: - break; - default: - dev_err(dev, "invalid max_speed: %s\n", - usb_speed_string(mtu->max_speed)); - /* fall through */ - case USB_SPEED_UNKNOWN: - /* default as SSP */ - mtu->max_speed = USB_SPEED_SUPER_PLUS; - break; - } - dev_dbg(dev, "mac_base=0x%p, ippc_base=0x%p\n", mtu->mac_base, mtu->ippc_base); From patchwork Mon Jul 27 07:14:55 2020 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: 11686455 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 614F0138C for ; Mon, 27 Jul 2020 07:21:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3345320738 for ; Mon, 27 Jul 2020 07:21:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="brmPxV7E"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="IeQC8Z1l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3345320738 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pHCI1C4GLu1tX+23CXAj6/lXbFENCcDhTCf5NjeX4JU=; b=brmPxV7EnLmOHtL0ZCjvDIze5 q7JrMkiAU8BKYgYVb4tAXjh+AR79GPapWcA5IkOfVonp5cWYduhVh80h+7kYZ21Uo9THMTprQY67j 5LRVJorZ546g6JviaN0goHgmUEk8H7dvMUesdquttH/GoNSdJ8WqLHc+Plznn9eOf1jNx6fXzL/zb F24sNawoGuFBQTyk5vy2nqQ1Ad43Dp1g3bBNdi08Mc8zQKocC8gO4ippL1Fi0L/O4JK9Lq/MhAN77 6v+nXOwWdvPMYPv8kqKb0yGWTh90AVv6TRTHWNvvqtNWprWvfsdTHXuARzlC3C39vJZev9ITdza5p QZt8zQZZw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxQL-0007MA-U3; Mon, 27 Jul 2020 07:19:49 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPT-0006we-RV; Mon, 27 Jul 2020 07:18:57 +0000 X-UUID: bcd87bd801214407a4e6fa8190f740db-20200726 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=R0PFD56iMUUiowOUwyB1KNj/knmrsfJF+Xf3HDW/OJs=; b=IeQC8Z1lS23jS0RO/jhG8gT8EtldQmBqZZNZczuBT5uvEzLF+G9HBFaPMCNt1yqb/34t/nAZ1a0mNBNnwk9+cWu371e0eJLOzDQ6XSTqRdLwzIt6Ps+DJ/5fbJh08Lk2icVOgIB/T5EDjf3bD56WdmOpEvzmpw56bnUhzkAsoU0=; X-UUID: bcd87bd801214407a4e6fa8190f740db-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 396134105; Sun, 26 Jul 2020 23:18:50 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:41 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:37 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:37 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 06/11] usb: mtu3: add ->udc_set_speed() Date: Mon, 27 Jul 2020 15:14:55 +0800 Message-ID: <1595834101-13094-6-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-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-20200727_031856_122056_2C1616D1 X-CRM114-Status: GOOD ( 16.12 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Make use of the method to make sure connect on speeds supported by the gadget driver. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3.h | 4 ++- drivers/usb/mtu3/mtu3_core.c | 68 +++++++++++++++++++++++++----------------- drivers/usb/mtu3/mtu3_gadget.c | 14 +++++++++ 3 files changed, 58 insertions(+), 28 deletions(-) diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h index d49db92..9d68f25 100644 --- a/drivers/usb/mtu3/mtu3.h +++ b/drivers/usb/mtu3/mtu3.h @@ -348,7 +348,8 @@ struct mtu3 { struct usb_gadget_driver *gadget_driver; struct mtu3_request ep0_req; u8 setup_buf[EP0_RESPONSE_BUF]; - u32 max_speed; + enum usb_device_speed max_speed; + enum usb_device_speed speed; unsigned is_active:1; unsigned may_wakeup:1; @@ -433,6 +434,7 @@ int mtu3_config_ep(struct mtu3 *mtu, struct mtu3_ep *mep, void mtu3_start(struct mtu3 *mtu); void mtu3_stop(struct mtu3 *mtu); void mtu3_dev_on_off(struct mtu3 *mtu, int is_on); +void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed); int mtu3_gadget_setup(struct mtu3 *mtu); void mtu3_gadget_cleanup(struct mtu3 *mtu); diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index 9694813..c875b22 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -203,7 +203,42 @@ static void mtu3_intr_enable(struct mtu3 *mtu) mtu3_writel(mbase, U3D_DEV_LINK_INTR_ENABLE, SSUSB_DEV_SPEED_CHG_INTR); } -static void mtu3_set_speed(struct mtu3 *mtu); +void mtu3_set_speed(struct mtu3 *mtu, enum usb_device_speed speed) +{ + void __iomem *mbase = mtu->mac_base; + + if (speed > mtu->max_speed) + speed = mtu->max_speed; + + switch (speed) { + case USB_SPEED_FULL: + /* disable U3 SS function */ + mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN); + /* disable HS function */ + mtu3_clrbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE); + break; + case USB_SPEED_HIGH: + mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN); + /* HS/FS detected by HW */ + mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE); + break; + case USB_SPEED_SUPER: + mtu3_clrbits(mtu->ippc_base, SSUSB_U3_CTRL(0), + SSUSB_U3_PORT_SSP_SPEED); + break; + case USB_SPEED_SUPER_PLUS: + mtu3_setbits(mtu->ippc_base, SSUSB_U3_CTRL(0), + SSUSB_U3_PORT_SSP_SPEED); + break; + default: + dev_err(mtu->dev, "invalid speed: %s\n", + usb_speed_string(speed)); + return; + } + + mtu->speed = speed; + dev_dbg(mtu->dev, "set speed: %s\n", usb_speed_string(speed)); +} /* CSR registers will be reset to default value if port is disabled */ static void mtu3_csr_init(struct mtu3 *mtu) @@ -225,8 +260,6 @@ static void mtu3_csr_init(struct mtu3 *mtu) mtu3_setbits(mbase, U3D_U3U2_SWITCH_CTRL, SOFTCON_CLR_AUTO_EN); } - mtu3_set_speed(mtu); - /* delay about 0.1us from detecting reset to send chirp-K */ mtu3_clrbits(mbase, U3D_LINK_RESET_INFO, WTCHRP_MSK); /* enable automatical HWRW from L1 */ @@ -280,13 +313,13 @@ void mtu3_ep_stall_set(struct mtu3_ep *mep, bool set) void mtu3_dev_on_off(struct mtu3 *mtu, int is_on) { - if (mtu->is_u3_ip && mtu->max_speed >= USB_SPEED_SUPER) + if (mtu->is_u3_ip && mtu->speed >= USB_SPEED_SUPER) mtu3_ss_func_set(mtu, is_on); else mtu3_hs_softconn_set(mtu, is_on); dev_info(mtu->dev, "gadget (%s) pullup D%s\n", - usb_speed_string(mtu->max_speed), is_on ? "+" : "-"); + usb_speed_string(mtu->speed), is_on ? "+" : "-"); } void mtu3_start(struct mtu3 *mtu) @@ -299,6 +332,7 @@ void mtu3_start(struct mtu3 *mtu) mtu3_clrbits(mtu->ippc_base, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN); mtu3_csr_init(mtu); + mtu3_set_speed(mtu, mtu->speed); /* Initialize the default interrupts */ mtu3_intr_enable(mtu); @@ -569,28 +603,6 @@ static void mtu3_mem_free(struct mtu3 *mtu) kfree(mtu->ep_array); } -static void mtu3_set_speed(struct mtu3 *mtu) -{ - void __iomem *mbase = mtu->mac_base; - - if (mtu->max_speed == USB_SPEED_FULL) { - /* disable U3 SS function */ - mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN); - /* disable HS function */ - mtu3_clrbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE); - } else if (mtu->max_speed == USB_SPEED_HIGH) { - mtu3_clrbits(mbase, U3D_USB3_CONFIG, USB3_EN); - /* HS/FS detected by HW */ - mtu3_setbits(mbase, U3D_POWER_MANAGEMENT, HS_ENABLE); - } else if (mtu->max_speed == USB_SPEED_SUPER) { - mtu3_clrbits(mtu->ippc_base, SSUSB_U3_CTRL(0), - SSUSB_U3_PORT_SSP_SPEED); - } - - dev_info(mtu->dev, "max_speed: %s\n", - usb_speed_string(mtu->max_speed)); -} - static void mtu3_regs_init(struct mtu3 *mtu) { void __iomem *mbase = mtu->mac_base; @@ -780,6 +792,8 @@ static void mtu3_check_params(struct mtu3 *mtu) if (!mtu->is_u3_ip && (mtu->max_speed > USB_SPEED_HIGH)) mtu->max_speed = USB_SPEED_HIGH; + mtu->speed = mtu->max_speed; + dev_info(mtu->dev, "max_speed: %s\n", usb_speed_string(mtu->max_speed)); } diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c index 6b26cb8..3d13129 100644 --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -577,6 +577,19 @@ static int mtu3_gadget_stop(struct usb_gadget *g) return 0; } +static void +mtu3_gadget_set_speed(struct usb_gadget *g, enum usb_device_speed speed) +{ + struct mtu3 *mtu = gadget_to_mtu3(g); + unsigned long flags; + + dev_dbg(mtu->dev, "%s %s\n", __func__, usb_speed_string(speed)); + + spin_lock_irqsave(&mtu->lock, flags); + mtu3_set_speed(mtu, speed); + spin_unlock_irqrestore(&mtu->lock, flags); +} + static const struct usb_gadget_ops mtu3_gadget_ops = { .get_frame = mtu3_gadget_get_frame, .wakeup = mtu3_gadget_wakeup, @@ -584,6 +597,7 @@ static int mtu3_gadget_stop(struct usb_gadget *g) .pullup = mtu3_gadget_pullup, .udc_start = mtu3_gadget_start, .udc_stop = mtu3_gadget_stop, + .udc_set_speed = mtu3_gadget_set_speed, }; static void mtu3_state_reset(struct mtu3 *mtu) From patchwork Mon Jul 27 07:14:56 2020 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: 11686457 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F1AD3138C for ; Mon, 27 Jul 2020 07:22:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 C8F532070B for ; Mon, 27 Jul 2020 07:22:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hdeU9rLd"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="jXOcOWcX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8F532070B 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1aPVB/n2a263usbdFkUfVmLc4LOWSpAcvpFcjLhHckg=; b=hdeU9rLda7a6BPa7Qf9hJPn+E uwcVfsdQjGZ1QO4RzOllmWI8MFejSCYCerx0Yu9Y8hGFXCHWBI9mefh14NL7IugToP3HFlFlFx7Fp yRzf79adOuZwr5KBMBKVsTRu7oH+7lVeJcxXLjsy63RHxgjc5SjwfMeiVtSavsr0anVkC2FscYxkH AdfPV/9Yl1WJrLBvn30XEqGV+/nO32DWhVsgiVvHHGY9Ui7LJdEfYWwL4SiAb+1OargjikPBxUEY8 rfQi3nHEeBIhUUDabK0maKAZanFzV6LtywP2yGvqkcvgfGZawb5qJL/0fXoHBLM/d/3fGwd1WHQ+c lwURgoYmQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxRI-0007si-2c; Mon, 27 Jul 2020 07:20:48 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxR7-0007ll-HM; Mon, 27 Jul 2020 07:20:38 +0000 X-UUID: cf2dcb5436e84e5888340bcb03cc88c9-20200726 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=ufjzZjNOHimcMX86Fnfqnwe5QrRh888Z/o+t/Lvqu3o=; b=jXOcOWcXga2m3FwL2ncjk9L+LprcPR6TvBrJfS1kK54uIRiivkSpW9fZsgo7z6zwqX/UG2HprZl9NZBzmND7Vb42ze7FpS+bkeSjZYH8wc2zSZS9mkzf23m302FWVhpDn5d7T/VyI8ltWQZemVXGb7kISCtOWtYJX2tWJ+NOXcQ=; X-UUID: cf2dcb5436e84e5888340bcb03cc88c9-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1543982542; Sun, 26 Jul 2020 23:20:33 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:40 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:38 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:39 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 07/11] usb: mtu3: remove repeated error log Date: Mon, 27 Jul 2020 15:14:56 +0800 Message-ID: <1595834101-13094-7-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: 00A026CDA25A030254C6AB9822EE2914ADBAA6D88F98B076D42B2123E33AE3752000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_032037_727148_5293DBF1 X-CRM114-Status: GOOD ( 10.58 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The caller already print error log. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_gadget.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c index 3d13129..2bc9a95 100644 --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -673,8 +673,6 @@ static void mtu3_gadget_init_eps(struct mtu3 *mtu) int mtu3_gadget_setup(struct mtu3 *mtu) { - int ret; - mtu->g.ops = &mtu3_gadget_ops; mtu->g.max_speed = mtu->max_speed; mtu->g.speed = USB_SPEED_UNKNOWN; @@ -685,11 +683,7 @@ int mtu3_gadget_setup(struct mtu3 *mtu) mtu3_gadget_init_eps(mtu); - ret = usb_add_gadget_udc(mtu->dev, &mtu->g); - if (ret) - dev_err(mtu->dev, "failed to register udc\n"); - - return ret; + return usb_add_gadget_udc(mtu->dev, &mtu->g); } void mtu3_gadget_cleanup(struct mtu3 *mtu) From patchwork Mon Jul 27 07:14:57 2020 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: 11686453 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10B9B138A for ; Mon, 27 Jul 2020 07:21:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 DAB6C2070B for ; Mon, 27 Jul 2020 07:21:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KFr7OS34"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="q4OJbjt1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAB6C2070B 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rPnMuKZw/B/5AiVE73amlLr8m6cEPCxBHBBgvDuXO1A=; b=KFr7OS34Mo2Vt91ZZ7TK/Faju bY+jSfg2anInAHOG1vRLSNrIuCwhhHaBrWQ1d0vVcC+jnS8rNy9NesNybWfK9rbumEjjKtImdDD+c 1gPe7OKxEiWz7YGTocyJ6dQKzD4Ekx+TbdrT9lyEfTLmazHlxoqU1aobzlB5Nwul3wzkOtKjbK8qG ZHUoC3am5Ynw/dZeC2YN5CArtuG59wIgZgRNZESCvc1kVtwTWfV6LTiTTUyZRjMbuOXj7CzFbftVV NKE731ybncgIC6x0g4tpMt0mtzHKwAsFU664rsvYUOoNyIW6KVjoXkB95BjALYb4lP+alw6RdE8Ng MRP+UwwMw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxQ2-0007DR-OB; Mon, 27 Jul 2020 07:19:30 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPR-0006we-Ua; Mon, 27 Jul 2020 07:18:55 +0000 X-UUID: 261cf3e125914686bd695afbf421cd3c-20200726 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=IOySdoF/dmmR5ME5Xkb3uJOwAvtUS4UDWtTsJzmoSt8=; b=q4OJbjt1MLYxwuBe+Ssk8MHXyRHATHDvsNnC/fAXHwkRHdjNFi1hicroGvKvrX4OcIti8NsVwYuDj9BdOBX0ZXHOR6r2AofYP4fqErsTgII/r9B8ph4d2V1+h/umDPp5S+IlbtPgU4gzhvI3Rg1iKd+A01ZRZDz7+Wh3FIQkJPU=; X-UUID: 261cf3e125914686bd695afbf421cd3c-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 193907932; Sun, 26 Jul 2020 23:18:50 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:41 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:39 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:39 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 08/11] usb: mtu3: remove useless member @busy in mtu3_ep struct Date: Mon, 27 Jul 2020 15:14:57 +0800 Message-ID: <1595834101-13094-8-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-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-20200727_031854_139417_8BB317B2 X-CRM114-Status: GOOD ( 10.63 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The member @busy in mtu3_ep struct is unnecessary, so remove it. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3.h | 1 - drivers/usb/mtu3/mtu3_gadget.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h index 9d68f25..8fd83bd 100644 --- a/drivers/usb/mtu3/mtu3.h +++ b/drivers/usb/mtu3/mtu3.h @@ -294,7 +294,6 @@ struct mtu3_ep { int flags; u8 wedged; - u8 busy; }; struct mtu3_request { diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c index 2bc9a95..ef9fcd5 100644 --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -17,7 +17,6 @@ void mtu3_req_complete(struct mtu3_ep *mep, { struct mtu3_request *mreq; struct mtu3 *mtu; - int busy = mep->busy; mreq = to_mtu3_request(req); list_del(&mreq->list); @@ -25,8 +24,6 @@ void mtu3_req_complete(struct mtu3_ep *mep, mreq->request.status = status; mtu = mreq->mtu; - mep->busy = 1; - trace_mtu3_req_complete(mreq); spin_unlock(&mtu->lock); @@ -40,14 +37,12 @@ void mtu3_req_complete(struct mtu3_ep *mep, usb_gadget_giveback_request(&mep->ep, &mreq->request); spin_lock(&mtu->lock); - mep->busy = busy; } static void nuke(struct mtu3_ep *mep, const int status) { struct mtu3_request *mreq = NULL; - mep->busy = 1; if (list_empty(&mep->req_list)) return; @@ -195,7 +190,6 @@ static int mtu3_gadget_ep_enable(struct usb_ep *ep, if (ret) goto error; - mep->busy = 0; mep->wedged = 0; mep->flags |= MTU3_EP_ENABLED; mtu->active_ep++; From patchwork Mon Jul 27 07:14:58 2020 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: 11686459 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CFD5138A for ; Mon, 27 Jul 2020 07:22:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 E63142070B for ; Mon, 27 Jul 2020 07:22:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="OFAwEaLG"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="NfzW4mAD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E63142070B 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rFyUEVY9dY/solLGs1V3xOsNerQZ7la17ES7ruHzwfQ=; b=OFAwEaLGVCeKTX9Es5XY33L7k 03UD1g+Dw1r5OJ3y6u3IHjctNuUPOzHWqaLqXhmQOtVdZheqxktLKJWGXl799atHKNQp3kj7k0r6Q oNs6cEYoCJ6lb7FoBCugpm0a89jlMqWKWUI4NWCTomNTTNvlTfEHTmRHmTKejfymW+BHIuV4ihvsa 8jIaCel6+IX7hJI++6xp9I4dg8gyyGpvxsjZJS6/yfsrW9SUiVWzbR7fusRyfiKGWW2Jqx36kw92F Xkcbd5kdnjI1Laz1IZiig7NBkQ4j8ntKXMpDu2Aeen79YzJQPlsG+Cxgpkaaeqntk4x416eblW9RQ ZGk/htpEg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxRP-0007yC-GK; Mon, 27 Jul 2020 07:20:55 +0000 Received: from mailgw02.mediatek.com ([216.200.240.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxR7-0007ly-HM; Mon, 27 Jul 2020 07:20:38 +0000 X-UUID: 8dc75aa203c74aa88394fb8d09aa275c-20200726 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=GCE0evIdyEqzM/0YYcavx+sGKjZL7yKWC2gJV9okxqg=; b=NfzW4mAD55T9PjCGc0eceoPjeAW1Pqn5KBP+vdbufqB0AqljVtrror1bNmluimdiDFEuWWxyJeysS1us9nXyOGP347rPSGZqEbaYEhN2YT4lrtEeBeTwlkqqWcK3UcwYhhKMpyZZRbUHZX7r29nxxCgOMACn5mcNgavyg1E9rTY=; X-UUID: 8dc75aa203c74aa88394fb8d09aa275c-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1653555852; Sun, 26 Jul 2020 23:20:33 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N2.mediatek.inc (172.29.193.42) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:41 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:40 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:40 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 09/11] usb: mtu3: use MTU3_EP_WEDGE flag Date: Mon, 27 Jul 2020 15:14:58 +0800 Message-ID: <1595834101-13094-9-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: EFF8B65C2BEBEA93AB9EB46D70B799355C8CC2F7183539089AC3D6D51822F01C2000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_032037_747164_4AA61BC8 X-CRM114-Status: GOOD ( 13.84 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use MTU3_EP_WEDGE flag instead of the member @wedged in mtu3_ep struct, then @wedged can be removed. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3.h | 1 - drivers/usb/mtu3/mtu3_gadget.c | 9 ++++----- drivers/usb/mtu3/mtu3_gadget_ep0.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/usb/mtu3/mtu3.h b/drivers/usb/mtu3/mtu3.h index 8fd83bd..71f4f02 100644 --- a/drivers/usb/mtu3/mtu3.h +++ b/drivers/usb/mtu3/mtu3.h @@ -293,7 +293,6 @@ struct mtu3_ep { const struct usb_endpoint_descriptor *desc; int flags; - u8 wedged; }; struct mtu3_request { diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c index ef9fcd5..73a8536 100644 --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -190,8 +190,7 @@ static int mtu3_gadget_ep_enable(struct usb_ep *ep, if (ret) goto error; - mep->wedged = 0; - mep->flags |= MTU3_EP_ENABLED; + mep->flags = MTU3_EP_ENABLED; mtu->active_ep++; error: @@ -219,7 +218,7 @@ static int mtu3_gadget_ep_disable(struct usb_ep *ep) spin_lock_irqsave(&mtu->lock, flags); mtu3_ep_disable(mep); - mep->flags &= ~MTU3_EP_ENABLED; + mep->flags = 0; mtu->active_ep--; spin_unlock_irqrestore(&(mtu->lock), flags); @@ -389,7 +388,7 @@ static int mtu3_gadget_ep_set_halt(struct usb_ep *ep, int value) goto done; } } else { - mep->wedged = 0; + mep->flags &= ~MTU3_EP_WEDGE; } dev_dbg(mtu->dev, "%s %s stall\n", ep->name, value ? "set" : "clear"); @@ -408,7 +407,7 @@ static int mtu3_gadget_ep_set_wedge(struct usb_ep *ep) { struct mtu3_ep *mep = to_mtu3_ep(ep); - mep->wedged = 1; + mep->flags |= MTU3_EP_WEDGE; return usb_ep_set_halt(ep); } diff --git a/drivers/usb/mtu3/mtu3_gadget_ep0.c b/drivers/usb/mtu3/mtu3_gadget_ep0.c index 563a0a2..0ca4721 100644 --- a/drivers/usb/mtu3/mtu3_gadget_ep0.c +++ b/drivers/usb/mtu3/mtu3_gadget_ep0.c @@ -417,7 +417,7 @@ static int ep0_handle_feature(struct mtu3 *mtu, handled = 1; /* ignore request if endpoint is wedged */ - if (mep->wedged) + if (mep->flags & MTU3_EP_WEDGE) break; mtu3_ep_stall_set(mep, set); From patchwork Mon Jul 27 07:14:59 2020 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: 11686471 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8647138A for ; Mon, 27 Jul 2020 07:28:31 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 9EEF82070B for ; Mon, 27 Jul 2020 07:28:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ZKwbmMY5"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="vAnnP6do" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EEF82070B 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j2SqI7AyEnadHBFGJm/nOXZi6K75z4P4a9piGQ5AWwg=; b=ZKwbmMY5xl44X1P0qJQ6UIj0x a8dQzB0O8XexBNWWnqQLnhKnxc5tDkFeqQGN6PG88ggEW9wX9539sN5ooy25G1cO9w0zNE535rN1a UfAJ1UuY9r1vuVPgaWJ+o8bxIHpuagBNUjvqDsnWiTZVTTfZFqpipBndTUQ4mb2VDiP8UBgoMLZfL FWc4yD6B0ft2TGdi5oBK+tOx5fCRJJrwbjLCBTvRGD9bNBxA4wEKK6QlP/b9k2AahZD9FsXk0npwB 1iVhvl8aS+Bdf56tnw6WmiNAiMbSYySrxAcdW8W2lwpbeq2OhsbtfKC3YhVWclcDbSOxyNgU1mu5q yQygNqHEw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxX6-0001HI-G4; Mon, 27 Jul 2020 07:26:48 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxX0-0001Em-32; Mon, 27 Jul 2020 07:26:43 +0000 X-UUID: 3dda4826677a4999b15b87d0866b10d6-20200726 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=dKMalhtdhFPPOdQozyVhSoiY/17guaRKov/u2gTo5Gk=; b=vAnnP6doSaYLjERbOiyUKH/Fe+AVwRRcFDJAbK/hPKlcNaKzhURF5j9aberKmFve7fswZAQPHDz2kvj3ue/RVI07pwtseVhBe+Jya4jvIFQV0cTSYAnNuDuIIitzaJYoBO+t+ACD8fYyYbV36FkDvb2I4uAVjb317S4G0Mtc0P8=; X-UUID: 3dda4826677a4999b15b87d0866b10d6-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1413872458; Sun, 26 Jul 2020 23:26:45 -0800 Received: from mtkmbs08n1.mediatek.inc (172.21.101.55) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:43 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:41 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:41 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 10/11] usb: mtu3: clear dual mode of u3port when disable device Date: Mon, 27 Jul 2020 15:14:59 +0800 Message-ID: <1595834101-13094-10-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-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-20200727_032642_339238_14B0BDE8 X-CRM114-Status: GOOD ( 10.75 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If not clear u3port's dual mode when disable device, the IP will fail to enter sleep mode when suspend. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c index c875b22..a9c5c32 100644 --- a/drivers/usb/mtu3/mtu3_core.c +++ b/drivers/usb/mtu3/mtu3_core.c @@ -131,8 +131,12 @@ static void mtu3_device_disable(struct mtu3 *mtu) mtu3_setbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_DIS | SSUSB_U2_PORT_PDN); - if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) + if (mtu->ssusb->dr_mode == USB_DR_MODE_OTG) { mtu3_clrbits(ibase, SSUSB_U2_CTRL(0), SSUSB_U2_PORT_OTG_SEL); + if (mtu->is_u3_ip) + mtu3_clrbits(ibase, SSUSB_U3_CTRL(0), + SSUSB_U3_PORT_DUAL_MODE); + } mtu3_setbits(ibase, U3D_SSUSB_IP_PW_CTRL2, SSUSB_IP_DEV_PDN); } From patchwork Mon Jul 27 07:15:00 2020 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: 11686441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69AE0138A for ; Mon, 27 Jul 2020 07:20:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3F37020759 for ; Mon, 27 Jul 2020 07:20:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iOMymSv/"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="f8QOemF0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F37020759 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-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=hd+gLgtfa+0sigyle6taJOrJejRXfCF9nNmhSoFRpug=; b=iOMymSv/jW2E4NuQR5zqF5L1D CSiMXN/lcMJm4G+ewdTXO/nlT5RCkGmRZMCouZycHQsS5nx7oTTDzA5ruSoVxEr1GOSIx4ThsWYwl hq/KXv1BSDIg8XbhT5O4RsLrDfUTvpuBbHb/O37BqgGf2iGNh2yr8xzFoYND86wf0CI/Sv+xT5n5J K2RrgF7RebNtg5OQC7+TbmheG86lX2LveRcWwu76oBW+w324TAV86hHFWP3etWQWZlIYVxo6iNTqc RkopEivUya8jleM6C9nBOKK8UOtiTCFD329WvRwe/CC70o/3NiigynwdP0yMsWmFD2XTxEU60sTBI kDXmpiETw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPX-00070s-E0; Mon, 27 Jul 2020 07:18:59 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxPP-0006wk-2G; Mon, 27 Jul 2020 07:18:52 +0000 X-UUID: 0d7e52adc4314189afa57c0c280ed589-20200726 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=kMaydL2v9BshbyUReMb3wcjNfslH3HmUZia9G0XRnJc=; b=f8QOemF0Ybi/R3Y2gLV5RrHQgGd+/QS0DvA6FC9LbwHengawHYgF+FJWwfSogANP+W+OqSti5+7s1a33onQGtna3AAXxOFSlbAVpbudpfpxOSTqgEBQm1DNSW0SmDrRm32K7zgh6/Btvths5HYA6bSJBIQPp4iCdJTmGtT7yw/U=; X-UUID: 0d7e52adc4314189afa57c0c280ed589-20200726 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 714515834; Sun, 26 Jul 2020 23:18:50 -0800 Received: from mtkmbs08n2.mediatek.inc (172.21.101.56) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 00:16:44 -0700 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n2.mediatek.inc (172.21.101.56) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 27 Jul 2020 15:16:43 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 27 Jul 2020 15:16:43 +0800 From: Chunfeng Yun To: Felipe Balbi , Greg Kroah-Hartman Subject: [PATCH 11/11] usb: mtu3: simplify mtu3_req_complete() Date: Mon, 27 Jul 2020 15:15:00 +0800 Message-ID: <1595834101-13094-11-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> References: <1595834101-13094-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 X-TM-SNTS-SMTP: B2FBB65A761F5069A6267965A8BC72CF8580797430EE14138B9473B4676492382000:8 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_031851_245643_69A46309 X-CRM114-Status: UNSURE ( 9.05 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eddie Hung , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Chunfeng Yun , linux-mediatek@lists.infradead.org, Matthias Brugger , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Use argument req directly instead of mreq->request, they are the same usb request. Signed-off-by: Chunfeng Yun --- drivers/usb/mtu3/mtu3_gadget.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/usb/mtu3/mtu3_gadget.c b/drivers/usb/mtu3/mtu3_gadget.c index 73a8536..1de5c9a 100644 --- a/drivers/usb/mtu3/mtu3_gadget.c +++ b/drivers/usb/mtu3/mtu3_gadget.c @@ -15,15 +15,13 @@ void mtu3_req_complete(struct mtu3_ep *mep, __releases(mep->mtu->lock) __acquires(mep->mtu->lock) { - struct mtu3_request *mreq; - struct mtu3 *mtu; + struct mtu3_request *mreq = to_mtu3_request(req); + struct mtu3 *mtu = mreq->mtu; - mreq = to_mtu3_request(req); list_del(&mreq->list); - if (mreq->request.status == -EINPROGRESS) - mreq->request.status = status; + if (req->status == -EINPROGRESS) + req->status = status; - mtu = mreq->mtu; trace_mtu3_req_complete(mreq); spin_unlock(&mtu->lock); @@ -31,11 +29,10 @@ void mtu3_req_complete(struct mtu3_ep *mep, if (mep->epnum) usb_gadget_unmap_request(&mtu->g, req, mep->is_in); - dev_dbg(mtu->dev, "%s complete req: %p, sts %d, %d/%d\n", mep->name, - req, req->status, mreq->request.actual, mreq->request.length); - - usb_gadget_giveback_request(&mep->ep, &mreq->request); + dev_dbg(mtu->dev, "%s complete req: %p, sts %d, %d/%d\n", + mep->name, req, req->status, req->actual, req->length); + usb_gadget_giveback_request(&mep->ep, req); spin_lock(&mtu->lock); }