From patchwork Fri Sep 20 09:40:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 829997 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2049.outbound.protection.outlook.com [40.107.22.49]) (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 66E157E107 for ; Fri, 20 Sep 2024 09:40:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726825209; cv=fail; b=W7sHfm9qEQo6cqYLnYAqsNaG8DX7/7iBZZc8bvilohxtBT9FCIy7HUE8WzbImd29FvgRzL+P2jUX6kYUlc8UMSqVDgk5KAn5PDs0PkWgVxHMrijL4Er2Fa/Lu+Q1oBFILiHkzW+doo8L8FMlfrq0xHimrwJr3qjwRr/6VEPmHzE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726825209; c=relaxed/simple; bh=PsBpL2Z9SNYKc6A6j3pwtjZbyiOr9JcoEyybyqCXJ/Y=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=MOPjBnDkO4k6ChNqNrr0ubl28VP2UZJoj5lKDOKYzWmpAKLJcq+CZvnBeVsNGTosZuvIf7+hKjy3rne7Rb5U6XDtsuzu0V2oeVgyOz2OYKigwZBtSwy9eE5TmR2jwE19R741QNUxteyNd7LlJjnbZPJUL7qbHMntm+ZnBHK62/g= 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=fGgbxZBC; arc=fail smtp.client-ip=40.107.22.49 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="fGgbxZBC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nkXYQ0rxY58jSdmBW/Ks4fzQE8100pNPwqqlxAyrUmYUZP+xoVtSatTHXyHq0oL77IO6BYMue1vyPwA53hXVCcioKMlKsY5k8PFP0vvw/xUWgxpC/yfeIn4FBl2CIQNjAc6Mt6b6IlgY47/58pN08RP2Cr5sMzpQPbYeEzkfOtGdXua9aGeWoLpu22Jrf1T2AuPYE4LUi/xEYin8qAd3yDkXjT3mm8/QyyCF5c8KnN2XPT5PTSokEaE+K2oFV+oRGqsRn3Lgj6mZVDnKCgv5tXEgfrgHa8llXL6YnUrh1RC2i+bsUdgDqfQ1ZYLdckojGllhIIrzaITjw80TuRhTxA== 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=n+VYpPTFjrsseXDgLUaFxm908ISxu2crss8cOzXTEdg=; b=yv6boroh6VNU5FJYX/NDZdVY9xj1C0yOVb3EIW8R6F/KPaUUdN6oW17aV2xYfrJFsF5io7qehbLlYFtJ9687gBuS5Hh4SBGGnfkA13f1WW7ljymqAEFViMyG171YE6hMj7jUf3mrf5JHUDAJugDHXpNF/vB1YsIsoX+ecr7RaguJq0NFgNIn136C41Hh+l//feRV95QMP59/p1OajrftmC9aoOAlFGcSHYPI3f72AJ2KaKQHXH0nhV5geGkhjreedl/js/MvrJDwSfs0B51eJl+GmXFN4yVtGAoQMSOPpbQyWITI1N9iDRn1RHCncUOSd6l+1kPugGdsHlx45uhavA== 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=n+VYpPTFjrsseXDgLUaFxm908ISxu2crss8cOzXTEdg=; b=fGgbxZBC01TDel7g6+MNCiT4fiIqporoweVkdfS1Lkt1DBz13SGj2EtyJvxueWUrqgyMwriwbQJ6beIMI6slwEfPkAZe/OaHSR4khupNm+Lo/zY/zOVWcjnYWexW+lAMR+FC7fGzTc0YBEXGcKtzt8Cks/uTWwykLRIyDyazV3cNPR8IrSbWTvw9z7Eu5aQvlYFiZmYdvQzsecI5AsrpfWF/3atFLMMAp3hUy06OnJR0gkUVaGpNucKMjAlZKsmMbEQa0FTkvcj94TKN0HpONs3qsZ2MymVM2J6LumTPqVBH8k0iFyTP1SGKmnbb4Sz7/dWvq/drT9JxfTlS+t0D2g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by VI1PR04MB7072.eurprd04.prod.outlook.com (2603:10a6:800:12c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Fri, 20 Sep 2024 09:40:03 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%4]) with mapi id 15.20.7918.024; Fri, 20 Sep 2024 09:40: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 v2 1/3] usb: chipidea: udc: handle USB Error Interrupt if IOC not set Date: Fri, 20 Sep 2024 17:40:54 +0800 Message-Id: <20240920094056.2680590-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2PR01CA0011.apcprd01.prod.exchangelabs.com (2603:1096:4:191::6) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) 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: DU2PR04MB8822:EE_|VI1PR04MB7072:EE_ X-MS-Office365-Filtering-Correlation-Id: 8034cc37-15d7-40be-dd97-08dcd95833a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: XCUVDl3Y0KPy6gTZK1e4BbHsMkNXvXLmCAl335qEafkLyNt4t2PX98FslG+SixwIZ9WpIOaPnGfR5+4v8n+9z4Kx6QX4lXqGS9BZ3s4uTcr78XjnBaorDCsoufMBB8QfnbRHo7RafTDsxpsS5ZxC+CGiCGj7KV5Rwn7tdWNaTnASBWSsN2pdFA8JCtP3n0wStdBAtGcGJXgYk2ZsIGZ6bpsee6YlxOihKc18qmnLEmfh2WtbRlsPv+kOuuAqCYLDHJvd6PMpQr+ObXIq5erp4awOVLkxssykyDT4bD2OPy4Srmd+E1otgX4VvVp/gtJkgOAIJJjQ7M6o/0m8uV4uWdcxuKy9T+MixTcxLBQrCLk8arYnYfNpWscoVVc8Qf4i3WhlOhSF4kkqVyGYWXCco7DQu+j5mk+vCPJPIY2g23MI074D4Qr9v55n7blaUN5yGHpnUqsvsxeuaI18ikJyIc2gdRJEHstNyFf9r+t6Xnb2DgzaZzSK38jxs0/3rQk6d68l9p66Cvft2bhduX7fpQZWd0vo0xV78169oOuG7dB3D5XK2G8FmduDr/9m9ytnhGMp/nxI8OYmFEKOgzq6kDL8dYtM/w/K9vf4P2tBYj92hgy7PtYin+byfRhm9c2XUyFGnX4nGekOobRLNhMGL79xNP19kRYVO6UUrPhvYb1rRdjJmM6dUlU33R0WXLQfsL8G65tvlzpbNdXToE4+tcXswKFtqgGmlp+CcJ756hD2aBAOWYqly0CFZlYXmhucw7/cJMvBxqJiQpGQiB6LqDJ6XNTnhv3jsslUSjRII1PUIREJ0bcS5lpXD5hbEzL86wA5EHDt6fL66uwM0zxmJ+vPl6LsobJ/0SGBu/oeqPR4o5S4K5du0YUSF+JZt27DBlD3VpRpiNwCmj0uA9AzIuA7TGJgFdH46rbvpCLtR4WuVIMxJBkYMSOZBRWV39B2div/0r8fAVQE693HqbsY434DHSH1zuikwW8tZ+tRZtWUnP7vPqdF/aZuXRKIc3XNTfnCc8OoHC2W9lEqONk9USc176eqb+zaoIvfyI/kBtqaTqF5Om+hvYubhAx1VK+GpRXRwNE4OZNVeUrhAU+SdaXQSvdDcaQt1f+gdSE2W/fCTDsUxcFAEcri91w0XErDXFK6PukzANlHBd298P95axDS09zRRes27Coc31NVaLHRNFj4qbV3qhh3wJ2l9+qK4QBbiffei79XxTNOpI1trU0qqeBbYM7IeoGSbgDoyQkjriy497wFJYvFVuSsakg2F8Xih2nG2hoDjmBWt7nWaMSqNM5B3cKT0PPfPO/g3OovuFhNW93406rr6NJ46Xi5zDBOHSeE22O+D+akgKFEN0e/lk8Q9LJ688BUHC1qTK5cEPDf+Vkn2+FtMekgowFxPY4lNnq7lZpVm7Sonl1drQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8822.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 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7W2srxvcDueIEit8IW+ijrIeoopspK5TNEUkQp5L0Du11swSWs8KxinvpTKbRdubFOEVkMier/aNpkVcvWMKOfGZBTvXDX0iNBe7K4A69AhisJUmPzbgHS/k1V4tB6j/0iVGUwvoo2uSgrdKzmGSZ/4U4rWZC8ctLH1QUc+y2Y5vvBButt1eAM8Yb7zbKsWIp5p6BbV3+NavUCuTNXgWiOq/ijjBi1xUJWgyhlAmS3ZWOu0RqtkauqAHMG9yUe30+y3xlMp46ma0brc3mOVSe16ywrFp5Z4GArGl2fHoX8inZ6FgEMmQ/ezOTGuTiM07SMmtwxfCzZla/fa+qpmp9Nk7qW/zrIO6k9a42jTmNoE9ctg7Xdik7BmF7rbbd2/b0VII7b2IYuOFNOax1W63s3OlylxLuO27NxxAE+5u3SsAplFIY1yqM0D+IgSFWygHTWK4B4rqxhRuI3rDVhav4zI4QrZ7xe6zoYqOB520aTR2KErJ8no+Z1W1WB388iB6wPzzTYv0KivzPH948SbX+nsXnPUxj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8034cc37-15d7-40be-dd97-08dcd95833a5 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2024 09:40:03.2218 (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: big8yi1XP/Njvnq541znMQJHMHMvuO+mJ2MbC6Afoj5Myys9RZVLdyvUHkIL0ihYVjFZbW3OeM1IDsNBydBR8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7072 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. Fixes: 26c696c678c4 ("USB: Chipidea: rename struct ci13xxx variables from udc to ci") Cc: stable@vger.kernel.org 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 --- 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 95b697f08a76..e0092c735a75 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -2215,7 +2215,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 Fri Sep 20 09:40:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 830190 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2049.outbound.protection.outlook.com [40.107.22.49]) (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 6ACC313B59B for ; Fri, 20 Sep 2024 09:40:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726825211; cv=fail; b=RoEfPMwBYLDBgqkDwsoXvQ9fTsqfvx0qr0hjt75GxHaf8UYdV69OzrMbjZ/rQPubz5r3GeGgrY1Z70fs5eCrPlrN9KnzUbrTvvAO4Oyx8UMO/C9FH91oMV1BErsTwXOb8thl7I/MbLbdSwgVGkWxXIvAwd7ONCYjHCJxd13QvBM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726825211; c=relaxed/simple; bh=K+yhhZPvrOOUZ/AJx2Rjkq8cgeWB/JLTIUSYwmNBuu4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=baqOvNo5gP5yJtppbwqQ1HjDGz6QcZW/goU+Z2nRm6KmV/nVmLhmDzHZ0kICvPARAGcl6aUeOMWqlmRnVqwSETa80M5YocGkOQAZBF4cq2C/ho3y5Ropu3sHGGb3+a0F0utgy7bGex24qwe5E5wQZ0r4zOdntesjUsxKj7/QaLc= 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=DZgJQPKD; arc=fail smtp.client-ip=40.107.22.49 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="DZgJQPKD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JL/kXqQ42eprMzUD41D4dWHmFNUpoynffiNPXIZ37W+ZRbbl5VYEP6VLYI2UDJz30vZj7yqJHNzM2T390JVrz0gbASCsw8D5e0Scra/Eo/qYDWs6qbf1EfJgWmka9bOAwxsVxpi9G9hGeGB88gWf5eX9Krw2If6YEc6BCwCBWxsu4H8GvpcOgwm2ADfe8S2shU9urCBjYvPxwFzRTIdn+838A6dtE8Z/mA35FZ+3OHTT1vGL9aiS4Ag/usTLGLiTTkhiFP+Dn1pcKZiWs/kJ1arklxaK6K/lL/++Bc+q8j4QHFKeMVq5B9VctW8Jyy6JkKfztT7W/cXyvW9Wup4HvQ== 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=2YV0/VUNSmoFKNRggUm6Wc8xIiIlealrJJmoEPGjoJE=; b=GSXUnYR5OjN3VW2p5cQaQhcBPqGAwTPAopI33+g5xw0BD/icAYBmvCNqWnKGZq7uiaMVALGGVtuqKQBRaGepLX5vt5pDS7AdlTFKut3LennmZTAtc+HoZ5ycWH2luu1g4R8COHtxlvmY6lxHOO4I84WMVevlCVPtlNwDyXG+CF38nChavI6cKID2rDFpQ+JSJatoyMVOiYNrTh4Amk1bKO9kABkjtgyV+XzLq7/sitaRRjUPl2Kj1kAF8hBDVsm6XTw6pW5JWHhrJkbf3n23P39q3X0G1HQLXM3t2ISCYh8e+/ozjScp9fdXAYqD4jIrQ9Kl9RFtR4oh8QSVeO5Ygw== 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=2YV0/VUNSmoFKNRggUm6Wc8xIiIlealrJJmoEPGjoJE=; b=DZgJQPKDG9yW9kkKuGyj0NyRikElq/E7A+Yj0AwEO//mv2lwJEKc+6jBWFf3t2D+Rz7NKK87BQ52nWJMFtiqgPYweG5MlNKTg+u/h0viI/89Vz979MwCagHErY1i31nQKJv6U6yx8fs4cywQg5JEIXoMilVFjwz8lHH90S4RfzssE2rSHwCDu5mtvrydmwFUD41xOOzaWVtZIpChpyM0P/rLPMO16IrMxreF+KJdSMXWthexyN8R4RiUaCKxtwTm0decfwczu9yyQfjuOulmA0twiPaYeFqK1OfddA2QbR0+OMd+qH+u45anzWy79lU9BvhoRxiZId7aqRSZBzcY+g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by VI1PR04MB7072.eurprd04.prod.outlook.com (2603:10a6:800:12c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Fri, 20 Sep 2024 09:40:05 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%4]) with mapi id 15.20.7918.024; Fri, 20 Sep 2024 09:40: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 v2 2/3] usb: chipidea: udc: improve dTD link logic Date: Fri, 20 Sep 2024 17:40:55 +0800 Message-Id: <20240920094056.2680590-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240920094056.2680590-1-xu.yang_2@nxp.com> References: <20240920094056.2680590-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI2PR01CA0011.apcprd01.prod.exchangelabs.com (2603:1096:4:191::6) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) 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: DU2PR04MB8822:EE_|VI1PR04MB7072:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b0619f2-17b5-4289-205a-08dcd9583530 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 8MWImkcYTVKGqP70wD1NO+BH9VUB7qE9tnKQWjSSGyysrvMt7hDZIdyQ3R8appTVxfQImPf4pNvGhUNvzMdKrTb7UWjLXRkF8s4ivckmuxELJ9ayIn809r2J53OhDC2+FciwotkqavjRs64OSxSm6z7ssq/7HBuaQkVnU3L7zlnICoFYv9z8k/tghtROp+S6WOS2YF0KmU+7RT7bqxNel5gEgApTo5QOu6W/SnEivsnVwztvGpOV8qjT8J+jKTRuC8rqRvqKMDQ05P7KfmbtAdQ9LiMboAFffeflMgrNClQJRS3+EUFer1yV0zNGUhr1Sr/bJE36WJEuank9E62f27sJuQB/JRcb7/02r7uyn+zegsUMJN5Cs9xYaBPxND/Ofcgpnmpbz/vtqynV5KI2l3Am9F4sv7nnV58ailjWCcuzRdhByeqmn0dAA/y38CO7S2mDpSdhdOSvPaUsp8x++0hCMGANSgn2if/q2bYAcxUVMowiUjJGPS1kc4ufxG0WdW+jTRcDj/U1lJUscyhsNiLh37WNHf5kBW24VEEBAcMFG2kF5lbv63TtGXm+B02TRLoYxNl3KHbXd5egdidPymBTeZV9HjFZansWRAXIzu8pjLySbI7kfmO7z/1xf+zJXNI0VLwSbOEyHOtZjZlP0FbzVwkXo7Cl3JYrQ7p8lb8YojUS+Xs9roJJmsYhoJnI8aNd0xsmcyE6tS3cTMzZ6RPbSNLbqPKqewTMqMk3K5ELBqT6d/QYzBQPxmiW+fxA0+iREDBXoZiRMgDsIjHr2tsnydyCgIdEl/+OP6cGNHbaIHuL6emf7OtUKGLAssJzPT3gKzpzChyGIs7/rjZ1zlUpxmT8dQvtUoEx3tWGDM5CXVdG4o+wH/QosrhiGyiJZAA2AjsDlNVWZfyyaPuzHHLhoA0R+FJESK72P1rgWrHY3nrKVqr251ZMaX+CTgjkWMbQJCUg0qb/T16uyyVKb2KGxUSC15HP0CukZvojRvpd4JI0f70G9De7xdN4ydUNaHIOhSOi3pnM916ZH8r9xea+Fd1vqUnO6XDFRjWq2Vd+4UhI7bXyThdKvdJaYmBWT7/YfAjHSBRaCsYThRPHpXCM838tm4CGrHSZGYFD/TOoP2kNnCRmRIwI3T7mU/tSI829drs243uonY5I3PQTy15ARqi298YxbN5o+DJrx2ZgaynYi1/9kxJj7w3RgjgbpQRMKaJZBHMIauf3V2CmB32pp8J4qoC2dIW6f4SNGt7qJFK2tnJoX1x8zpKZWPoS1680R4kTPprHF7eMFwtbL5/nUha1ttociMDW/u+F3oN2kkTarnzQneOR0V6Tw/YUlfjQuqVa5wdwfhGtjlNBFrZuFin6Ti0Z+4aTSgs8xHCZSS9IE/cYo/Ir1+IxazK5FJc+pqJ8MoDDqWoa9q0/AQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8822.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5jBJdHT0sG8WghRx7CJIWzjIaGRrkeEdambK+B6VRTpxmFzVaZs0YBhIwFofXQqEEcFrYR67dPKivcSbbmWkTQR3a3+8Vbn8POZWo4GPcFmUstEVbsaKB5ab2KtV4wqqpR3Ukl2OE3qDWPYkoKzkIFJavdfyxOOoktizpIJZ4YBgo/0xZwQ7DWW74sWDY983enIWp9jd7JUDX+4wrvvnrpDFkutPcKADuZBiUL5jOVuURU8mig2Gkg9chphNmfquGCwEnLZKzaDgXFWBVGCirZSh510le+kRPce45QS4+5uI6Kra+bOcxcDGgsD+wZVsDu5dcCNUxWt/WWzFx87IZAISERHUEuDQkBOHmAQ8MLmwftnE+/T90hYP4NzI/4TlPKUI2jiehqesBHhOvhEntcWB6jtI/aqrchgyiNDlDuW6aT3cLX9QJ/A/RU8GtaDPFcGUnxi8ty8/iBqe2l6VNRI0eb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8WhCAO+nTckAMcMaBmCaeSmQwNDInraOCLxjmqVuoo X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b0619f2-17b5-4289-205a-08dcd9583530 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2024 09:40:05.4178 (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: 1iGNe0XNpL3CD0QHcE6aSEEl+t/gtmYigNjYc5GhylrCfhZ+WA5Gm9oyY7KyW8pxyLN+CdI1ibO05KtKyaczAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7072 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. Fixes: 26c696c678c4 ("USB: Chipidea: rename struct ci13xxx variables from udc to ci") Cc: stable@vger.kernel.org Signed-off-by: Xu Yang --- Changes in v2: - modify comments - fix kernel test robot build warning by using cpu_to_le32 - add fix tag and cc stable --- 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 e0092c735a75..c0b8745234c6 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -752,10 +752,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 Fri Sep 20 09:40:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 829996 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2049.outbound.protection.outlook.com [40.107.22.49]) (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 884D613C67E for ; Fri, 20 Sep 2024 09:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726825213; cv=fail; b=WNKwGCrNgGCfkSx/TBa8oeCfljBD4mLwAgd+hpKB2vsLdJrt3TpzTd9bFIAi9kjBC2YWO9uMzHQMn6sBP20eRXMxcffnOu1ZDvoKHuR6LBwdF48nFuJNh67rCUgi/xG7FeKJXfZjKFbyBucjdYt/pZj0+JO1OesElmn+sWdBwIU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726825213; c=relaxed/simple; bh=t1ABZvI0JQ+VlKICZHWmyDZ+Wovq9jVfXqsULN4MKjk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=W7GIbIrDSWGYoW/xB8GS9/CAM+8Rqt5ESMH7DTKnjHypKG4/FTEWA4N2jfg5j0BaPZcMeMcdBtwuRtzPrz4cEzKJyAnfSDBQ/PbtttNzpqFH9lsDpCJU+BF5JbHZVnRShVFvqna8JZjn2hcKcWzmtPrKSINs0GdSLoAy21rnIek= 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=JEUFk7PV; arc=fail smtp.client-ip=40.107.22.49 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="JEUFk7PV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=D3l/ezMiUB2z8DPZzGLBcbJF57UmOEiXxXv4cIUkFl1rxR9ReUa4pqtMLzuUWSlHxmP9h+IdlcOY8CKVPfpJ1/fvLBfHoBenCXR93/vn7rcBEnt5eGD0Fcb/+5TYn5X6AiV/DXjwQ62mHfkKf/WMWbnja/pXscGGDHlfvRFL71XCg0kWisP8SH6q0/f5pk7q/7Vi6Nxm38xBHSQnz+IAt0ZrLRMjQ4rcEHqGxJv5D3VYzf6kzTiczpLKs+tyYFby8ROWOsQa59NCIAbcNrmWq01hHIkVwea9f1vr641cJfao2lz11lMfMxfSTPvqGVunFnaVU00cHQXkaRR+5lmhbg== 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=he+lsVjWrtn1tVIXUA7TgQZWaBbjcU23UVG0jilaFPk=; b=og8zhWxltXqm4pAwWVcsC3P6zNgND75v69nQificwO4f8leK/Et8VPQXwO36vrpdidWO5KDhgGNAAg4kA3wkgH8vwSCTxi4DwCSyRwsdu+vV11pQXCC4E3dMAdLn63tKis7hnuen/+RuW+IXPerLw/ArtUne3OoU/W2hN4yDXF9l0r8Nl41dczv6yUtBMhyuXQ+TvXSBtLNEXIHiWniV8wNPJxz8dAqb8fSne1V9qWp1cBTUn/egNQpf4oI3Zd2A4uuCCchn0eP5zar6dxoFL7/wuG+jdyGKh4Ncyxn/UH1P+sZUQ0a7J1HRCHLhlH2nHrBeDClXzvnz+7uY4n8iVA== 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=he+lsVjWrtn1tVIXUA7TgQZWaBbjcU23UVG0jilaFPk=; b=JEUFk7PVj/7VxBP6xXI54MyIqWni9kJafIASr9c7EbgjjsITlK9MNstCM0MkdtI1qHo+ym7BKwYnzdrg7+Roaiv0rnaxNPm7FFja7zPSaq59c/VB+uk7POOgsleEs2jirNFkBgy9vWhoHMuykGocw7aX+WeXWJiLwkKxbnCWaIi3uo2WxYIpkH7dB9OPBqTjgRemwrldiJd4R7gwpXvmEqjAj9FSoQ5GJ2T025+gymNzLDs3JykkSCZTzqnV5gIilBzQ+QvLRUxnb0zGgMgmnpt0rOtXa28djosjfipXr6r6RX6ois34wWddYzHqvqCeuEiS5jpgwkPSUoa13hhTXQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) by VI1PR04MB7072.eurprd04.prod.outlook.com (2603:10a6:800:12c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.22; Fri, 20 Sep 2024 09:40:07 +0000 Received: from DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7]) by DU2PR04MB8822.eurprd04.prod.outlook.com ([fe80::4e24:c2c7:bd58:c5c7%4]) with mapi id 15.20.7918.024; Fri, 20 Sep 2024 09:40: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 v2 3/3] usb: chipidea: udc: improve error recovery for ISO transfer Date: Fri, 20 Sep 2024 17:40:56 +0800 Message-Id: <20240920094056.2680590-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240920094056.2680590-1-xu.yang_2@nxp.com> References: <20240920094056.2680590-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI2PR01CA0011.apcprd01.prod.exchangelabs.com (2603:1096:4:191::6) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) 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: DU2PR04MB8822:EE_|VI1PR04MB7072:EE_ X-MS-Office365-Filtering-Correlation-Id: 51a15a0e-9243-4ba6-18ed-08dcd9583675 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: 6r0h6knRaRd61oSXFYplHMYNIV4DkorU5YKRG6CcBVC4qxiK3yiPk8ewiw/Cqd5q8VqBRsJAED41FN3if/8m1tmyVFmAv8k0Bmmj9CLwGWPJHs5xEu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gWpWKp5hKoFBPtlnq5Z8rduwjcuIyhvbOVG0lPYKyC5XImqG1IaXYYKZE/kxVhyqMkpilgchRVqcsRNggi+BzWdWgmfUnnvFn2zprQnryGN+Kib3/Plqays9p2il+eC6BgZn3zRTLpIfzSYlGx7TWSeCdWoc3VaCib1JjrzMRM64nhPYLdniDJl8Hk2TRgy4aMe/xL8/LxCus1wWfn5y/q1Oicc77HhC/PC1fvA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8822.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: n/10zFeQsszrlvQuTzqrRmMlcpaK7WFzu1uVUbKH3FPyaoCwSsRnkZMugey8tQAPq6FwW/eI1H6pvPNNJs5f2oabVPhZBHXC8MsTJnrfaJzyyNkNoD5GWRbL0fucMzXWgoJjc0lwDi6Yiufk5vMMEpanH3yjHJp/GSvBM14AeNbltUdavzuhlZA076EaA67ynxU86H52Uc878N8dNNgHtDe/t9hi5DzbY5xgzpqgxaAM6gnWmMgqM9CWxeVjIX8t8gapmDCXWk9ayrf9bjK8ufKF7/cR+Q6/6aBuF2L8gtXlVYeXp8i/9FBkmveHsbkBs8FEzfrn8zA3Gj28xzn5OrpgCmdJjgWKlTUc19Fk+s4Ev/Ao6oJbK9an2CqB7gaheGH9NI+IG4PQBcsKsDfEvBthHwMEBkKhLUo5Xsk8wQOMMxHtyGDL8yImiHyUjoseBBWYZTy7vdseJBd9DhY3tz8sZFDCBy3y76xf0tDlwrtU09ksawaZrhUSMidt5/tBywpcyv1N1P0oOXWvJZZf/eVC/gkRxgIuSDHJ8Ta5bF4AIAole5nsaPVmyvBw+nNuFg6fZj/7ChgXR3WP7KF3YEm8FTvvQobBlgYGUzbmO5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thSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2024 09:40:07.6358 (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: KsUdkhXoQtGPSBjdZYsSwTHZ5U7RHchKocLVmGjeWqqbCmjAYREHjuoIjTqC+XhJOvF9BG7/tADYBjTKiBglxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7072 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 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 --- 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 c0b8745234c6..e1121db0aea0 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -823,6 +823,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; @@ -836,7 +837,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; @@ -855,11 +856,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;