From patchwork Mon Sep 23 08:12:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13809380 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011036.outbound.protection.outlook.com [52.101.70.36]) (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 B229F4F215 for ; Mon, 23 Sep 2024 08:11:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.36 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727079071; cv=fail; b=Lhp0YcTDL8V1Aghz03sk1Fpk9xMN5d0gMcaq1QewmqN7uK+yo2+JhLyWTDD5yiZIF+mYKUp0KphyPSPdcF+7HJlu2HSdJFQjTjzm2QuOA6zB9WWpdbf9iXarbt0g+vcGZ4oVHF4r9nDMO8+QtlAZeWZMvrSNnbzeluqqOnHzXj4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727079071; c=relaxed/simple; bh=eGXYF/Mvb3FCExUJeiCYcoTGUnGyX8YzOEh42vD0R80=; h=From:To:Cc:Subject:Date:Message-Id:Content-Type:MIME-Version; b=ZGJBviMuRUBhKBp0DZVBOEZLRF32qQccKi3+/CW/Mm8ueu497WyrfUGto9u+6z3yVrda62lD9T8zX+Rtcbj5zH2HUZy2Sy4u29XfoPxIeM/xZdpn07Xt9AHWjJXJpz6wG1aZab1xm3k5MuyI3RA9tGyNP87vcVRC25iPrUw+AXQ= 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=gI/rG8T2; arc=fail smtp.client-ip=52.101.70.36 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="gI/rG8T2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CsoNmb3+yK1beInPYy2mPnPuvbqESgNjbEpmGpdXJ1l67o56wUwdN5phHUSTfYzjEQLaBVO7BxlebftrqntR7K621m8in8iAYeyMdvKTT76yF72S7QgZf0TIDw45zj7QMDyqnKZvuTlPiweeXgp0BKK4JuTjYfL40z2tITSX6e+ukkps2uKsIZJAzD507s7uIGjVHRXaPP68UPdHnVso1PL0iZyj/9/SGfv/WPPg/nhXgiMMHP2WTAZsA7RH7aOIUpKgwLVzQzzuQcw3vTyOJNaifZzMBagaLJ4gLgRavUtL/MmTF1Yxk96lZsHYaSHLyOvqTZ7X9v9wsECyP/C4ZA== 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=9Ye8NjMJz6I7mT07gigiSOXZpMY+iI5gH2ci3E0dBxs=; b=NkSIhQscBE9Pro54U8jdABhNJJVXm6MQLPvJpG0tgsBuESUr5yfLzdcUfHUXGvsMN5Kn3HkVYnMQPVhVc4rmOvsPUOe3fgpM54CzRPVkGY4kRExqySgqeaA5rg7qwpZhT8yuDAULKz58ZQBQtJLE8Ghu8boMbARx32UVQ3W/0SwWg5f7VbQJBi/2HMXtIGorp24tymOE1V9lwONOHm4pYm8lP+RyJy5fMI0yPhj1CRS71KzaWA9I70Nx9meQwgOeaZDkPNbQb82a21lyhym9+i7oY5NNPkBYTMCgIKDMWRH5ssSuioltDxSOoS0rqzkvHDpBgjgeoJXXIPNSR0dH5g== 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=9Ye8NjMJz6I7mT07gigiSOXZpMY+iI5gH2ci3E0dBxs=; b=gI/rG8T25SOh1Bj4Kr+cx/xh3XQHYJzfS2GYFY+KNzyuQXrVDNPE/IeB4pK5zDQxh4ePnn8uCtYvmBVr+wLyu4zKTjoPpN3sMmQprlHNiy/YRIJlinEEg5Oquscg+dDeSI8pZtfzteWG9xs1JQYsGn+sJ+uUtUwTcc3JG4r/idttReZxHE7wYw4JoyidYINlPkuoW3AxPlpgQgTi6EbahhpvnJxQmNX/cXcKSY+/n+cK2zQ36IIIK/YLb906kixxrAq7j8VNpqkIEyJn9Y8EjoyJusM6ziNIjyvGYy0TsHOyp5D8XEAQ0Vu3DHuLAdT+QkZilIJloavJWtoz4YDB5w== 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 PR3PR04MB7244.eurprd04.prod.outlook.com (2603:10a6:102:8e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Mon, 23 Sep 2024 08:11: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; Mon, 23 Sep 2024 08:11:02 +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: add CI_HDRC_HAS_SHORT_PKT_LIMIT flag Date: Mon, 23 Sep 2024 16:12:01 +0800 Message-Id: <20240923081203.2851768-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR06CA0237.apcprd06.prod.outlook.com (2603:1096:4:ac::21) To DU2PR04MB8822.eurprd04.prod.outlook.com (2603:10a6:10:2e1::11) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8822:EE_|PR3PR04MB7244:EE_ X-MS-Office365-Filtering-Correlation-Id: de474912-7b66-450e-29c2-08dcdba743bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|366016|376014|38350700014; X-Microsoft-Antispam-Message-Info: 7yOw0SDxKgkXxXAIk13SEwiNPnGHdVz/XrQt5rBFBSOekSkM+K9Nk8xNxaz14AO0Slw+Z5antHQPP5dR4ICi1aPI6D0BHcG/CdjM6CmXJJPzxZFv88+0Vqo0e639Lrg8m3bKiaro3H7fUHEmRi8rR888hJDe9Sp3acIqwZvsoXY6uLE55H9pEuPTN/8OA9osk7cW1t7vAeCLexm3ibnIZgiF11XBdoM+MdMpKT/dW9M9UvRtB6r3lHI9Fh59Luj6PcYMhhFrMugopI/TtTSNal4QN4NXnxrTpFkpZB2lyQfgIFPWiufpf59Onei1nn20mUAIKCIM6v8oM9u7PZaSkg7dfUj1Zxn3a0q8a+fwy2pPElkbRGwNMMgpY8T990Bg5vqIjTO2gp1Yek1n67Q0iC+fM3Mq9TnfTQeBszI0JbI+vgNrG+7PdRWHUTMRuCtkMoSqeCsGUOUElX/tswwl6rxpVR2g+RAP1HyqkX45oSk3OSzMHapS1XVHRqhvBbgVNjDzqMVVXPDct0Im8n0/3s9eKj+e5uO1Gn3oCQ+O2ITQDWimCv3Pe7xzJYMePJ+CRjlFx6s9eu2IW71bN04k2TUTVldCg6CJd/EHnn11DqsyWaxuV0Ylbd358/C+rgAF/2cWqCDQHVhHEFI03Lg4hZVWUVZ16orQLYq93QUEKNXMiwUIOgmOEMT9XC3QTlTiG/8NCSbOuugr/BybO6VtVC5MkyFn0TgIDcLy9d+15n2GVvOMpbVR6DRZi6wbK+2pva2YOould8KV03PLUK4KxCqm38SXbkVA908tsXVJWNpQze49wXCE5xzRUepKuE+UeJ91FRxl9Mkx4G2R+H3eCd0/FIHMDE4V7qyqsjLOU/TXhqVlTtHMYNEabmdxMJMNe7sVDmbAg3J0n5No8qqczBb66ug3Tp3DVId2PqDrdZPDsxzxH6aidx0L9G/SLgc7fCfJHQWu+qNEVDtrG9XHbR+lJ6mJMpbcoCFTmBl1jS71FeM2Zo9qZpZ0aXLt/6NUguObQWN4tDSNdWxebzyR7txDEtJHMvOjbC1eBUJ6fh1a0MNNSLV7pWVwTPjpY9JzfcQ88mltfRPyVKSYS6MiVkqXU5StJnsXTI5wCBI048YjP/NXjqB2Rr+r2CQXys+Npf/mx0TjrX+ZNNYtQSkHCqo2HqDe/Xn88PxQDcfyeqc0a4cM8x6GhAhDNsSyvbj5E+Yqlk63Qu00DpCwisW6qNd1H0MRZzE8L5GAK+zxG8Ks1FHAsPOk1ZIUCXXCyBXEUp41YE8RRcnvpECO1WHsoeZc3z89jarkcVlv8bRU45RLJiQPMeW1+NoKmEfGR3rDMbNtKsTGf6nz9Ps+f4lq6g== 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)(1800799024)(366016)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-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zP9HTDD4U7SBC1H5mVxbdMOrnPvvW3JgWaxRQ//ddElk4FV0GsqS7cuJvERRBpV0jDEdNDqFjOa9W79V1BdUbdFuIOq0nUjXeV1y7F4a7fKgfyt3JNhdfki+E+Z0LQAAsirG45CuGXdLu7zVFVmqkWYAJksZ3D4lyscfkQLuj9siIWjd6GlGpwW3j4rrASXfz2BbB9gYyiqp++UpbxDvwUEdBVh10tQNIPWMU9Q1J/UDJg2G9xVq8kCCJ7/7kPF6zVO/A5oGiJTYRYKkNSwp0/J3CXNsg535PY4sftFWJDFHcSFhF8gbYZ7EIKKy7CQXcCql9aPoTE/1MZul46RtKUWk/54ty7GMe6kE1pTjN5Nxx8ozdFTxYfkQHLYAPUkGk8Sy+EHCorMD0gvTz/g3QXhlXjxDpKbJoECSUxbZZi+Kl0erx1Lt/0w/ooSrkMVGAfMHOkJfE9dDVgbLlw/olvj+TmsuuUOQC2eWE3RW2PqwN5yHIun77mGPVIMLMfQee9VT7PWXbqowSNZAoNAm4Sfz X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: de474912-7b66-450e-29c2-08dcdba743bb X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8822.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2024 08:11:02.4150 (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: uQ0pZLe8l9c8WgIYEN3K/yyQvZzgstUVNKQsq5u+5Fhr5BK0xMeQtka6CZU8hqr1+j3LZly3rRKZYbydxeeIXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7244 Currently, the imx deivice controller has below limitations: 1. can't generate short packet interrupt if IOC not set in dTD. So if one request span more than one dTDs and only the last dTD set IOC, the usb request will pending there if no more data comes. 2. the controller can't accurately deliver data to differtent usb requests in some cases due to short packet. For example: one usb request span 3 dTDs, then if the controller received a short packet the next packet will go to 2nd dTD of current request rather than the first dTD of next request. 3. can't build a bus packet use multiple dTDs. For example: controller needs to send one packet of 512 bytes use dTD1 (200 bytes) + dTD2 (312 bytes), actually the host side will see 200 bytes short packet. Based on these limits, add CI_HDRC_HAS_SHORT_PKT_LIMIT flag and use it on imx platforms. Signed-off-by: Xu Yang Acked-by: Peter Chen --- Changes in v2: - new patch --- drivers/usb/chipidea/ci.h | 1 + drivers/usb/chipidea/ci_hdrc_imx.c | 1 + drivers/usb/chipidea/core.c | 2 ++ include/linux/usb/chipidea.h | 1 + 4 files changed, 5 insertions(+) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 2a38e1eb6546..e4b003d060c2 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -260,6 +260,7 @@ struct ci_hdrc { bool b_sess_valid_event; bool imx28_write_fix; bool has_portsc_pec_bug; + bool has_short_pkt_limit; bool supports_runtime_pm; bool in_lpm; bool wakeup_int; diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index c64ab0e07ea0..17b3ac2ac8a1 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -342,6 +342,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) struct ci_hdrc_platform_data pdata = { .name = dev_name(&pdev->dev), .capoffset = DEF_CAPOFFSET, + .flags = CI_HDRC_HAS_SHORT_PKT_LIMIT, .notify_event = ci_hdrc_imx_notify_event, }; int ret; diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 835bf2428dc6..5aa16dbfc289 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -1076,6 +1076,8 @@ static int ci_hdrc_probe(struct platform_device *pdev) CI_HDRC_SUPPORTS_RUNTIME_PM); ci->has_portsc_pec_bug = !!(ci->platdata->flags & CI_HDRC_HAS_PORTSC_PEC_MISSED); + ci->has_short_pkt_limit = !!(ci->platdata->flags & + CI_HDRC_HAS_SHORT_PKT_LIMIT); platform_set_drvdata(pdev, ci); ret = hw_device_init(ci, base); diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index 5a7f96684ea2..ebdfef124b2b 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h @@ -65,6 +65,7 @@ struct ci_hdrc_platform_data { #define CI_HDRC_PHY_VBUS_CONTROL BIT(16) #define CI_HDRC_HAS_PORTSC_PEC_MISSED BIT(17) #define CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS BIT(18) +#define CI_HDRC_HAS_SHORT_PKT_LIMIT BIT(19) enum usb_dr_mode dr_mode; #define CI_HDRC_CONTROLLER_RESET_EVENT 0 #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1