From nobody Thu Oct 2 11:50:41 2025 Received: from BN1PR04CU002.outbound.protection.outlook.com (mail-eastus2azon11010026.outbound.protection.outlook.com [52.101.56.26]) (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 06DE210F1; Wed, 17 Sep 2025 08:57:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.56.26 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758099441; cv=fail; b=sZnckyd+Vwd7rIm6l9rpTnYUvDlr20uvcop+0YJrnu4kouTKItxTGMAKIcwK/eX3WmUdZI1bgt8QVxZwfhyhCsWaLo6IXZTHOjnIpP1kO+6H4O9IVZofQYhjQMl94uqyFUrEz3TyC2oyqhX0B5uomIC9CWlGGfLOPceNWb+IPLw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758099441; c=relaxed/simple; bh=jUeZ3fY8py7aax0r06HmFI469u9quWXmXLV+13XNxFM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YKi43Jku2KqyQMzisq9QVW7qYlGwXiohHXmqKe33I4Oyc+zArIB79fmAO4m1z1Mf/I/mSbhwCXl3yUIqY88S1QFvZgTI+Fp8v+Womte520Edx8bRMjcdjYOP+VLo3c56cBjRg/FucgRgUU1LsQ5stEKxUsCyRlnU/eRy7zqfaGA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=jfBLUV2v; arc=fail smtp.client-ip=52.101.56.26 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="jfBLUV2v" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B8SdMQvAjmtkIfTzWKNsVTUKaeGUAxY+DTR2c/BNUu2Oy80EqRwDt9Qv3s78rChTWawx7Iv65Qq8TS3gkN3M9cMF4+A7Vl4TG7wHxyPWF0DqTeMst3LmpzKlPhIyJvntKutqGNDbLHcA9hzfCChB5t0UTV3YLiuJLm3sJnwwcAcekCdaUqGdqQZe2k08gN1AwcyGYiRHgB1d9IGym8ARMsfLVNMSkIhSXi1qi7r3uNRSmgOOLBqqeddncS8uapVsalwjNatDOjleZ9dw1hnZK9OB6aIEFRnKfj8ocwfdADQXfOUnaSiDdU+wGihpH6I+hXXcGFcSguHWKKs42iWqzA== 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=FW40/Qs4rmdq02lO8N6EQPhFFO8N65jgWUR8bJrW8LU=; b=w5kxRBc+VEU16Q04va8bRrtxXZ5ZKfeWPNeX6nP+e7wVjXvLvki/BZ7pfYxuilNL32KTi3jxQW4LJxYP31YDC7HRYCBn0TVXYaZJ43JXQQqcttGCN0Sx6NWi7UWgt+2ksHmZpXwYCznq4J3h1jzxQYzjHmTpXksBTTBQsyF7F4aSt9MfPv9Jep2AI9Nom+UcJX76i0/XyXblySL+7klJkRBnrGQYVICLROr2CLiwPkLDfHCO6twW8/pgdiYSKReY3tvcYbc6fV3Xt0ZlIb7GfDnldS82AOTYEFQpD5xmWLaMpE5NNpzDBFNcI+v6cQI757FKeO/YuzzwiZQpEdzCwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FW40/Qs4rmdq02lO8N6EQPhFFO8N65jgWUR8bJrW8LU=; b=jfBLUV2vgwgpcDj6m9gOEVzmISZ0EP0dFT/V8rqpuLrYDRWj8YIrQfm3gsJz7PXnmRDsPr2xnedxaT7cB/tSw2A2UGV4hK2dOXrym7yy3Qk3L6mftIqT6q1LZi/az5S435MNPBwZN9TgjZYfLS2Cyic2gCU9HKxxxZaYE41uBekKUOtBiaQEZwpvj3lbYBNfx+eI83kCZ2nZMvfnzrnhEPWz6wsj5HkPOmrR2ICwDxqM14NwT6eY7Ukrh/JcmudKHxXn3faToDEJP/fc030UAPOtG36CcAubNHaDjxC1TAY/VV0ncm1vNF2sDUaGouJ/amT+OcttrTbcLiMZNe3Oow== Received: from CH2PR05CA0062.namprd05.prod.outlook.com (2603:10b6:610:38::39) by CH3PR12MB8728.namprd12.prod.outlook.com (2603:10b6:610:171::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9115.22; Wed, 17 Sep 2025 08:57:14 +0000 Received: from CH2PEPF00000144.namprd02.prod.outlook.com (2603:10b6:610:38:cafe::f8) by CH2PR05CA0062.outlook.office365.com (2603:10b6:610:38::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9137.13 via Frontend Transport; Wed, 17 Sep 2025 08:57:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CH2PEPF00000144.mail.protection.outlook.com (10.167.244.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.12 via Frontend Transport; Wed, 17 Sep 2025 08:57:13 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 17 Sep 2025 01:57:02 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 17 Sep 2025 01:57:01 -0700 Received: from kkartik-desktop.nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Wed, 17 Sep 2025 01:56:57 -0700 From: Kartik Rajput To: , , , , , , , , , , , , CC: Subject: [PATCH v8 1/4] i2c: tegra: Do not configure DMA if not supported Date: Wed, 17 Sep 2025 14:26:47 +0530 Message-ID: <20250917085650.594279-2-kkartik@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250917085650.594279-1-kkartik@nvidia.com> References: <20250917085650.594279-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000144:EE_|CH3PR12MB8728:EE_ X-MS-Office365-Filtering-Correlation-Id: f23f1fde-8d03-491f-855e-08ddf5c8321f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|7416014|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7yW55j8KJburIoktocFtkcmLsjfGsr6zmVPwJAP4Y8ZGoJbjoySSEtUdzp31?= =?us-ascii?Q?0fCPdnN3uLH8fHBUm+Uzo21luh/4kzSZ94h000FBV1GKE8+WaTCXT5/mt5eg?= =?us-ascii?Q?x7lHU3SA04DcJk4wTqrqVGgA+Dy5OZodiVA0tbZJSKE47+yFNmIHXfAzYPIl?= =?us-ascii?Q?ljrCmU6PO2EZIjPa2Li5uF3qbwcMcvS4iKrCsnY/lWiqL3VvddzJjHP2qAFt?= =?us-ascii?Q?p/zdRz3WcZOrYno9g9i1v/oH8lCYhO883FEa0nnEhwIxYNJkm0QPtOMJB1r5?= =?us-ascii?Q?XxmANs0BKl5iFpxf7T1cwUkSRV2gfJn8C+UNLp3J/a0AMBQrZihe7VV0oLWe?= =?us-ascii?Q?TLPJKyppOCLMPLd4ZhkdNywcSMCe71Iw8iNm1+6AXj4WlV1zej4AbT8FCyHc?= =?us-ascii?Q?zKGn29LzRUG4Xe04SRa6AxfwpaBbUaeF6+NMfpMkBgwKh5eom36nXWXbBP04?= =?us-ascii?Q?IzkYSZGhxAFJgWgHj9NgvsjTy//bVslq0OeW+MaKDxZRE/2KB6Nn0ovlMrqI?= =?us-ascii?Q?fQVnm2c0r45sB2M2LP/O3C6HdpMfl+Ed61FoEAKIzJepqkOICu8v4ACXEsk6?= =?us-ascii?Q?8yufeVetNc+LS8lSqFxKMtCbVMQ9K3xRKYWpiQzokKtR97ZWS1jimOdvPJVj?= =?us-ascii?Q?7AJStwo7lNwwHXA47AwEwNUQ/+ILrziaUSUDnu4VhppLdHHpS05zySwHz/Zx?= =?us-ascii?Q?gHIfXaoEK5aMIeXxb9PNErfWfzxb4Y9TWQqmuRaoSJVFbw5R9ez61bBtxzYR?= =?us-ascii?Q?IpjlL7lltaf/nMAI/n2c/dtSC4vGu6OtkDylkRB2A3R/BNCTpaUeRWthTEsJ?= =?us-ascii?Q?rgValL5tzXzT9Z8OC37cEQ6l2WU1yrVd+meIQ7CcL0C3pbwb2uvhHnCKH7zj?= =?us-ascii?Q?BgW22lUt83ARnMP/xeCeuPhFN6dlnOoqKtiQ2tTLu5aLvGTTmcxPMvQ11nPl?= =?us-ascii?Q?BsziIW5U036vOol6iY39kJb+okvWO5X+t77oDOqnMG1h8T8EfbZwkPUoQllr?= =?us-ascii?Q?ei8keoQlTiuCKd67BCveP/Kl5/MI+dm01Ru4G0P1h+sx7cjBJ4o21iH8DjYJ?= =?us-ascii?Q?zt/gC4g+Nlbd/l4kkhgYfGMRIOrIDlu0lUNowqZDENzzJ7Ar20IMQWZSE/IN?= =?us-ascii?Q?gGGw5slOwZYtpVh2Yi9dX2D6r3s3Q9QIbseXstxuE3oI/OEbBHX56CeUNpJG?= =?us-ascii?Q?MZA5POaG3x3VB3Q8Km1eAb/2bscLKscj/+WeSwGvMl11WZxbdVytU2B4WXXz?= =?us-ascii?Q?i+/G1hR4X8qQqKYDXucNw8Lgujti6EgEglpiPuJHOS7OSmFh/nnCmGlkQ6l5?= =?us-ascii?Q?CDdJIvcwARVxdU6Ml2FNvtkosNhMuaQelt7+0bNV95OlG4MZNox81oIA+vHl?= =?us-ascii?Q?V9al4UygLGBmXswSRx6sZJQjXuKH1Y4eMvARLE+/vTCMJbfBTWJNSVETtng/?= =?us-ascii?Q?XLTe1e66wOxfd/wmTDTvstD9GPNwOAOIeub2rmMuL6WXXKk8ybIR+2VSgmRc?= =?us-ascii?Q?V7ekVokIpyMLn4/5nDA7nvxSJoSX+VRnM+4EsK42F/NV49vBX7+TJsA2tA?= =?us-ascii?Q?=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700013)(376014)(7416014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2025 08:57:13.8229 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f23f1fde-8d03-491f-855e-08ddf5c8321f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00000144.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8728 Content-Type: text/plain; charset="utf-8" On Tegra264, not all I2C controllers have the necessary interface to GPC DMA, this causes failures when function tegra_i2c_init_dma() is called. Ensure that "dmas" device-tree property is present before initializing DMA in function tegra_i2c_init_dma(). Signed-off-by: Kartik Rajput --- v2 -> v4: * Add debug print if DMA is not supported by the I2C controller. v1 -> v2: * Update commit message to clarify that some I2C controllers may not have the necessary interface to GPC DMA. --- drivers/i2c/busses/i2c-tegra.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index e533460bccc3..d908e5e3f0af 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -446,6 +446,11 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2= c_dev) u32 *dma_buf; int err; =20 + if (!of_property_present(i2c_dev->dev->of_node, "dmas")) { + dev_dbg(i2c_dev->dev, "DMA not available, falling back to PIO\n"); + return 0; + } + if (IS_VI(i2c_dev)) return 0; =20 --=20 2.43.0 From nobody Thu Oct 2 11:50:41 2025 Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013056.outbound.protection.outlook.com [40.107.201.56]) (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 792DD10F1; Wed, 17 Sep 2025 08:57:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.201.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758099448; cv=fail; b=d7E7v4k6PhBDK9qNRg+9uIhZWhR9mm51C/wd2UKKoIqHp19LupcLYqI8x9uAaieeZ6CRNnLulzNgYY76Fmxxo/FmuOuJ5V36o5yvpmWq/h3biLe5nU+W12TN60W6j5OVN+jNusyMAIDFuwTT85Q3i8A2zZI8fA6Ewn9GbslgfDU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758099448; c=relaxed/simple; bh=3NT0asyN+4B7B4ZacJ/XxXEar9SWskpn/isqrECowN8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fBzzAUGXJ0hEsfKyF8z34vXOwNm9+GOeeIBPzk7lNJk8A4emK7O2lCDxjTVYqQXf61vbVVnEvR7e8AWT3a6MZJeQgYYQPdgpCnGGKnt9TNC8YFlvXZS4oNKtjMciPi7Ldj4JEIDrrAcmk0EqxLg/oDMi6fuQoJ71pNKs2GFKrtk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=nw39z4ck; arc=fail smtp.client-ip=40.107.201.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="nw39z4ck" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hsp+mchVekvRnM5dofzcgj0H2+vzC66hulCcy4yyYNzpjKDcidzJ/zTj4W6bAZAnIhAhaRYjeOVuTa4yjZNgtsqxtI1f+GgCOOxAT07NJQyj15T7ZMdgsArlWoJZD4XiRsL1zz7jxqpDI77rk5B83pGdvzjMh0WpOu2UcHzpI4kBskZtotXCp9erHq/Jo8N616eQmUbAMg/QdkJp+JOsaTfe56I+QoebAghp5TYOrW39dXMSsCeaYXqyGrs4LgMbJSS2F2IvJ5VFiyQyKDtsZ1h8McJAgoWBvPBGzp5xcX70ytRerdeLz8JhrDXDHSmKSumWOFL0gz9tIbJXZpLkSQ== 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=iTxgFfYexw/UXf4L1m47ZK0qpWUylLrTnUsGU87uf0U=; b=rkAdrXXld4xgsHu14x8jscXtjFYhj72Td0TgS+jYLT25ZoGiQRVpu6OvmEvz5g5MLgTXMkUimwVWeiPB2bNdzWBySgw+mQgySHRXaoehlPwxyM8YpR2npNecaEJAu4UC4+0chymyt3eopBHRLcazMg7u/OM+hZ1VO9iqwZjMLn0i7+1zE5eqe59GYIAHQ+3uohuo9Rxtshmo9QiTMuzVGbpe9RK5h+2SIp+3BuUsEXcIjjnE5wS3t19Vc5f1t08/EL3bzSlmdZv/fw4TcP6jDwwnNievFV2ggD2q151Trnym/xiw78nMDH/BXFwHCUPTbQ8ILuzybZTtJBETX/5W6A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iTxgFfYexw/UXf4L1m47ZK0qpWUylLrTnUsGU87uf0U=; b=nw39z4ckExQhdSzHtk+6MUzSrAtVx78rdSRvDRNzV21dzH+nxPxPSqhX3tmSP8ANpuLHwfZOB10+AWtf6WZp97IYM+GdVs7neFPIrM97G7vD7+d4Td2Z4PELYOyXZaVFkmJjnCxN1gHqyeBgiMdDWEz7mPd3WxbDPWR48JD8NNRF+rS3l237ECH7EEM9sl9kZGBPnB8KjfGP/7YFqVheCNdXwZT+6vkwhfUnfT+Zjbc09rF83yVtNJ4cnZ0slDAd/K1te/kK50XgUvihd1/l7sruOOwtt8rdyZyk4QwB28MUxcso2URF1OYzhdyPFqW1pVNfewBlBIlrgsMI7l791A== Received: from CH2PR05CA0049.namprd05.prod.outlook.com (2603:10b6:610:38::26) by DM4PR12MB7598.namprd12.prod.outlook.com (2603:10b6:8:10a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.13; Wed, 17 Sep 2025 08:57:20 +0000 Received: from CH2PEPF00000144.namprd02.prod.outlook.com (2603:10b6:610:38:cafe::26) by CH2PR05CA0049.outlook.office365.com (2603:10b6:610:38::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9137.12 via Frontend Transport; Wed, 17 Sep 2025 08:57:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CH2PEPF00000144.mail.protection.outlook.com (10.167.244.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.12 via Frontend Transport; Wed, 17 Sep 2025 08:57:19 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 17 Sep 2025 01:57:06 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 17 Sep 2025 01:57:06 -0700 Received: from kkartik-desktop.nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Wed, 17 Sep 2025 01:57:02 -0700 From: Kartik Rajput To: , , , , , , , , , , , , CC: Subject: [PATCH v8 2/4] i2c: tegra: Add HS mode support Date: Wed, 17 Sep 2025 14:26:48 +0530 Message-ID: <20250917085650.594279-3-kkartik@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250917085650.594279-1-kkartik@nvidia.com> References: <20250917085650.594279-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000144:EE_|DM4PR12MB7598:EE_ X-MS-Office365-Filtering-Correlation-Id: 57b83037-9e1a-4c6a-2297-08ddf5c835b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|7416014|376014|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?CCIU7nmYpxkW6qPqXER4H1F1H+avliYvl/n4ZovmvffvAlcknlVWzeqy0SxA?= =?us-ascii?Q?6QGtmGL243NUrigTaZ3PxauEd/fUuxQQ0oJn0Jy3GJXt0Ajt9Zi9CtLZpIia?= =?us-ascii?Q?My2+FbCrwUXOWFv897+TDyBL541M6LP/V39jeS+LcAkyra0hPC49DmbHsyrY?= =?us-ascii?Q?C+kd1BBhSyVMBNbA8xc+KgXpNWa6U5XtuuzBVHbUH96mz5i8OlgO6TkcAlRt?= =?us-ascii?Q?4P5ra2nab/pxql+N82HnxfSkkAtq9iwWX/ig6bEoVNG929l9blRBbOPRQhEA?= =?us-ascii?Q?in+EwJ82fkGuGRpB/p+ZC/0BPuwF6Q4LEaU4WVWB57N4EGx+c0nIB4qIvfWb?= =?us-ascii?Q?AZdsBnLD11LT6JJCTCMGtGdgJ21sJpDG1mA57z5+cubCGehsiIgWZvRa5JSN?= =?us-ascii?Q?uYXiVGTc8xq7PpBtZlTQzg0dzIljHXdO1MXRCIyaMwToHwwR0HFuEapJ7tCG?= =?us-ascii?Q?CSvU8+glv8nzHRADasl/SAf4ABFpH9CPoBGcEiqatFu/1+VjBnkBnlTQmt5Y?= =?us-ascii?Q?VjW1iFz/qQTzkRE7l5zPoz6ssEpRmJrpXPw/1JTKu4KkFZ8rBkH6fefhnKu2?= =?us-ascii?Q?AZmT6X+U0CLeSJEFPRgNBaAfsMoYVZXhQlH+qiv0YG6JlUuT3gXosX6WyGwy?= =?us-ascii?Q?CJFqPiyrobDX1/bnIXJDy8ZbGUSj27qaZ+TWpZQN/LRDrlUILuGkRgvZCGpp?= =?us-ascii?Q?uvUxgQ3ygI/58K9yxWcZivxZ/tNKRaAUwlY6l2qbHVrjij/XrJGYqz90ijgj?= =?us-ascii?Q?q95AoEWwXjgoJb0yCeC3+F6ne5I9/DS+78Q6UZLbduDnCN7c8R+dWPGX/WEn?= =?us-ascii?Q?7XLFlTlkHlc9uMb4JT8GajUc0P8jIRgW4mDZ2KvKIXja2HV5M9jiYcYvrMTj?= =?us-ascii?Q?+2QZpF0cO0mrglmguubeF16OlJoNIA+UHboQw1YeKid6QWPAZ0Wwslk+ihK6?= =?us-ascii?Q?8TiGlhrukNrjkWantxE0ELfdprVQDYdixO9KbMkVvI9/Wpnkow7ixfVykLF+?= =?us-ascii?Q?1rLHzB8IiJBxrCvgrizijE+JpLlqK3cyLIAZt0cAdD3rTKsqSPIhc011Ra0+?= =?us-ascii?Q?fMl21AXMOpF+B1owHoU8FAiaxyI4IlfBtT2y4tpeE5v4Z4gYx0282wTPGPNa?= =?us-ascii?Q?K2ElaF3aYUb6pqi1Czmx3+2DxrXOUuj3Iplzn5z5dk5OG8xPh5Y+I/CkrVGv?= =?us-ascii?Q?OeLckcCWLME0lkxaWifOAMDq768wLTF4ltvAEfraGCIf/Z0+aBuT4PILvmGW?= =?us-ascii?Q?y+ShP0WiqSV94yQcDARz6YQ0SAfwSX9iUzZUVgyxDF2Uf1orKjxFQ3GueI11?= =?us-ascii?Q?uNOYpbbcFB6mVpczYgRG0ezO/tXJBYvW3JZ/zRMApwTz/EfeD37sNiHzlgxy?= =?us-ascii?Q?2wv9rOkMkf/eQdorgmDFf4l//niEhjrTyxwPUkQwZBALgVQ7I37UTatj4gWO?= =?us-ascii?Q?tjLOegBPKUsNhBseqF7RqUWfsl7siem18+lpaVMLCaY0GzwiJPEJ91Jib9Qd?= =?us-ascii?Q?yxuV21tbeTUrxwzGsbTOOM3F3AdjQPqaNuIyN1CqU2KdVtrO1QllN125AA?= =?us-ascii?Q?=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(7416014)(376014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2025 08:57:19.8466 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57b83037-9e1a-4c6a-2297-08ddf5c835b7 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00000144.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7598 Content-Type: text/plain; charset="utf-8" From: Akhil R Add support for HS (High Speed) mode transfers, which is supported by Tegra194 onwards. Signed-off-by: Akhil R Signed-off-by: Kartik Rajput --- v3 -> v5: * Set has_hs_mode_support to false for unsupported SoCs. v2 -> v3: * Document tlow_hs_mode and thigh_hs_mode. v1 -> v2: * Document has_hs_mode_support. * Add a check to set the frequency to fastmode+ if the device does not support HS mode but the requested frequency is more than fastmode+. --- drivers/i2c/busses/i2c-tegra.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index d908e5e3f0af..6f816de8b3af 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -91,6 +91,7 @@ #define I2C_HEADER_IE_ENABLE BIT(17) #define I2C_HEADER_REPEAT_START BIT(16) #define I2C_HEADER_CONTINUE_XFER BIT(15) +#define I2C_HEADER_HS_MODE BIT(22) #define I2C_HEADER_SLAVE_ADDR_SHIFT 1 =20 #define I2C_BUS_CLEAR_CNFG 0x084 @@ -198,6 +199,8 @@ enum msg_end_type { * @thigh_std_mode: High period of the clock in standard mode. * @tlow_fast_fastplus_mode: Low period of the clock in fast/fast-plus mod= es. * @thigh_fast_fastplus_mode: High period of the clock in fast/fast-plus m= odes. + * @tlow_hs_mode: Low period of the clock in HS mode. + * @thigh_hs_mode: High period of the clock in HS mode. * @setup_hold_time_std_mode: Setup and hold time for start and stop condi= tions * in standard mode. * @setup_hold_time_fast_fast_plus_mode: Setup and hold time for start and= stop @@ -206,6 +209,7 @@ enum msg_end_type { * in HS mode. * @has_interface_timing_reg: Has interface timing register to program the= tuned * timing settings. + * @has_hs_mode_support: Has support for high speed (HS) mode transfers. */ struct tegra_i2c_hw_feature { bool has_continue_xfer_support; @@ -226,10 +230,13 @@ struct tegra_i2c_hw_feature { u32 thigh_std_mode; u32 tlow_fast_fastplus_mode; u32 thigh_fast_fastplus_mode; + u32 tlow_hs_mode; + u32 thigh_hs_mode; u32 setup_hold_time_std_mode; u32 setup_hold_time_fast_fast_plus_mode; u32 setup_hold_time_hs_mode; bool has_interface_timing_reg; + bool has_hs_mode_support; }; =20 /** @@ -717,6 +724,20 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_de= v) if (i2c_dev->hw->has_interface_timing_reg && tsu_thd) i2c_writel(i2c_dev, tsu_thd, I2C_INTERFACE_TIMING_1); =20 + /* Write HS mode registers. These will get used only for HS mode*/ + if (i2c_dev->hw->has_hs_mode_support) { + tlow =3D i2c_dev->hw->tlow_hs_mode; + thigh =3D i2c_dev->hw->thigh_hs_mode; + tsu_thd =3D i2c_dev->hw->setup_hold_time_hs_mode; + + val =3D FIELD_PREP(I2C_HS_INTERFACE_TIMING_THIGH, thigh) | + FIELD_PREP(I2C_HS_INTERFACE_TIMING_TLOW, tlow); + i2c_writel(i2c_dev, val, I2C_HS_INTERFACE_TIMING_0); + i2c_writel(i2c_dev, tsu_thd, I2C_HS_INTERFACE_TIMING_1); + } else if (t->bus_freq_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) { + t->bus_freq_hz =3D I2C_MAX_FAST_MODE_PLUS_FREQ; + } + clk_multiplier =3D (tlow + thigh + 2) * (non_hs_mode + 1); =20 err =3D clk_set_rate(i2c_dev->div_clk, @@ -1214,6 +1235,9 @@ static void tegra_i2c_push_packet_header(struct tegra= _i2c_dev *i2c_dev, if (msg->flags & I2C_M_RD) packet_header |=3D I2C_HEADER_READ; =20 + if (i2c_dev->timings.bus_freq_hz > I2C_MAX_FAST_MODE_PLUS_FREQ) + packet_header |=3D I2C_HEADER_HS_MODE; + if (i2c_dev->dma_mode && !i2c_dev->msg_read) *dma_buf++ =3D packet_header; else @@ -1502,6 +1526,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_= hw =3D { .setup_hold_time_fast_fast_plus_mode =3D 0x0, .setup_hold_time_hs_mode =3D 0x0, .has_interface_timing_reg =3D false, + .has_hs_mode_support =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra30_i2c_hw =3D { @@ -1527,6 +1552,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_= hw =3D { .setup_hold_time_fast_fast_plus_mode =3D 0x0, .setup_hold_time_hs_mode =3D 0x0, .has_interface_timing_reg =3D false, + .has_hs_mode_support =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra114_i2c_hw =3D { @@ -1552,6 +1578,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c= _hw =3D { .setup_hold_time_fast_fast_plus_mode =3D 0x0, .setup_hold_time_hs_mode =3D 0x0, .has_interface_timing_reg =3D false, + .has_hs_mode_support =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra124_i2c_hw =3D { @@ -1577,6 +1604,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c= _hw =3D { .setup_hold_time_fast_fast_plus_mode =3D 0x0, .setup_hold_time_hs_mode =3D 0x0, .has_interface_timing_reg =3D true, + .has_hs_mode_support =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra210_i2c_hw =3D { @@ -1602,6 +1630,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c= _hw =3D { .setup_hold_time_fast_fast_plus_mode =3D 0, .setup_hold_time_hs_mode =3D 0, .has_interface_timing_reg =3D true, + .has_hs_mode_support =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra186_i2c_hw =3D { @@ -1627,6 +1656,7 @@ static const struct tegra_i2c_hw_feature tegra186_i2c= _hw =3D { .setup_hold_time_fast_fast_plus_mode =3D 0, .setup_hold_time_hs_mode =3D 0, .has_interface_timing_reg =3D true, + .has_hs_mode_support =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra194_i2c_hw =3D { @@ -1648,10 +1678,13 @@ static const struct tegra_i2c_hw_feature tegra194_i= 2c_hw =3D { .thigh_std_mode =3D 0x7, .tlow_fast_fastplus_mode =3D 0x2, .thigh_fast_fastplus_mode =3D 0x2, + .tlow_hs_mode =3D 0x8, + .thigh_hs_mode =3D 0x3, .setup_hold_time_std_mode =3D 0x08080808, .setup_hold_time_fast_fast_plus_mode =3D 0x02020202, .setup_hold_time_hs_mode =3D 0x090909, .has_interface_timing_reg =3D true, + .has_hs_mode_support =3D true, }; =20 static const struct tegra_i2c_hw_feature tegra256_i2c_hw =3D { --=20 2.43.0 From nobody Thu Oct 2 11:50:41 2025 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012005.outbound.protection.outlook.com [40.107.200.5]) (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 91A2430F949; Wed, 17 Sep 2025 08:57:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.200.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758099449; cv=fail; b=JMlJwRiq6U/9b0jmZPdgjLBMy4RLppqTE0nLwQSLHhmFXtQfdBqk+ZIU+cK6zMeQaOzeKlqnXdcH8iPq6fLo/aYC/O2HnmRwQp7wKMSHFmot4WuogECgwIxZWLyTP4MJXkHtLpZaayvoG3tjj8ELWWD95zRWi+Huib/1iM+XkCk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758099449; c=relaxed/simple; bh=rwAdHBgobGbivRbWgIntS6cdjNMNU0eJymNGcVkMGdo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lr6hMOjG/UvRZUKVx9eer3q5xKXZvU+PD8OLxgF2Ku4Okn3YPT+I3V+dmSWHBMU2CUp6HDtX1xyRFA3W8p+KX0OXaw9A9NEwb1g7tX6YwhTMjybMwBDdWsAnRzHspN1hbRQyLmadNPvPGCC3Omjy6h2LgI1f52B/UrBuMU+7C5w= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=QwpYXKWc; arc=fail smtp.client-ip=40.107.200.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="QwpYXKWc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NwKIDZnOz8m9ZX8mD0h/qygAxgBydF9Gbg+zsdtALSKmwKbRZzTDRFvZE6o9sEzfjIwdrNtiz+aKTrjQ/rz8U/hXBWxWRqR4AjREkIPLeHvo0CAwzBtr8Fl0zCTDf7aFRpjApCdBq8eHoBDtwPgiNK/HGvl+EM6KdEjy/s0x+Y9hfCY2iITiQbeAgUvj/sPi3rTxDDXlOju88dA7GPP20QxAVW7rJOrKLEP42h8CHW8G9u2IP/6sgMLk6iJpUCgPaeUe0nHJIsb7Chg4M55z7B+AI3lpuiL+UGVygCjiafFLklfTwr0CqubIqkSUyCo2mlWk5K/kBoSqmmZlPTS1kg== 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=Prmh1JvKWsHTOj9kwhRy+OX28FFes7iIjFl3PFo9WWM=; b=upAH/rPI0rwwTJzecUFeAwwqNqwpB/KYMuc7MsLhNB9GCkewD1X242TSF+LWpFWz2lzPjUMy/q2rU7AUmGqYOS3bPqBro3sqVDLeVFchJqNPrYKyGTmmLKHTImhg3UhwuUIwcDETBBM+kk4/RxnCQbuLI6T0mZbUe0dVL70IyYndRuqSojA68f8hsDpMkId9UEN0a9EnXOSSgKryHlQ1ON1IlALfwUZtW9ax6pBR0j5tmQrpLswzNT04aC+8j4nbHZJdHiYFZilc21sxNMGZTlfZqs7Tf7vUdH9qnjPsRgn1gICfZe0b1PAcwVyBtiolBP3pQeOhN5BLz+0HM/zQOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Prmh1JvKWsHTOj9kwhRy+OX28FFes7iIjFl3PFo9WWM=; b=QwpYXKWcwFjN0uBxzk4DrIGRM5zRMyYGHHYOa+w8hqpwQhpv++KBLxJxz57PQ8Q3K5HpfdyOXgQd2gHhBDQn6fG9uuDRZcIsHPseN3WMvFhzFwDS7CGnv3uqJUjSsghniqu6rA+sWJWLM/j6jGaROGLe5H45gLcpk36UNeIbYbgGGDi9U6xuPpL/ujcAX3O4OEDvsnmcf66zUpQS+v6K6dEBTDSIDNTTeXdIFQ9V5L6xODHqsYhUcR2n807LPXQQ75ES31EU5BNH2aKuZEqTUNYwp1Sh/E06vlcfS1P2MuQ0uVVV6gXNjfTluweDe191D+nv44iuDNMZHpkih1YXWw== Received: from CH2PR05CA0064.namprd05.prod.outlook.com (2603:10b6:610:38::41) by LV2PR12MB5991.namprd12.prod.outlook.com (2603:10b6:408:14f::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Wed, 17 Sep 2025 08:57:23 +0000 Received: from CH2PEPF00000144.namprd02.prod.outlook.com (2603:10b6:610:38:cafe::85) by CH2PR05CA0064.outlook.office365.com (2603:10b6:610:38::41) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9137.13 via Frontend Transport; Wed, 17 Sep 2025 08:57:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CH2PEPF00000144.mail.protection.outlook.com (10.167.244.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.12 via Frontend Transport; Wed, 17 Sep 2025 08:57:23 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 17 Sep 2025 01:57:11 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 17 Sep 2025 01:57:10 -0700 Received: from kkartik-desktop.nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Wed, 17 Sep 2025 01:57:06 -0700 From: Kartik Rajput To: , , , , , , , , , , , , CC: Subject: [PATCH v8 3/4] i2c: tegra: Add support for SW mutex register Date: Wed, 17 Sep 2025 14:26:49 +0530 Message-ID: <20250917085650.594279-4-kkartik@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250917085650.594279-1-kkartik@nvidia.com> References: <20250917085650.594279-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000144:EE_|LV2PR12MB5991:EE_ X-MS-Office365-Filtering-Correlation-Id: c4a49553-2651-47e8-a7c7-08ddf5c837ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|1800799024|36860700013|376014|82310400026|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?aw9v/DusVfJ2rdHPir3gtFgJJVsNpE8qzQQM5uwTrCXmRtCrSeuAR0G6n/g+?= =?us-ascii?Q?VpAqsyjwtnNqhu5FtFeUVJFP27ebns/+lQK4CnzMjWJ1dQQllHDOd0BFB/HO?= =?us-ascii?Q?vmXMOcigfC4RvPzqANXtbsQClCunrt0MgmRfbWGz1Tsd0rwEBhGBBw10G+Ei?= =?us-ascii?Q?FraWkJX+M0i/3SiufdrdgzQsfvcc2ccgSwXoToUSfc4l6HkSBwcpFPYb2BL4?= =?us-ascii?Q?7bsnxCb0ctaDbG/nCF/IfrB1kIknGBiKpcbJM8CMwadmE7o67US8c+95QW4g?= =?us-ascii?Q?8+McybIwLgAzLJIfPyXUgoyXIsGRCPZf2DqEwif5q0vkLNeJ3Gco1sRJomPB?= =?us-ascii?Q?nik9vMi2RxsShbCwRCT9JDITlynIQKrmwkyscpsWcg14AlFGf0EciHovF3vS?= =?us-ascii?Q?tFBk6yfVbd2+6Cm3xCxUbR6CeYnp9Eh8Tl8Md4MYr2C46ZBr102J9XhQ1uhO?= =?us-ascii?Q?W85Zkgy6hGjgTwKLi4YW0/6i43ROqYycIP+zt84T8SBobCh6q2lWxDJir0w0?= =?us-ascii?Q?p+W1j7SFAbLRl9MXPMdETydrmobGuFUl50kILUQbSBQIy6pQi3l2vzGvZACv?= =?us-ascii?Q?zz+49ESD+hxfg2mgMpS7qxZQJs0ofmJJhNRnd/xdSNfBRKhm/GJfnvdAkWkH?= =?us-ascii?Q?XOorKtlu8nQQcSnC4B7jQbacUxTU+HKj5qvCNArUUEYvxF60HqoI7iikDMbF?= =?us-ascii?Q?RmTSAMb6DbSQOfaWD/ePdnVWjMby7DZK3pHrJu8h+HQkkGRyiWcFb2jd0X4h?= =?us-ascii?Q?/pIe5htWRIyr1mufMDEzfXAx2GiAIwYdMm5uYaRenMsm86GkeeB5QHJXOdg4?= =?us-ascii?Q?PQXCr37UjqkPRhNlt4YnrApPwbD/hgFwvcGxLGTmw1qGE3q94VTa5akkkbMP?= =?us-ascii?Q?J8j9w6VT8KTpGC0mfou4XoCxEbOyEfN269QGn6TWX/jooSeanz3lgZlwS4/A?= =?us-ascii?Q?FqJHSUO5sNgD/MewsDRX4k7XHr2Nd+LGPF0RWOZ82wFIzWfZq4cXFWMF3KYg?= =?us-ascii?Q?d2L3sRMnFs1lFqUvLTSAPyZijwmeGY0mj0sq/lfIGA0yWsxgOuvg7gPKSffb?= =?us-ascii?Q?zu4iVzQx2tGUDQPZN7kpg69OycfHe17p+p8xYHiXZnp6WODVeyvbWfRIXjAX?= =?us-ascii?Q?UyRioFHVJorIzQKM7hCmm66hoeyqGfKXunTkYGJf4YLvIkJqABEC7Qepccsi?= =?us-ascii?Q?g1oKhGFVwsnJk9jSIP1gPg7heRaMBsx2OTbih8+4syd/4k+PK19dXzKIPxls?= =?us-ascii?Q?+Akc2pFK04g0BZCUz4OMh0sInSth+r12mF+8JpsXbpc4idhbvMPdffKShuC6?= =?us-ascii?Q?88Q7xGkt7LOhdx3/49jnCPGwx0u2Z44gXTTchCTXsTZt+4r2R7a6L4vQXGIK?= =?us-ascii?Q?kTF0mw5917RZaiEd6EYyLebg20guMp53TVJEfdMGYfVJKR9p9C5fc6zd7gen?= =?us-ascii?Q?2oxRK84SEoeRnJg+4TZUnloZk+xBKbfyGxmQbHNZXDxIOLTRl4qPDWHEG+Qt?= =?us-ascii?Q?E8q2N4vx+R0gwfjclRkiTGk0jsAZpf3XeuwQKRvb70xT67/tFHFPrc/AEw?= =?us-ascii?Q?=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230040)(7416014)(1800799024)(36860700013)(376014)(82310400026)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2025 08:57:23.3579 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c4a49553-2651-47e8-a7c7-08ddf5c837ce X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00000144.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR12MB5991 Content-Type: text/plain; charset="utf-8" Add support for SW mutex register introduced in Tegra264 to provide an option to share the interface between multiple firmwares and/or VMs. This involves following steps: - A firmware/OS writes its unique ID to the mutex REQUEST field. - Ownership is established when reading the GRANT field returns the same ID. - If GRANT shows a different non-zero ID, the firmware/OS retries until timeout. - After completing access, it releases the mutex by writing 0. However, the hardware does not ensure any protection based on the values. The driver/firmware should honor the peer who already holds the mutex. Signed-off-by: Kartik Rajput Signed-off-by: Akhil R --- v7 -> v8: * Use `bool` instead of `int` for `locked` variable in tegra_i2c_mutex_lock() function. v6 -> v7: * Return bool from tegra_i2c_mutex_acquired() and tegra_i2c_mutex_trylock() functions. * Move `has_mutex` check inside tegra_i2c_mutex_lock/unlock functions. * Remove redundant empty line added in tegra_i2c_xfer() in v6. * Fix pm_runtime_put() not getting called if mutex unlock fails. * In tegra_i2c_mutex_lock() simplify the logic to check if the mutex is acquired or not by checking the value of `ret` variable. * Update commit message to describe the functioning of SW mutex feature. v4 -> v6: * Guard tegra_i2c_mutex_lock() and tegra_i2c_mutex_unlock() to ensure that they are called on platforms which support SW mutex.=20 v3 -> v4: * Update timeout logic of tegra_i2c_mutex_lock() to use read_poll_timeout APIs for improving timeout logic. * Add tegra_i2c_mutex_acquired() to check if mutex is acquired or not. * Rename I2C_SW_MUTEX_ID as I2C_SW_MUTEX_ID_CCPLEX. * Function tegra_i2c_poll_register() was moved unnecessarily, it has now been moved to its original location. * Use tegra_i2c_mutex_lock/unlock APIs in the tegra_i2c_xfer() function. This ensures proper propagation of error in case mutex lock fails. Please note that as the function tegra_i2c_xfer() is already guarded by the bus lock operation there is no need of additional lock for the tegra_i2c_mutex_lock/unlock APIs. v2 -> v3: * Update tegra_i2c_mutex_trylock and tegra_i2c_mutex_unlock to use readl and writel APIs instead of i2c_readl and i2c_writel which use relaxed APIs. * Use dev_warn instead of WARN_ON if mutex lock/unlock fails. v1 -> v2: * Fixed typos. * Fix tegra_i2c_mutex_lock() logic. * Add a timeout in tegra_i2c_mutex_lock() instead of polling for mutex indefinitely. --- drivers/i2c/busses/i2c-tegra.c | 92 ++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 6f816de8b3af..a2119b8bcc1d 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -137,6 +137,14 @@ =20 #define I2C_MASTER_RESET_CNTRL 0x0a8 =20 +#define I2C_SW_MUTEX 0x0ec +#define I2C_SW_MUTEX_REQUEST GENMASK(3, 0) +#define I2C_SW_MUTEX_GRANT GENMASK(7, 4) +#define I2C_SW_MUTEX_ID_CCPLEX 9 + +/* SW mutex acquire timeout value in microseconds. */ +#define I2C_SW_MUTEX_TIMEOUT_US (25 * USEC_PER_MSEC) + /* configuration load timeout in microseconds */ #define I2C_CONFIG_LOAD_TIMEOUT 1000000 =20 @@ -210,6 +218,7 @@ enum msg_end_type { * @has_interface_timing_reg: Has interface timing register to program the= tuned * timing settings. * @has_hs_mode_support: Has support for high speed (HS) mode transfers. + * @has_mutex: Has mutex register for mutual exclusion with other firmware= s or VMs. */ struct tegra_i2c_hw_feature { bool has_continue_xfer_support; @@ -237,6 +246,7 @@ struct tegra_i2c_hw_feature { u32 setup_hold_time_hs_mode; bool has_interface_timing_reg; bool has_hs_mode_support; + bool has_mutex; }; =20 /** @@ -381,6 +391,76 @@ static void i2c_readsl(struct tegra_i2c_dev *i2c_dev, = void *data, readsl(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg), data, len); } =20 +static bool tegra_i2c_mutex_acquired(struct tegra_i2c_dev *i2c_dev) +{ + unsigned int reg =3D tegra_i2c_reg_addr(i2c_dev, I2C_SW_MUTEX); + u32 val, id; + + val =3D readl(i2c_dev->base + reg); + id =3D FIELD_GET(I2C_SW_MUTEX_GRANT, val); + + return id =3D=3D I2C_SW_MUTEX_ID_CCPLEX; +} + +static bool tegra_i2c_mutex_trylock(struct tegra_i2c_dev *i2c_dev) +{ + unsigned int reg =3D tegra_i2c_reg_addr(i2c_dev, I2C_SW_MUTEX); + u32 val, id; + + val =3D readl(i2c_dev->base + reg); + id =3D FIELD_GET(I2C_SW_MUTEX_GRANT, val); + if (id !=3D 0 && id !=3D I2C_SW_MUTEX_ID_CCPLEX) + return false; + + val =3D FIELD_PREP(I2C_SW_MUTEX_REQUEST, I2C_SW_MUTEX_ID_CCPLEX); + writel(val, i2c_dev->base + reg); + + return tegra_i2c_mutex_acquired(i2c_dev); +} + +static int tegra_i2c_mutex_lock(struct tegra_i2c_dev *i2c_dev) +{ + bool locked; + int ret; + + if (!i2c_dev->hw->has_mutex) + return 0; + + if (i2c_dev->atomic_mode) + ret =3D read_poll_timeout_atomic(tegra_i2c_mutex_trylock, locked, locked, + USEC_PER_MSEC, I2C_SW_MUTEX_TIMEOUT_US, + false, i2c_dev); + else + ret =3D read_poll_timeout(tegra_i2c_mutex_trylock, locked, locked, USEC_= PER_MSEC, + I2C_SW_MUTEX_TIMEOUT_US, false, i2c_dev); + + if (ret) + dev_warn(i2c_dev->dev, "failed to acquire mutex\n"); + + return ret; +} + +static int tegra_i2c_mutex_unlock(struct tegra_i2c_dev *i2c_dev) +{ + unsigned int reg =3D tegra_i2c_reg_addr(i2c_dev, I2C_SW_MUTEX); + u32 val, id; + + if (!i2c_dev->hw->has_mutex) + return 0; + + val =3D readl(i2c_dev->base + reg); + + id =3D FIELD_GET(I2C_SW_MUTEX_GRANT, val); + if (id && id !=3D I2C_SW_MUTEX_ID_CCPLEX) { + dev_warn(i2c_dev->dev, "unable to unlock mutex, mutex is owned by: %u\n"= , id); + return -EPERM; + } + + writel(0, i2c_dev->base + reg); + + return 0; +} + static void tegra_i2c_mask_irq(struct tegra_i2c_dev *i2c_dev, u32 mask) { u32 int_mask; @@ -1422,6 +1502,10 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, = struct i2c_msg msgs[], return ret; } =20 + ret =3D tegra_i2c_mutex_lock(i2c_dev); + if (ret) + return ret; + for (i =3D 0; i < num; i++) { enum msg_end_type end_type =3D MSG_END_STOP; =20 @@ -1451,6 +1535,7 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, s= truct i2c_msg msgs[], break; } =20 + ret =3D tegra_i2c_mutex_unlock(i2c_dev); pm_runtime_put(i2c_dev->dev); =20 return ret ?: i; @@ -1527,6 +1612,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_= hw =3D { .setup_hold_time_hs_mode =3D 0x0, .has_interface_timing_reg =3D false, .has_hs_mode_support =3D false, + .has_mutex =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra30_i2c_hw =3D { @@ -1553,6 +1639,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_= hw =3D { .setup_hold_time_hs_mode =3D 0x0, .has_interface_timing_reg =3D false, .has_hs_mode_support =3D false, + .has_mutex =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra114_i2c_hw =3D { @@ -1579,6 +1666,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c= _hw =3D { .setup_hold_time_hs_mode =3D 0x0, .has_interface_timing_reg =3D false, .has_hs_mode_support =3D false, + .has_mutex =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra124_i2c_hw =3D { @@ -1605,6 +1693,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c= _hw =3D { .setup_hold_time_hs_mode =3D 0x0, .has_interface_timing_reg =3D true, .has_hs_mode_support =3D false, + .has_mutex =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra210_i2c_hw =3D { @@ -1631,6 +1720,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c= _hw =3D { .setup_hold_time_hs_mode =3D 0, .has_interface_timing_reg =3D true, .has_hs_mode_support =3D false, + .has_mutex =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra186_i2c_hw =3D { @@ -1657,6 +1747,7 @@ static const struct tegra_i2c_hw_feature tegra186_i2c= _hw =3D { .setup_hold_time_hs_mode =3D 0, .has_interface_timing_reg =3D true, .has_hs_mode_support =3D false, + .has_mutex =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra194_i2c_hw =3D { @@ -1685,6 +1776,7 @@ static const struct tegra_i2c_hw_feature tegra194_i2c= _hw =3D { .setup_hold_time_hs_mode =3D 0x090909, .has_interface_timing_reg =3D true, .has_hs_mode_support =3D true, + .has_mutex =3D false, }; =20 static const struct tegra_i2c_hw_feature tegra256_i2c_hw =3D { --=20 2.43.0 From nobody Thu Oct 2 11:50:41 2025 Received: from BN8PR05CU002.outbound.protection.outlook.com (mail-eastus2azon11011033.outbound.protection.outlook.com [52.101.57.33]) (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 B1E4C310652; Wed, 17 Sep 2025 08:57:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.57.33 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758099452; cv=fail; b=R9sqdOUMDbrVA3RVGu8sjrQ0bh01dg90RnWzlcciZFhBoG8pNSalowh4JLxbrVDGjCQBBbaHaiL51VPT2o9bG9aAU18dI8OaZsrTL++/e7XTxj/Eq0tET7xUN9yrYmgJQ5g2Abz6qR9lg0Ti9yesrUR7TtgaAqhWuI1ksbUih8Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758099452; c=relaxed/simple; bh=lnGkIj5ugbvNbGVo7T4u3ZdQ7S2a+QuFCpOhlwkWKms=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mW+M9KacvwAndmh/IX6SLGPbeD5Vlwo5mqIcHUW+ufimkMWcDh5QnJW4oKYRB3/Pff/7bVZh2SRfJirXbZvTgt/eoBoAw/wgWaaP13ARFWF8KurNFDzbe06AJDzn8BnBlkIO+qoq6nqxKOXQwgJRJ2MSxWZL3Z+sG3/qcsd61Bo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=tSW4zbK6; arc=fail smtp.client-ip=52.101.57.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="tSW4zbK6" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mkcoALyuDBCM3xY/w3PGPBufT1shCPhDANjhsCTnwKwq8rwWrpQT+gfXcmCdhJ3esXQDwB/0y2jXESNz+MQzFfGye9y5E3qyfRdO5CEHYJMU0442tx54z/4D7zU7azMvuzrXEZ7wbd71b5Ehr7lQObWIZBqmMIfPDlXUAcf+SRnWWNrfFflmV5XFhOsQfGhUIPi3/pqZqC+7dEHIhnNz/TZ6bDNJEW4esGhnT0SyjM8ZCkbSBXSaNDMYZscVZFdHm9wPET/CKzjygK+ymoG/tufyxXqAY9LsWpG9Syu1T8UnoJkXVMUWg3qssOrihOfXgsWKI+Ehx/K7m/wjAK0txA== 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=XfmJSZoabzycpu8zhzYxRez2aCoAcToHId0DGEApSDY=; b=L6UA7KElHIzDS23CMdeiqLq5lmruppQZAWsiuA6ypre8+eBowLKYGQ2Siu6N7kbvrfWLxaH5S+wZu/dlvGgKPSNLAO0g7SSmKO6TIPTqD5Hd7H9qlf/Yq9POtpyCpY8P/KDYZOa9EHRXQ51BZhcY4U3ysU+2p5brXBYs2gUPyZ4XQPoNuLnpyYsYQl3ohB+UB00Le+wGsVni0YivfPN7Zlc6pNwJbSuRfGNP26zOMsKJVPjODPrdNpcA2JEIWZ8ttrR/BRNp7XkZYeUX2IvHNzsNa8TBQkHfqTFPEUY9HLyypns6j6U4CIw+cOVRd1Jls0OCSizGZSOrPYEXiZ7VgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XfmJSZoabzycpu8zhzYxRez2aCoAcToHId0DGEApSDY=; b=tSW4zbK6x4n9fdmV2EadqqWFnDJj08VW8+8pTMJSan61syX0lH9psRl8PUu1Jt91s0PbXyM8Yj8zcgD3ZuDsPRFg8a2B2F+dsvqzFVYXXnA3S2zUSXPgtZnmAepGGaFIcPkVNZMJqQ0EXg5SNnjqGx3YbVilC0tgIXj+3PMRCx12/zhHFVbP4f/YUeVaOYt/2+/yge8/S/CuOe4tKvWkto/r+nuoYSTxIMdSH6yfeEDBRE73VtHfSLI5FjQln0eNWgoaEH4nMvqcy9KilnWuXWthdeQ8F+szaYzaWuH7KshSTWR/HV2LN9xo/guWx78UV5vJVF1vCxrve7OsSaUIsQ== Received: from CH0P221CA0031.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:11d::13) by CYXPR12MB9340.namprd12.prod.outlook.com (2603:10b6:930:e4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.13; Wed, 17 Sep 2025 08:57:26 +0000 Received: from CH2PEPF00000147.namprd02.prod.outlook.com (2603:10b6:610:11d:cafe::62) by CH0P221CA0031.outlook.office365.com (2603:10b6:610:11d::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9137.13 via Frontend Transport; Wed, 17 Sep 2025 08:57:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CH2PEPF00000147.mail.protection.outlook.com (10.167.244.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9137.12 via Frontend Transport; Wed, 17 Sep 2025 08:57:26 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 17 Sep 2025 01:57:16 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail201.nvidia.com (10.126.190.180) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.14; Wed, 17 Sep 2025 01:57:15 -0700 Received: from kkartik-desktop.nvidia.com (10.127.8.13) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.14 via Frontend Transport; Wed, 17 Sep 2025 01:57:11 -0700 From: Kartik Rajput To: , , , , , , , , , , , , CC: Subject: [PATCH v8 4/4] i2c: tegra: Add Tegra264 support Date: Wed, 17 Sep 2025 14:26:50 +0530 Message-ID: <20250917085650.594279-5-kkartik@nvidia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250917085650.594279-1-kkartik@nvidia.com> References: <20250917085650.594279-1-kkartik@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PEPF00000147:EE_|CYXPR12MB9340:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a173031-5485-4fce-95a5-08ddf5c839b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|7416014|1800799024|921020; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?URW0prKk18AB904b0JE1riTeZpUkgtleHef5iRI4ZyjlYn+nj9Jam4slybN4?= =?us-ascii?Q?fnHhG83smwAXGBCk2vXB6Js1tgiDYB5mfdFi259prZi5hC8MB/RzkTWXyHSU?= =?us-ascii?Q?OAdbbEbY1WGcPQtKdH5SK1woH5irhgrYgF47GtYacLQA1rxBwA3FfuBIf6/I?= =?us-ascii?Q?Yju/eN4Mx8tms6ykVBTQ2cmtmjKhyH1duN/GrcBW2QmZWM0vIN7TRcBmq2NB?= =?us-ascii?Q?qFf911VGmfawmMvmy3H4+dPaalOBARq9Vp7hNJctAW5q5Wy6pqp9OIP2XLrE?= =?us-ascii?Q?2r7/Qvge236rOFF26NB5xpHicI+JDPRT+9Kve+5iVTb3qXwWd0zwKpRmR3g5?= =?us-ascii?Q?9Wf7rDL94kxTh1t7GS4+723CG3rhsu4T3fEUKPB3FEL0WSCYASrHW1Lo5Zkk?= =?us-ascii?Q?5OuT4dDZwop4pwXyCSs7t0pBzq2Xmsycuprh0YNFENfDU9vymBnV4IPUye4L?= =?us-ascii?Q?2r9+8yaUMQgP8APt6IW4J5yl5hNe4JoxVsF2FOdEQL7ZUYri8we26zTHFPv3?= =?us-ascii?Q?q2cpL3oGrEIoTUMU4QLyhpwrlZOmP2lK+WVldC49iqlvegUim4LHHZga4ALU?= =?us-ascii?Q?wGk4u7TM+CefxZrLuXvk8v8PlIc8XKZnch59X2B5jpcx8g+Fsc09F5o5d6QI?= =?us-ascii?Q?TvoP26XfKam737/R0RmznV1G033NeWxqmwhR/RV3VQjU7HKtLUvFFI2oI4+3?= =?us-ascii?Q?Tnn9Ad69KqWstl+rmIY/skccrKZWD1N6UfOvuV/2H2KfyLiN9ntaLWT7hZ8F?= =?us-ascii?Q?EgTbVGVNzVsIlxDvD+rW5oovlP2X10b2HCLl+r9eo79aSyuKvf1qqgmDQHoY?= =?us-ascii?Q?AcY3D0lP6R6qYOKVWorpiXffMSf24f7SBtZ0EqKBNUeGYPCXXobyuvYTTrmZ?= =?us-ascii?Q?Du2KXEMJHSjYHLvMfIs+9qLvUkL38dNvPSa64erphucs3bo79ACUmzddpYPZ?= =?us-ascii?Q?6BnA8Fkr0YsSGdWrUToN1nA51r7ZUL3aBHXiDJT3a69mSPpzis9VBdHlZpnh?= =?us-ascii?Q?eSkiNEwuT7uKj9Dfs6OArJi+0zeWJtk/okVimNRnBqghDfe1f0cCKD7cR+mF?= =?us-ascii?Q?rbdEpxsIWPJUEOhuJ8XTnFzyRqF9Jou+56ILfc4KvI9vwS1DvcdCGuo8nDQj?= =?us-ascii?Q?j35wFUg8tB7fmNXns6OtsTvOA6PafM069nugorBQxy2+NwtjXDu+5V35SHVi?= =?us-ascii?Q?ttOaxK5aVTEi6EuQuB7ebuD0NVhk1IxNUESlJR+NoI8sF2ScsPOh0Z78WGTp?= =?us-ascii?Q?dp7+ggN3MiCQnStFaksQj4Kkdf0EJGfEl93IQUMaczZ8FTTpBdSVfIuukjoN?= =?us-ascii?Q?oyrac54t0a9YYnTzZ5Bw903WAVnkrN3uCYGNQQpLMUNpwG6iN6ReGWCKtmGg?= =?us-ascii?Q?X6/w40aTgbTHEFDrA5+6BZC7oXvYZL1mR9QNV48OZXV4q2DbNGFfNU9S3Rni?= =?us-ascii?Q?GISIdXHLEGAlGBYSFAaIRW0EGO/8XnLNe4PPspNBvedaeFa0Jdudi4becMC2?= =?us-ascii?Q?zdRG9FiN8tLA5TxEVLp0ScyaD/o+tx6K6qbZK8fcZ1NgtQPoDEfwnRk0Yw?= =?us-ascii?Q?=3D=3D?= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(7416014)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2025 08:57:26.5412 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2a173031-5485-4fce-95a5-08ddf5c839b3 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CH2PEPF00000147.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9340 Content-Type: text/plain; charset="utf-8" From: Akhil R Add support for Tegra264 SoC which supports 17 generic I2C controllers, two of which are in the AON (always-on) partition of the SoC. In addition to the features supported by Tegra194 it also supports a SW mutex register to allow sharing the same I2C instance across multiple firmware. Signed-off-by: Akhil R Signed-off-by: Kartik Rajput --- v1 -> v4: * Update commit message to mention the SW mutex feature available on Tegra264. --- drivers/i2c/busses/i2c-tegra.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index a2119b8bcc1d..cc9aa7f008eb 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -1804,7 +1804,36 @@ static const struct tegra_i2c_hw_feature tegra256_i2= c_hw =3D { .has_interface_timing_reg =3D true, }; =20 +static const struct tegra_i2c_hw_feature tegra264_i2c_hw =3D { + .has_continue_xfer_support =3D true, + .has_per_pkt_xfer_complete_irq =3D true, + .clk_divisor_hs_mode =3D 1, + .clk_divisor_std_mode =3D 0x1d, + .clk_divisor_fast_mode =3D 0x15, + .clk_divisor_fast_plus_mode =3D 0x8, + .has_config_load_reg =3D true, + .has_multi_master_mode =3D true, + .has_slcg_override_reg =3D true, + .has_mst_fifo =3D true, + .quirks =3D &tegra194_i2c_quirks, + .supports_bus_clear =3D true, + .has_apb_dma =3D false, + .tlow_std_mode =3D 0x8, + .thigh_std_mode =3D 0x7, + .tlow_fast_fastplus_mode =3D 0x2, + .thigh_fast_fastplus_mode =3D 0x2, + .tlow_hs_mode =3D 0x4, + .thigh_hs_mode =3D 0x2, + .setup_hold_time_std_mode =3D 0x08080808, + .setup_hold_time_fast_fast_plus_mode =3D 0x02020202, + .setup_hold_time_hs_mode =3D 0x090909, + .has_interface_timing_reg =3D true, + .has_hs_mode_support =3D true, + .has_mutex =3D true, +}; + static const struct of_device_id tegra_i2c_of_match[] =3D { + { .compatible =3D "nvidia,tegra264-i2c", .data =3D &tegra264_i2c_hw, }, { .compatible =3D "nvidia,tegra256-i2c", .data =3D &tegra256_i2c_hw, }, { .compatible =3D "nvidia,tegra194-i2c", .data =3D &tegra194_i2c_hw, }, { .compatible =3D "nvidia,tegra186-i2c", .data =3D &tegra186_i2c_hw, }, --=20 2.43.0