From patchwork Mon May 6 22:51:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 795070 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2052.outbound.protection.outlook.com [40.107.223.52]) (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 2F6A315D5A9; Mon, 6 May 2024 22:52:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035954; cv=fail; b=YC/e077PdEt80NhIpvJ4Ae6ubFv9aysWBZi52HzSWXHD3jrd0h6S3SdcWXTvoD3FIaZAsqtnZIkPPT2sNyra9ktd+tijOFtv3PEsaSoUlzMLGEMUsAlIARXcrnZjT3mqNXN+DTi8yYBYCSTeqZeJIprbHZw0jQXPAYp5vPNzu7U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035954; c=relaxed/simple; bh=Kkq0y3Z2UElReYwPOoFUNOoAO3+JvI4tFshPhhZUg7A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tM+57qyVlU35wDkfAO/MMMN8FHQPjNGVDmoOElmG9Gjb++72ZLEQ6Y9FpzTCLaitom6W808iXbwbgGVXPqx68Ps5IOO0zBjNqlV3W0jG/iZ8dnAQ6pIlfSPCCagn+y0bIRSgGtuwzF1uJLDGPzv+xB6zRabbq0GwW4pKkQj/yHA= 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=tCfHpNiL; arc=fail smtp.client-ip=40.107.223.52 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="tCfHpNiL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n/4JCj4S0UQv48xSIO20fAYM7pBwd3YsEgl9a5sUaOjPfw4LeRuAKFOXF76VmlYNlJhqQeiadGObATVN8gj5T9TX09OU32Uv5kKduHPHToHHAYsEPhE84kHaTECfv/D24oCHQ4ro4a/oU2AA6al21VNywntCBrvhgDzJnuVwqk7yA/S7V1Z7xF3Na6hTviNGS0/ml6llq9YcG6MumYEgES/8Y3uUdj5/AP8bUuGjdYMoBG76536kezRVVeNBiMFkUpG1E1wh7aPhoRbfH64sjGPggrgYg9TUA0J2HH5h7sMihyTx217bF7kS35WoiI6ZziczodOUa50VoegwDo+Stw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YUtaoCuNX4Rx/0K+PV7JINzAsPZmH1ZYPtFIuDXviKI=; b=kkfLEHH5/b+Wl7Zafqi3QbR1q9i/UW7jcqR/tgUf/iA0KYzleY/X8Izwx1XU0ZMaek8VMnaUDc4VRgWmna6lMq8QXOa/nNUOsrXw5Y6XHaViExaGkExodSNWQR8s8cGelXrAN98QBKROB0qBrpokYfSTBdMiXOLg8/IBCYR1lXxP5e7apZyZSpo38eX4UHceY9OTZ82e7zUv3jiGvIVAbiKzSe2oQEOpxtCh0dEB7gCqKQwi/RsL9F8cfnBj4OU/2qMIluLtL9SjS2sFnm+CTzS3vwaaiQj/xMxDOe8nFIsBJYPtiWEm1laPxTP1Tx1HBF6GZqg0ekMPaVzp+5/1gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=vger.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=YUtaoCuNX4Rx/0K+PV7JINzAsPZmH1ZYPtFIuDXviKI=; b=tCfHpNiLITv+Tl6QJCW5i00b41BmxZSvJGVlXKPjx+6GjIqrfkOYpH3daXGkCfW22yooS99Ei4TDe6g7EGuqGu1sX/yP6nDiw5WxT6KDiWID0k3MtoEbhhXPMtI/5cwo+78A8ssGxMJdj6qKBpeEuPQ4cM1MsBgj9PMIv+Sq2cq9neqCu8r2hLDcFLqjii/ySYxX5dyu2ggL9AXT8ejUA2AumruuFIiqsIcngH/lj8vFBaQ8C8zZ3JpY7HDZCGwJ8IVAFp8qDOYkyVdQ3kgW3G6nE0B0c9dGsUEMB05cf97YalIBD1XSB+wYZ4H3Wke3G6Z+vYf13Ebt3g5w75nWjQ== Received: from PH8PR07CA0033.namprd07.prod.outlook.com (2603:10b6:510:2cf::20) by IA1PR12MB6580.namprd12.prod.outlook.com (2603:10b6:208:3a0::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.29; Mon, 6 May 2024 22:52:28 +0000 Received: from SN1PEPF00036F3D.namprd05.prod.outlook.com (2603:10b6:510:2cf:cafe::b) by PH8PR07CA0033.outlook.office365.com (2603:10b6:510:2cf::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 22:52:28 +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 SN1PEPF00036F3D.mail.protection.outlook.com (10.167.248.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:52:27 +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.4; Mon, 6 May 2024 15:52:15 -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.4; Mon, 6 May 2024 15:52:14 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:09 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 01/11] Documentation: Introduce config settings framework Date: Tue, 7 May 2024 04:21:29 +0530 Message-ID: <20240506225139.57647-2-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F3D:EE_|IA1PR12MB6580:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ae6fd2f-828b-4df2-ee2d-08dc6e1f345a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|7416005|36860700004|1800799015|376005; X-Microsoft-Antispam-Message-Info: ZKoeiJR/P8/hU09cZKUkIrXpr/c3i9YlnDeBDsJCdOSNjjiOifyUd90oMGcysxKUVt3u476duZoIPWDG36MnDTd5VF/dkIVnKz7LrK4L5uASPNlVeZ3gO3Uj0iUQYT8JNiXdSz2kwC72dGFEMzHh8LCy/UFdS1Bg/1K4v4tcOei4B4qP96YgBdJTysrzjkk2qjD2/CtnZqFzRkVTFtp8Rs1302M84dsR9hMDjU/03OALbdqPK9BwXX3RFnsjFAK79fApum40EcXP3cDOnNFgS7rASoLa6OmzED0LehrJcbmaCHrsOK6LdAi2G4uDpkgeXZmDpJB3hz5vR6ZWL45u0eUU/w17JqQcWiHEjKbcx0noJrRn8ZlcxYtUcU3nQaVaYC/BEAYSu86np1dYbChvAFoWgv/JEODuvsoW3wRvxABw65tTwRJuTaXOQhdkoiod3jRzUQntLzRpxbLdmruv/N8Qdvp5wX3SsU6ccatKs4gleXJtiHRswSOKTNHYNBxWqCk0xs3VYSCNgdPA7kTP1S4ttdc6SMEyaApoym1e1CngLy+sgj4xnaMR1E1v6PhQ9GgEJ3bY645i+JiHP3NidG9bHOuEJgVrNcy08X+AyIQjDixpl5P7Lf5m5+eH6OQRgEuHM73hhRHQBel9z8A0DW+hR2e85KFmtNxZ49w/pFOTpdsXB9p2FnW9Os03YzldE7XDgqWjEtr6b/NGAGklm15W0JqM1DNA7ztcvBrUclEeoT2nlHcMlPaqJ9pzF8Yh8W6OybykEBLLtr6IKVQ3BYhLlwOz/rFaahMDiMRQvVvYlAaXf+1gcepfuLUDv/OnbmR0wnxFmCgUHxB+WxzM+5EKG/b3tUMHJhw2uIbkZBUbWz9+fCD82mCI/m2DY+0n4rK3v02qOvorBvRUkvLVFi13MerAmxiZLC7dayL3paCvlDwxrj2gnaxoCTs4xJseNc77vPbK/9pccbftnd1hTN7qn8G26teQ2OstRpSrIQmVVu1qb+qPUMwDxbpdvo2g+6AWV2wgnaxfkuO2s2QS+EWTroBmvQlemVNWac2M+B9mbFnBaERD2rW2FeCFs2HLzMNEqAiTafDJ7Z2s4OYXE+GdP+AfIAz/VoNNWtR4so5TM0wWBz2RVz3U4H8h4BgLmyc9voM9C3LkIT9mHWfN1QvYUTaXCCKUjMb9k4GUYmZNnPor6jsQTM6nbgzk4I/Bp0Mu7kdGrgFTFJ9f/P62f/R2KrkqfByEjZuXxfCWAzsbMETpvoXawwBT5ApXwLCAn31+xYetmh6UlIF1oakydP95hhHqN+7IHkJYkQ+0/HDs4WSV7MbYUCuCkE1GTHEChvAm2GUp0UA2wg9v9ia7e+HqWSasW7TpwODnzSdnzvbJ8qS9rPftSW0vQWmN1pkg 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:(13230031)(82310400017)(7416005)(36860700004)(1800799015)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:52:27.9777 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ae6fd2f-828b-4df2-ee2d-08dc6e1f345a 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: SN1PEPF00036F3D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6580 Add documentation for config settings framework utilized by Tegra SOCs. This framework is used to configure various device registers (I2C, SPI, etc) with the optimal/recommended settings for a given operating mode. For each operating mode there may be various register fields that need to be configured and so these settings are broken down by register field. This framework uses device-tree for specifying various register settings for each operating mode for a given device. Signed-off-by: Krishna Yarlagadda --- Documentation/misc-devices/tegra-cfg.rst | 128 +++++++++++++++++++++++ MAINTAINERS | 7 ++ 2 files changed, 135 insertions(+) create mode 100644 Documentation/misc-devices/tegra-cfg.rst diff --git a/Documentation/misc-devices/tegra-cfg.rst b/Documentation/misc-devices/tegra-cfg.rst new file mode 100644 index 000000000000..be3926ff9a3e --- /dev/null +++ b/Documentation/misc-devices/tegra-cfg.rst @@ -0,0 +1,128 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=================================== +NVIDIA Tegra Configuration Settings +=================================== + +Introduction +------------ +NVIDIA Tegra SoCs have various I/O controllers and these controllers require +specific register configurations. + +They could be due to changes in: + - Functional mode (eg. speed) + - Interface properties (eg. signal timings) + - Manufacturing characteristics (eg. process/package) + - Thermal characteristics + - Board characteristics + +Some of the configurations can be provided by device specific standard DT +properties like speed of interface in I2C, rising/falling timing etc. However, +there are more device specific configurations required to tune the interface +based on execution mode or other runtime parameters. All such configurations are +defined as 'config' settings of the device. This configures a device to operate +with the optimal settings for a particular mode to improve performance, +stability or reduce power. + +These configurations are either static or dynamic: + - Static configuration which is set once during device boot and controller + reset + - Dynamic configuration is applied based on a particular condition like bus + speed, controller mode, peripheral connected to controller, SoC and platform + characterization + +Static configurations are provided as common config setting and dynamic +configurations are provided as mode/condition specific. + +Background +---------- +Slew rates, tap delay and other calibration parameters for an interface +controller, are measured through characterization. These values are dynamic +and requires different values for same property / field. + +Use case +-------- +Tegra device drivers that use these config settings include: + - I2C uses config settings to configure setup & hold times, clock divider + values. + - SDMMC tuning iterations per speed and CQE values can be set with this method. + +Device tree +----------- +Config settings of a controller are added under a child node +"config" of the controller's device tree node. +Further subnodes are created under config for each conditional setting. +:: + + controller@xyz { + config { + common { + reg-field-a = ; + reg-field-b = ; + reg-field-c = ; + }; + cfg1 { + reg-field-a = ; + reg-field-b = ; + reg-field-c = ; + }; + cfg2 { + reg-field-a = ; + reg-field-b = ; + reg-field-c = ; + }; + }; + }; + +: + - "config": subnode in device node to hold configuration settings. + - "common": static configuration that needs to be applied on controller reset. + Register fields under 'common' node are applied during initialization + irrespective of any condition. + - "cfg1": conditional configuration to be applied when controller is set in + specific functional mode. Conditional configs may override existing settings + in 'common' or contain settings unique to the config. + - Properties defined under config must correspond to a register field of + device controller. + - Properties are device specific and added to device node. + +Example +------- +Ex:: + + i2c@3160000 { + config { + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + }; + }; + diff --git a/MAINTAINERS b/MAINTAINERS index eea74166a2d9..c788ff0506c3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21991,6 +21991,13 @@ S: Maintained F: Documentation/devicetree/bindings/mtd/nvidia-tegra20-nand.txt F: drivers/mtd/nand/raw/tegra_nand.c +TEGRA CONFIG SETTINGS DRIVER +M: Thierry Reding +R: Laxman Dewangan +R: Krishna Yarlagadda +S: Supported +F: Documentation/misc-devices/tegra-cfg.rst + TEGRA PWM DRIVER M: Thierry Reding S: Supported From patchwork Mon May 6 22:51:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 796093 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2080.outbound.protection.outlook.com [40.107.102.80]) (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 D9FC615B969; Mon, 6 May 2024 22:52:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035963; cv=fail; b=DOynsEfToVGyymN+9XfI/v6RdxPBN/ZssbOLJeUYkCsDTmjXPkW8xbIEBCWhpgoeQ+dST++GdMXBvZWM4P7nW9TpgmRg2uh5/zrYGaAmqdpa6b/7vjQp6f0/V9ND2iSDv4yDdfbLKCMNWtfIEY/ZZgnSEBCaEvDq/uppNX1xTjs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035963; c=relaxed/simple; bh=05ubJ7dlKDQIbOjOvbMb9nSl6zkIEdRfOhaXhajpBV0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uYX8otbZ+55nnV4BmTDEtFiqGhi0USbj3C1qSwtxG0VjYb+yHbms8BzgoWhouZ/Mdyxb1HagoGiEf/wAi+8mtP1t5pcWLK/ekE3orNFhAwklOXuj+DXm4Pq3PnpwPgVXVpaH3NopFBvDJt/mxEuPQd6ETdSin0KbkH0VwFzaAys= 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=oFuaWjfR; arc=fail smtp.client-ip=40.107.102.80 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="oFuaWjfR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RojDqogmI0Wv7UzWpQGQaDPvKc0NKdMuImEKdcZ/nyUBTagqtEDw9+1B2Fchy7se8WMNwjp2XxWQgA25gFbd9R+p6sov47uH1HinSFw/84W50P1HS313AdeRwC05UXqUxHzhHJHSoLpGbxroWD6xNf5gApPiLONY/sUTqLfoU8X0fyYOrVo1akmmq2Eqpe9TRWK+/EzRpvIW8P17rm6ROZX8ulXKh5on0FYBCG31eZLVSwU2xEMX9N3QG057YdEJcT+U7ZJwek8Loq53DEu2GFZkxN4DBxu66Ri95Lavxy7ghkl0NmxU56Wi+Phd5sSXLAGcNsE/SkeZnkHIv0TIUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=C5ZbTM98IAx2QOYl1zjZFYcBMQMZTLMcJdNfTtGKYgI=; b=oXinB9y3yt698Ev4ZbUNPAkwF/iS0V0u4grt62fMBgby5Uo6NPYc7UQ1Pj2tzipOeovZKcEPX+bokl/ht2iay0OU354XGWhHNq8+0R1bQ85AJtg3lHS4I1Ht9hMVDLTJq5hX2taUcx44MeI7FItSHwqREgHBqpCd2DbwirmTlZdJHMcDibalcYMyrIplAcqx4Klo472TkaNIbva8dmCtMwqpMbTbGFN67LaC6EvLIBYuvWsU5IK/AeAiYxybEAjaFDPOMbJUfc7yTxwwIHMHRQQ190xAzNl3OIK80yijU+dX81GwBZNXvFEgsL1VAls/LlGxlXGeOGWSzVE7CT+fag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=vger.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=C5ZbTM98IAx2QOYl1zjZFYcBMQMZTLMcJdNfTtGKYgI=; b=oFuaWjfREJIdHj3qY9b4It6d5jfem/IHSOLZpltbo/megQr+o4wnDcZSF5m0mTVYJjeHpEmcWTB1E5kdG/Q9qKFZujj6bpGvoa5c4YlrgvxgMZDs0ltjy8YE5r6AuEYiASCN8XRsR/zJhcNGBjCk+0y6WKi+HiEgys7RTQi126fga9cMXlAye973x4NptcwaqBZZ2euKa3FObY0f4gBVqXN6OAXDqa8KdCN42cKjn6g1W/sHMZ+YwJECbySMcRG/75ke1DFthUnMTqxf7mXIqjjbkHmSnkU2PyR7vUSVRWp7l/o7yviH9mlKn3/mT4nZzBVAT0bBEHvhlkTOsYghtA== Received: from SA1P222CA0155.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::25) by CH3PR12MB8851.namprd12.prod.outlook.com (2603:10b6:610:180::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Mon, 6 May 2024 22:52:38 +0000 Received: from SN1PEPF00036F3E.namprd05.prod.outlook.com (2603:10b6:806:3c3:cafe::20) by SA1P222CA0155.outlook.office365.com (2603:10b6:806:3c3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 22:52:37 +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 SN1PEPF00036F3E.mail.protection.outlook.com (10.167.248.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:52:37 +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.4; Mon, 6 May 2024 15:52:20 -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.4; Mon, 6 May 2024 15:52:20 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:15 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 02/11] soc: tegra: Add config setting framework Date: Tue, 7 May 2024 04:21:30 +0530 Message-ID: <20240506225139.57647-3-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F3E:EE_|CH3PR12MB8851:EE_ X-MS-Office365-Filtering-Correlation-Id: 36dc76b2-7935-48d5-4753-08dc6e1f3a2e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|82310400017|376005|1800799015|7416005; X-Microsoft-Antispam-Message-Info: vkE0jJFIM4gUbp6cLM7Fkz2z646ZQK3rkvF0ah/ZuFt/UUaFaviL/pjQIz/CaO1v37CcRhdkT+xZq59086ZupJcvuR5Z2KwRwpDKfpbml0K+tYs3lkAoSCwwBhFoq8lhI5allQs7VfwNFnewXz6WKYoQoTcPFq03YdgY9UqdHNJ0LmQ8NOvA8iWERP/ca7jnFlmJLLgs+tykl3bo69Hp8sdrnEfn1YD9tqcaC6d/xDryO6OT86j64BBS3Jpmj8QjlZnJ3HuimSxyaqCuPVINqbxbXhKwoFeFWHKFzpc7QQNDCJkbv/M6QYSSq25GSRq5lWWGQanViZesnZm0Mrf9t5iycPk2sv5Vg683PRZXf7slU+Ai+4v4caWw6Om8CQfT6Stc4g9hfCVWojrdzNwnNa5xz3dmFM2WrUrmmV0UcBf/0MjAaFaWMUr4fkrqo1Wrh3vn20H960LsOe+ceDq8jPHSMAfxfNfp+f3GzpQqVwifPcUeolYBOAvvooxlYG6hPO4/v3sPtLGNfrz8y7vWKo/5h29dyJtYhLpb2sJpfGXxmUOrACbmv/5PsYWIQIZJbITyHQMzHfnZhLsiWf8pNiOds65vr8sLIvBW9vfOi7zor0+QPjJJ06LAl8zwMv3yUm5T3TPcbxl/BnnXFExqiwibqdnL5rJj15b1ghFDreIwB1C9jhQvn+9fgUan3nzHrCekxjCgIr1qj33O5nOFtjfWfYcTcwVpq2cKMbPL9VRzQjaacAcZzak07szYCa4KuuidjtuSnQDXNRKNs6yx4fYs7giFQpQDmSN6IGK+VmFjIAwg3xaD+7iM164kJCxTafEORZCSQsbV9BALVG1ryGvYA06Ef1iORGF2lqF8Gavgb2Rb+z7yxt88GcavFG0DSbtgqvkwYw+wO+Qrsc0ElNmToTnAhIm/iJHVlc70RLyL4/Sh8yGRk3RdJY7DguuhKNWO9BS1mKhNSg6R+DXKC5njo5UZH+tlmhVqA6O6cD6jiiRYSR502iZT9wNGUZ8n3QptQP6kWbpg73l5oC9drLp8lPIQtDwf46GfXA0we4XpEo/5JQY8ygh4kNjd5dkAFVQoyzwxMToz8A5wPq+ATvM4xSshvxQmIX9vXCIWx/XMnmPv3wA4P889OLwiXFEp+5mH3S8coVaiNwFS6pGvdb6+OjCItH9KmbHfOYowKqkb6sACwxOQedwBKVgxWzoGEWHnrFADLsHcsaksnr5X3kJfrMnlEXOVEXkRK8G9dYirx71kPc7WR12fp3mkibytRZWLvMkCeA3L5gZfKKgr2QDbgDFDavgBxXqa+nCc+S9xTAAizywcEM2O0V7kct9Q5bfzRrG0uGv31DfiwrNyKJTIXL2/zfx/g8odAtu3+UA= 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:(13230031)(36860700004)(82310400017)(376005)(1800799015)(7416005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:52:37.7670 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36dc76b2-7935-48d5-4753-08dc6e1f3a2e 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: SN1PEPF00036F3E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8851 Config settings are defined as a property per field and have different modes per device. Each mode contains multiple properties and a device can have multiple modes. Config framework parses device tree and provides a list of register settings with mask per mode to be applied by the controller. Add APIs to parse list of register config settings and to get config from the list by name to be applied. Signed-off-by: Laxman Dewangan Signed-off-by: Krishna Yarlagadda --- MAINTAINERS | 1 + drivers/soc/tegra/Makefile | 1 + drivers/soc/tegra/tegra-cfg.c | 147 ++++++++++++++++++++++++++++++++++ include/soc/tegra/tegra-cfg.h | 87 ++++++++++++++++++++ 4 files changed, 236 insertions(+) create mode 100644 drivers/soc/tegra/tegra-cfg.c create mode 100644 include/soc/tegra/tegra-cfg.h diff --git a/MAINTAINERS b/MAINTAINERS index c788ff0506c3..9eeb749ef234 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21997,6 +21997,7 @@ R: Laxman Dewangan R: Krishna Yarlagadda S: Supported F: Documentation/misc-devices/tegra-cfg.rst +F: drivers/soc/tegra/tegra-cfg.c TEGRA PWM DRIVER M: Thierry Reding diff --git a/drivers/soc/tegra/Makefile b/drivers/soc/tegra/Makefile index 01059619e764..8d0c8dc62c8c 100644 --- a/drivers/soc/tegra/Makefile +++ b/drivers/soc/tegra/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_SOC_TEGRA_PMC) += pmc.o obj-$(CONFIG_SOC_TEGRA20_VOLTAGE_COUPLER) += regulators-tegra20.o obj-$(CONFIG_SOC_TEGRA30_VOLTAGE_COUPLER) += regulators-tegra30.o obj-$(CONFIG_ARCH_TEGRA_186_SOC) += ari-tegra186.o +obj-y += tegra-cfg.o diff --git a/drivers/soc/tegra/tegra-cfg.c b/drivers/soc/tegra/tegra-cfg.c new file mode 100644 index 000000000000..53d181bff40a --- /dev/null +++ b/drivers/soc/tegra/tegra-cfg.c @@ -0,0 +1,147 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2024 NVIDIA CORPORATION. All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +static int tegra_cfg_update_reg_info(struct device_node *cfg_node, + const struct tegra_cfg_field_desc *field, + struct tegra_cfg_reg *regs, + struct tegra_cfg *cfg) +{ + int ret; + unsigned int k, value = 0; + + ret = of_property_read_u32(cfg_node, field->name, &value); + if (ret) + return ret; + + /* + * Find matching register for this field in register info. Field info + * has details of register offset. + */ + for (k = 0; k < cfg->num_regs; ++k) { + if (regs[k].offset == field->offset) + break; + } + + /* If register not found, add new at end of list */ + if (k == cfg->num_regs) { + cfg->num_regs++; + regs[k].offset = field->offset; + } + + /* add field value to register */ + value = value << __ffs(field->mask); + regs[k].value |= value & field->mask; + regs[k].mask |= field->mask; + + return 0; +} + +/* + * Initialize config list. Parse config node for properties (register fields). + * Get list of configs and value of fields populated in tegra_cfg_desc. + * Consolidate field data in reg offset, mask & value format in tegra_cfg. + * Repeat for each config and store in tegra_cfg_list. + */ +static struct tegra_cfg_list *tegra_cfg_init(struct device *dev, + const struct device_node *np, + const struct tegra_cfg_desc *cfg_desc) +{ + struct device_node *np_cfg = NULL, *child; + struct tegra_cfg_reg *regs; + struct tegra_cfg_list *list; + struct tegra_cfg *cfg; + const struct tegra_cfg_field_desc *fields; + unsigned int count, i; + int ret; + + if (np) + np_cfg = of_get_child_by_name(np, "config"); + if (!np_cfg) + return ERR_PTR(-ENODEV); + + count = of_get_child_count(np_cfg); + if (count <= 0) { + dev_dbg(dev, "Node %s: No child node for config settings\n", + np->name); + return ERR_PTR(-ENODEV); + } + + list = devm_kzalloc(dev, sizeof(*list), GFP_KERNEL); + if (!list) + return ERR_PTR(-ENOMEM); + list->num_cfg = 0; + list->cfg = NULL; + + /* allocate mem for all configurations */ + list->cfg = devm_kcalloc(dev, count, sizeof(*list->cfg), + GFP_KERNEL); + if (!list->cfg) + return ERR_PTR(-ENOMEM); + + fields = cfg_desc->fields; + count = 0; + /* + * Iterate through all configurations. + */ + for_each_available_child_of_node(np_cfg, child) { + cfg = &list->cfg[count]; + + regs = devm_kcalloc(dev, cfg_desc->num_regs, + sizeof(*regs), GFP_KERNEL); + if (!regs) + return ERR_PTR(-ENOMEM); + + cfg->name = child->name; + cfg->regs = regs; + cfg->num_regs = 0; + + /* Look for all fields in 'child' config */ + for (i = 0; i < cfg_desc->num_fields; i++) { + ret = tegra_cfg_update_reg_info(child, &fields[i], + regs, cfg); + if (ret < 0) + continue; + } + count++; + } + + list->num_cfg = count; + + return list; +} + +struct tegra_cfg * +tegra_cfg_get_by_name(struct device *dev, + const struct tegra_cfg_list *list, + const char *name) +{ + unsigned int i; + + for (i = 0; i < list->num_cfg; ++i) { + if (!strcmp(list->cfg[i].name, name)) + return &list->cfg[i]; + } + + return NULL; +} +EXPORT_SYMBOL(tegra_cfg_get_by_name); + +struct tegra_cfg_list *tegra_cfg_get(struct device *dev, + const struct device_node *np, + const struct tegra_cfg_desc *cfg_desc) +{ + return tegra_cfg_init(dev, np, cfg_desc); +} +EXPORT_SYMBOL(tegra_cfg_get); diff --git a/include/soc/tegra/tegra-cfg.h b/include/soc/tegra/tegra-cfg.h new file mode 100644 index 000000000000..ece6f63a83c1 --- /dev/null +++ b/include/soc/tegra/tegra-cfg.h @@ -0,0 +1,87 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved. + */ + +#ifndef __SOC_TEGRA_CFG_H__ +#define __SOC_TEGRA_CFG_H__ + +#include + +/** + * Config settings are a list of DT properties holding each field's recommended + * value. Field info is held in tegra_cfg_field and tegra_cfg_desc. + * Data of all fields in a single register are parsed and stored in + * tegra_cfg_reg. Struct tegra_cfg_list contains list of configurations + * and each config tegra_cfg contains register list. + * Client drivers provide field and register data through tegra_cfg_desc. + */ + +/** + * Register field and DT property mapping. + * @name: device property name of the field. + * @offset: offset of register from base. + * @mask: mask of field within register. + */ +struct tegra_cfg_field_desc { + const char *name; + u32 offset; + u32 mask; +}; + +#define TEGRA_CFG_FIELD(fname, roffset, fmask) \ +{ \ + .name = fname, \ + .offset = roffset, \ + .mask = fmask, \ +} + +/** + * Configuration setting from controller where it passes the total number of + * registers having config, and their register field names. + */ +struct tegra_cfg_desc { + unsigned int num_regs; + unsigned int num_fields; + const struct tegra_cfg_field_desc *fields; +}; + +/** + * Configuration register info generated by combining all field config settings + * in device tree of a register. + * @offset: offset of register from base. + * @mask: generated mask from aggregate of all field settings read from dt. + * @value: generated value by combining all field properties read from dt. + */ +struct tegra_cfg_reg { + u32 offset; + u32 mask; + u32 value; +}; + +/** + * Per config info of all registers. + */ +struct tegra_cfg { + const char *name; + unsigned int num_regs; + struct tegra_cfg_reg *regs; +}; + +/** + * Config settings list. + */ +struct tegra_cfg_list { + unsigned int num_cfg; + struct tegra_cfg *cfg; +}; + +struct tegra_cfg * +tegra_cfg_get_by_name(struct device *dev, + const struct tegra_cfg_list *list, + const char *cfg_name); + +struct tegra_cfg_list *tegra_cfg_get(struct device *dev, + const struct device_node *np, + const struct tegra_cfg_desc *cfg_dev); +#endif /* __SOC_TEGRA_CFG_H__ */ From patchwork Mon May 6 22:51:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 795069 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2044.outbound.protection.outlook.com [40.107.102.44]) (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 3D66215B133; Mon, 6 May 2024 22:52:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035975; cv=fail; b=o1Logo5PnAPZF3/e0k772+qZ61nM/kwyyVY7M4w/bqqQDIoTxcOVDYvSRyFNaE+j7IbnEHNtXLCeb+idK10OL6nUiAL5LPI6jXeZtHoPXAvQFHYMeoWvsTu7BumfceZ2uzCgXE0PHwAxeA24fcZTh2T7A2dlFeYA6jX+fhhdecU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035975; c=relaxed/simple; bh=Z+ceSn5c1zEMGM6W9rFL5mCCvtw6RA3NaeR54XDveT8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rAnjVQpnIVAImvF7qs1hxJQx0VIAxSzSeondgk81W/rIjrOEzPVTCbZOaoMTPsqfaU0N/7LcbcUPwJg2ch4xYTjEWM2zIIuWjWhe53ilNsi1TtIeGxriC195t+srWTtYJTAtecZXGpxdUiUqnQaa5v5N1hqCJy9c+Ml5Xifr7Ko= 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=nS2rb8h/; arc=fail smtp.client-ip=40.107.102.44 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="nS2rb8h/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ciQT+E+XnCYJIAjZT6DoTrADn0l8lnHuFE+NHNZxoP6EqxkIpXUdYjUQyYWIru3NucJiJwS3wOj1dsio2VbfWwWkYgvNX3ysCZv+Er6RXNaMTKrgytBP/VD42NuJWCVncQAvozIhmLzfd4KYVEGzHJZbe27wyVD3NnQSbwTD4QAgLjAja/u3F1lbvjkC/BfVewp1+C+y5lJvmfS1kwmBXJUnHnk0Q7G5YiIWWvjJWuYMbrty8/yYJojo8IdihimF92c0TKtRrAMG2RDNMiq5j4DDLQoCYm+k2Kr6gyFI8H4+T97sgFUUValMQm/cyECdfsC9ebvKrCk+5vu/NNHxrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0KuRvoty4KWkXm/UVG0NNWVGVH8+v/ZEdwh2McqxeG8=; b=ltRTagkCh7UIuChJ8G+8JrjcVTw7tjki5VJuMU4ZKXLaACBaDh3hmxH6HHxDxJ91srQgzU9whinZLHpcMlK7j3QUnU46ihncHf3hW6THn5E7YRZFSLw5/ECEDw4DbVVvlLUBBa3ziii2nQIsut2jDjDjSgcSBOG0ffKiyxkg24MrRP1/1sd9d9zFprL/MHTLvpWHRC+xQcudh4CVBdFrcHapbyrQfFf5ZBHckkcvyZ2A0tJqY8bLT7Nbcoa59eKP88I7jSVS0GWuYCj0Z7Xw66MeoVPb/Zlsu6tVMcaMBFOFMbVM33uBr/ZlKZdEmU65yNxt0Fs8lTELkS6Cmpe3cg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=vger.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=0KuRvoty4KWkXm/UVG0NNWVGVH8+v/ZEdwh2McqxeG8=; b=nS2rb8h/IgdxhOvLCFeiOnDkzU9Cn1AeB3gIkv4ls7Xc4si46WSNujz4neGI+0FDu+CkGBU7KpleuAegoVR1k4/p4XoRRN0Dc+xZs7yJywCjNymJdmHsd3TD7kqSdTLDClyVgRMDELArokCr1DH9nJcyO3DgBNkkn8Q3bDzeEJ/aUHy+WkdVIskdONqcFSv3DpodKGgw5j+3/Q1ShfCTnVEvJ1fvKt4UEC4c7fAqqCc8wMQ8fqWrGUXZ+Qd9U3HIpd59hDx+zgvsh/qurJIpg/av2dT26EW7gHsBiaAYg+8WpK9lCGxumgCGXmeMEWchZx5y3sz+rBP9oKDxx+lJIg== Received: from CH0PR04CA0102.namprd04.prod.outlook.com (2603:10b6:610:75::17) by DS7PR12MB6287.namprd12.prod.outlook.com (2603:10b6:8:94::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.29; Mon, 6 May 2024 22:52:49 +0000 Received: from DS3PEPF0000C37C.namprd04.prod.outlook.com (2603:10b6:610:75:cafe::e6) by CH0PR04CA0102.outlook.office365.com (2603:10b6:610:75::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 22:52:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS3PEPF0000C37C.mail.protection.outlook.com (10.167.23.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:52:49 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:26 -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.4; Mon, 6 May 2024 15:52:25 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:21 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 03/11] soc: tegra: config settings binding document Date: Tue, 7 May 2024 04:21:31 +0530 Message-ID: <20240506225139.57647-4-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37C:EE_|DS7PR12MB6287:EE_ X-MS-Office365-Filtering-Correlation-Id: be8fafb8-b1af-4f8a-79cd-08dc6e1f4130 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|7416005|1800799015|82310400017|376005; X-Microsoft-Antispam-Message-Info: jYXiedVG/jQYRG3reKfWZHxRXQWnd4mLyx6rqpKawQlvuoNjdPhmK+zJ3+8Ew7Q32fHvAhmYlfT+KY9yU4A02OeNsnuFQOBfv+DRg5S3s8gG5fSzoeGb7xvg36PqOja1CgvSXRTRFVu35YulxNu8lvkOmdb0KXYQKRc/ZDO00JoaZzNVwdRORrwIW5sq0+QMtM9NUMJTsY5DHPahnbtFBLYTZQ2qaK48qX1mYREaHhMMbejZgSi/FeQqDUxoqik5zdssf9cWh7doiVSlUx7LAmhu2zUObeLN2OQFCPGKpq5xd6ogRuLJowVgCQH1j8ycUgJNDPTF1sBzsf1ckrDvUyqTn65biJosVmtpdnTEqavnSal3yAqEFiSS956v8QIRBtktUmGUsjYg7xT06wYtLx+wtVdUEiYArXbcqFjiO4FeEJa+oiNJvVsKnEhQfEz59ZEjy54vTQqSsZq0dIGnjUWsKO6us+Ij3SC5JUQ8JWuZD0XTkZRkb+tUzvl8/ty0se7MWmEjK1Tc295Eu0Q9O1lGMFmWd3QihrJlTkKOt3cxxGL4MlQvCh/uTrC8Al3OT6xSjO02fp/EdZr34HTJrOzFwWy387he+bUFEgS2ZDAB8kxkjsQw3aTW4fHfLfrSM/iX1IMTppi6vgfi7nel4ai7OTtFB/UXOgFhLH21HePiapSV+6Zxev6KMrAGKxhr5+l5Wjw3FXc95+/Oei7KXgAsOqOuAutWMuzYJynMBsxFFnbLQ1WEAQATDgXOnWs0O8l4CTCPziRkN4cqfZXOET8Ntta6Gjapb/gAEGUtmNsKBZGnmSOmMf5Wz8p7i1wQOTAVE6TfC4Tm3BtuOguY+NxJckA3zu6hoGWHfkOadbx1noGfm+kgC5DQfEYgsRBazWSRcl6QfO+62vnB4BrmtG7O8f7q6UPcwzM3KuqIhp8Kz4GkkYwOhoP0G2vUdNpvEct12qlqj6PuX5Kuvk+2wjnd1N9bsTzmOfTZtJvy9Ny5If8D8C68uTOp+AA8voqnXDVstvp8iDxE2AaZAU+r2AZze0YF0Tqj3NyjJSjdZUP6ZBnMu7Xcw47H2VgWoV2LIeR3H0UniMqxKwra55JB3wNpfTll6+i7nDfXAj8Na/psoPj1PQIuFDB+o6Urb157gVi3w0qpXOS1HB9Z6VfOFMj7gP0sfsRWiBSb5JuktRvEOEnROlHD2B6jtmDnhfOqUL5K4z19iU+qg8rM8Iq1q4Kv4/CSKmskfAgn76/DrEjdoC2jmpUwnAb81Ylur4um97pJYuUP6jy5P5w8bGOaHKmU0xoJ7SglSdbZeLc+FlnKUzRWPlb6IcY/HihHn2+1kNdH+SkQ/KPEdQu8WleNdCsc3NxgCvJGjGZQS4Yb32fMKj/zepY7lDQgtl+7z5vn X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(7416005)(1800799015)(82310400017)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:52:49.5099 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: be8fafb8-b1af-4f8a-79cd-08dc6e1f4130 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.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6287 Config framework parses device tree and provides a list of register settings with mask per mode to be applied by the controller. Add binding document for config settings framework. Config settings are defined as a property per field and have different modes per device. Signed-off-by: Krishna Yarlagadda --- .../misc/nvidia,tegra-config-settings.yaml | 50 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/nvidia,tegra-config-settings.yaml diff --git a/Documentation/devicetree/bindings/misc/nvidia,tegra-config-settings.yaml b/Documentation/devicetree/bindings/misc/nvidia,tegra-config-settings.yaml new file mode 100644 index 000000000000..e379cbd5b597 --- /dev/null +++ b/Documentation/devicetree/bindings/misc/nvidia,tegra-config-settings.yaml @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/nvidia,tegra-config-settings.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Config properties for a device. + +description: + Config setting is the configuration based on chip/board/system + characterization on interface/controller settings. This is needed for + - making the controller internal configuration to better perform + - making the interface to work proper by setting drive strength, slew + rates etc + - making the low power leakage. + There are two types of recommended configuration settings + - Controller register specific for internal operation of controller. + - Pad control/Pinmux/pincontrol registers for interfacing. + These configurations can further be categorized as static and dynamic. + - Static config does not change until a controller is reset. + - Dynamic config changes based on mode or condition, controller is + operating in. + +maintainers: + - Thierry Reding + +patternProperties: + "^[a-z0-9_]*$": + description: + Config name to be applied on controller. + type: object + +additionalProperties: true + +examples: + - | + config { + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + }; + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 9eeb749ef234..a8c0cfd1d5a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21996,6 +21996,7 @@ M: Thierry Reding R: Laxman Dewangan R: Krishna Yarlagadda S: Supported +F: Documentation/devicetree/bindings/misc/nvidia,tegra-config-settings.yaml F: Documentation/misc-devices/tegra-cfg.rst F: drivers/soc/tegra/tegra-cfg.c From patchwork Mon May 6 22:51:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 795068 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2048.outbound.protection.outlook.com [40.107.220.48]) (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 EBCC515E209; Mon, 6 May 2024 22:53:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035983; cv=fail; b=WMnAWlEphG60V/3U13BY/6PFVn8E8jx/uXCNQH639pRaAjhhVOOi03N8QXR1ZJv6I/6GM9kQR0JZod+nTbypBNlx8VBr/5K7qiRKgdXBJEa1YlkOoflgQluHHFloef1un7RcrxkY87g9CR/9ehSSDJnqOs+nVBW9UUAM0M23vOs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035983; c=relaxed/simple; bh=lEYDOGYNjXvbZ3EQQDHJV6B3QBcqKvBfJkyN2qZGftU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K0mX0D72fTDpzV3Mpfq6+T+xG2ZWck82qCoziZ+WT32HIZchtIBVa7nPie7MJOaCUmMnuo7qyepALI6gS+6fXaZXUGdIpyhGh+B0680vHA0wgotMaqv+jot900lgXEwh44O5Kmnip6beC4TtE6PDnpLXdrjdb6611lo8ifsybtY= 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=cUoNwgS3; arc=fail smtp.client-ip=40.107.220.48 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="cUoNwgS3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a5Jpw7/MhsZT/zBILFuJ8Ro3HIcxgvpF8uNz2E8WpHf2ai6Lfkefu9jBzcXLaMjpnvLcJOvjR1jnM/x1G4GE2EZIXmA4mykO8hTDyeAtq76bEipdk/OtHTsJcyGqo8PDFceqw5IqzIyLaJSwXDYuhcny1JapT8Hz6zIWODRoqPejvgEBv31o0naw0GFX6Rwngdi5ogoTMyqr4T0umPgDaupsvuGOypEwEVaGnu1bEWsGCOGbYPpJN1jKVseDEGCq+Oc2Cfn2MifAJRrsvUWRDk1HDcS2rMGS6CY704kn65cApz8ZI6NeOvn8U1VzLIHoJbCNnE7HeRua4Nuvs097+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9oCefoMf/V0IxwGJzTPu7nLcqoNai3U2jyEtJPW7SFY=; b=TjQjiug572cSlJD7x419mSIwgIOTzt9k4c5AEXOX6YhEzBy/KdEb3IjIRjBzA0UQA3nJPgVyuT86Akvb3Qv4dFRxEdFWCSg00o3+16GtnqFxMNp8CLwrqg/1CDd8UtTlF4/Y0/M4YVOmgI1024AIsSVI4+3vaZg5vea1krF0dUdQE8wkFB8lrLP3CWJDcKgLLayKhjFrk18qMblWPnecbcrzQRgASud00BZqTD/HRtGxututJ8HRqG7oYMSe80rqs7mD/Ww3tJOz0SF0nHgIzAWLnb8uGi7kbyoRR7WKsSxYxDuDSoUHxF6ixNiGVwxEPry9Cnm8sygp1dGR62KDEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=vger.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=9oCefoMf/V0IxwGJzTPu7nLcqoNai3U2jyEtJPW7SFY=; b=cUoNwgS37wUSGlaoUgDJuw4iNq5YHN/oe6we6NBk0G1OTuBq2OUdXkikHt2G/HABKz0AQkSP+htRA5HsdfKZBoyUdXzX7WAaFp7z2iPFjc1QZfE5N4LuYvQ2IdeId9u99fRqjnf0eJiNCQ9S76snsVJFoZMU+7vJpQc0XJANI5vtlL0uW6R+jGodCAvMmDVxEIXdfqfLRUlG2WflDYs2+2PnlH9WT0ujFciazei2XdNxHXqym243aFAPrjkQPvQBNl9Sb8Nc9YfJ3hdG2sPJr5yqUVJpmtiDYuMJ/mKhx2KOaFZfzxtDjhNzo9ULgBtI2ZtSO1Zzd1eK/VHzWx7lZg== Received: from SA1P222CA0153.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c3::17) by BL1PR12MB5778.namprd12.prod.outlook.com (2603:10b6:208:391::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 22:52:49 +0000 Received: from SN1PEPF00036F3E.namprd05.prod.outlook.com (2603:10b6:806:3c3:cafe::27) by SA1P222CA0153.outlook.office365.com (2603:10b6:806:3c3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 22:52:48 +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 SN1PEPF00036F3E.mail.protection.outlook.com (10.167.248.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:52:48 +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.4; Mon, 6 May 2024 15:52:31 -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.4; Mon, 6 May 2024 15:52:31 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:26 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 04/11] i2c: dt-bindings: configuration settings Date: Tue, 7 May 2024 04:21:32 +0530 Message-ID: <20240506225139.57647-5-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F3E:EE_|BL1PR12MB5778:EE_ X-MS-Office365-Filtering-Correlation-Id: 113ae663-9164-4d22-ad13-08dc6e1f40c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|7416005|1800799015|36860700004|376005|82310400017; X-Microsoft-Antispam-Message-Info: 3GKQlyi5zygDAMfsLwYxjJXWqBhPAoLXyai2o7BuE3Q15MT0JUKrumx7kVQuts8MEGuGz4FeCaENDoilg++nH/DaNu6hS7kdYUDVcTRCAFGlb6rncRqSn5vuhoAaBy8wmJ5hIZNTQbmW078TjwxWhBijPB9vy28Jc4/ucfj+QRByBAYaZMl0eFErBx+HfhEsqVJMKJb3VsxbscIkeWKK/ssrTa6YQI/K3HOuH9E3DP0qC+bNGYxf41XfsFStAVtLamIP1eB28AWkIrcxRNDLq5UIb9Td2j8SpJJe6Pan6wNIMWmZL1oT/7KfL386GHvSsMCYI9WNkDnzxkEaKzX7VwiEuuabmXjb56Rtzvtw1x4+atKj/mix1OShnXX7mvn4nPO3xAj6KZgUXFQqBA4DdhEOvflBmGR5e1xBIhdlP90sBqCrd4v3KPA9rpku1A1M8VCiL02cRI3z+xnaVyhoMoNjcTDJq4UcEXoAhdHudQeEfRsDPmpJPjsLwdcmx4+UjzFq/3YDOdM0dDU4au3oTQRVcWLFAlEeHYt51Usf+1ZLfAlI+XlK1TXnOe9Qj7CMlM56XRQvpDk0DtCh1nVby4crv3iq+0NRMuj0KJI7YlwnhRnEozoMunaYq1LktW8VtuDlLrz6E5p0GSGFudMd7N9o9UcRPbC8YqUPwkSjH0PpLcM0XhTaBmGmNcNgFNvRQeVetVqhNFQ373PLMUQzFmY4RQHjtbGR5YHyltZPmzf6q+Y7tklFxO6bhLnKCAXPzBkiC1A/b3P+3n6+xlMJZSy6vSs0ywmJe4pyc1+nM8BSwswti7Y9z9s2fNOAUdBX8kHmKlrXW4bExPrUrkAZFLecuDfyACJQAzRM9FMZcig5rLdkQJVaUXXEpZ9m70wa8yQyjoWUHGHpG8q33W9RDhXMCrgVb6hhkju1Y5J3x43VDJn4MZQ/RcKxNT3Tog5+r5XjxbDkKfpDpDdspQEzvXl0dmJX1A4L3hPCL0aMgpgRdzAFuBjW+y2EM/celQbOGkwXc4v6gHwm01BI84cCgGhzpdS6tbgUxGhT4KVOBjLLNePb7BqyW5Agb1NFZw/LQ38FZgM8JqHoXXhpw8BhD/V2Mve3iAQJjBR1Yg9SRMx8C7/udbSiLD3ijJqp0WA0ohnpi0I/lOpAck9Pp/nCMs7kvd95oLxAipzRG7ZnJ/waO3PnUwjs8tH8+v7jqd45yf605YxAFbvRqYEVuiWomi/eB7Daz5kWvbMZf/t9s7rkgIdOVUPKLNmu60W3OlQAQO7fknG5Hlsu1RhSVaPQhqW4siSwXUnY7NtHbgc3vQ7ASihBBhhtmTvYS1hLSJhC+oGrSCoHfRP4T9YjOSXjGfD6cdPw9YqkGsLE4menzbk= 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:(13230031)(7416005)(1800799015)(36860700004)(376005)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:52:48.8296 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 113ae663-9164-4d22-ad13-08dc6e1f40c8 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: SN1PEPF00036F3E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5778 I2C interface timing registers are configured using config setting framework. Document available properties for Tegra I2C controllers. Signed-off-by: Krishna Yarlagadda --- .../bindings/i2c/nvidia,tegra20-i2c.yaml | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml index 424a4fc218b6..3b22e75e5aa0 100644 --- a/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml +++ b/Documentation/devicetree/bindings/i2c/nvidia,tegra20-i2c.yaml @@ -119,6 +119,96 @@ properties: - const: rx - const: tx + config: + description: Config settings for I2C devices enlisted with I2C controller. + Config setting is the configuration based on chip/board/system + characterization on interface/controller settings. This is needed for + - making the controller internal configuration to better perform + - making the interface to work proper by setting drive strength, slew + rates etc + - making the low power leakage. + There are two types of recommended configuration settings + - Controller register specific for internal operation of controller. + - Pad control/Pinmux/pincontrol registers for interfacing. + These configurations can further be categorized as static and dynamic. + - Static config does not change until a controller is reset. + - Dynamic config changes based on mode or condition, controller is + operating in. + I2C has configuration based on clock speed and has below modes. + - common is set on all speeds and can be overridden by speed mode. + - high is set when clock mode is high speed. + - fastplus is set when clock mode is fast plus. + - fast is set when clock mode is fast mode. + - standard is set when clock mode is standard mode. + $ref: /schemas/misc/nvidia,tegra-config-settings.yaml + unevaluatedProperties: false + properties: + nvidia,i2c-clk-divisor-hs-mode: + description: I2C clock divisor for HS mode. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-clk-divisor-fs-mode: + description: I2C clock divisor for FS mode. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-hs-sclk-high-period: + description: I2C high speed sclk high period. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-hs-sclk-low-period: + description: I2C high speed sclk low period. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-hs-stop-setup-time: + description: I2C high speed stop setup time. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-hs-start-hold-time: + description: I2C high speed start hold time. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-hs-start-setup-time: + description: I2C high speed start setup time. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-sclk-high-period: + description: I2C sclk high period. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-sclk-low-period: + description: I2C sclk low period. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-bus-free-time: + description: I2C bus free time. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-stop-setup-time: + description: I2C stop setup time. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-start-hold-time: + description: I2C start hold time. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + nvidia,i2c-start-setup-time: + description: I2C start setup time. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + allOf: - $ref: /schemas/i2c/i2c-controller.yaml - if: @@ -189,4 +279,18 @@ examples: #address-cells = <1>; #size-cells = <0>; + config { + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + }; + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + }; + }; }; From patchwork Mon May 6 22:51:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 796092 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2055.outbound.protection.outlook.com [40.107.244.55]) (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 DA2F115E207; Mon, 6 May 2024 22:52:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035981; cv=fail; b=jCj1fMBHPX5FXBaDV4FijMr/9W4jvpkYQZNNI2L38tiBLsuejdU1Onk35rvLSDN4EdJsKHySZwtQpZ5GhcUiIB/w/j7x/Ce07mrrwvzyxlgmpz2Gzdkpg13Vq7VJVQa9TlSh68TTkvgJ8ZhiBYC02HwenDcFtNdfNJ/nL4gYzWI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035981; c=relaxed/simple; bh=5sF5H72vJEZ6OOrBy78Ol32EOzCGpO0XtEnEeSmuAVA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=afOZ3lgfORB2XjrsqnTVPgBYKA6tClTrOoQEoLIwMnWw2l+GnGEumnLHD+Up9BzRYWp+/U14mkC16YISBO2NXTtgzu/KpygC9G55uR1nLfGOvSe4ST1PINonq5WHiizaaoaS9JwQWj/U7Dob+5Ykeer8w+fSb26fWyruUN9S8Jc= 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=UoZt+Gic; arc=fail smtp.client-ip=40.107.244.55 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="UoZt+Gic" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n/rNKpzM3NMUSIfiLtDVOz4wYQVjnqmHVpovpbHgLK/dlaqNa6hJRBujAc5efLbaaFIaa8EFap63jVGZuLh6vG1hhEOuyKO8v1sFfLqPXJXI9qrs30DxL8n0F9xN1qOtOMINLrRJ63N5RunVP3S//L1+4XTumJ4xPLArPGITeOLPTJXpZ/AdcLK+2g6TxnLautCNPICCjNqCxzZJCmcVtCXs6nBYPrN5UagLZ/uWOkZAP81Y/hl7dUxDprPLk41a8Otp+jiQKsTFD4aLguyWhLXjr93ldheOXI1XZJOA/gttYMgoD1w7e33yQO5IwhnBdCWpZP3YWtXuk4P8hYCcZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wiQuF3eFUeh98VKG/OOdx5BnftWfQCDIwqUhGxsFYhA=; b=goyOKxQWlnABkPIHVVq77c/3puQFJzn+fviP2NdrqTU1c5mMZOHcUhUtUUznm4Cs6TaKHwItvAmBs08j7+nNqqJbHcZFXE4fMUz+M+0/HtKbvWutIrQC7wyt7cD/gpYuHLg7TyMC/yocxgBc0mqj0spwmUcPQgvQR7FZF84rvmyOcVqcj8/UfdfLAnfU/CBMuhWGXriuXsuEVHSnNL7rWbOQ2DFIZfTK5L/Yy1HcUqaEO3Xs3GkkOnf3b3f1XiDGprAgWGtvN8BhOyBGBCZkE58famTnS0jJbrEpea4uZjDnWkSPfSezAdR8tGzO5N4pCVlr81pjdD8BPhpwnT5SbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=vger.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=wiQuF3eFUeh98VKG/OOdx5BnftWfQCDIwqUhGxsFYhA=; b=UoZt+Gic257k+TdbbygKPAZlD4otmCpEuu59efSWeD8D4Mz0hNqXaJyr5EyKphZpn66SN5hybkOUKzyTe+xibjdVuWnplt/ADW1dD7fbnR8sS+NQ3oOulOxZtTm2VohhSynf1IE4W5nzSGHYi/Y3VlIusu1oCGEAwakx63u1Xh8rNNDmrynZBSW2d8gA0C0fRDTdzbVNXFJ5n+BO56Y3/SpLzWrcu8Pu+PQmcu3HMamVd1oakn3nZtIw98xZWQ8dgCRbxKFbx1nBHA9tCmbyYu/IlY/s9xAFlRPv66Hs+CffUZN/48YSiOoyz26ijAPPrfyTseTh2H7BHnQxUkxIQg== Received: from SA0PR11CA0039.namprd11.prod.outlook.com (2603:10b6:806:d0::14) by SJ2PR12MB7895.namprd12.prod.outlook.com (2603:10b6:a03:4c6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 22:52:55 +0000 Received: from SN1PEPF00036F40.namprd05.prod.outlook.com (2603:10b6:806:d0:cafe::9e) by SA0PR11CA0039.outlook.office365.com (2603:10b6:806:d0::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41 via Frontend Transport; Mon, 6 May 2024 22:52:55 +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 SN1PEPF00036F40.mail.protection.outlook.com (10.167.248.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:52:55 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) 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.4; Mon, 6 May 2024 15:52:37 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:36 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:31 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 05/11] i2c: core: Avoid config node enumeration Date: Tue, 7 May 2024 04:21:33 +0530 Message-ID: <20240506225139.57647-6-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F40:EE_|SJ2PR12MB7895:EE_ X-MS-Office365-Filtering-Correlation-Id: e64133d3-083b-4203-8d9e-08dc6e1f44ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|36860700004|1800799015|7416005|82310400017; X-Microsoft-Antispam-Message-Info: RGuqQPprSyssS10SII/Ii9ETwLXMBkUgJ/vxiZ3aHPy4PghRyIaNhozF7MgJ4herMAyMACEeSdfqo89nG8loit+zNeIvcUqX+uMWXo6IVoX1KnIGNBVhccDkgrb6YNSVdxZ9r7jHJJNmZxR9LntS6s2QmkBediY4XKY9fHN3FJI2H7LgH7tVUBfKgvr34/SkAGPmJ93mJJFXbIQ7+qkb8SLskQbsWgzphr/0Nz7f1GIN6bl1QrYvdytEgTnEifFeIozbH0COidXKigitMcfIl8z0oDtU1Tdwr+rz6/0JxfeIbPD5HX4inzlcpdxOVPtLkI7CHdGMWWwLIWgEWFVzd5TfYjmFu4b/w6Mf+WoZ0NNISrvElhko+gF95zhMTDhmDmYzb4IfApe6QoIdyM9sYfHcBD7hQT8Kgedho4aF27qfksa1SJH/C/FHVyEEURSaqj48BAPKsayHNRniiHDzf5JCZ6q7mvkZhLpPo8yMWWlwTn4ZxsE4U7aTBrkc3KsM9/dTdBd11jybdwzcH0xU9W/nIOd3WrVGNwT2q5VIqpPw+TYFwXtetHMO3fURGVsnVtl6n3Siydsq16cLgaT9VOSACuFZFnrM0LXPd9JLO94WBGK4oYdR9ZWQLEcceldhAKE8K8F+bhYPAHPAtiHlxsbeNwGHFoprhcVptZf7sHu66zrys0zodPEZgi9yOoF9ygU51f4hbptte8XiWfXbCwbC6CVN/dWv6Ii5BR6POlmF4064NlSggNf+W2MOTvbgLVSLDjzs7DnFZVovk4xdSIpqyjyTCDbrcNPqwdnR/a+di+Mt9aaLxlpQd/H44vZ4Uce8kmJRGFbCKYpV93PkaqdtpaJqSrRmj/+wi3LLU0CexQE8UvhBsAl8ayC6KX2VVMJwaYdC/4l4dzpeSYioPad6RVcT0GhC5arwyMhuD3wv5o4HiF/exdyhSCAvwoJ2zRim+ZRH0BcqpxOXhS+hCRBDayf6/oPiya6W2AGfqSKecwNtHDMthl5B8Nf9sfol06x//SgkUJRzhD7YbJobUluVw1nhVihEh4PFidoSBce2/Sjqr0sooKEnrCrGtWFTxQT3bW46WPborfpuHTdIdyfV0qaHHs5gaxKLaXvxTR0PXr5kVvUIQ0OVNSbby6BE1eYUmBUR9iynaD1SKp2h0AeOpBp4uyxfumEWhx7Z9yoykS0+zVdDDUkYYqhmkPiwq96inCto4szGosuOy71TzU33MH4qGqhm/kYn8slLU2kTsZWGQOJ+xcgHKSy3GdL2nWUvQIZ2kMDvSDe7uRzCU+rD57Ml4fKCbk2pPLyE/LKkNB/gMultvx3vFa7YvRUBFBviaylXxlAe2fC2hI7m5qQxsx5QhVsKNoLtwOk7C73Dm9L1fg3IwpWRTinef2rq 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:(13230031)(376005)(36860700004)(1800799015)(7416005)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:52:55.3718 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e64133d3-083b-4203-8d9e-08dc6e1f44ac 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: SN1PEPF00036F40.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7895 Add "config" as a common node to add device configuration settings and other data. This child node should not be treated as a device. Skip "config" child node during i2c device registration. Signed-off-by: Krishna Yarlagadda --- drivers/i2c/i2c-core-of.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c index a6c407d36800..f50206c6c4d6 100644 --- a/drivers/i2c/i2c-core-of.c +++ b/drivers/i2c/i2c-core-of.c @@ -98,6 +98,9 @@ void of_i2c_register_devices(struct i2c_adapter *adap) bus = of_node_get(adap->dev.of_node); for_each_available_child_of_node(bus, node) { + if (!strcmp(node->name, "config")) + continue; + if (of_node_test_and_set_flag(node, OF_POPULATED)) continue; From patchwork Mon May 6 22:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 796091 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2061.outbound.protection.outlook.com [40.107.236.61]) (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 ABC5215DBAE; Mon, 6 May 2024 22:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035991; cv=fail; b=iONIlIURn3mAjh0LIGo6UgObco9bJEwvOOMqL3bK6J7AWfWppl3S4DetLv6vSmb02RejDL1RuTSK9hUgJeGEZMny5FJNHBQZdQCKdsBYElwZqqbHdn6dx1jFVlxnHy/b9S0i6ky7C8B14wV9r630+xRd2/WvxsBwYT19JCSQgrI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035991; c=relaxed/simple; bh=iBX/Ign0ibZ2cJo5H4xOwNyhcHnttHXJDUWTRrucGnk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=B9jXdO0k221XU0wjPQV+2v/ayLKT8VXB7D60f+lECGmSO8Nr7hYU5dpg74bdw2bhIn2szQDxNTy1f4uuVhVcprdlPs9E1yPNIQO0mxdwYmCJJF8E1MGgMKG05mMiIlKijLy/Eua0aaTVAvyJx/1Leb7oMNtHE7Z+4jzYBnyH9IY= 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=WLtFBcRp; arc=fail smtp.client-ip=40.107.236.61 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="WLtFBcRp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RYEoBsikzqWLXKrdP+vV1qahkV7HJ2ynJnp6Q9b7pooXdlCwr/Yideqt5FjaQFoR9YN2qZ/S573F23QJ3xZ+h4p0Jpf4tFFvhDTzVC9ZNdooQVk7Pm33JRDayzYu0zn7MpaR1ypfAfPIhuNzBMiaKCKxTFPBI5uGSvVH0Y7nzKaI0gN/3zrMqqeOtus3mIRQq+b9gymra3QZ7D4DuBXsnTo3GMg+wtj1r/xCOVUiz4W2DSowgZyNp0Om9tR4A9gd5oDrYxbrBh0wEMq/Nf9OyaJVLm5K4UCmiTXH83R4ekWuhUsFngqCbl66qPbwqGS+3pyzTgVWrgQcfFEjXmRadQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WFZD/oaACHTDbMFEGbqUivhtJCQ+tYY8GI/iakxP/jg=; b=Cwi5PHXR3Pj1Rkl17+K9MVSCBaUs7YAN7YbcPk1LxYx/DiJV6xTi5glX+A8H6CoYXXevbXTlTb+Ha8KH9rT2cB4wPSlLEps+U3EtezHTnYLrkyAsBlkCcj0ubqrg7RXhDnJQOFokn/TQjzothRyMigu7LjRgCEQoYGlvRzTPJ2/oKtEo3rdun5FNFRa2VSowKkBQbWxRVSWlHiPfaX/fJ3cUPJB7J1RhuT9oTqPLvvH21dymqRgtbZgMmbAW2Nnj3R2LYmPzhbuw/PPxiWszIt9FuEocuj0ck/CmENi7A9PrwNrfSA6ovIc52rmDavPsJawbdahmO9FER747Dfu0QQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=vger.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=WFZD/oaACHTDbMFEGbqUivhtJCQ+tYY8GI/iakxP/jg=; b=WLtFBcRp8SMZw1mPMHrDF903/G81ol3I3eF6WwOjMIpaS0QVF9D9NiKw4OqpJh2KBAVfNFlttJbhoOkGKBB5CtpY5E+/a9Zr1v+n14TDwkOY+pjSJ34Az5eEsBUxIfw2y4H2cc2AwtPxUPMLyX02ZXFZoiS5myaZCLvhShqj77jUoEJzjuWzd4zCpXc+8zmJgb6vubThdcP3aDpc5OS66rQ/XJDYfFkjRwzSl4phYFSlCGuwn0VgsZU/ENk25RD1yoS7VslOQWIjcEednQ/npIEr8Py+KGNSZ7NAsb4h0PNSow83v8UN2zBFI8j6EikDb7noaLbbRI9tqRxPKunMkw== Received: from DS7PR03CA0312.namprd03.prod.outlook.com (2603:10b6:8:2b::21) by DS0PR12MB8416.namprd12.prod.outlook.com (2603:10b6:8:ff::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.38; Mon, 6 May 2024 22:53:01 +0000 Received: from DS3PEPF0000C37E.namprd04.prod.outlook.com (2603:10b6:8:2b:cafe::1e) by DS7PR03CA0312.outlook.office365.com (2603:10b6:8:2b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 22:53:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS3PEPF0000C37E.mail.protection.outlook.com (10.167.23.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:53:01 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:42 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:42 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:37 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 06/11] i2c: tegra: split clock initialization code Date: Tue, 7 May 2024 04:21:34 +0530 Message-ID: <20240506225139.57647-7-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37E:EE_|DS0PR12MB8416:EE_ X-MS-Office365-Filtering-Correlation-Id: 126af70d-8369-4306-2e3b-08dc6e1f4886 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|36860700004|376005|82310400017|7416005; X-Microsoft-Antispam-Message-Info: 92ptHH9HaKuTXbIS0x/L73v5zyZQNI0B6B1zYiBCS3OQSdKexoWHB5uehcOdgFgYOHqcsdYHUERHctHnMtfbXH7vq1CfsOyew8wQkOw0CbqPQpabO2MBlGE5x5fxvldd2vdDN9vOnxoWzO0CK38XxkPANvkYTeFVmflGZdCcpGeFU8bvDCenLZp0ELq70SWy0nTrBl8bOAKEcyIJmMj3a6mkr+WgGGqv+hZYZ3KadocJ1Og4DHD4XV1+JhXpmiTbBezPEDEuT1/L+U5tKidjybC0mi0N4k2Gy+W8NC6s/FttZEjyP8lUDGl6fDXai3CZwYcV5MPmb536MJxweL5QXzmJP/5rnexWmiX2cpcxEdxG9yWELqe+S082rfZgKzCa/Wymg7BT4X11KDPnrtBmTQihjkacSumkIkqkHHS9VXxQGKyzY2eGnqtylJ8Bsqikjqkb/s++gOwQ1SXhzogmT/Kf+/kjuWmbaDMv1KWKuzMaCDE8uzL+4eKp8ZNxzuC/JoxRkDRLArDhpE7zjoXgPfJWln785jRLB0x9buVAlxgZUzShnPTWk6qoXRY9uEtgFH5jRTIZrGDrENMDmaNjDRXpsXONCnqQnJFwxVldHEVVeYL0M8xi0CoIQ/dtAUDwZU+UBJ7qCyD4Ppwch1QLSbWLgvISIuBlBIWGDHJQ0ZoxfIG2qP/XfMN+gK0WbiGIG9HC4siHyn2Qu2n0ZO5tAxbv8G/8rKdLdx5+HqHscDagnBTUomz23xTzkWXg6AVuvsIwXKm1LZHBdAp6CONu947J9MqXgMHWTWezqot2C4U0yjkkNg9FsafygCoyioOJ8t9SE9LnFgM9SY0uebYI/es4v6j8Ir1o+fFwKnG/sgl+vihlbMTOnjDt/6B2mWeXeh0snTBh9qJGTwD3MY9ByY/8Wljb0r1uWUcFYyFcgIpbuHEJWZVfbwLW+lY3RwSwa35IzpMSpLuZGiVYa5znoZPyFXcCPf0id6Da/6o7ducQysF3Lr7p+mDackodzJx5Jbn5Q2Cwv478nbSVQVQUe4thhylqv5FDrTlAqSxkeOvTkhPSfNa5zHRyvVupiKgTNeO4QQfFQ5IScZkQplRJhz/6s8YmbMDT8syCEs2l6ALTmkKsMnDoFu9Q2sU6WO5kwsp6mgV6GHNxY02CpedU8ueCQdfsvx0FgTlr+mK3BlqGHEN63WYo3jrWdVpXEBqli5Rmpyr5e+2VGH9NuQ2Aec/qYXj6zm4atOg1pbI/D7AKnM5ZPRtiVEzn/9jPG7kwwwDewLB4wZro08l/JM8dxcDWImcjF4dtDDuArxgB+3tzcx09Q4YrRtygRV+LxR4x4ilWVlAy8MmU3v/apEWruJ7oVfMFb4z6GjMV1sFzon8QfmUAZKuGAm2ftGTpJhls X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(1800799015)(36860700004)(376005)(82310400017)(7416005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:53:01.8000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 126af70d-8369-4306-2e3b-08dc6e1f4886 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.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8416 Add new methods for setting clock parameters and setting clock divisor. Signed-off-by: Krishna Yarlagadda --- drivers/i2c/busses/i2c-tegra.c | 127 ++++++++++++++++++++------------- 1 file changed, 77 insertions(+), 50 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 85b31edc558d..b3dc2603db35 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -604,12 +604,83 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev) return 0; } +static void tegra_i2c_set_clk_params(struct tegra_i2c_dev *i2c_dev) +{ + u32 val, clk_divisor, tsu_thd, tlow, thigh, non_hs_mode; + + switch (i2c_dev->timings.bus_freq_hz) { + case I2C_MAX_STANDARD_MODE_FREQ + 1 ... I2C_MAX_FAST_MODE_PLUS_FREQ: + default: + tlow = i2c_dev->hw->tlow_fast_fastplus_mode; + thigh = i2c_dev->hw->thigh_fast_fastplus_mode; + tsu_thd = i2c_dev->hw->setup_hold_time_fast_fast_plus_mode; + + if (i2c_dev->timings.bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) + non_hs_mode = i2c_dev->hw->clk_divisor_fast_plus_mode; + else + non_hs_mode = i2c_dev->hw->clk_divisor_fast_mode; + break; + + case 0 ... I2C_MAX_STANDARD_MODE_FREQ: + tlow = i2c_dev->hw->tlow_std_mode; + thigh = i2c_dev->hw->thigh_std_mode; + tsu_thd = i2c_dev->hw->setup_hold_time_std_mode; + non_hs_mode = i2c_dev->hw->clk_divisor_std_mode; + break; + } + + /* make sure clock divisor programmed correctly */ + clk_divisor = FIELD_PREP(I2C_CLK_DIVISOR_HSMODE, + i2c_dev->hw->clk_divisor_hs_mode) | + FIELD_PREP(I2C_CLK_DIVISOR_STD_FAST_MODE, non_hs_mode); + i2c_writel(i2c_dev, clk_divisor, I2C_CLK_DIVISOR); + + if (i2c_dev->hw->has_interface_timing_reg) { + val = FIELD_PREP(I2C_INTERFACE_TIMING_THIGH, thigh) | + FIELD_PREP(I2C_INTERFACE_TIMING_TLOW, tlow); + i2c_writel(i2c_dev, val, I2C_INTERFACE_TIMING_0); + } + + /* + * Configure setup and hold times only when tsu_thd is non-zero. + * Otherwise, preserve the chip default values. + */ + if (i2c_dev->hw->has_interface_timing_reg && tsu_thd) + i2c_writel(i2c_dev, tsu_thd, I2C_INTERFACE_TIMING_1); +} + +static int tegra_i2c_set_div_clk(struct tegra_i2c_dev *i2c_dev) +{ + u32 clk_multiplier, tlow, thigh, non_hs_mode; + u32 timing, clk_divisor; + int err; + + timing = i2c_readl(i2c_dev, I2C_INTERFACE_TIMING_0); + + tlow = FIELD_GET(I2C_INTERFACE_TIMING_TLOW, timing); + thigh = FIELD_GET(I2C_INTERFACE_TIMING_THIGH, timing); + + clk_divisor = i2c_readl(i2c_dev, I2C_CLK_DIVISOR); + + non_hs_mode = FIELD_GET(I2C_CLK_DIVISOR_STD_FAST_MODE, clk_divisor); + + clk_multiplier = (thigh + tlow + 2) * (non_hs_mode + 1); + + err = clk_set_rate(i2c_dev->div_clk, + i2c_dev->timings.bus_freq_hz * clk_multiplier); + if (err) { + dev_err(i2c_dev->dev, "failed to set div_clk rate: %d\n", err); + return err; + } + + return 0; +} + static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) { - u32 val, clk_divisor, clk_multiplier, tsu_thd, tlow, thigh, non_hs_mode; + u32 val; + int err; acpi_handle handle = ACPI_HANDLE(i2c_dev->dev); - struct i2c_timings *t = &i2c_dev->timings; - int err; /* * The reset shouldn't ever fail in practice. The failure will be a @@ -641,54 +712,10 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) if (IS_VI(i2c_dev)) tegra_i2c_vi_init(i2c_dev); - switch (t->bus_freq_hz) { - case I2C_MAX_STANDARD_MODE_FREQ + 1 ... I2C_MAX_FAST_MODE_PLUS_FREQ: - default: - tlow = i2c_dev->hw->tlow_fast_fastplus_mode; - thigh = i2c_dev->hw->thigh_fast_fastplus_mode; - tsu_thd = i2c_dev->hw->setup_hold_time_fast_fast_plus_mode; - - if (t->bus_freq_hz > I2C_MAX_FAST_MODE_FREQ) - non_hs_mode = i2c_dev->hw->clk_divisor_fast_plus_mode; - else - non_hs_mode = i2c_dev->hw->clk_divisor_fast_mode; - break; - - case 0 ... I2C_MAX_STANDARD_MODE_FREQ: - tlow = i2c_dev->hw->tlow_std_mode; - thigh = i2c_dev->hw->thigh_std_mode; - tsu_thd = i2c_dev->hw->setup_hold_time_std_mode; - non_hs_mode = i2c_dev->hw->clk_divisor_std_mode; - break; - } - - /* make sure clock divisor programmed correctly */ - clk_divisor = FIELD_PREP(I2C_CLK_DIVISOR_HSMODE, - i2c_dev->hw->clk_divisor_hs_mode) | - FIELD_PREP(I2C_CLK_DIVISOR_STD_FAST_MODE, non_hs_mode); - i2c_writel(i2c_dev, clk_divisor, I2C_CLK_DIVISOR); - - if (i2c_dev->hw->has_interface_timing_reg) { - val = FIELD_PREP(I2C_INTERFACE_TIMING_THIGH, thigh) | - FIELD_PREP(I2C_INTERFACE_TIMING_TLOW, tlow); - i2c_writel(i2c_dev, val, I2C_INTERFACE_TIMING_0); - } - - /* - * Configure setup and hold times only when tsu_thd is non-zero. - * Otherwise, preserve the chip default values. - */ - if (i2c_dev->hw->has_interface_timing_reg && tsu_thd) - i2c_writel(i2c_dev, tsu_thd, I2C_INTERFACE_TIMING_1); - - clk_multiplier = (tlow + thigh + 2) * (non_hs_mode + 1); - - err = clk_set_rate(i2c_dev->div_clk, - t->bus_freq_hz * clk_multiplier); - if (err) { - dev_err(i2c_dev->dev, "failed to set div-clk rate: %d\n", err); + tegra_i2c_set_clk_params(i2c_dev); + err = tegra_i2c_set_div_clk(i2c_dev); + if (err) return err; - } if (!IS_DVC(i2c_dev) && !IS_VI(i2c_dev)) { u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG); From patchwork Mon May 6 22:51:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 795067 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2089.outbound.protection.outlook.com [40.107.212.89]) (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 DDB3215E209; Mon, 6 May 2024 22:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035991; cv=fail; b=DzVKYeI5A8vGUVpcooCrx+zA1YBhrAUqPxlQx4yL3MxkNS2rFn85jlXrDB0dKJUwOOkUm6ZBMvpI6JRleDCZAoyjQ21OOBjkTP/lYJd9NJqEUtxRy8rlQXQ4CL0Ezlxtvx7xlbjgM2wUsZYFto3q392FJ2/Ptxp1RePfy6NXkIA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035991; c=relaxed/simple; bh=FbGlXhJjDNJUhD1IsvjFyvU8cXfKPSOSGrbtzM5JRAA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QI5YHlP7vw7F8+DxmyXPKEJZ10AnK/yyHWTqdZvbm0dQwogaIRgruaZQ4B3ryo/pjndVJ4jao5gHBFRHhL1IhXwLI3NRwo8yggSAekq9I59BMv5n/lJrt80C8QM0HFx753huOg/6s71F6Y1XaCtAp7Av5zsV5nDjZcPcidHyuLQ= 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=a6VAAP3M; arc=fail smtp.client-ip=40.107.212.89 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="a6VAAP3M" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FckNgg8IvDYwuETkKub+pCkuoe/3T83XBGKg9V/aA0S956ojPDJQ/5UG/cCTFK61oMdI/6voo9QxL123/lnnWUtO0ZYNgRIfRzktPV2jveEpwfmviZ/sPzl2g9vEp/ho8S92eYj7F0oXhHg7SCBZNBNlDQRcR54yeGEBZ+6DgnXe1TKGNFUUK+w55I5ZLI24ALeDgWdixWMYFjOPqr3na6wY/BHCtzjotN6CSUQLlHT14zeYLnHz7PF347BXeSAEd25SA2tztEZH07QFuYMHpBSjtFSPdgTItD4FBio6tXKX9WPdMncv9It6i440xOXLUiTOM9JNgfVNpAWbEjD7YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=w+bFvYH+NXPBYXsdnKjMmmU8m87SEXjDrEUcztxlrw4=; b=nVrgYAfUDliv3HPeNIVPaYzmFQLXWEdLcIWFUtd9NA4JY7tCVzCQhEKlskkwr2sGAWdqWUIsTvaxr/bY2z+5S05Npl4jfRf3KCgiCZxNikNflHkfCWCOdjAgQyiN3KeH5Nc3CZdhg/7VjAqzxKQvTgMysiHhlCeWUQIF2J5vOkENQx5A1ZnPLWCWVIs0pyK0aDOczXUtkgirkcHV/l1il3tPW49p5/LYwWYGiqjMyt1Fnp/PXCqTPF6CDOvlwX55UfCs8nQVEWZcZRJCYT3OcPGCBFaVtMfCT4zP7GLsl2NPoORcR2ggENnaMd+OqW6ZeUmyksC4Y0kx2CHqWFK8Rg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=vger.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=w+bFvYH+NXPBYXsdnKjMmmU8m87SEXjDrEUcztxlrw4=; b=a6VAAP3MnVTgLSL6HUs0+UYl7RdCUAbEmkbAlVYz1gaseMoL8oczs0qxGHd2O/ToekXWusiLAlHTdGRJzPd7EarGPFnzT/UAYcvJShNSetWB3UijHMz/3P1w5l43s4HSnlHqa7RaaOCqxS5tzUO8qVE4ucgzWSFg8IQMFXF7TOQEtNje3MrsJj8MsaWwDvO5jH+vsW9vtWfGz3YJt2wQNL/itC8GybDsq6A9EDUtODUgAj7Ku3bKeXNkqPWVFse0XbKqjDNd+x7tDEGazaVk+Z2joDfyYUkTQqwHslyR5k8dg6/5ZakPCsJK9uppkK4WF4V9j7YsYi3bMz2gn2U4Wg== Received: from CH0PR04CA0097.namprd04.prod.outlook.com (2603:10b6:610:75::12) by CY8PR12MB7586.namprd12.prod.outlook.com (2603:10b6:930:99::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 22:53:05 +0000 Received: from DS3PEPF0000C37C.namprd04.prod.outlook.com (2603:10b6:610:75:cafe::e) by CH0PR04CA0097.outlook.office365.com (2603:10b6:610:75::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 22:53:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS3PEPF0000C37C.mail.protection.outlook.com (10.167.23.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:53:05 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:48 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:48 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:42 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , , "Akhil R" Subject: [RFC PATCH 07/11] i2c: tegra: config settings for interface timings Date: Tue, 7 May 2024 04:21:35 +0530 Message-ID: <20240506225139.57647-8-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37C:EE_|CY8PR12MB7586:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a4049cd-2c91-4fc6-4d08-08dc6e1f4a7e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|376005|7416005|1800799015|36860700004; X-Microsoft-Antispam-Message-Info: UScEXKSYdXPok7XjM+bNsbmLoiGARkgZmEmhXgrmAfv5ZX1bL6WYVTjUzNoOHSS4QiSfDNbQELbKCyptRLWAWZ9ca8TESmCeOln/YKhh6cyeINkUu8NQt/PmHLikTF/36ZVf6Z4HCt4h+Kxxio4vG+S9iBg3aYAM4OilnUKf0Z9dFOzkQ5a+Yj9goaOctHrmWJBb2WTZMbHlFPha5ZjC6d/+ZAQRisGczxcNotqq3TJz4EDvIZcGTN2LcdmSXCTT5DKfUtg3FOyvKSh4VvnT9iQu4RS+GS0Z4Eo/8EbLzPtupaOC56M0Kx80S8WQdNpgesJW09Q6nqFys5p4TPgdD3lMybNUn4LMDHQYWFPQlg29UwE2UnuaIyvoJNvvvYkwfdn7RkM9kZKXOt3n92rUcutGQMWELcG5zHpcTR5JiN50zHlLRQVy3oxi9qKKNsGVsfuN0CdRf1TMnuaemnGvC2ImH0gvE3Av4lklVy4Y5/w40VA9KrUzPSKYR6S8Ibe9IhY952PLljyMTX3m/iEQ1vMb2HAkJZEEM0GHPyrfO2XJl9H1dSrquIGxPsTOg0QlvqcjQekE261Aoqx0aszJkR2fqDIggjaCn19k0s/VRt8M2/L0RDJP4PbKItO17vwerHWw4uviaawYgKLjHpHACdckGnIolcbMFBFoHC1Tq4edIKEoM8d5zb821/4795U1cPKos0bnjimY5er3AALP8C9T5wGFmCZfWb+P41jBwGEfpYf0cfaSEfCB+8iR8VRjF5d+U7Hc8O4LEnPPnSXXrxs3syRtOiuVAPRfzu1Fn5KzdqWn1GN6bBeM7eDdC5p8yTRzCsbU5paGr0ccNGKlWxCAuSoov1n0mpXYwF1cVl5wkSIiEIPIAGXU2JBSvm99bXhzu70c8N7up+CgO9YrEe8r6zFEyHEtRkWKrp5kXR2W2TGy9DYNV+/CR8Hfe26LwvBMbO5dZkeuMCwBb5tM7vSudQ8iiQm9p2iBanPfrTt5tkICuXziB8OZGzxjxNPQVW21WXS6o6BZjYhWhvpT1kG5lpsukvTwtluuHCv99Qnvt6ejuQVFZUPsvE3VHZq8ZYkdwvAasx9T3ifMGI1Y/1ce4fNbtAJumyhqjc+XrkwgPX0/B0QbJI2ggvEgEt5RWEMwLO3oHejlZu52v+tUxvuBfpDzHFD/EOobyhgY7uFdWplSYzHxLpeNX1+uLFqkXFWuhVQKCreyBzb5jlR/RSCqgrzuCc9rd2nkWKwRFO5QpFZ3oTwpFy1oGisCTkT4mB0dmnESK8aJ6tWjQgEVMEgcnTK4RcJdUmLGzoYqgacRL4HUVFvVjYGqKv44tCaTqJdkjgfuncDaOWBKyxL3Vt4UJlgDfhysXM1VBBzY8Jc= X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(82310400017)(376005)(7416005)(1800799015)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:53:05.1350 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a4049cd-2c91-4fc6-4d08-08dc6e1f4a7e 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.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7586 Use config settings framework to initialize Tegra I2C interface timing registers and clock divisor based on I2C speed modes. Each speed mode uses predefined configuration for interface timing and clock registers. Signed-off-by: Akhil R Signed-off-by: Laxman Dewangan Signed-off-by: Krishna Yarlagadda --- drivers/i2c/busses/i2c-tegra.c | 134 +++++++++++++++++++++++++++++++-- 1 file changed, 129 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index b3dc2603db35..263fd64e440f 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -28,6 +28,8 @@ #include #include +#include + #define BYTES_PER_FIFO_WORD 4 #define I2C_CNFG 0x000 @@ -108,8 +110,9 @@ #define I2C_MST_CORE_CLKEN_OVR BIT(0) #define I2C_INTERFACE_TIMING_0 0x094 -#define I2C_INTERFACE_TIMING_THIGH GENMASK(13, 8) -#define I2C_INTERFACE_TIMING_TLOW GENMASK(5, 0) +#define I2C_INTERFACE_TIMING_THIGH GENMASK(15, 8) +#define I2C_INTERFACE_TIMING_TLOW GENMASK(7, 0) + #define I2C_INTERFACE_TIMING_1 0x098 #define I2C_INTERFACE_TIMING_TBUF GENMASK(29, 24) #define I2C_INTERFACE_TIMING_TSU_STO GENMASK(21, 16) @@ -117,8 +120,9 @@ #define I2C_INTERFACE_TIMING_TSU_STA GENMASK(5, 0) #define I2C_HS_INTERFACE_TIMING_0 0x09c -#define I2C_HS_INTERFACE_TIMING_THIGH GENMASK(13, 8) -#define I2C_HS_INTERFACE_TIMING_TLOW GENMASK(5, 0) +#define I2C_HS_INTERFACE_TIMING_THIGH GENMASK(15, 8) +#define I2C_HS_INTERFACE_TIMING_TLOW GENMASK(7, 0) + #define I2C_HS_INTERFACE_TIMING_1 0x0a0 #define I2C_HS_INTERFACE_TIMING_TSU_STO GENMASK(21, 16) #define I2C_HS_INTERFACE_TIMING_THD_STA GENMASK(13, 8) @@ -226,6 +230,49 @@ struct tegra_i2c_hw_feature { bool has_interface_timing_reg; }; +/** + * I2C register config fields. + */ +static const struct tegra_cfg_field_desc i2c_cfg_fields[] = { + TEGRA_CFG_FIELD("nvidia,i2c-clk-divisor-fs-mode", + I2C_CLK_DIVISOR, I2C_CLK_DIVISOR_STD_FAST_MODE), + TEGRA_CFG_FIELD("nvidia,i2c-clk-divisor-hs-mode", + I2C_CLK_DIVISOR, I2C_CLK_DIVISOR_HSMODE), + TEGRA_CFG_FIELD("nvidia,i2c-hs-sclk-high-period", + I2C_HS_INTERFACE_TIMING_0, + I2C_HS_INTERFACE_TIMING_THIGH), + TEGRA_CFG_FIELD("nvidia,i2c-hs-sclk-low-period", + I2C_HS_INTERFACE_TIMING_0, + I2C_HS_INTERFACE_TIMING_TLOW), + TEGRA_CFG_FIELD("nvidia,i2c-hs-stop-setup-time", + I2C_HS_INTERFACE_TIMING_1, + I2C_HS_INTERFACE_TIMING_TSU_STO), + TEGRA_CFG_FIELD("nvidia,i2c-hs-start-hold-time", + I2C_HS_INTERFACE_TIMING_1, + I2C_HS_INTERFACE_TIMING_THD_STA), + TEGRA_CFG_FIELD("nvidia,i2c-hs-start-setup-time", + I2C_HS_INTERFACE_TIMING_1, + I2C_HS_INTERFACE_TIMING_TSU_STA), + TEGRA_CFG_FIELD("nvidia,i2c-sclk-high-period", + I2C_INTERFACE_TIMING_0, I2C_INTERFACE_TIMING_THIGH), + TEGRA_CFG_FIELD("nvidia,i2c-sclk-low-period", + I2C_INTERFACE_TIMING_0, I2C_INTERFACE_TIMING_TLOW), + TEGRA_CFG_FIELD("nvidia,i2c-bus-free-time", + I2C_INTERFACE_TIMING_1, I2C_INTERFACE_TIMING_TBUF), + TEGRA_CFG_FIELD("nvidia,i2c-stop-setup-time", + I2C_INTERFACE_TIMING_1, I2C_INTERFACE_TIMING_TSU_STO), + TEGRA_CFG_FIELD("nvidia,i2c-start-hold-time", + I2C_INTERFACE_TIMING_1, I2C_INTERFACE_TIMING_THD_STA), + TEGRA_CFG_FIELD("nvidia,i2c-start-setup-time", + I2C_INTERFACE_TIMING_1, I2C_INTERFACE_TIMING_TSU_STA), +}; + +static struct tegra_cfg_desc i2c_cfg_desc = { + .num_regs = 0, + .num_fields = ARRAY_SIZE(i2c_cfg_fields), + .fields = i2c_cfg_fields, +}; + /** * struct tegra_i2c_dev - per device I2C context * @dev: device reference for power management @@ -288,6 +335,8 @@ struct tegra_i2c_dev { dma_addr_t dma_phys; void *dma_buf; + struct tegra_cfg_list *list; + bool multimaster_mode; bool atomic_mode; bool dma_mode; @@ -340,6 +389,16 @@ static u32 i2c_readl(struct tegra_i2c_dev *i2c_dev, unsigned int reg) return readl_relaxed(i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg)); } +static void i2c_update(struct tegra_i2c_dev *i2c_dev, u32 mask, + u32 val, unsigned int reg) +{ + u32 rval; + + rval = i2c_readl(i2c_dev, reg); + rval = (rval & ~mask) | val; + i2c_writel(i2c_dev, rval, reg); +} + static void i2c_writesl(struct tegra_i2c_dev *i2c_dev, void *data, unsigned int reg, unsigned int len) { @@ -604,6 +663,48 @@ static int tegra_i2c_wait_for_config_load(struct tegra_i2c_dev *i2c_dev) return 0; } +static void tegra_i2c_write_cfg_settings(struct tegra_i2c_dev *i2c_dev, + const char *name) +{ + struct tegra_cfg_reg *regs; + struct tegra_cfg *cfg; + unsigned int i; + + cfg = tegra_cfg_get_by_name(i2c_dev->dev, i2c_dev->list, name); + if (!cfg) + return; + + regs = cfg->regs; + for (i = 0; i < cfg->num_regs; i++) { + i2c_update(i2c_dev, regs[i].mask, regs[i].value, + regs[i].offset); + } +} + +static void tegra_i2c_config_cfg_settings(struct tegra_i2c_dev *i2c_dev) +{ + const char *name; + + switch (i2c_dev->timings.bus_freq_hz) { + case I2C_MAX_FAST_MODE_PLUS_FREQ + 1 ... I2C_MAX_HIGH_SPEED_MODE_FREQ: + name = "high"; + break; + case I2C_MAX_FAST_MODE_FREQ + 1 ... I2C_MAX_FAST_MODE_PLUS_FREQ: + name = "fastplus"; + break; + case I2C_MAX_STANDARD_MODE_FREQ + 1 ... I2C_MAX_FAST_MODE_FREQ: + name = "fast"; + break; + case 0 ... I2C_MAX_STANDARD_MODE_FREQ: + default: + name = "standard"; + break; + } + + tegra_i2c_write_cfg_settings(i2c_dev, "common"); + tegra_i2c_write_cfg_settings(i2c_dev, name); +} + static void tegra_i2c_set_clk_params(struct tegra_i2c_dev *i2c_dev) { u32 val, clk_divisor, tsu_thd, tlow, thigh, non_hs_mode; @@ -712,7 +813,11 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev) if (IS_VI(i2c_dev)) tegra_i2c_vi_init(i2c_dev); - tegra_i2c_set_clk_params(i2c_dev); + if (i2c_dev->list) + tegra_i2c_config_cfg_settings(i2c_dev); + else + tegra_i2c_set_clk_params(i2c_dev); + err = tegra_i2c_set_div_clk(i2c_dev); if (err) return err; @@ -1772,6 +1877,8 @@ static int tegra_i2c_probe(struct platform_device *pdev) struct tegra_i2c_dev *i2c_dev; struct resource *res; int err; + const struct tegra_cfg_field_desc *fields; + unsigned int count = 0, i, j; i2c_dev = devm_kzalloc(&pdev->dev, sizeof(*i2c_dev), GFP_KERNEL); if (!i2c_dev) @@ -1808,6 +1915,23 @@ static int tegra_i2c_probe(struct platform_device *pdev) if (err) return err; + fields = i2c_cfg_fields; + + for (i = 0; i < i2c_cfg_desc.num_fields; i++) { + for (j = 0; j < i; j++) + if (fields[i].offset == fields[j].offset) + break; + if (i == j) + count++; + } + i2c_cfg_desc.num_regs = count; + + i2c_dev->list = tegra_cfg_get(i2c_dev->dev, NULL, &i2c_cfg_desc); + if (IS_ERR_OR_NULL(i2c_dev->list)) { + dev_dbg(&pdev->dev, "Config setting not available\n"); + i2c_dev->list = NULL; + } + tegra_i2c_parse_dt(i2c_dev); err = tegra_i2c_init_reset(i2c_dev); From patchwork Mon May 6 22:51:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 796090 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2052.outbound.protection.outlook.com [40.107.220.52]) (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 141BE15E815; Mon, 6 May 2024 22:53:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035996; cv=fail; b=OY3GiM+fVgiegupi7mWhAh3jGc73R0xHB/yMuGkSxEBRHHqr2Detm7TJtAF3qKBWvVaq9qhbS3JDmZpfmX6gJlwuWcMG+T16AI/axbKLiXG25eGo9CgMY5l50tExQrHUtMSJ3aJqxExpBqKx1pLaYg3h0RGpi2CcSzzVCcxdFus= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715035996; c=relaxed/simple; bh=iGyO5atBVDla5HR4nmtm3MBM9+vQGyRLH1nVdXhcgi8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wni6kWvb+/c4RiovLVHJxgF46bkUEidEGByd1Bctsrr3MrYJidWO6HRYViGgEiQuQ3863uYhaoYQQNIbSOZCBsGqZU5clfg7ZGx6/w4zTZst0qdpV6TSVYUFr6qqQYcmQbbCw/SvbjE0P0YxG8hjxQjjGvOOfQLXNeGeKROpCr8= 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=A4EhG6pc; arc=fail smtp.client-ip=40.107.220.52 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="A4EhG6pc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WCORBX1AuEa+B4b5Q7i5k+eyZKVMk/fyNvUE4H8zjmCb0bkfe/bn/Ix1qVXF0dmgAsYQx+10/EYvEtVrRZpSFsZAwa7DGMkO9dIANVQJmSUvHThBMXN5gThEHNu8gOUPutRttxWavTpHys7a4MfHBWY14eHbimp8rxaWHMPA5E9vne6qfTzfxO8snWrnipAd3rjzpR37lRd3IBu8kRL/VxhdIBLZ39XEdS5WSNR8sk1nX6obee0lAOOjB84egG2KQd0OXj8Aeg4WeU1nAaxaISbKgBxWQecjthYmZ47HPqop9W/B6dq3NEe7zQ4Tw7TQvK1Ewv41WRS+j4QFcXQROA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7iLBU+RqZm3ScG4G6B30z1j9Jl36pZlyxKWA1BOIORA=; b=Kn4fkz9K8/qEGDBA2fsjOdzTBO2ujiEj4qEdOqfAJcD5gklafFmZCA3cEA2gfjLwVJJbdwbykHB2KeMC7de6Ki1MpuSlqJ0Ft4nn3UutssRj3O7rSJrgcGLsn7NshSl6K3YhlA/KQjidDCa3YGxxklVyVtFBytsA1CawGdrTaNl0OeU4LvvCry4I0HO2eujLm2MjPZgqC04V7CrKpCVSWHjWwEG/GlHSNypMPToIfnCHu+nI6msiyRy3IO0zZ0ZYiNhWZVKmYFksTFiexwRZV2hKno9IBF3nC3V/a0Y8cr7YFz41C0Ki6+Dkp/u4Zg2xVvDKPfGF335EDbJTkmWInQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=vger.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=7iLBU+RqZm3ScG4G6B30z1j9Jl36pZlyxKWA1BOIORA=; b=A4EhG6pcuFCrpPx2Mt8AjL6+FcOz2ve6RK8vthzGDnj3n7owOG/enIO2T+U7rTEGTJJE6tDgXPZClyx3nwiE5K23o+pc0A7rI4f9998V5GYbYyNpFV0a1boniL74GwBcDM4EWe2uIN3XkjJ04en2xT2pMvSyZ5OJYuO5KOYfC5PGMdi/xCJ5Mr3vMxeRj/IX8tH+ygPlFismRqM6gYHsrkMRvc2Tg75yYN2T/YOz0fc7bHjp+p295rYiySysSyQLELv1tt4/f4mk93HJFkN6TNjvWZwfA20CFcg9MqmOkxx1AflXvBqStd0lkyUqVuthqU4nWFf0j/Md8H4Iys2L9g== Received: from CH0PR04CA0029.namprd04.prod.outlook.com (2603:10b6:610:76::34) by CH2PR12MB4168.namprd12.prod.outlook.com (2603:10b6:610:a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Mon, 6 May 2024 22:53:10 +0000 Received: from DS3PEPF0000C37D.namprd04.prod.outlook.com (2603:10b6:610:76:cafe::c0) by CH0PR04CA0029.outlook.office365.com (2603:10b6:610:76::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 22:53:10 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS3PEPF0000C37D.mail.protection.outlook.com (10.167.23.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:53:09 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:54 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:53 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:48 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 08/11] arm64: tegra: I2C interface timings Date: Tue, 7 May 2024 04:21:36 +0530 Message-ID: <20240506225139.57647-9-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37D:EE_|CH2PR12MB4168:EE_ X-MS-Office365-Filtering-Correlation-Id: 810dbd44-cb4f-43a3-9473-08dc6e1f4d64 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|1800799015|7416005|36860700004|376005; X-Microsoft-Antispam-Message-Info: ikgjApASfBcBS7f1XtiKuAEY4NGogdzQXrLpfvkiQoJ44vBARBp3jjb06yAkhi+tg0x8/xphOCbtas8SJp3RzB6t/m8jhIz81ykByeUT/6R1iO3zuB3fuvLYq6YJsqcrvg4MSeHHq8Ogfsae6QKu7NBDEyi/c7QrNfVHgsj0TAR3taV8xP7f1UsAs502eScqTYd7CT6q1u5azdgtHhdBnmYQzkG17epZS7NZoXmxt2tt+G2k5mye4z2OdGQxDzWd0Q8V4Mslb7Pg0U4VLtcBRiz25lJf5AF7i9/GdZP7j68Tjdi4tYLMoJ16e3jbmWwdkLVkDCeni2R2T34Ilrhz2VBvNUZu9lLBDUraQYTJow22EErJF5SO9uplDibpN8qaFvXsJNL6ZuaTzDvSLJ63l1HiYNIx1S2wVvjYYVSPJbyLVu2/9tsX4hcpo4S8kUX825e9cEWw0zn83sSe/kmKhOo7KVKprETdu+SihKrMiR3+AZWk23/4CHwxN5QcTlMoUXjKC/WadBBU93jUaRNR2G3Ro4sSvjLpZXrrQdWvf0bD7wSCbGsxuhMIJvifpIHVcA+5m/XZ8BZYExkDlf6/yvhrOntHtxMgnmGsPn5GZXkhzKISJaS9ChEyCd/P2gEy7fq8huL8IQBEprVTZ9HHEpCaNmGRwIThWE64a3E4zkPJxCo3o8xC5gFHefTFTOuH6mqG41zVYNawxENJxwYEAv1XNOnGFmbUKhN8SxLIdm8h4iTuc7ssHq9HZR/9mF7L6GQIGG6cKxMMbMqTldlDnk4jHqLh9khQlnJERQKvp1FlegSlXzobPO2BmjU8g/RMpJxFQ2jqlEMWP/VqeftUcsxA5ybHT+KlWUV1GuHL9Un3r8xXouYKwPqmL64fYgCIdvYyNmIwVUSK6JDPF1mgALftBSIUgvqc0RRkwqUnRvg3wfohob3vxtQoHzdsBAmJVzfRVnwBsCdB9mOQUnyJ4YQCO7y5YdhWY4foaWRDdkkur5KOlSoCy0eqRu63P1ErmAIMVRCZ/9Qq4QgqHcyQ2UndZpOkV0fyx7iqGhUiW4SoIDEvXdIMM+QcbLMMGah9lZGfcjDqS7TR9q89vUNccZrqoD0ei5KoaRwnExl8reAp/ANPkxTefzEq6LrGu5gEnTemlELK9Bk0lH5pi3ssbcxsNodOaEQAadGsDpy4ajNci1frsz0ZKBUelQEoq4+G8VdYvuI7KTyD5fpVi6hFKVQEKeEoql9HSMqRPwrVgBe9D6FDmoz7qahYtnzUoGAQp272g2/KWWScoHFUJk79WeiSz/xhFceco79/Y3G9xPEG0TK2cOUMnc9wvaqpvYYm/LrBm2VjDijnzlHT5anNUN/jGJZ7ffsWzXBWRBTuX4Ibmxq2lixf8M2tF2dsuJVO X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(82310400017)(1800799015)(7416005)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:53:09.9996 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 810dbd44-cb4f-43a3-9473-08dc6e1f4d64 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.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4168 Set I2C interface timing registers through config settings for Tegra234 chip and P3701 board. Signed-off-by: Krishna Yarlagadda --- MAINTAINERS | 1 + arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi | 446 ++++++++++++++++++ .../dts/nvidia/tegra234-p3701-0000-cfg.dtsi | 123 +++++ .../boot/dts/nvidia/tegra234-p3701-0000.dtsi | 1 + 4 files changed, 571 insertions(+) create mode 100644 arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi create mode 100644 arch/arm64/boot/dts/nvidia/tegra234-p3701-0000-cfg.dtsi diff --git a/MAINTAINERS b/MAINTAINERS index a8c0cfd1d5a6..27ca5bd9203e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21996,6 +21996,7 @@ M: Thierry Reding R: Laxman Dewangan R: Krishna Yarlagadda S: Supported +F: arch/arm64/boot/dts/nvidia/tegra234*cfg.dtsi F: Documentation/devicetree/bindings/misc/nvidia,tegra-config-settings.yaml F: Documentation/misc-devices/tegra-cfg.rst F: drivers/soc/tegra/tegra-cfg.c diff --git a/arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi new file mode 100644 index 000000000000..832538e45797 --- /dev/null +++ b/arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi @@ -0,0 +1,446 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/ { + bus@0 { + i2c@3160000 { + config { + + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + high { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-clk-divisor-hs-mode = <0x02>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + nvidia,i2c-hs-stop-setup-time = <0x09>; + nvidia,i2c-hs-start-hold-time = <0x09>; + nvidia,i2c-hs-start-setup-time = <0x09>; + }; + + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + + }; + }; + + i2c@3180000 { + config { + + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + high { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-clk-divisor-hs-mode = <0x02>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + nvidia,i2c-hs-stop-setup-time = <0x09>; + nvidia,i2c-hs-start-hold-time = <0x09>; + nvidia,i2c-hs-start-setup-time = <0x09>; + }; + + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + + }; + }; + + i2c@3190000 { + config { + + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + high { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-clk-divisor-hs-mode = <0x02>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + nvidia,i2c-hs-stop-setup-time = <0x09>; + nvidia,i2c-hs-start-hold-time = <0x09>; + nvidia,i2c-hs-start-setup-time = <0x09>; + }; + + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + + }; + }; + + i2c@31b0000 { + config { + + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + high { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-clk-divisor-hs-mode = <0x02>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + nvidia,i2c-hs-stop-setup-time = <0x09>; + nvidia,i2c-hs-start-hold-time = <0x09>; + nvidia,i2c-hs-start-setup-time = <0x09>; + }; + + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + + }; + }; + + i2c@31c0000 { + config { + + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + high { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-clk-divisor-hs-mode = <0x02>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + nvidia,i2c-hs-stop-setup-time = <0x09>; + nvidia,i2c-hs-start-hold-time = <0x09>; + nvidia,i2c-hs-start-setup-time = <0x09>; + }; + + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + + }; + }; + + i2c@31e0000 { + config { + + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + high { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-clk-divisor-hs-mode = <0x02>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + nvidia,i2c-hs-stop-setup-time = <0x09>; + nvidia,i2c-hs-start-hold-time = <0x09>; + nvidia,i2c-hs-start-setup-time = <0x09>; + }; + + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + + }; + }; + + i2c@c240000 { + config { + + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + high { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-clk-divisor-hs-mode = <0x02>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + nvidia,i2c-hs-stop-setup-time = <0x09>; + nvidia,i2c-hs-start-hold-time = <0x09>; + nvidia,i2c-hs-start-setup-time = <0x09>; + }; + + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + + }; + }; + + i2c@c250000 { + config { + + common { + nvidia,i2c-hs-sclk-high-period = <0x03>; + nvidia,i2c-hs-sclk-low-period = <0x08>; + }; + + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + + high { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-clk-divisor-hs-mode = <0x02>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + nvidia,i2c-hs-stop-setup-time = <0x09>; + nvidia,i2c-hs-start-hold-time = <0x09>; + nvidia,i2c-hs-start-setup-time = <0x09>; + }; + + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + + }; + }; + + }; +}; diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3701-0000-cfg.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3701-0000-cfg.dtsi new file mode 100644 index 000000000000..3eb13c06d34d --- /dev/null +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3701-0000-cfg.dtsi @@ -0,0 +1,123 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include "tegra234-cfg.dtsi" + +/ { + bus@0 { + i2c@3160000 { + config { + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + }; + }; + + i2c@3180000 { + config { + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + standard { + nvidia,i2c-clk-divisor-fs-mode = <0x4f>; + nvidia,i2c-sclk-high-period = <0x07>; + nvidia,i2c-sclk-low-period = <0x08>; + nvidia,i2c-bus-free-time = <0x08>; + nvidia,i2c-stop-setup-time = <0x08>; + nvidia,i2c-start-hold-time = <0x08>; + nvidia,i2c-start-setup-time = <0x08>; + }; + }; + }; + + i2c@3190000 { + config { + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + }; + }; + + i2c@31c0000 { + config { + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + }; + }; + + i2c@31e0000 { + config { + fast { + nvidia,i2c-clk-divisor-fs-mode = <0x3c>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + }; + }; + + i2c@c240000 { + config { + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + }; + }; + + i2c@c250000 { + config { + fastplus { + nvidia,i2c-clk-divisor-fs-mode = <0x16>; + nvidia,i2c-sclk-high-period = <0x02>; + nvidia,i2c-sclk-low-period = <0x02>; + nvidia,i2c-bus-free-time = <0x02>; + nvidia,i2c-stop-setup-time = <0x02>; + nvidia,i2c-start-hold-time = <0x02>; + nvidia,i2c-start-setup-time = <0x02>; + }; + }; + }; + }; +}; diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3701-0000.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3701-0000.dtsi index cb792041fc62..71506c51a5ea 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234-p3701-0000.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234-p3701-0000.dtsi @@ -2,6 +2,7 @@ #include "tegra234.dtsi" #include "tegra234-p3701.dtsi" +#include "tegra234-p3701-0000-cfg.dtsi" / { model = "NVIDIA Jetson AGX Orin"; From patchwork Mon May 6 22:51:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 795066 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2081.outbound.protection.outlook.com [40.107.92.81]) (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 22D9F15DBCC; Mon, 6 May 2024 22:53:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715036003; cv=fail; b=KjkV79A6lsHCo+viQyAiyafZssv05Q98/n6q7vueDyUKOcqewXGJWoBMQBwu8WEyyByuO756/iTPrXrjaMfiesPVYi23oeoPL9VPVx7/BFGBG9vr2y0Akp8zU0fOL61yI0XW4cprovtQh9YkTNzGIs3HYd1pLN0xRIpNQEABBQc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715036003; c=relaxed/simple; bh=4TFk0u/A0TeZesqnRHpNftOznPAwvR5iNnJIIWmQp2U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wc9Puq9CCiDUGWe6E0Kb/VmpCh6PuFW26JcPzBY97X5PHiPrG0mdghOI8gkQLPoymCUBIySudGT3XK0JB+I3ARghYRmaIkVQ5JuSBW88lDXC19DhqSgSeovHuT/KFRPxmVTZcDtJT/Z4Nlj/sojqo/w1qt+rXVBaBK1C8JCGwbA= 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=fRVn/Zaw; arc=fail smtp.client-ip=40.107.92.81 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="fRVn/Zaw" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XwmZfltuJsE+jaR6m/Bj8/WcqMN0c1ZfujD9vlMSRDeneyofoYaLeG/lEmq0+SDEoPv1xr92uqqxSDMMBjKPu4XVqIWywDwOoal26u9sbs2Uu2tC4Acwe782nDLPrJVH/VHfzJYPDe+EKrynq8CiReUEnImi9XIwQ2DHTyod4GpZrJJ0yz5mbUqZ1p0an2qyaozB9NjLfMN1x0BKdmIIS4ijBVq0USJKKu/jqxzmDbvKCm0XesOxrfbHQ1ybA3ExZcafbR1FzXFEpkoRAa99UyjNcS3OcuGbjINIdGYFMeR0Xhfa0ZTE0pErZsgn+odIkfPH9plzjZFIXodOetyS8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=E89wNX7QMImCvT2JhkGzDnT7Sk3uU1oi2vU94qoB3JY=; b=CoEXNnaJRRcVTy0OdrTGX2q/tc2xYhkvyftCg/KzZmQGxmBVrb5PgUJ2WF6UASBpKiInQJroFeQKJF7T2Fh1fcIZMXQ+kqu1z25wMivdLLqVmr177ygJ/uDr3rk4uA1s9+KtzBkmIN/FEdkkOSexAtQEYDY//oxXraBYTloxtsW+qVF+AELIXLu53INm9iVhgicfiCBdn+nOk9cfMyeA8VVlzguvgHhssuzxk8Ex+OKNZaKa6zHXS1vW3s7p/LdTtz+i+Jt/8TqfW8i5ZhqT5zPisKOQvPSb0isLkXWlZAq8LjynOlDHaX0hWipJcrjquPX4wveD8saHOoUIu+DCJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=vger.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=E89wNX7QMImCvT2JhkGzDnT7Sk3uU1oi2vU94qoB3JY=; b=fRVn/Zaw5Sz3qJxPg7r6Yv/20JFqI1NVCdM7RylRqC3oWU8AMsg/gGZ39gwYHTCgi7TPgOfb6MI5xwGiKdQABV/ORrETkJwKocHrBT9D67ZhVHaRlfxecwCG7v5D0EzIBnnrCgputcQqgiS1nTx8yzmUPZy2Me46F2tWeTIrWI6mx/oD+4xd2NHm4d47Td3Dh7eTRdq0rKfIN18cn8Y5eBA4mICx7ARVDsxj+VM7nx5CGH0Jr3l28Oj5kG9R3O9McgHv/EgvpR3IJbOP8MeXxER9f/HlHdF/BSwotoCmfyDa/LJwhXlvDEheqUYlLeyS08JheMHia0JCpiotT4THoQ== Received: from DS7PR03CA0329.namprd03.prod.outlook.com (2603:10b6:8:2b::33) by DS0PR12MB8293.namprd12.prod.outlook.com (2603:10b6:8:f3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 22:53:18 +0000 Received: from DS3PEPF0000C37E.namprd04.prod.outlook.com (2603:10b6:8:2b:cafe::3e) by DS7PR03CA0329.outlook.office365.com (2603:10b6:8:2b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.34 via Frontend Transport; Mon, 6 May 2024 22:53:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) 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.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.232) by DS3PEPF0000C37E.mail.protection.outlook.com (10.167.23.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:53:18 +0000 Received: from drhqmail201.nvidia.com (10.126.190.180) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:52:59 -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.4; Mon, 6 May 2024 15:52:59 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:52:54 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 09/11] sdhci: dt-bindings: configuration settings Date: Tue, 7 May 2024 04:21:37 +0530 Message-ID: <20240506225139.57647-10-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C37E:EE_|DS0PR12MB8293:EE_ X-MS-Office365-Filtering-Correlation-Id: 257c4beb-e129-40cd-0f8a-08dc6e1f5282 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|36860700004|1800799015|7416005|82310400017; X-Microsoft-Antispam-Message-Info: jf9e23SryRl1j7cNNnjnl+1qyMgm6dbbu4jj9fgZuvfc2Gql2dWtnoKQ6n/wfidgHfakWg0x5iIGBImPwbk6mJVQ2og2PXe5vqGlXLlIYrtZ9wpaygPJJuDuGBDM2x2EcLJr3ESBGfC/uZYnaM/dJE1MizJkp7sAwlUdLUsOS68iBcaO8w2QSXEHIBgRz9Nb9ycsYF699BWPS+iHP8WpxxSqd+p4j5pJCn+7r4PXHkYITyxoKOCSSW1kyE53ijxnyvaSkKK0kJyWlBX6Ix8+QYi4VDg4FVOFqPyCBZY82+JcIWYSHZKExDtr4hELPhJHfuwWS4DIiAuYGe2YBlFmwxxBtjJiPlt12R6uz6agPuIAP71lh2CXwV06hFAHPBcPuS/JB2TWFZYyPA7YXil++6IHPTBry71Y5PssufGldjnfvW6mAI73m23AYviYKYp3psZxE6SMYfNIWwAfFDiSUMw6Ebd1+8cttm4pXwVuERM0Pr9Xy57zrahXpcvkDRB/K6p4AaOJx44AlcqiQ1qNIQPaeTcHWidD0TD7OETT4gCFNnSE9eEHhJshLDQpMs6qMbKyySEn7wqDzKT5jefVbuE2qf4lQfogHg70Ry/nZsT3+VAM3ANVF/vDMQKIMtoJaVYXPgPFu6zb8CgLPxwDgKwgcem0ryllh/AW5it8TJZoJeOPkceeUt6vT7+wJ5Nw/KHSqrembXPMcTHlMQT4RZKstuXotg1L0Vc2/PFsa1Q7hxk7qbEjUy2fXHwYslc4Y4u0gZ6aSp1bEl0WzwmnMpQmG56OCHOO0K0zQr+2Aeq7Jp+ZtNNE1L1d5rc4PUm9l/rlkEFBZ0tJT/dmBpQab/MfbWreFS7yra1Smo6nKwjrdoBrFHcpmPoqy7LwhWBzaNJRmALge8g6cmwkbfXp9ivAdHWoByusoIxB0pR3D1h7Our+u5/FMh/K/odtj80zKBgD6x3gJwy8ssEfrgfsl7x+UCv87S0fOGWIMoarRlacpiDf3qYV3ZRChEUq0lqPlSjKklO6dZ1MZSVzoiqHyGYLZqw9mJ7VdK1MRH6X14tYkpB9lfnd75nLsPFoHKPFOzqq8ZDn1eC1NQ7azedyM28CfBBiOOq9tVTNLB1m+20zx8bIzh7Bku8bKdPOzFEox7zsJqvrPEkAtfUC4xVKu9VtqAMOLRU4IpTtDKaEQV3J0IGx6jOlrHzVs9KhafRs0iHKXeLbFXWVJRQZR5gDn5zU9BaDDsAEpdvPZq4jk9qkRnXoO47gBGVyD2Dt8bKI1BMnsSZ6KRl9IszDT7WS7am1agcH6G6kXVro+OHzr32pkrMjaDBimVw+n/WUz6OleKow3n3gP1NHtvqqkmEd6aMSjiTHZcXFpuRMJpaytKY= X-Forefront-Antispam-Report: CIP:216.228.118.232; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc7edge1.nvidia.com; CAT:NONE; SFS:(13230031)(376005)(36860700004)(1800799015)(7416005)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:53:18.5658 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 257c4beb-e129-40cd-0f8a-08dc6e1f5282 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.232]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF0000C37E.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8293 SDHCI vendor tuning registers are configured using config setting framework. Document available config for Tegra SDHCI controllers. Signed-off-by: Krishna Yarlagadda --- .../bindings/mmc/nvidia,tegra20-sdhci.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.yaml b/Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.yaml index 72987f0326a1..002bc1ffc156 100644 --- a/Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.yaml +++ b/Documentation/devicetree/bindings/mmc/nvidia,tegra20-sdhci.yaml @@ -177,6 +177,37 @@ properties: operates at a 1.8 V fixed I/O voltage. $ref: /schemas/types.yaml#/definitions/flag + config: + description: Config settings for SDHCI devices. + Config setting is the configuration based on chip/board/system + characterization on interface/controller settings. This is needed for + - making the controller internal configuration to better perform + - making the interface to work proper by setting drive strength, slew + rates etc + - making the low power leakage. + SDHCI has configuration based on device speed modes. + - common is set on all speeds and can be overridden by speed mode. + - List of speed modes and their config name + "default", /* MMC_TIMING_LEGACY */ + "sd-mmc-highspeed", /* MMC_TIMING_MMC_HS */ + "sd-mmc-highspeed", /* MMC_TIMING_SD_HS */ + "uhs-sdr12", /* MMC_TIMING_UHS_SDR12 */ + "uhs-sdr25", /* MMC_TIMING_UHS_SDR25 */ + "uhs-sdr50", /* MMC_TIMING_UHS_SDR50 */ + "uhs-sdr104", /* MMC_TIMING_UHS_SDR104 */ + "uhs-ddr52", /* MMC_TIMING_UHS_DDR50 */ + "uhs-ddr52", /* MMC_TIMING_MMC_DDR52 */ + "mmc-hs200", /* MMC_TIMING_MMC_HS200 */ + "mmc-hs400", /* MMC_TIMING_MMC_HS400 */ + type: object + unevaluatedProperties: true + properties: + nvidia,num-tuning-iter: + description: Specify DQS trim value for HS400 timing. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 0xffff + required: - compatible - reg @@ -278,6 +309,11 @@ examples: wp-gpios = <&gpio 57 0>; /* gpio PH1 */ power-gpios = <&gpio 155 0>; /* gpio PT3 */ bus-width = <8>; + config { + mmc-hs200 { + nvidia,num-tuning-iter = <0x2>; + }; + }; }; - | From patchwork Mon May 6 22:51:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 796089 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2079.outbound.protection.outlook.com [40.107.223.79]) (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 C09CE15ECFB; Mon, 6 May 2024 22:53:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715036006; cv=fail; b=Wm2oPLLS2mNkyy/UOhIV+jeGWsnK4NQDMVmg6vQWTUMGHCfQkN8WM1Ghmz2eqv7DPKVD1fgiTJCgSAjNVyBWsEVEZqiP0WEm3QZvdlK3vnPNAYI19A6iTBOQldFmtVVeOuB3FnNkM9lXqtAO+ybyZNs0D3VcZGvg/H6MXxALwQY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715036006; c=relaxed/simple; bh=ZeI9XqjCSfK9WXMGKx6v6jplqyejYpRlrad9i/2p/bQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WS+eCBIwcPXd2Ga9jSBLGA0O5lsvuIXNIpVlD73PdMlEe/ATeKLDfpyDE/kFu0XbnAJjiqxkylv05dQEsAFH4CLaUWEgpVv0OEhHIawlpSD67x4gODwhJxclQhfxEaROrvSx2V7M+48S8AmUrCRoTpLi/a/c+YjEqhN02mU8O7Y= 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=aMCW+6vP; arc=fail smtp.client-ip=40.107.223.79 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="aMCW+6vP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E1Cv5ETl5Ttp4A+2ynftxf8djVjnogWNWMJ4B879w72ApgP17O10NYWsPbsCY6zonfyT4JHe6yXmx72Vf6iFcLPLQzA8qGfdc9HqNnpwvqx4qn8m29NwfUlQuvZIYviRAMWau3YvnsYpsezNVsPXCkICO7WVSgbG7fovtY4qhIu4m+pYQtBXRktrF0p/f+0v2kNWPYKCAEI+MICTaUfF8vwOZ7O+W1x1y+vz64OTnQF8HqahSH22QxEsyaIrtlqzbnb6qP9kv8vQrFHRaYCygWRnfsQ1omuXAw418x3AU3ILT9d9Eq0T/HPS8HdUqhx5Ycg1xGIS9pCGjvu3LJgPHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Mb6M2vwJVq9iUqseSEHpaC3Cuy5stf4/lv68f4kNEZM=; b=kaHv9eLv7f0mkx4MjOye091iRQP5jpXB2ZVT4XvPwlhwyH35JpryaHtMLnJzWcoJ/nSro/vptuzSBrwdA6E8ArgiAtCct1u9LmTB1HREnCCbaASZ4RUy5ybuPbGXtkwhtmBlxRj4t1OIQFqR4rn64wtfuLSXCJA8zWI72U7ZV30Xw5599KEwrRN0967Bv4eSLMVi9hJzgFJKJXjOdE/5CSW1yqB55/M8YEb7KFGDb4zbM+qCtOPuQDiiSFOj+YfAk9u1lU+qCr/eEdeOTXPZF2EUwWZyEnUc8sr7Aq7NfBV2damas9C7IzIGIvf15as3eUUW7hlKEtR81uom2Yampg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=vger.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=Mb6M2vwJVq9iUqseSEHpaC3Cuy5stf4/lv68f4kNEZM=; b=aMCW+6vP2gPiDXHzraS8ooRTWJ+1Mq/hCUSfe4TUmBaiNcvH3NBaTFy113KIlj563Ef/peTtZ0pTBY5Kdi7gx4cL0fVFTCPPW+5yE9sG5K3rk+lYVE+HPob+c/3MiE8GUOhQG1y8dCEuozeEVs9BS5RxWSO5PoMdly2cR5VYol7P8SYr8EmACigzRxst7jztlCPCcNRdXJAmASmvNmRoWY7wEKdSZUF+p/Gf5+CGBd7/OfyuyXLXSjV5aHDQM902tDzBruIJGl6cJFl/bgDV8e9jHcMOGdv617gf4MZUAkyn5KcOyXjow7+W0WJs92CAc1lb5F5eJKCJCt0DT15bxw== Received: from SA9P223CA0006.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::11) by CH3PR12MB7593.namprd12.prod.outlook.com (2603:10b6:610:141::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 22:53:20 +0000 Received: from SN1PEPF00036F3C.namprd05.prod.outlook.com (2603:10b6:806:26:cafe::cd) by SA9P223CA0006.outlook.office365.com (2603:10b6:806:26::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.40 via Frontend Transport; Mon, 6 May 2024 22:53:18 +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 SN1PEPF00036F3C.mail.protection.outlook.com (10.167.248.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:53:18 +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.4; Mon, 6 May 2024 15:53:05 -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.4; Mon, 6 May 2024 15:53:05 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:53:00 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , , Prathamesh Shete Subject: [RFC PATCH 10/11] mmc: host: tegra: config settings for timing Date: Tue, 7 May 2024 04:21:38 +0530 Message-ID: <20240506225139.57647-11-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F3C:EE_|CH3PR12MB7593:EE_ X-MS-Office365-Filtering-Correlation-Id: ac4e33bb-829e-4383-5947-08dc6e1f527e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|7416005|1800799015|376005|36860700004|82310400017; X-Microsoft-Antispam-Message-Info: ey+5dbLuP0jav4Z8IGP0PRqGvjPTPCqcrYmY0z9zivHgNkOGjxkva5n6XKLkuhk824Ka+Ip9L8bIy7RgD5l04mVPLCHrtVZik6fnkyl6bA22yiS/gTWC1yL2UP2IPq+fRFBTqNjfL+VzDBf3zjkN1J15E5IhXWfd7DZEhJZ0pqBrpqDE8EKcUkhAN9PHI+yaHadBUPgovYi6zmy3vRGleLqb+R1vuKwbN46dzAqW0lDyvuFTPVVyFCeVyraeWibsa9JkmdC4nQ3DzADDm7Fe3Yx8UOgQz+KlKYmYfxxHuwp1M4onJ0UeU3CKo7zOwDBuj7fjvW+5pE/o9qId96r5zvF2AVzGDJ4eCeQbM/O51OdPX6g8jRJbZR48VWLp/hNr+e3xQ3tuovnlfohCSpZPh5ZbNfO5ibOyIWw0ZfIaNL6obAMn9ND+mr7//pYWFY292rtE3g5dWm4V0tf+f7WWPNBbKChxqSP5yJ8IMsYch68TU9kkpRGz6KxvGzbzS1jPKXwbWWanLcZcdA5zN2lOmRqahRN3QO05YzxXmQs8Xix89Zkxuis1V49NUnONkMwnAPff7RoOW3tJwy5gy7qmxvFu00695OTZuQQ/K3nwANbJq2B31JNc2Xs37suq52vaHiP9+uHyiNnzMllGhzswZs+QwWJzSXM3IgH8U6GzCWrTUh5N7+0ewHgS60Ux5VmqWux8MdpfwsgrCM1ZAanj9UMXaevAwgq++vlFFTSGl4tX5JWpYBwXBaNYODeGZWBafuMGPS6HPH438ZSlcYsTMfzVuprgXqUclej9cMD0asIuZeUGiAME+w8xfCRAxv5twnGQm6vom7agOIMHr2f35BujRoVhBa3QSx+s8A9BucGLSMPHoEbS+srWh37GdbznK3+Zds0eMTC2HkX6bvy+f8levd3Dm5GtrJJjX52Swh98bCV/JZGLdatPuivHLpePdCY4KBMnR1i15zuGfoDrDZOcBlthUdvMtae4Ni6QTQTzsBaOTrRqzaV9/NU5IxGz24Ja6ObkGdGB4yJV+G97INxHT+rQ10Wp2vL7dU6izYbQNHZOB7qrNriy+5LjeCuGQzy+a0Y0hS7gKZyKzXrlzz6GH9xtE+IBZtwDO8kD0wDQ5U5nnX15peIWegkUl262YbXybp8qq01PU/ainOvwQKpuE8aQjIt7d+AqefPW1lAqhuWPTrEYdkMfjir2Iplttt6fAK14ToyZ59sSBk/W2VUZus5DeTVVKsVgM3BIyDzYU/atVveVuKtfQ6Vn2Vhd9y2ErQKVeSUyRr63rrnYIVuF5Y0ZRjXXeZQgWZsm2V9c77OpCAi2dxKT79GjV1uC5pcqmzgX7swfUTdE93tlpLFtMFyobYE3kE5B+/q2xC4= 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:(13230031)(7416005)(1800799015)(376005)(36860700004)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:53:18.5571 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ac4e33bb-829e-4383-5947-08dc6e1f527e 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: SN1PEPF00036F3C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7593 Use config settings framework to initialize Tegra SDHCI timing registers Signed-off-by: Krishna Yarlagadda Signed-off-by: Prathamesh Shete --- drivers/mmc/host/sdhci-tegra.c | 84 ++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 1ad0a6b3a2eb..87fe85991617 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -28,6 +28,7 @@ #include #include +#include #include "sdhci-cqhci.h" #include "sdhci-pltfm.h" @@ -64,6 +65,7 @@ #define SDHCI_TEGRA_DLLCAL_STA_ACTIVE BIT(31) #define SDHCI_VNDR_TUN_CTRL0_0 0x1c0 +#define SDHCI_VNDR_TUN_CTRL0_CMD_CRC_ERR_EN BIT(28) #define SDHCI_VNDR_TUN_CTRL0_TUN_HW_TAP 0x20000 #define SDHCI_VNDR_TUN_CTRL0_START_TAP_VAL_MASK 0x03fc0000 #define SDHCI_VNDR_TUN_CTRL0_START_TAP_VAL_SHIFT 18 @@ -74,6 +76,7 @@ #define TRIES_128 2 #define TRIES_256 4 #define SDHCI_VNDR_TUN_CTRL0_TUN_WORD_SEL_MASK 0x7 +#define SDHCI_VNDR_TUN_CTRL0_DIV_N_MASK GENMASK(5, 3) #define SDHCI_TEGRA_VNDR_TUN_CTRL1_0 0x1c4 #define SDHCI_TEGRA_VNDR_TUN_STATUS0 0x1C8 @@ -134,6 +137,20 @@ SDHCI_TRNS_BLK_CNT_EN | \ SDHCI_TRNS_DMA) +static const char * const cfg_device_states[] = { + "default", /* MMC_TIMING_LEGACY */ + "sd-mmc-highspeed", /* MMC_TIMING_MMC_HS */ + "sd-mmc-highspeed", /* MMC_TIMING_SD_HS */ + "uhs-sdr12", /* MMC_TIMING_UHS_SDR12 */ + "uhs-sdr25", /* MMC_TIMING_UHS_SDR25 */ + "uhs-sdr50", /* MMC_TIMING_UHS_SDR50 */ + "uhs-sdr104", /* MMC_TIMING_UHS_SDR104 */ + "uhs-ddr52", /* MMC_TIMING_UHS_DDR50 */ + "uhs-ddr52", /* MMC_TIMING_MMC_DDR52 */ + "mmc-hs200", /* MMC_TIMING_MMC_HS200 */ + "mmc-hs400", /* MMC_TIMING_MMC_HS400 */ +}; + struct sdhci_tegra_soc_data { const struct sdhci_pltfm_data *pdata; u64 dma_mask; @@ -158,6 +175,18 @@ struct sdhci_tegra_autocal_offsets { u32 pull_down_hs400; }; +static const struct tegra_cfg_field_desc sdhci_cfg_fields[] = { + TEGRA_CFG_FIELD("nvidia,num-tuning-iter", + SDHCI_VNDR_TUN_CTRL0_0, + SDHCI_VNDR_TUN_CTRL0_TUN_ITER_MASK), +}; + +static struct tegra_cfg_desc sdhci_cfg_desc = { + .num_regs = 0, + .num_fields = ARRAY_SIZE(sdhci_cfg_fields), + .fields = sdhci_cfg_fields, +}; + struct sdhci_tegra { const struct sdhci_tegra_soc_data *soc_data; struct gpio_desc *power_gpio; @@ -183,6 +212,7 @@ struct sdhci_tegra { unsigned long curr_clk_rate; u8 tuned_tap_delay; u32 stream_id; + struct tegra_cfg_list *list; }; static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg) @@ -362,6 +392,30 @@ static void tegra_sdhci_set_tap(struct sdhci_host *host, unsigned int tap) } } +static void tegra_sdhci_write_cfg_settings(struct sdhci_host *host, + const char *name) +{ + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_tegra *tegra_host = sdhci_pltfm_priv(pltfm_host); + struct tegra_cfg_reg *regs; + struct tegra_cfg *cfg; + unsigned int i; + u32 val; + + cfg = tegra_cfg_get_by_name(mmc_dev(host->mmc), + tegra_host->list, name); + if (!cfg) + return; + + regs = cfg->regs; + for (i = 0; i < cfg->num_regs; ++i) { + val = sdhci_readl(host, regs[i].offset); + val &= ~regs[i].mask; + val |= regs[i].value; + sdhci_writel(host, val, regs[i].offset); + } +} + static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); @@ -374,6 +428,8 @@ static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask) if (!(mask & SDHCI_RESET_ALL)) return; + tegra_sdhci_write_cfg_settings(host, "common"); + tegra_sdhci_set_tap(host, tegra_host->default_tap); misc_ctrl = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL); @@ -1011,6 +1067,7 @@ static void tegra_sdhci_set_uhs_signaling(struct sdhci_host *host, bool set_default_tap = false; bool set_dqs_trim = false; bool do_hs400_dll_cal = false; + bool set_config = false; u8 iter = TRIES_256; u32 val; @@ -1027,6 +1084,7 @@ static void tegra_sdhci_set_uhs_signaling(struct sdhci_host *host, set_dqs_trim = true; do_hs400_dll_cal = true; iter = TRIES_128; + set_config = true; break; case MMC_TIMING_MMC_DDR52: case MMC_TIMING_UHS_DDR50: @@ -1059,6 +1117,9 @@ static void tegra_sdhci_set_uhs_signaling(struct sdhci_host *host, else tegra_sdhci_set_tap(host, tegra_host->default_tap); + if (set_config) + tegra_sdhci_write_cfg_settings(host, + cfg_device_states[timing]); if (set_dqs_trim) tegra_sdhci_set_dqs_trim(host, tegra_host->dqs_trim); @@ -1129,6 +1190,29 @@ static int sdhci_tegra_start_signal_voltage_switch(struct mmc_host *mmc, static int tegra_sdhci_init_pinctrl_info(struct device *dev, struct sdhci_tegra *tegra_host) { + unsigned int i, j, count; + const struct tegra_cfg_field_desc *fields; + + count = 0; + fields = sdhci_cfg_fields; + + for (i = 0; i < sdhci_cfg_desc.num_fields; i++) { + for (j = 0; j < i; j++) + if (fields[i].offset == fields[j].offset) + break; + + if (i == j) + count++; + } + + sdhci_cfg_desc.num_regs = count; + tegra_host->list = tegra_cfg_get(dev, NULL, &sdhci_cfg_desc); + if (IS_ERR(tegra_host->list)) { + dev_dbg(dev, "Config setting not available, err: %ld\n", + PTR_ERR(tegra_host->list)); + tegra_host->list = NULL; + } + tegra_host->pinctrl_sdmmc = devm_pinctrl_get(dev); if (IS_ERR(tegra_host->pinctrl_sdmmc)) { dev_dbg(dev, "No pinctrl info, err: %ld\n", From patchwork Mon May 6 22:51:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 795065 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2085.outbound.protection.outlook.com [40.107.94.85]) (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 ABDE015F30D; Mon, 6 May 2024 22:53:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.85 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715036013; cv=fail; b=E3SEDRvISe3Tq6TmLyDMQzNQ62qBp+N+85rz1frjhfQkktH0ZsccWyh7She4KgXACjd6ByxKTmMyZxQBq+gB4ErraJ88ZVgoJfx4KQCJ73A3cUkJzJoUetWKzlZhkSGV+oKYyOT0mMaeEdfaXOxzqerxLemxUSC8KECh3Uu20jM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715036013; c=relaxed/simple; bh=FurZBtDayT8KVOQWb5a+JH0WSk8OR04OieKsW5FTv0Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Omhp5/ATSP+nAYNarI91xh6u0zpEa8gqSm5plC/6hvUt/C+SCf29EGhXSUNWmPdHllWF+JdjSLG7jsYhtQPDE8gfiWjC0l3jK7Z3LoqwJNL83/Iuj/voyx3TNpJtdK/wmxCIVjYglkuSf71vPcLOxf7U94/q7tIJRfFAh5gGz00= 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=iPcmLS2w; arc=fail smtp.client-ip=40.107.94.85 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="iPcmLS2w" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gPq41I1IF8+FRX3Al+xQ6Azw2ZJc75Dx3xCzBBPCL0LSjleMwbrpSOgGKZfB/ZygbiiK1FkvFsSRiVINP9p4uO12Wq6H639B6R5n9m5/NfqLCSo9RyaagPziJoNcbmRpHKKof0nofX/pynM0IQXCqjn4P7apONeVcG4znuqLvDHa/E99sj6B++32/8jh+nL0YiadgqQIbTpzs4JwVuEy8OkgE28N3SbIvkSJae9QZp73SNDODnI1zzRNi/QR59VFEgjxtpPg6XO94td7BkysmvT23YzSKYx5APtxhjK2SF+M7puLsfQi9fVbUnft9odnfqMTogzLXj+rqgMY5NJF1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jqoTQh6sZkzbBLNA3XYso3LxgeNyoG5U9zc5JxmSyLI=; b=k+0DrmMKuwDtECF7QTUvDLDfga7sa8zHj7tq/pf8Nz5wTaJlcGdf6ZL0jbXV4ilqxsKtE2/OLTEGx5ro6bxXba3nEdAAN1CoSWBeH8rXXKbQ/2Xbcx5OEFNBxlwVU77dS2OzCbei1BwKV2+FrJwjDXkohKnLQZggWo3ms3GgU89ZFAs9thW73zNnYwC0kr8Cdq5SyRN8m9fCrytQRhtU8FTGXoAkaKkt7z3vRZHDHr0Set549a/gX2gTqnedfgm7z/UPr+rnHJ9/yG84gI8MGd2KMgrSXzmumrdxQHN6BioC4ED6qDTFzntOglLXnWPFsG+I0Pk5CcmrHNNUWGJi7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=vger.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=jqoTQh6sZkzbBLNA3XYso3LxgeNyoG5U9zc5JxmSyLI=; b=iPcmLS2w+Z/j0u421WKtM+WAROWBKjVqW3QCl5czruKuYvKb3n9CC5BIThwdJoUWbe7sSbM9cP+wHGXRGQ9Qkz9EcUsgKbjXKl1a+91pU17UZula5q78Kybrb1QWBf2dbn4P5lfZvNcAy9omavwkVBtOIPPC9/A5au2Sv4cDCMuBVBDZgDHEyPktvKOuMmJxTtnAOa8obId4h79WuYTc9dj2vuDpYTpWlr9076bwecE9rvPb/3sDfj2OKhHZk28Zjk9xN6msMFywtGYYjeWdXJmvl7aiveIFlg6m1fYw541nO6xDIGRnPgGPrYtOw2eX0bMJqzw3eyiAU2srM/F87w== Received: from SA9P223CA0019.NAMP223.PROD.OUTLOOK.COM (2603:10b6:806:26::24) by PH7PR12MB7987.namprd12.prod.outlook.com (2603:10b6:510:27c::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Mon, 6 May 2024 22:53:23 +0000 Received: from SN1PEPF00036F3C.namprd05.prod.outlook.com (2603:10b6:806:26:cafe::43) by SA9P223CA0019.outlook.office365.com (2603:10b6:806:26::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Mon, 6 May 2024 22:53:23 +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 SN1PEPF00036F3C.mail.protection.outlook.com (10.167.248.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.18 via Frontend Transport; Mon, 6 May 2024 22:53:23 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) 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.4; Mon, 6 May 2024 15:53:11 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 6 May 2024 15:53:10 -0700 Received: from BUILDSERVER-IO-L4T.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 6 May 2024 15:53:05 -0700 From: Krishna Yarlagadda To: , , , , , CC: , , , , , , , , , , , , , Subject: [RFC PATCH 11/11] arm64: tegra: SDHCI timing settings Date: Tue, 7 May 2024 04:21:39 +0530 Message-ID: <20240506225139.57647-12-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240506225139.57647-1-kyarlagadda@nvidia.com> References: <20240506225139.57647-1-kyarlagadda@nvidia.com> Precedence: bulk X-Mailing-List: linux-i2c@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F3C:EE_|PH7PR12MB7987:EE_ X-MS-Office365-Filtering-Correlation-Id: 76aa8b6a-121d-4f50-fb05-08dc6e1f5589 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|376005|36860700004|1800799015|7416005; X-Microsoft-Antispam-Message-Info: KiGl4lLu4VdN5Uvz7h02jlXCfwl1Aoo/nrdBoedEgDdEUh1IAX0moAMYBask3n/DzBliXFc3c/IsDDO0bhHoekrHT31HkFQ07IQXq6M+/blPWURl5z5E52d8RWLjui5VAN6vnStEmFk37u7XWiGbSkMFl1FJMk0/Lht/icPJ8cF0r4mpjBSk9EFovQ5XEv0gzLhrd9zLfOJ15Iygul4yjI9IL96ZyzmiCtquQqAHuO/Z6oNQo0z+8KyQXWQ3hPhsrFACw2YXT2PTsDtdq4gCHi1KdDVSo24Dn9fLseiZcGMZKd5JqlYwUEyfWglg6Rf9tLnnhvuC3F4ADISZX4xl4Flp9sE6sHhnoPpJLCO2wzC4rumqt7NVa0ZcQ6DEit1rx/Rh8hmURKiU1iqu0mB/BqCDxbY7FgA1Hd8BbxvrmQgf8ZQqM/osUO/Fy9oRN8MAoOOOMrMULw1vtIrYD2p+ftGu4+gyEO/vXr+j/vze2SlmuRGP/rZkNApBKhGGojM8Ij0id2n+1VKanOSfULClV1AXST8jSdWpS7XfFH1oodHyM1S0BU0TZfDSQXw99jdRpkm8KTOfbBWI5UR0mNDXb0dv7XjRPz0wCvvlrs+hV5t4UAPma1L0vgOermSbWMTWcnVgJ67Aw+O976AcpGGt7aBwrYwhv96266tXIOhIkoWeIlrhKokCWV3770HvtkSBzXAx2RdKoZWGY4m4G1TcSjzMEaz4UfM2hFGtQIv9Jhw6Z4H9ouTaiHsp3nfl/Fd+snOrNk1hkZzZq+tmOYA3FFZhWQavSDpEAhUt6hkiODKD+ZxGzjLv651e+r1nConb7MuG08oZie6Kpqh/PCaQN0RBAlABVuA+qGYE7sK9saosjvkcWU8Hgn/0/n42U4QZ+WIeol3tcO4n+3vY36pegA8CEE57zybBXy1P86cPl4f02Pm3gFQyu+PuDWdaLHvOzGtJSsnG5csehRUV0uM2WN29ol0KL9CvJthenuw1nIzc0ZzbJYnOsFEv8OXvyKTXNp3wiZCrOCkHKaahWfhDIh6vPGg+QUlhDF1ZxYjfZcEyB1hBswJ8f/Mh7kmvCFfObzP10H7qLAZ4XIb7C56veRYtnY4jXDUAo+xVVjuEi42ZlfW2IBDykvTveZyPCF7hynAIGxE+EhNewuKUd2tNz0tGc0g9CekPVqWrwLjQwrOrL6ysNqS1Q5k1DVl7KbOHBLpiI50hobzhOTut9RaSdpyk59EKEkm6md+k5pT3U5K1DEEoWGlMRFDjQBL2o3xR9VvF0KC8X9B7LHIe1KmCT3tu4GWvYimeKmHFEfRsPJEt/bUi3AB23M5sRZ5qRFGoSygTD8mlZ5mu+e3M08MZW4WWgjPiyUavK3oyBo2orpXRb0YIpOdvELolNfxUyXLN 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:(13230031)(82310400017)(376005)(36860700004)(1800799015)(7416005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 May 2024 22:53:23.6665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 76aa8b6a-121d-4f50-fb05-08dc6e1f5589 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: SN1PEPF00036F3C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7987 Set SDHCI timing registers through config settings for Tegra234 chip and P3701 board. Signed-off-by: Krishna Yarlagadda --- arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi index 832538e45797..f9a92853b04a 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234-cfg.dtsi @@ -442,5 +442,37 @@ standard { }; }; + mmc@3400000 { + config { + + mmc-hs200 { + nvidia,num-tuning-iter = <0x2>; + }; + + uhs-sdr104 { + nvidia,num-tuning-iter = <0x2>; + }; + + uhs-sdr50 { + nvidia,num-tuning-iter = <0x4>; + }; + + }; + }; + + mmc@3460000 { + config { + + mmc-hs200 { + nvidia,num-tuning-iter = <0x2>; + }; + + mmc-hs400 { + nvidia,num-tuning-iter = <0x2>; + }; + + }; + }; + }; };