From patchwork Tue Jun 23 03:09:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11619665 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 6EAFD60D for ; Tue, 23 Jun 2020 03:09:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C2AE207BC for ; Tue, 23 Jun 2020 03:09:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="TSjw+W8T" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731930AbgFWDJN (ORCPT ); Mon, 22 Jun 2020 23:09:13 -0400 Received: from mail-am6eur05on2060.outbound.protection.outlook.com ([40.107.22.60]:38126 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731690AbgFWDJM (ORCPT ); Mon, 22 Jun 2020 23:09:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QoQVHOcgY+CjtHt8xNpa04vLLJYZxgjcM0X5sGsAv4ZxifIKjGKvcZZFbTnGgASQmBJVS9mxBB5J9IhY61rkgUf9mXsLw7d8txcDFKhq0etK0ZHb9j9BzzGYdrdSxYQqWTPpFTYRa28a21MexiR0awogcdK4HOdZCbeLBCzd9Gc1GS4lN2T0j9bd5m4JNT/7OLZHXDAus+JeVgk8sVt2Om0wPRn8xjNdyMfk0F9QBGKmexkZy6DHBfJl02VrgRbfb0WMoSLCVEqRt0O8j+QK2fBIlkOeF2rkwZ4jH3w4S5iUV3jK3HyZGDqw81iQhxGihjtd09vblbcNY7GLwxIsNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R60Q3zQXyLF0pY1ylTobYrl09+PDICmnewOEQkS1a7U=; b=NJfnbycg71HVv/5X27hlnY6mYIP9wGEL/4HuoVGEWUy4Hei1xnsLOcil8dTdspaiqd1aTzyZfCDaw2eEvEttOIte1LefeSgWuz1ukeFUL7kh51TVWLoN8+PhSuuNax5IOa4y4OOxzF6DUXAkAuI4nE5Yfbkc45IsdnxDIxP1wjzR9PoPr2TPucUVf+3UBxDjIpaWlfnQRSzcDnGxrqdv6k29HXeOwTPaHGo/UpARjuar1cuhy73bX3AoVlxJIrbrQ2XWkbH6KVSQuCqzZRS4CDvII6AQrI/8NeGwEYrijMw+5nASJ5QHI8iPgvT6Ab0OT9Izjm+iDJpntsawSZcuQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R60Q3zQXyLF0pY1ylTobYrl09+PDICmnewOEQkS1a7U=; b=TSjw+W8TzRYVm+nGxbV/rj9LxCydK8FXnr4f85EGl0ht3vc9HcGZ/hJsiqLk8HX0iEt5xnDvHLVtb0uDg46j17tQVltqh9wzjvcsqhZm36hoh+8sU45I2PsS7CQXrj1ri4j5cONCaZca+j+TmRQPJNsWD1ZJuxMYNWZSvFHYf/8= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) by AM7PR04MB6854.eurprd04.prod.outlook.com (2603:10a6:20b:10c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Tue, 23 Jun 2020 03:09:09 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3109.027; Tue, 23 Jun 2020 03:09:09 +0000 From: Peter Chen To: balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, pawell@cadence.com, rogerq@ti.com, jun.li@nxp.com, Peter Chen , stable@vger.kernel.org Subject: [PATCH 1/3] usb: cdns3: ep0: fix the test mode set incorrectly Date: Tue, 23 Jun 2020 11:09:16 +0800 Message-Id: <20200623030918.8409-2-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200623030918.8409-1-peter.chen@nxp.com> References: <20200623030918.8409-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR06CA0189.apcprd06.prod.outlook.com (2603:1096:4:1::21) To AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.67) by SG2PR06CA0189.apcprd06.prod.outlook.com (2603:1096:4:1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21 via Frontend Transport; Tue, 23 Jun 2020 03:09:06 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.67] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 43390d82-8b61-4aeb-90e5-08d81722cc07 X-MS-TrafficTypeDiagnostic: AM7PR04MB6854: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-Forefront-PRVS: 04433051BF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P+dp7F0jVJj2cHjEL99ilC64yWrFW8RwXtTI9q6ZNZAf8gjI4QthWMb1kwqG2cmJiFPI5fRXOwqB45fr9biZ2yQKQtcqSb06cLvLI6qnlJe4HFrNbCC8KsWIDKKqEw26Z8jyMi5KBCyp8NwuPi3bAIA6cpen3N69NzwlZtFpUIDzBEuz0cmaKvnEmrDmbv04EYaoLybIMIN37+GOdjNQ82zyP5xsEmenGTaYYhPyybz2gPIgFNhnHRLyvRgnSB0tr29fDN9UMcqw5/FVHiR6THe8XtCVlzf8LzH+lqp+6Vss6d1Js8BRWIWwGOO82sMEqyWMSfkfdwPRapVClT7ZoA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7157.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(376002)(346002)(39860400002)(366004)(136003)(86362001)(6512007)(1076003)(4744005)(316002)(2906002)(66476007)(66556008)(66946007)(6486002)(44832011)(956004)(5660300002)(2616005)(478600001)(6666004)(26005)(16526019)(186003)(6506007)(8936002)(8676002)(52116002)(4326008)(83380400001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: GK+IOJyPlAnYBGHkjJTEKpfi5diCbSsMp+j7WYRkG5ZjO3+QzTy8svECC+MYDqFkrvzdkt8mneRdZfOjEZ4UOCe1GccqjvHKcsV2f6DggW2D24tf/96nt1cUBMh0P84U0cZx3Xeb5GkXStOnutV0ueZrQr3lUgKmD7iNs25TcFh7KrIeqN7REnEuFKpipK4370EelJhXPluHktBbem3e18ibq37rHg9E5Pax02lkxQy2QWnuzThT7njGxqOcHQ0WLuyW+Wb+DJZkaBMrH21aIp4UFZvvWmlo5NnH1t0WQk2+HzWUvrmaQD3q7vA8yF6cDT2IofKnNMs0u5eru/t01L5vb8FrI8JrJsfKXo/HZWP8N1mizXBz5nm1ZtM7eOi2OfgleiiTSCxBDKgTevrwGg2IKy/Atkq0feltzeeGdQ/u021VCcxvdJWvHWGqJL4PlChfI1qfL3qmB6Ps2sJpUTmBBJ/FPi2/4hzhMHIEtQJZEL58MAYOTEMg1zJMX58A X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43390d82-8b61-4aeb-90e5-08d81722cc07 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2020 03:09:09.5286 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OGihjTupdFqzRierGxhByqF4xCSzAQ+H1vbAy+M1V3101z4Xj+/Uks3bSYrOovN6HP1pDEMBfT0/+DhPhjYqUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6854 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The 'tmode' is ctrl->wIndex, changing it as the real test mode value for register assignment. Cc: Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") Reviewed-by: Jun Li Signed-off-by: Peter Chen Reviewed-by: Pawel Laszczak --- drivers/usb/cdns3/ep0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c index 2465a84e8fee..74a1ff5000ba 100644 --- a/drivers/usb/cdns3/ep0.c +++ b/drivers/usb/cdns3/ep0.c @@ -327,7 +327,8 @@ static int cdns3_ep0_feature_handle_device(struct cdns3_device *priv_dev, if (!set || (tmode & 0xff) != 0) return -EINVAL; - switch (tmode >> 8) { + tmode >>= 8; + switch (tmode) { case TEST_J: case TEST_K: case TEST_SE0_NAK: From patchwork Tue Jun 23 03:09:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11619667 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 C009614B7 for ; Tue, 23 Jun 2020 03:09:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A48042082F for ; Tue, 23 Jun 2020 03:09:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="jRePFCKy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731439AbgFWDJR (ORCPT ); Mon, 22 Jun 2020 23:09:17 -0400 Received: from mail-eopbgr20066.outbound.protection.outlook.com ([40.107.2.66]:13838 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731308AbgFWDJQ (ORCPT ); Mon, 22 Jun 2020 23:09:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7r3PV0d6PAWXGPE8SrCwZ88o6r0nu/U5bxwXknQF1Zv+Ufhh0jeSGNOCVbhzSqXQtQqcw1i2SA9cwHwMdhx1btzXSFOTgalmwwZw8p1PA1B7zLgJh46O5lbRNOhUcYMhWvjTIhqG/aCrXe5TIb38cejBGBNNXtQm/Y1yi5o7DcHHwd26vrfQn5XhdZHBIf8MjUwhPPSrFG0GpzL/EhcywZBtPqagP8EcA+S1VF6R7wcOzCUSSnTKDQxS5f8F0exIYawOFRjmAChbOdju4zDKGvR3uqgdUFCAoTH9WmxxhsRegedRHByXwT2r+i1GVF/7tsh2/YjhGiFq8lyr5kU4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TM6xaQEgJZ5/HrNNf9mg7phfYmVNBC86IXnEoMgs/qo=; b=Z1vC8xiJ7wBlG82zOGpro0SXigsD3deDoquq2Su8R3Iu7gIm/StmIJupsBXvgaY/3N7gULC/rW2Yhm/x8ppKxDnCR6Nr8+YOS+DiTLStInCb6XYHwJl0mc7BR8D+J8Bi9ArpIespM+U38kfSGMSkMk/G0e7fzXcwGb/THPGyKTqyCX8ipDmUhI701d7FkFCDowDlwR/XlJO2jId3QQxNoTFgkOrGhOJkFYoHEEU7LoJ9fltOcqRqlUo4X3e8Qc7chBV9EGxSJyTKjPtQN3McS6wO1OOMoA/CQe+TASJA+6pe9Ky3T0+u5tjYFvynSEIwZ2IzlNk61czB5xcHL4o8Pw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TM6xaQEgJZ5/HrNNf9mg7phfYmVNBC86IXnEoMgs/qo=; b=jRePFCKy55mECL2NzvgMoLOtOXKt6l4/0KALFgdOJhxZd5O5UP5EKojFTyjbQSioRqRubQjAzf86Te7VeYr3PNwp2GPQYQhv1MOzE3uzZPLnKpUDEJ6Bgx2O57moa6bK9W7kxegnPFevcy+EU1LLCaGpgAnk5E9lsJcwNTH6xv8= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) by AM7PR04MB6854.eurprd04.prod.outlook.com (2603:10a6:20b:10c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Tue, 23 Jun 2020 03:09:12 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3109.027; Tue, 23 Jun 2020 03:09:12 +0000 From: Peter Chen To: balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, pawell@cadence.com, rogerq@ti.com, jun.li@nxp.com, Peter Chen , stable@vger.kernel.org Subject: [PATCH 2/3] usb: cdns3: trace: using correct dir value Date: Tue, 23 Jun 2020 11:09:17 +0800 Message-Id: <20200623030918.8409-3-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200623030918.8409-1-peter.chen@nxp.com> References: <20200623030918.8409-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR06CA0189.apcprd06.prod.outlook.com (2603:1096:4:1::21) To AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.67) by SG2PR06CA0189.apcprd06.prod.outlook.com (2603:1096:4:1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21 via Frontend Transport; Tue, 23 Jun 2020 03:09:09 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.67] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4640df1b-85b6-4186-6143-08d81722cdf6 X-MS-TrafficTypeDiagnostic: AM7PR04MB6854: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 04433051BF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XU8eMy3hwp7Mm6pMg4RQVnaDizYYMgccmr+CkT0o1LEnC9+64uJ/Dbwgi8JuAr1GuHuQqqBI1DH1CVIn45qoMjkHsaItCzMMZlcFE6LSAkEDSQE87wdzHj0jFukRE+b5MI1pl7Rjcy4Pn/zIzU/lv2AapKd7LZl6Ds8Jz77mrgBDr0cxyowsKeNlBun79buInIhufldyVyei8KYqfXS8F+4Iap5cYP/Kvv1ge47fNK2k0j5IJ88jG9tO127UAhfMh5Z7XA72hnGXs/Cx89DoSRrEr5lNY9Ls605kQd5dGCHOhCpktdxYDv85tcsFebu5zwd7jPUBcX/ya4lgFYBeLw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7157.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(376002)(346002)(39860400002)(366004)(136003)(86362001)(6512007)(1076003)(316002)(2906002)(66476007)(66556008)(66946007)(6486002)(44832011)(956004)(5660300002)(2616005)(478600001)(6666004)(26005)(16526019)(186003)(6506007)(8936002)(8676002)(52116002)(4326008)(83380400001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vQKPXsboykPvvhWQdz4hV+W14M15JmKMS+Lpwy5H7jyFwB8/yb4KY6Cc7tDR+cAGiBJ7aLwW4q6X8mgA75GduRD6RT73swBaXmkl56+B0OvRkgRyN03iAzrscVmMxNdHUjtGvo0AmZGLv17vtzXbbm/fdTvU08MqTTnkSVoRTFa1CzhNL1Zc9jL6EI2xH+RYdstlICZYNwHg7QgnlO+kcdvXIAlCDqNwKrI3KIZpNgBXGZ4JqIqn+wgip/ztjll/nN1dxTuUi727DoC1nfgtxaMHE8uQVKHbeVwywb4lS0kQdbe0Yf+5svegDwaeVb4X21Ie6PMScsboPGm++YrLyn0vvDjmTlpA3FQOaErVxJd1J8h7LHypC1CmCzJkgPVLGu7tA7DkmiLPXRhhix7uhRk3rFHRnlA4r6iJxkeTmJl7DUmCc7dR9GeKh4UFbaRbqW5yDiA0arGMSH4lU1MdL3VIvyXsFHpBEeu27iXBwYuMG7MxgAmIc3FrUFzcyyGZ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4640df1b-85b6-4186-6143-08d81722cdf6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2020 03:09:12.7525 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v9mvC4VdnbMpEllm9v/DRM7B5RAYEMERuACJk5Uao3WrXh3Qq/i7rTSgGqTSmtFMw+7uL4jKAjxsRvVX7xiScA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6854 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org It should use the correct direction value from register, not depends on previous software setting. It fixed the EP number wrong issue at trace when the TRBERR interrupt occurs for EP0IN. When the EP0IN IOC has finished, software prepares the setup packet request, the expected direction is OUT, but at that time, the TRBERR for EP0IN may occur since it is DMULT mode, the DMA does not stop until TRBERR has met. Cc: Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") Signed-off-by: Peter Chen Reviewed-by: Pawel Laszczak --- drivers/usb/cdns3/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/cdns3/trace.h b/drivers/usb/cdns3/trace.h index de2c34d5bfc5..0a2a3269bfac 100644 --- a/drivers/usb/cdns3/trace.h +++ b/drivers/usb/cdns3/trace.h @@ -156,7 +156,7 @@ DECLARE_EVENT_CLASS(cdns3_log_ep0_irq, __dynamic_array(char, str, CDNS3_MSG_MAX) ), TP_fast_assign( - __entry->ep_dir = priv_dev->ep0_data_dir; + __entry->ep_dir = priv_dev->selected_ep; __entry->ep_sts = ep_sts; ), TP_printk("%s", cdns3_decode_ep0_irq(__get_str(str), From patchwork Tue Jun 23 03:09:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11619669 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 D8F8314B7 for ; Tue, 23 Jun 2020 03:09:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0F81207BC for ; Tue, 23 Jun 2020 03:09:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="mOUHEqNI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731504AbgFWDJV (ORCPT ); Mon, 22 Jun 2020 23:09:21 -0400 Received: from mail-eopbgr20066.outbound.protection.outlook.com ([40.107.2.66]:13838 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731364AbgFWDJU (ORCPT ); Mon, 22 Jun 2020 23:09:20 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tc5FRY/rbDLWDQ/VQIyDERkniR/krDN7Bq9K8BuEkooPysAl3SUx5HZtOSSDAV1ZOXzhkI5t0FPT4fj18AAqWxqXIwMTlOWqOHyWO2OoKleF+ypz9kAJvRX+inXf8+9984DZ2pipZgJDK1rUoWL9La6mMlXsX/v+BYy1tR3TGdG1T7OBb5+3XtGDDPPhUGvBVrtF4OgnJCX1hL3tmrMtILu01tieLnC5VlYF3H6nZqBd9ch0nohg+4E+mI+ZFP6AogMX4K6D7g0ZfYMpfJf+DhdKX3D7ltCwXH9NhqtujfaUR6NSTd41Edp/TIHzwpv31Eqlswg5G5DnNQ/7kpWpEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1olVLb9tc/M/8WugwDTzKk2Qh7q5Vzt7ZA7YAyCoJ80=; b=Bh50D2ulxLRGjBiAr/C9teRkv8cCb7p4lcbeHADHPFYR7QvZKAlDnLwOayEhAO04BZgks9mP3j8/ak6CGgiL90I9/2oZlM2kzZSaSd3c6oDxYw1R7d8V66FGzhgfs1feQXAhzSXk/QTfUyD8mQ75/C1nNiWqXFr+FUORxfJv1DTdk3HvBSPaOB1lIxUwhfqPob3YOZ3iHWq/6n4dAzGjxbAHkcRhTIciDQjJgGc39ApJ2yH3l5SbO88m8Upcf0Fo9noc3pJXJVFm/YWXgpkJdejZSkq9sTqh0lCNOrBLKXLXXblChqhIYodjmN9h85EE0rDZnl0yKrz3ZQnV3llRwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1olVLb9tc/M/8WugwDTzKk2Qh7q5Vzt7ZA7YAyCoJ80=; b=mOUHEqNImdpkGXAMEBqGqT2v1l1fp/PoKc8Gx9JhCq9JRNK4hgG1+vDUQC8ZjJ3ROYV40fhV0vQTG0xiQATtNJtEeOFroFtfLBalqJKue6Nu2UWVUBY50n5ttu0gS4eNZiQBQbNFg7rz3lzKAlE4CAUEA7PsNL6nmKQsRNpgWbE= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) by AM7PR04MB6854.eurprd04.prod.outlook.com (2603:10a6:20b:10c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Tue, 23 Jun 2020 03:09:16 +0000 Received: from AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a]) by AM7PR04MB7157.eurprd04.prod.outlook.com ([fe80::1101:adaa:ee89:af2a%3]) with mapi id 15.20.3109.027; Tue, 23 Jun 2020 03:09:16 +0000 From: Peter Chen To: balbi@kernel.org, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-imx@nxp.com, pawell@cadence.com, rogerq@ti.com, jun.li@nxp.com, Peter Chen , stable@vger.kernel.org Subject: [PATCH 3/3] usb: cdns3: ep0: add spinlock for cdns3_check_new_setup Date: Tue, 23 Jun 2020 11:09:18 +0800 Message-Id: <20200623030918.8409-4-peter.chen@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200623030918.8409-1-peter.chen@nxp.com> References: <20200623030918.8409-1-peter.chen@nxp.com> X-ClientProxiedBy: SG2PR06CA0189.apcprd06.prod.outlook.com (2603:1096:4:1::21) To AM7PR04MB7157.eurprd04.prod.outlook.com (2603:10a6:20b:118::20) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from b29397-desktop.ap.freescale.net (119.31.174.67) by SG2PR06CA0189.apcprd06.prod.outlook.com (2603:1096:4:1::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.21 via Frontend Transport; Tue, 23 Jun 2020 03:09:13 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.67] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: cdd5e6a4-42ce-42cc-1b66-08d81722cff2 X-MS-TrafficTypeDiagnostic: AM7PR04MB6854: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 04433051BF X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jXdq1QcjLr/bZ2Z3NAwyBoQIec+DqAx6jmc8ZRjVRgsRlE1UiTT/YmubpOgU/2AeNaTOtGxlJHXM/oQ1w30ZkVZepgrtOUWdyovuB+qXnnHuaNJ/ugTOVUU6pbXoGRYshRbgvKx12mp2GqgO3/oj0qUt8BOVvVmeBNTzB9dzotZoGvAy2hMdlfPZXRDJo6WjZonURoMN8k3V+/t+ifFFU+PCUhf3mHaKiUBrFz9Uva8LhJFdaQ+EtzUnp2lMN5H9B6IzbUHBQ2wkP0tqLM/iRkuBQ/PlG6jNScg2iP14y4sToUvRwwBXMZSmMCBNLJT57QKWvqXfo9I0Aow24NsWDw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7157.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(376002)(346002)(39860400002)(366004)(136003)(86362001)(6512007)(1076003)(316002)(2906002)(66476007)(66556008)(66946007)(6486002)(44832011)(956004)(5660300002)(2616005)(478600001)(26005)(16526019)(186003)(6506007)(8936002)(8676002)(52116002)(4326008)(83380400001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fu0WE8gV9ZQ5rLk0B7iQrLrZ3kBFAukHb5fpc4PdBa60gthgNxzvUFF4fYU8GLeMAhwIsXyGOta1CGc0dPQT6CHyyj6e5vDFpAZ1PlfxlWVAtkpmCewCTNtFYIJdF9WkZYZ7lg2KGYp87k++3mOziWGgTeP00EGJ43QmotUlFJZyQFy4OTyhy7S+2czGw05CCCdp0HiZu0CQacFqo4MmYMyLAIFgwWJCzs3OLgX/lJ7oEd8or9PFuulGJ3ZteuVDPmgP7m63Mj3l2LwnebEBtfarbl0gMOFm6TrMm+uEaYOkJoSVZIzekECrf8jw2HOXXaOFotJxjnX40qeVB5XrU8pbjSRSIUlKx11TgAuwzvt7Ojl3XXz2g39DxChzCA63DztLQdNLXC1HJ7vjtMoSBvCiB9Hnjq1P21PeF3nRnTm9XLL20DCj6vf1kGnEIF2w4IndGtpFk57vRf9oLS5bDKRRaJxIFqno3YlKKaCJGP69dUXTdxO4Yw0adpNn1b7L X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cdd5e6a4-42ce-42cc-1b66-08d81722cff2 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2020 03:09:16.0362 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wJ4T0O1VUVYWlZ0pj9bk87DTxTsCWl6w6Pw76Iufk3rMSp/wWrNnD28IT8+2SrUtdgAZ7q6Fgt3m1wsqMdrCHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6854 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The other thread may access other endpoints when the cdns3_check_new_setup is handling, add spinlock to protect it. Cc: Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") Signed-off-by: Peter Chen Reviewed-by: Pawel Laszczak --- drivers/usb/cdns3/ep0.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c index 74a1ff5000ba..5aa69980e7ff 100644 --- a/drivers/usb/cdns3/ep0.c +++ b/drivers/usb/cdns3/ep0.c @@ -705,15 +705,17 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep, int ret = 0; u8 zlp = 0; + spin_lock_irqsave(&priv_dev->lock, flags); trace_cdns3_ep0_queue(priv_dev, request); /* cancel the request if controller receive new SETUP packet. */ - if (cdns3_check_new_setup(priv_dev)) + if (cdns3_check_new_setup(priv_dev)) { + spin_unlock_irqrestore(&priv_dev->lock, flags); return -ECONNRESET; + } /* send STATUS stage. Should be called only for SET_CONFIGURATION */ if (priv_dev->ep0_stage == CDNS3_STATUS_STAGE) { - spin_lock_irqsave(&priv_dev->lock, flags); cdns3_select_ep(priv_dev, 0x00); erdy_sent = !priv_dev->hw_configured_flag; @@ -738,7 +740,6 @@ static int cdns3_gadget_ep0_queue(struct usb_ep *ep, return 0; } - spin_lock_irqsave(&priv_dev->lock, flags); if (!list_empty(&priv_ep->pending_req_list)) { dev_err(priv_dev->dev, "can't handle multiple requests for ep0\n");