From patchwork Thu Sep 26 02:29:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13812744 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011012.outbound.protection.outlook.com [52.101.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C13CA1714CB for ; Thu, 26 Sep 2024 02:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727317692; cv=fail; b=SNMNSVLjx/YW55dKacPPIIiTn75KkC2qPA0coWe2hMUL2kDycrWAGHkZ7ZIWesPZLmcdxNqZKgzKIsA0aok3uaNFv4lq5Xf/IvhDzo6mfJplfOCkMAi1F214pDW3YwOxVUXq9zCdL2Yj5ihvl/N5i69CdU8J0Z7tC5JUZB17734= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727317692; c=relaxed/simple; bh=h5BYZJWlFKnSZ8p0FjTCGZuISn/ucgpU5JWYRuRcfH8=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=WLQcac13Q44AnoPCe9x0E6yKNfmL8MP7exR96CMG4wO88405oJqBogEY93bdIXMMzwYyj1BAQm9BRz0PiLoeR98IBHWi6TR/PbLFs2w16a3nB6ZwIbnNZdfBkq9iscfhHHPojavObOPVYHHL4ZG1pl/eRj30VT69APaHZpulRzA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=B2ROUiOT; arc=fail smtp.client-ip=52.101.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="B2ROUiOT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mik31jFGP6ZrOhzd54X9I2BUYLWdxczghl7yyo5jP8FXTukq1RMHWHYmnrEzP7gxKtVtq9f1tc2asrvxGr5kZoOMGG0J5hV5jQf6W0zSVutlYruSsQ+326AMTf6Aeaknekko9TEnqdi1AmI5n9NCr9DREXkiV8+z21zqaY8/tQKrV1l3SN3hJvOvnwLyp8Fux5A0fIOZ28Enjsb9zBTQreO9SQeM3IZ7A+tTcPvqqXwHDVcOpf3DhGy6X/PM5CssmlGoIXaCNB0QedDcy89IHRKP/UAmiO0T553qBuT6JB6WXrwHJbcjttWpYAXsY8t9V6jN5bMkQXt4hJxmMqjCmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9inbm5XNT30h6XX3nSQ5+r7IGQS3ksitmU68sGVbrAM=; b=GeOsXB3sd1NokooD3u7f9Zb0odJDvE9S004JCqpy0VNn/a6TWgSdoWXqpfIKoPES4AOsq+48Mt/VCsZBPvUHLGpwlnOpvSf/Zab9Z6quw5TKNhReq3CIhLdFvbehZMqOAd+6N4xu6mMDng4/5USSmw2FBVoOxLraECH/1uwoPWET39UmZ0KDPjsnlDYgsXXeNRXLG4GgHKTwk9umOPUTLGXuGjMtyupn3P+0aUMw1N2HyFaeZGBWBheoIYd22B8Dmk10fDYyGnx9qRo/6XurWLZeCFuWifwGyv8V/dudkwSeMtzC34QI3FPKi/zhNcYo8jl8M1xuCeEd++N6VDm76g== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9inbm5XNT30h6XX3nSQ5+r7IGQS3ksitmU68sGVbrAM=; b=B2ROUiOT8aJMHHr4HF+zWOv51M+Ewlva9DHwNgoTTkPDsucUz3hE2ttsk655D7/UNo86sdNl13HEqdwSWUr71v9z+NrHY/T3lARXGiKt+JAEGi26M1qjueOKG4WbMgayELG38/ZcbtpOQlTFlgKcyxdRT0XXDrtaj78ZX9QA9zrwv8sw6DNmJl1uEQZ+1gOUFkT0O3zrFPlnGBOxMUlprX7aCPXOHL5448JqR2XtiYmuskJHKH0CWnoYtAwP0coaycNhWfmBcSb1O4Is+BMWEzWWHr3j3yMMW5P4reEqiP4shA3ay1HVvhjTJblbX/kyisy2LprQwA2r4safBPmpsw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) by DB8PR04MB6972.eurprd04.prod.outlook.com (2603:10a6:10:11c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Thu, 26 Sep 2024 02:28:03 +0000 Received: from PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::cdc5:713a:9592:f7ad]) by PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::cdc5:713a:9592:f7ad%3]) with mapi id 15.20.7918.024; Thu, 26 Sep 2024 02:28:03 +0000 From: Xu Yang To: peter.chen@kernel.org, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, imx@lists.linux.dev, jun.li@nxp.com Subject: [PATCH v3 1/3] usb: chipidea: udc: handle USB Error Interrupt if IOC not set Date: Thu, 26 Sep 2024 10:29:04 +0800 Message-Id: <20240926022906.473319-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::14) To PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8829:EE_|DB8PR04MB6972:EE_ X-MS-Office365-Filtering-Correlation-Id: 51c6d12f-734c-40c1-e498-08dcddd2d8c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: 1cC2SiYbiMQqJdlghGJWGNHY8VnoPpK1M6rj04oyTJ0UP/RWXZpX/QZTQMi6MW3LI510ECrvgs6OAO6m+edvnCh8VcSe2WDlwYE9tyglMNoBTEfmhaJNnkh7RvkyPQItjcFl+/45R5q87UYyrQ9aWHPeD2pY1AFR1YXi409Vpum4ov5PIZfeMpyhHNRuav/Aq/olaXpPo0Go+x+5l+BSrMugGOBUYcbNjPp5SbUswqwyYAvv1WyVzENyQjXnD7hFJPdQK0p73KAWRjkPB3U2z/M+gOnzJI9EQqG2Dyp7R2xevdQZXS/NvFAld66gutBAcI4X0UI3zrlkQdcgcawRNAhGqazea27L0VtgjzqcIYFy4xSUdxpEj8XqwpLytusfJL/9zDQkvwUdbrC+Aj0xsbPnjzITW6ozoscGEfjpUJ6fpnfZsAllZsMpFRhWNHd1QISX7gzqH6UXjhMBHrR32fVO+VWTF+DUAd0iwtdAIQXhkOE2slUUfYY8y39tLlwauqZEervm4qa4+6AU9WB/3175dTAdaT6xYlP3GK9RBD76wsiKDa4q7fNf9vfwhbbpF75UXjfYKz0+K+fBOKPTYwG25LRFjyDrGAhbTdo3S15F+K/0sR6Up6G+zxlDm01rrf3TahUrzUgE/Z07Uags+RPTpheI0AonP96azKisUJjYGzIBnmqbz/Flt9ZRZahPJIg0mwdWW7BasQIAFcQxcBw/QPtasEJnKsAZo+BN1+BSvMYmzv1yHa9SNEYjbeYdgti3ra9mqp6db6VHMglMmY9FNMPS7F0cbbBJiR9IyY8xhjEa2xv0aUIOTn8RuCD5AkP/4loov1SRToHGkZ1iGpiDIBMJQxu4SNgBYXNdKZb0iUs7QzkeD0qHDriCnKxfvAWiuELvBQOjdP6VPqXOVAv7ztbaYvpTZKrk3HmkY14bxvv/3XN2tvmNqJIOoKy/kMGfwYCx4aFcCGsG20wdt4IcHZCyBw5LmlJHEksHlXOMvEv8AIEcGUAF7vwe+Q9RiFxPi3heemAEQnBz+UiqjrCqQ1i5Ys+WGnULp+XsRMjpCYjlDHSZJslVAI8ullC52A+/2I5j74TXZ+S9E0sV6L6kWHII2sDys7vG6WVsj68obDr0fyDoE6qGpOvuMI/iDoUx78eA9DdHVFArQf7xaaHZJCKgGABVk3spCq0XFO9pmkuLwUMtA7J7aqyAY9FYv07mv7kH2WhJui50yPEBMkQsOJkdXEFposgFP5TzajCyXvZedylVN1jPkj44ks1z51bgNpqmOdiQtjCfOHL9T3DIXtPnB5kgU4vqegjkryx+1McPoG7eTkrU4rf5Y0GQwvCAXGG5oep1DjFtJhskZoXRRZ0Hwngdp9/KKxrsRLRhzWFuDd13qvlyfSrvhHPfu83sOa6cxzxzaiMq68Jz8Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8829.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-Ant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TaV6BUjxvofag0N7xZWZKu+mXDy1TKoQyPPIT7CXwzF5FTUSJNEzNgN8N2eSs55nDVAN+RBzJdefC3uoIOwwxBwFt/9zxUKI/e/CdO83FWlU3P8MfRq/lFIOZ8tSE+XVpT4zXw6JEh/BiV5zaYs6LpxSj2F7G+Av5pmZMLJwiXPy3sqrP7CjFFyRu2pARAREHPW1hOaZSweA0byE+vxyInY2quhabq/EtxSegLQwBqwmGcQ6AUhL9A8tLSRi084Z0YTwJwcY2VUGk6NEOoRUFOg1amv4+RSMMYa92pnE0xX1jRl6u29xdv36Kthe2RvhAzAgYCLfluFzh/0uqr7Q7hX2gWvff11FycVCa6VaLKzlQK3GqpvC/OOyTb/FOJRnDXlfs1Qh94qcnoqavVdGn/2cuNv2R9yoqZZKDowIU9IqaJTKwW/7WV0fFxXKU5THl3keFLiG3sxWMAY8ek1aN/AYGeFiwm+KqJQV0y7sFB6+mGpbZQJfIABJFmwE5nmejlIHHuFHvcJpARNYdSe4odoHz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51c6d12f-734c-40c1-e498-08dcddd2d8c9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8829.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 02:28:03.2730 (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: 9ztblEs/0I/HZJ+8993X0uBo15MWYipybhpzUJh0W2/RH4feupr5TTmWR4gfl0BU3t9INvxsmXU57Glx+SQWFQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6972 As per USBSTS register description about UEI: When completion of a USB transaction results in an error condition, this bit is set by the Host/Device Controller. This bit is set along with the USBINT bit, if the TD on which the error interrupt occurred also had its interrupt on complete (IOC) bit set. UI is set only when IOC set. Add checking UEI to fix miss call isr_tr_complete_handler() when IOC have not set and transfer error happen. Acked-by: Peter Chen Signed-off-by: Xu Yang --- Changes in v2: - modify part commit message - add Ack-by tag - add fix tag and cc stable Changes in v3: - remove fixes tag and stable maillist --- drivers/usb/chipidea/udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 69ef3cd8d4f8..b9ccf62e0a50 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -2063,7 +2063,7 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci) } } - if (USBi_UI & intr) + if ((USBi_UI | USBi_UEI) & intr) isr_tr_complete_handler(ci); if ((USBi_SLI & intr) && !(ci->suspended)) { From patchwork Thu Sep 26 02:29:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13812745 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011012.outbound.protection.outlook.com [52.101.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDF4B174ED0 for ; Thu, 26 Sep 2024 02:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727317694; cv=fail; b=uhtQwcv4kvqoOOQ9j2bpKYvfUs6vMU8GyXETZcJxqHcg5mum+Tqn45+qPThz6lFbslOjEDUgJJp+zmhpYd3npk6qx2fumZXGQF3w7a00jyYMRFL4fQXeYE/iRr2S70Y+xrYRoC0AIfFMrKWLh3mxKHotaXfv7ccVF/c7KG/B64A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727317694; c=relaxed/simple; bh=rAPXjuJayXero/f/mIVAO31S2CScHLZ6fQXS2Gm9Oaw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=X4F+KQlqJkBInaI9ypDhopagz6fAZffH7S/cB0xM55onOryV0EFRyj9amYT9tBk+wSa83Hqi9aa4e3u6nLnQIkyJizYzu/DwKekXcEIkfPIhYleK82HbM6BrSeW0/G1pJIRlRhH9a5GWSDQWxWbOVMYStwxfqMrllcVqCq5V96c= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=iPRwaFcp; arc=fail smtp.client-ip=52.101.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="iPRwaFcp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DeMVwwVeS+A5oJCYYy95Nc6PfZZVHucbllglVDpoaSF/Vtlt9yBy68fuk7iPwb3C+6GbOswkDZF3LMZyXmYMDcb6cmwZB7E+hgCILJjhmxySXohF3nZGMZ5VoWc285KY6OSCc99z48ahKCyL78GXW10XxrcCMDfqpS4Sq5KEGKWtzat9K+9AyrJmT1wR+7GwsDokR5mA8t6FFva4oTHnqdTGHgUA3tHepDIhpSRgBWFJjI1Yp3q/LJAZKIIBdqIJmGM20xrkJKi/0xP0ilXmjHCI1CTtevc9wgBa+r29OqeWDK6hYhN4kzMSW02LDXhEatbS5ElS9iTjAg67LovyQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/dgPoiDmzUDWUWId15U7RPATc+kkv3jyuhHBxmsVKsU=; b=juVowWaMRpRkto5X9Mb4ipMZi0akR+2kCoaH6JnqqQyXJIzJPIwv4tOuQLtK4mJD3IU2TJdSnLCd8v478nRbMBKErs/i+51OmeqIXUDAd9QR8pZWvRK4La9VO1txE+go9wKYQk+b22AIUAayBoeAfa6XDnjMx+dE2pNVFNvkkwFU86mXo6CPXdstI624hTu2fXIYHmWJ5foH1vJ7R9Sp0TNwOVI/vrOWuKuuG6M/Z2RrtD7L7HF9anN6XQ1BHOamkcq379t0wLNGLS0MJSOZxFAX8MLqeG/lbbVgt4HgSbW3afVF8qySTlj9Qt8LcsgqDQGhuskLHuQnx9IMm9kKMg== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/dgPoiDmzUDWUWId15U7RPATc+kkv3jyuhHBxmsVKsU=; b=iPRwaFcptNAnZ1iRVQ4uhFtJ1Y+DTHhwxVWroutvh/jgHCb0+K9Alb/x7m/cJjQ6XDF3pPDBDsI1MP4nxIDPAO4h4PJQpuQsGWGTrEqaa79h/JXHBQX4P4EtlP8gf9eQY7P12vZ5zwKes2ARcy1G2z6+kC8qMH4gwMZlj23bNWqiE7doZX1MK97bAGE1pZdEorZOLnpxfjH4WegX6XOksAZOUrmqDE76AnzGRSeFk6fBJnSlcQmeF9C7YXwczXBnU3EpbAS9ESDh+5Azi6HYZQHQpbey23AxaSFAWtxo/UNat41W/HCa56wWyvAFhF4PuYVsTwo3l8H4vuUVo3RdMA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) by DB8PR04MB6972.eurprd04.prod.outlook.com (2603:10a6:10:11c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Thu, 26 Sep 2024 02:28:05 +0000 Received: from PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::cdc5:713a:9592:f7ad]) by PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::cdc5:713a:9592:f7ad%3]) with mapi id 15.20.7918.024; Thu, 26 Sep 2024 02:28:05 +0000 From: Xu Yang To: peter.chen@kernel.org, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, imx@lists.linux.dev, jun.li@nxp.com Subject: [PATCH v3 2/3] usb: chipidea: udc: improve dTD link logic Date: Thu, 26 Sep 2024 10:29:05 +0800 Message-Id: <20240926022906.473319-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240926022906.473319-1-xu.yang_2@nxp.com> References: <20240926022906.473319-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::14) To PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8829:EE_|DB8PR04MB6972:EE_ X-MS-Office365-Filtering-Correlation-Id: 2b3de2c2-cfbe-4ef0-0389-08dcddd2da18 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info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hp/AFx4T6pliGdJvgICY2RTwhzrW57PqVfWH0E/Rk/9HzKtj6gGEoJcjlGyjFeekQ82IqbIHGIwjNylMuawrdsHBvAkFrVxID97rV7+4v4HLbAB4X8axlln1jGRkvnbZUONb9KRqf+6Ic3GS0h2kN0A2pMFbeBBbHkLUC4x+7QYvhNQsR+IypB2bzl6Po7RFp9dyb0A/entiCKpWoMpL7JJw9186IyNSipHtL26HPiF9b7w1el5TywfCneVmEuSExxXpId1GXrAwC+ICVZqgwk+yqKg/NP5lNpoMNn0kA52bRV0jMLBnM7iIgO12XJBwz49hWGeDfcISZDjpTzl4j5DnE8Ptvcg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8829.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E7nXK5H2AIXL/qbP7LZ0E9cFHIhueqFUiZqvlPfOo1rGLOD/ivOpJr0m/M5gj0kwVdS1B/075UA1TFY1hJxqpjNhebeLbOv4nlhoaEGlbUvW3k2wFYIS6XwxIckbuB3Q0pAiV5Y0IVpKSOi/iOnt/dYwTnjzQ8WOJLrCdw+NfYwUNJDoRWyWmDljNeVEECVqiYB3PSier+V7Pdqz+olUTPlYpNh/03ISxN+MEFVPzwVx2Nc8Qxa++NFZ7dWPJqrBImNCGdfj0kGnUpX0PgYaiIBbsrnMDNwnB+2Zgh3YNF+crelsmO20R21TQJkNrhO5SY6vlhem2Xj8TQLKEngbFRsd8xpVMnqqrgZlss6Shp2Z+E9RW2LC1JmoWI72aMWoF1OLFEZ8ddJO8tbbHte2INPYtm9L+hLRm/seHAukrWa78D9lvx+V+wnfD6eHM5ENEcKvhKp6ocG923GgWn2Z7iVtsCi9CpngnGzh0eP4WM3VQ1MWd3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gHZKgYWsz1FL70xSyiKzG+ATkPtwu5BRQIsuNCPst X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b3de2c2-cfbe-4ef0-0389-08dcddd2da18 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8829.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 02:28:05.4537 (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: c/dGcjYQb2ErxEJ+4AuotKD4T5TYP4PgWKS6W50KEteAbegKjA5plzTdCJbMqSqVdPNhgk520PGzwXS6hN3PLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6972 Currently, ATDTW semaphore is used to safety link new dTD to dQH. But this code has a bug when the endpoint is already in error before polling ATDTW or just met error during polling ATDTW. In that cases, ATDTW will never turn to 1 and the cpu will busy loop there. When the endpoint met error, ENDPTSTAT will be cleared by HW. Therefore, ENDPTSTAT should also be considered during this process. In case of endpoint error, the current dTD should not be pushed to the head of dQH since some dTDs may be still not executed. Therefore, the link logic is also improved accordingly. Signed-off-by: Xu Yang Acked-by: Peter Chen --- Changes in v2: - modify comments - fix kernel test robot build warning by using cpu_to_le32 - add fix tag and cc stable Changes in v3: - remove fixes tag and stable maillist --- drivers/usb/chipidea/udc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index b9ccf62e0a50..0132bb25c9b5 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -612,10 +612,17 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) do { hw_write(ci, OP_USBCMD, USBCMD_ATDTW, USBCMD_ATDTW); tmp_stat = hw_read(ci, OP_ENDPTSTAT, BIT(n)); - } while (!hw_read(ci, OP_USBCMD, USBCMD_ATDTW)); + } while (!hw_read(ci, OP_USBCMD, USBCMD_ATDTW) && tmp_stat); hw_write(ci, OP_USBCMD, USBCMD_ATDTW, 0); if (tmp_stat) goto done; + + /* OP_ENDPTSTAT will be clear by HW when the endpoint met + * err. This dTD don't push to dQH if current dTD point is + * not the last one in previous request. + */ + if (hwep->qh.ptr->curr != cpu_to_le32(prevlastnode->dma)) + goto done; } /* QH configuration */ From patchwork Thu Sep 26 02:29:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13812746 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011012.outbound.protection.outlook.com [52.101.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC07E176AD8 for ; Thu, 26 Sep 2024 02:28:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.12 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727317696; cv=fail; b=VM/U5SSGdY/jRE2/AEvfoRY8g10FZ4oHCBjHeIGhd9N3wBhg4HXhEZhfqMQ0S8h96qN7lXifICu8PNdp25gyHKJGCRNmgi3gHTJ0ljArsR6XAMwzgV5ZOqDI+Jms1t6r4t6cYd+oqLTrlkBNKLHVlX59oCHO3Rlxt8Mgk4vu/oM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727317696; c=relaxed/simple; bh=Lrrwj6NiMzyP2cq9BL6kbc4Yi8RzK8EvwTSy00OjDcc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=nZiiqxfhwoxHK6QBrUSCcoPb3b0kj+vmbtLnB3fN5n19nIuTmFgKms4vo4o0sDbmb0xwaCM/CHHzJYeDKgPEBgnv8obXiyYwgPEVUAWqIHsqW48x4RToTQ6kUO3wAZjH+lt+xNnQUvxzwpANz6fdp9oynec1Go4on0O7RNDU7Ts= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=gevCujZp; arc=fail smtp.client-ip=52.101.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="gevCujZp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GGQidC20QARqA1TRT72cuTH/U36FVlul/k5AnPen8Wmc0NTSIO4Zy3/kg3wYIC1GomnoumMEh66Dkp63GfbDuOmzflvXEkuJ/woO1FBC7dyrcLv7CQHD5oHf3HsGJwd9nldy8AklWzaTL1eCcYavSlxinyLkWntFUBDEaoedPaOvSgoQxBzvxQ2fKJA8lKqHUBPt5tzKtytL9EoWc3Ccin3IPcIUnSKFT+XAZpeWq/czfRfk5jWNwh8i/gfXzMR6vlSAY+QNrCapZsd4a4t9OwGLLSQCfhqWoZwMtuFjE4kw8iY0GioBVBlcx/gNDdKSN6UDKw1pXsHsSi8vJWriGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/WfcSE+/dbFQGApHyge6JosWtJgWNuIhIWMdDupYxTE=; b=rziem/CINMt7yNFzg6wnrEBn36JISoPCye+fkpK/pSdsEHhnm+uT1OYXBB5iAPrYQMMQ31V0cxlWeszSn0xR6Kyv6YbN7k8wW7eSAAN9syWCDMkXny/R45FljdTUQuC/XtsIRsjZsB9PaeW9Y5VlCiEzM+KZF6ASX+slz6yKUo4Hm5AMy8N0a6nXcOCfqwkoRWJAJ1Q4eLBvqXf9mD80uC+81fnQGyveLhEmdlTCip4CJTS+HiPvTRlaFVx4tvUWRrnKNuykXIMTMzVYrTC+ldYqQFWo9bEvx5N5jhGf0hGvMtrNX3RhuRqAgSro8ZVDnYT+d/Fpyti4bVRAuiuQeA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/WfcSE+/dbFQGApHyge6JosWtJgWNuIhIWMdDupYxTE=; b=gevCujZpgMGPaa+cNVxCR6ZSTmAfzO4DeGj8zEOfcTM6ejGWaBrLGrz06+YHWvt8Q+WYFm+LkS/GrzBHmChdZzgyBI5sut5kPVonWy66WorlgVds78XtPz9s8UcSU7SuTQDXlozWvgOxq9g3QFtvMZd2D2e9QnaLo5ZmKG/KYa/wV9VVGn00Y6XYNtEcpxz5OjawmNsJUwjV6PzCtLdjvqa2s492gOoQ/Hu61jnSIKUYnCVpc62CfCAoA2SDCjYyP6PMkwzbwk/Vm+aa3GB6yF47Yu9jRGymITOluxEtAewEAiSVjPQZhacex679j/lXzmh/bjsQpUZAtFFTlDdEqA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) by DB8PR04MB6972.eurprd04.prod.outlook.com (2603:10a6:10:11c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Thu, 26 Sep 2024 02:28:07 +0000 Received: from PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::cdc5:713a:9592:f7ad]) by PAXPR04MB8829.eurprd04.prod.outlook.com ([fe80::cdc5:713a:9592:f7ad%3]) with mapi id 15.20.7918.024; Thu, 26 Sep 2024 02:28:07 +0000 From: Xu Yang To: peter.chen@kernel.org, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, imx@lists.linux.dev, jun.li@nxp.com Subject: [PATCH v3 3/3] usb: chipidea: udc: improve error recovery for ISO transfer Date: Thu, 26 Sep 2024 10:29:06 +0800 Message-Id: <20240926022906.473319-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240926022906.473319-1-xu.yang_2@nxp.com> References: <20240926022906.473319-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI2P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::14) To PAXPR04MB8829.eurprd04.prod.outlook.com (2603:10a6:102:20c::17) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8829:EE_|DB8PR04MB6972:EE_ X-MS-Office365-Filtering-Correlation-Id: 435e2b45-4221-4708-6473-08dcddd2db66 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: C/7N4bfarG3DDWjEuim2+4yh3NtON9kq17iWSmi+lYf19GDn5GQtYMA902vxH8b2jgOow0gBlVialPZsQBCHCTjdE1fh7Nsk58rudpvNesLGn+q3tG6MVZXvHssPevO/bHTGbUp0ctf2zOirRK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5WRaITxMLdTeHitA8eaeLrNEvZ+8yZJGKqDds0ikwPlnBJluTr7ohgxvU1HF7rSrCWB1WSfSlk8loyfs+nbuLnUNsJLmFv+yCssCEXaRZNGLKqrbVv8gzu/dMl+d/c1eMdYUAriqBQSH8l2+4NPuW+tgU8EtZvedMMR35NXZisyzJqs5HqDkNiRv+MDHrhyc2IqY8g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8829.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: abbc+Gy+dXXTmbyfNcQUxplu/CjAd4TC97mPKxl3EushN6PKGO+1LnxQure0aICSUPZ1IkZndR5YBzYGWif+f8O+MP2UhWSY7LfAfGsDes6/6NCqlPx9vsvelV0JoCFs0ikZSlW3lxaIqnWbPjICCVXrK6yGbyNcGTYod1PvVnKejHsnZdWh9aPA8A5HtB3etWRAP1RmjO3OX93Hp1K4gTR11JDMoXjFbJ+Bi0bZtlwKUc4pprlDHPiV5brPo8RN0AP6XM1g+htV+bLXUD9GoMFI7/j2ZpUhEWCdHKjhqTFe1UDS/jXFas6juh+8lQLsQYhAnCAlDwYLIm1L8nmGqZsV8oVK8H6PRfhhtgFeio+9mSrswaOxRLhQAumil44BCKUaCCwzE/r1f9kAX+wKgAqgIeKY+IIM7/TWh5h5mlXSjqjhJumG6V1T0G9Whj2Xq76QMAUiVTLJoj1VL73f8OqaAlVuf1ViAVGZjeDI8OeT75uX5EAu7QXkQT69vZmKo3XCD+lrTt/UsyK2HT/1A35EHUeEryMGi8D0jZ45434jSKcHAgRCZZn2F3toaJxTA+KyCDMMZ6TWPBH2c38CwHpAosNJjfQ2sHSvNpBruL7/MALD8PuMXMtVfszidyGKJINLIAx8L/vA77QdLfprGae5Idabb4e9FM1KfFWcDDM19Vd0TE08Nf9ADOhoV5iJvSFuAIi3kDTGFJ96GBVXQyqg7Q0MDsrZWoPNIC2JY3euBiNl3QtyE3ZkvLVJzNR7bcdkSIMco56q1pY3AxvYHURSryFe9bQP4eDKsb8IFO0xy7brTEN352/XI6Cwc9b7Gf88jFnf5vuoqv3yqLCkDGI3Nm7bsDu0c2jdAfgR5GFT1WZbTUNsoRHgi9KryJY69/CvtkVT8UTs4188h2vnGP2mKx96ngXNcMaK0lrv5DeVqG3mCkbJvNcV6Zu3JdHYw4qky09jUMYTi+8J0827WpC/T5UU7Edhj1Ac7PqVQ8lJV+1EGoSC3VPWkZ+cQ+iOUin6uafnELo0H5xpvYujBO0yGqxtUfpBrO/DEPqU+CDrYqjla9VIqFhSTI4TZiuU/mNClmiemx9c55fTF3OCIZwtIuwVGui2dlem8nNywSEXyWT8uhLIUxMtfkQOqyBxjEA0OX94n/XxZ3+zCRrGfbM88uyfWC6hcq376BkL3JkCtRGwE86Rgo8DSUtQsLSSgG8O/FtLl0tVuX9gJflmbnJGteZ0TjeWKVFt996SRZ/SG3ALaJgy6yK/uDkq1vbeogHzewl0aa5C88t90syRzTSb2L0Uk/2DgTjze0Jgc19vC0w4saOKk9mfN/XYqxFtR1mX5kUMa7GsmIYlRFz1SeBT9mCOv6iGchabsiE8uKMuOwjFikkK9C5luNwDsvdR6wY7tEHsySZvmzT9YiXia/tNVIYyq6D58xBTAetkVnEkasSOzUUc1HUOvaA8cxxq9bUl4viwCP1pXDLDrbylvS32NuhqiiKwXDSBly631IQ4qYxHUXDzaeAgTCZp6oG3iLc5QIB6Pn8JYXZpA3ShN/hRpTxaNVf8WHT/AYFNdVs9aR8Ngky5JpvaqbPhHY5F X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 435e2b45-4221-4708-6473-08dcddd2db66 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8829.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2024 02:28:07.7607 (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: bVAavy1lihJtzhtsXsrK1IGUxzSvQFH3j64xDvI3hEpntNkvAegKTx4C9nzDZquUMwIxn7debNoaqj4STyDTew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6972 Impove device mode ISO transfer error tolerant by reprime the corresponding endpoint. The recovery steps when error occurs: - Delete the error dTD from dQH and giveback request to user. - Do reprime if dQH is not empty. - Do prime when new dTD is queued if dQH is empty Acked-by: Peter Chen Signed-off-by: Xu Yang --- Changes in v2: - modify commit message - keep "hwreq->req.status = tmptoken & TD_STATUS" - giveback status 0 to user for isoc error case Changes in v3: - add Acked-by tag --- drivers/usb/chipidea/udc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 0132bb25c9b5..18c1882cf088 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -683,6 +683,7 @@ static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) unsigned remaining_length; unsigned actual = hwreq->req.length; struct ci_hdrc *ci = hwep->ci; + bool is_isoc = hwep->type == USB_ENDPOINT_XFER_ISOC; if (hwreq->req.status != -EALREADY) return -EINVAL; @@ -696,7 +697,7 @@ static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) int n = hw_ep_bit(hwep->num, hwep->dir); if (ci->rev == CI_REVISION_24 || - ci->rev == CI_REVISION_22) + ci->rev == CI_REVISION_22 || is_isoc) if (!hw_read(ci, OP_ENDPTSTAT, BIT(n))) reprime_dtd(ci, hwep, node); hwreq->req.status = -EALREADY; @@ -715,11 +716,15 @@ static int _hardware_dequeue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq) hwreq->req.status = -EPROTO; break; } else if ((TD_STATUS_TR_ERR & hwreq->req.status)) { - hwreq->req.status = -EILSEQ; - break; + if (is_isoc) { + hwreq->req.status = 0; + } else { + hwreq->req.status = -EILSEQ; + break; + } } - if (remaining_length) { + if (remaining_length && !is_isoc) { if (hwep->dir == TX) { hwreq->req.status = -EPROTO; break;