From patchwork Mon Dec 23 00:46:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13918328 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 06B9DE77188 for ; Mon, 23 Dec 2024 00:49:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rsEDvNEYhF3R8DXfZgJKKwqLRbmEeD16rDVIKjmLYLA=; b=MphPCfdvGkCeifThitvWftcw6a k7hq6CHu/7LbZLxeZaE4fyT1Z68wJMPvMNHYjpMPir3sTGeFJCvYtXGnFYGvKcwxB2vnFFbCl4SrH xisdlXd3NPtZMhk9dMZ+ZmkEgPFKyU+9BOrCL6Y6B+mDVj86erxrq9wjkw3mamop9Uwa8nqC1zrK1 DGtdqWx/7pBVrQqTxgq+EIVcg6hrkbsaVpXAbp3jRYD3iaPIZjXObujbcSkbLZU6Sf382UCoGmWXj sEqksJsPJiOoxBJkf6Qx6bCG3hcKCByHyRaWixaJjb6jj4TZk1ad6mOvr74DdBoza0OOSHed9mNYO Hb/DeQLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tPWda-0000000925v-2uqZ; Mon, 23 Dec 2024 00:49:34 +0000 Received: from mail-db8eur05on2061f.outbound.protection.outlook.com ([2a01:111:f403:2614::61f] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tPWb5-000000091og-2Jt1 for linux-arm-kernel@lists.infradead.org; Mon, 23 Dec 2024 00:47:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yDJ2oig1ubDtb4DG/IvZSYSc+fv3jj4Otop6eo+lgxaORd7T6LM3JQxWTi9yxZwG1lIAECChZhYyteaQFBsfpB+rNtylci65wAkkBq+Oknj3+YC4W3D/GotVFleex3o/e1WpY4dtHgZ199rWrLGLdGBX4dEUSivUfJUp4JPlSUw4kJEwLONTO2GTrmNh94O3RStcV1HBoHaM17/rgRY+PKJPd0BZvkdneCOIXGI3TLqtSjK9C7hyXQey6koJHNGevJiUZDxaHyiy0bRHgMInwU9laS0jOzvCLag+qEyrAE+1Do5bqVjyzbrt0yj9Mw4tuFywyPoZLa+F9le22gMXtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rsEDvNEYhF3R8DXfZgJKKwqLRbmEeD16rDVIKjmLYLA=; b=EEp/9DsdPkIZbaxJyvv0mI4dzbIR7aSpdV/Y/AytN3DUS/N7tQy5jp1WCFieVkkpzu4tamZvaUDAOV6eJxiXga1YK04U3PT3dHbJ49eGHOx+3s6RtAfp6Yd72KprQS/57DShRSBlW9Z3YcFk34lh6GTiK7TnA4WF8BC2Mv3iPZAJCzzpCa73zzgGG+JBB02kOEGkwavu2yZdYgbW0FhDqZXglMionCScKvR6sl/mEOgZo+ZDgdKkcbVAP02wgj9X9HgrkNU9SyfpYLCfsY83yt6GPeQEB0C4dWRxgK9YFw4zClLaRvFLRzMNyXmQNwxiuPvMa00+mtsZsfkgnraxiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rsEDvNEYhF3R8DXfZgJKKwqLRbmEeD16rDVIKjmLYLA=; b=veGBszxxBIxQ3tHO0VMSiaxwRV5MnpMahFzCgA4gqOIGr0HHK2WyP/9SmMuUEK3Vlys8P+B7gyJO0s1zd0ybJG6DI6D3+ckQBMVXMDncEBOPk3FiOczzUEqrGHZgivHr1LBsFN3+cI3wtSx6tQJnL6KhcXsmCDF2SGYUyllQR91S52bdEx6LWgWY+HqYK0NBaXvFuTMvsSTOO5Y4EtRYmMZlog1U0WrrDWDXI7bQWW5friqDHeHpJxSGMXtuMO/zrueJ6laxLKu2+F0T1VI8vzQ3Z9yMp6pnQW9GQKogRzphBvv3GVBaFJGED+EKq3aVQNzAt6t2JaqhaVUilhY7Mg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by AS8PR04MB8995.eurprd04.prod.outlook.com (2603:10a6:20b:42e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.20; Mon, 23 Dec 2024 00:46:46 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%5]) with mapi id 15.20.8272.013; Mon, 23 Dec 2024 00:46:46 +0000 From: "Peng Fan (OSS)" Date: Mon, 23 Dec 2024 08:46:13 +0800 Subject: [PATCH v4 1/2] dt-bindings: nvmem: imx-ocotp: Introduce #access-controller-cells Message-Id: <20241223-imx-ocotp-v4-1-f504c1420640@nxp.com> References: <20241223-imx-ocotp-v4-0-f504c1420640@nxp.com> In-Reply-To: <20241223-imx-ocotp-v4-0-f504c1420640@nxp.com> To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan , Frank Li , Conor Dooley X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734914780; l=4068; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=4MXzYq4oLyYtlA95EQap1UQZ2xOM248M5j3t6NvUUFI=; b=K4oE7C3O1As6zXhEb2v5Y2o59RbpiVV/TreKSVlwwee+gtZSeu0u062kLOUx+ky8ie7PaDLF5 wkjZQ63rTnfC1caRpd8kwrNRl6WBSSDWwqmRdo9UlEL3c2TLZScmjRt X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:195::20) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AS8PR04MB8995:EE_ X-MS-Office365-Filtering-Correlation-Id: 5beee755-c242-49f0-6a47-08dd22eb46ef X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|7053199007|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?sBs/94JwSStP3T1uktWQSBtDhnKau6R?= =?utf-8?q?QqJRXP1mK9JW4aG9iWhvQjetoCIvywxOkeeCi8y+uWuCDHEcV3URL5/KSjTonsaUI?= =?utf-8?q?vLftxx4MxTXUi8IRglNvU/oAIlPDRgDSqwovqzFWhjgVOhVBSElucDUp2ePhFdd3M?= =?utf-8?q?5vPJhq7g/pm1EmLzYYaKmNGAP+5F8DPeS2HD9BsrBWf6DA75crBy8gU11kUHMxdPS?= =?utf-8?q?rs3NzAqFhOAjUgaljcEfaeBOAo8PeX2Y0m1kVM6rKuvfviSww/cy7b3bLpC37dhVe?= =?utf-8?q?Xnf0SfsMXKBGs/0dj8nd1jOpF4+zyZEOyQaTj7NpLvsRHOnEijv1mSWRDaQkychfl?= =?utf-8?q?/j26oWRBEWBk/Q877nFpZqe4YslsoxdQHdGrEHTf0isyfzDLQNkFr0ceY8IB3Nlmq?= =?utf-8?q?+caAlpE9L6PE975G5YpwO97uEIzetSLe1Y4wI2SoAuioMxka/Iosi5GeNCUi2Icjy?= =?utf-8?q?V8gwm6iApFrxAtV2MErHyenKHtk2NnTGBeHjfO07vkBimY7nYFgg9u8d6lXu6DXSF?= =?utf-8?q?E4XrSdK3adt/I5zyK63e8ZDh9cSLgPFPrK4NOtKbZeoXjw3z/8Niuc3fF4zaEIK1E?= =?utf-8?q?7yng0A1UK1UpyWOQS0KyAK2sfTq/ehzr1ZI52dbMFMi26t87HFPGR7HqdLPYijR1I?= =?utf-8?q?Lut4oU0RqY+b3e+YtNa1mJvMMn/IS0h8X/f1bo7MrCF++r0QD/x07is4RHqPO0+SQ?= =?utf-8?q?iLdhiR+pBZpjpXV0/X5dlZPSgYTERLHAPV2uKr2A25gPOz0XWXumxxVebBjrq/gsp?= =?utf-8?q?nKbUefRuMBpO4T49rfiXVJRoljPHyvpXWN2EP8VPshdpRxzNdMfMkMEIQmE8f6JLW?= =?utf-8?q?E6r0Hh+b/QeaJgTOXBk1krfcE+VP2PSpT8sMADmnE+lwEtWHpsf3/lOeUih9sjN1U?= =?utf-8?q?PVAVttDZTJgqqoG2UyNdQE8PS2M5OUUqx70JpQBjYorZrgYCAcVOyUyMHUo/N77Vj?= =?utf-8?q?nU8aFnB9o/3PrU1uq1PdxQjBdfRReZ3XrWvfZvSFv/gZxlqAHjjwJF1ATAHO8Oxca?= =?utf-8?q?q7EKP7rxFOEqijgdl/QpfUijVymWLCMSX/Jz9h+KezIZwsIj1C+A6sR2AMr9RCaJU?= =?utf-8?q?A6bE5u18kXbEM1N4XmbMuu1jEMjo7GPpUrYGjeH3bcIW5C+FXWXoJPxXfWBNESRTA?= =?utf-8?q?0Mi6adV2zeo8SATV8k6dH9++NOQdB/LB7CYdA8fJ/2vvP/ahqLAkCIA562gg05sP1?= =?utf-8?q?UKoimtS3YebU8vj/CoNtV6zWMFc8cicJDgtdNhyW+qwnVlx1oDUxPSrOOP9bL9SvV?= =?utf-8?q?tqTxl8+Q0iMT8SI0ulCFYwfZBp69MzxVKRs+v7hMAYFLFUt5erESI5eohywDfm8bH?= =?utf-8?q?wUs8qJSKrqbaWA5zOoJP9tpjBAhp6JOw2Rq+2+OE8KqYEubYh/wXX+cF3asGoNsHH?= =?utf-8?q?L+Hfg9XAXUv?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(7416014)(1800799024)(366016)(7053199007)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?J9Pr5lPtuAuQmHYXQ7xqlAIIjX9O?= =?utf-8?q?suvEZ/eawbZZ6fhFncl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HXjyP1X7Km7X6zYoaf2fb61DHGUq7aZZP3X79srDMQ2NgL?= =?utf-8?q?QE78dzFM5ufPuEbVqflakD+tITtsVm2Q8NeJMkNmAtzyj+4qKH9Mt87uvbhv220+W?= =?utf-8?q?ZPoANqsUU6dCY+VC0+yCePiVcJdrxzIV7eA8hUScY7DPoNJIe9RzX4Dhr4lJANbaE?= =?utf-8?q?YNimJkkEL76zHIcpFb4Rruca//raXc2dB+5obr2/SBn/y3Q4+OtnQLeftR3nTFiZW?= =?utf-8?q?qIhkhtmZX6fDIPBkTJeronxrTBbUtdW0CLQbepx5GhP3ZiXO22Uivq4TfuA/Th/Ri?= =?utf-8?q?6Mqsuy6Zc1UPeKo4oPGdAZmQEbGYxojGuR6bRbYnJpH+HvH6P8S9liovF85NTE5bN?= =?utf-8?q?DYfIc7mKFfGanUMNghQ7ipyzVYEhZ3Q8mRECKo7bI/j/3pqr1Zg7+7CkhTU3b01p3?= =?utf-8?q?dT84UeLasVtF2Wf8jj9QjSITNC7jgzLzR76/8CTv9oEQT3EQ6gqDxyTElcP8IxldM?= =?utf-8?q?tu0n4ETGKhGAFYsqmlMVs4MEk3t3Uw3vjB2Hrcy2ss2pKneP/sX4iyc+00DUapwNL?= =?utf-8?q?Z0xXUV3iWAVLQT+0l0fkmgkNd6wAW/Fcb0btAGBVuTtPMTkI0QLoJ6qvwm+kcSgiQ?= =?utf-8?q?ytt4JJFLSmXc?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5beee755-c242-49f0-6a47-08dd22eb46ef X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2024 00:46:46.0455 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SEdL0SqunRd1moDXJ0WR8sUGMOg+xn3W4xh9AHPXf+VZAfAtH3pTbAQ3KEqSO/vfYHDyzKnTI+GjjuVPtgJI2g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8995 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241222_164659_644094_49C10799 X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan Introduce "#access-controller-cells" to make OCOTP be an accessing controller, because i.MX Family OCOTP supports a specific peripheral or function being fused which means being disabled. Add the i.MX[95,93] OCOTP gate index. Reviewed-by: Frank Li Acked-by: Conor Dooley Signed-off-by: Peng Fan --- .../devicetree/bindings/nvmem/imx-ocotp.yaml | 5 +++ include/dt-bindings/nvmem/fsl,imx93-ocotp.h | 24 ++++++++++++ include/dt-bindings/nvmem/fsl,imx95-ocotp.h | 43 ++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml b/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml index b2cb76cf9053a883a158acaf5eaa108895818afc..c78e202ced22f1c278f7be827b71ba434832d2a7 100644 --- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml +++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.yaml @@ -54,6 +54,11 @@ properties: clocks: maxItems: 1 + "#access-controller-cells": + const: 1 + description: + Contains the gate ID associated to the peripheral. + required: - "#address-cells" - "#size-cells" diff --git a/include/dt-bindings/nvmem/fsl,imx93-ocotp.h b/include/dt-bindings/nvmem/fsl,imx93-ocotp.h new file mode 100644 index 0000000000000000000000000000000000000000..6ef525173845fd4ee0e847cf5a17e53a14f71362 --- /dev/null +++ b/include/dt-bindings/nvmem/fsl,imx93-ocotp.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ + +#ifndef _DT_BINDINGS_NVMEM_IMX93_OTPC_H +#define _DT_BINDINGS_NVMEM_IMX93_OTPC_H + +#define IMX93_OCOTP_NPU_GATE 0 +#define IMX93_OCOTP_A550_GATE 1 +#define IMX93_OCOTP_A551_GATE 2 +#define IMX93_OCOTP_M33_GATE 3 +#define IMX93_OCOTP_CAN1_FD_GATE 4 +#define IMX93_OCOTP_CAN2_FD_GATE 5 +#define IMX93_OCOTP_CAN1_GATE 6 +#define IMX93_OCOTP_CAN2_GATE 7 +#define IMX93_OCOTP_USB1_GATE 8 +#define IMX93_OCOTP_USB2_GATE 9 +#define IMX93_OCOTP_ENET1_GATE 10 +#define IMX93_OCOTP_ENET2_GATE 11 +#define IMX93_OCOTP_PXP_GATE 12 +#define IMX93_OCOTP_MIPI_CSI1_GATE 13 +#define IMX93_OCOTP_MIPI_DSI1_GATE 14 +#define IMX93_OCOTP_LVDS1_GATE 15 +#define IMX93_OCOTP_ADC1_GATE 16 + +#endif diff --git a/include/dt-bindings/nvmem/fsl,imx95-ocotp.h b/include/dt-bindings/nvmem/fsl,imx95-ocotp.h new file mode 100644 index 0000000000000000000000000000000000000000..2d21d1f690974d0215c71352168378a150f489af --- /dev/null +++ b/include/dt-bindings/nvmem/fsl,imx95-ocotp.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ + +#ifndef _DT_BINDINGS_NVMEM_IMX95_OTPC_H +#define _DT_BINDINGS_NVMEM_IMX95_OTPC_H + +#define IMX95_OCOTP_CANFD1_GATE 0 +#define IMX95_OCOTP_CANFD2_GATE 1 +#define IMX95_OCOTP_CANFD3_GATE 2 +#define IMX95_OCOTP_CANFD4_GATE 3 +#define IMX95_OCOTP_CANFD5_GATE 4 +#define IMX95_OCOTP_CAN1_GATE 5 +#define IMX95_OCOTP_CAN2_GATE 6 +#define IMX95_OCOTP_CAN3_GATE 7 +#define IMX95_OCOTP_CAN4_GATE 8 +#define IMX95_OCOTP_CAN5_GATE 9 +#define IMX95_OCOTP_NPU_GATE 10 +#define IMX95_OCOTP_A550_GATE 11 +#define IMX95_OCOTP_A551_GATE 12 +#define IMX95_OCOTP_A552_GATE 13 +#define IMX95_OCOTP_A553_GATE 14 +#define IMX95_OCOTP_A554_GATE 15 +#define IMX95_OCOTP_A555_GATE 16 +#define IMX95_OCOTP_M7_GATE 17 +#define IMX95_OCOTP_DCSS_GATE 18 +#define IMX95_OCOTP_LVDS1_GATE 19 +#define IMX95_OCOTP_ISP_GATE 20 +#define IMX95_OCOTP_USB1_GATE 21 +#define IMX95_OCOTP_USB2_GATE 22 +#define IMX95_OCOTP_NETC_GATE 23 +#define IMX95_OCOTP_PCIE1_GATE 24 +#define IMX95_OCOTP_PCIE2_GATE 25 +#define IMX95_OCOTP_ADC1_GATE 26 +#define IMX95_OCOTP_EARC_RX_GATE 27 +#define IMX95_OCOTP_GPU3D_GATE 28 +#define IMX95_OCOTP_VPU_GATE 29 +#define IMX95_OCOTP_JPEG_ENC_GATE 30 +#define IMX95_OCOTP_JPEG_DEC_GATE 31 +#define IMX95_OCOTP_MIPI_CSI1_GATE 32 +#define IMX95_OCOTP_MIPI_CSI2_GATE 33 +#define IMX95_OCOTP_MIPI_DSI1_GATE 34 +#define IMX95_OCOTP_V2X_GATE 35 + +#endif From patchwork Mon Dec 23 00:46:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13918329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 11F25E77188 for ; Mon, 23 Dec 2024 00:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8xVgXFE9hKcU+iNGR3SqhVUINRKr3uSZbjYMBjDK8EY=; b=QeMl/HLyEixqZdumKOe+0Do9Ib S/eHgWIbktC8JgbOMC4WUUTi3VqPa6MMv7xPwVWsUQogMIO41fl3/H5pWzf1C2s4Wbh8EGF6mlVtq iDdn+7+KmSCiQjQzAWDawYZpGdStYsNSY4GrFQlAShYvArsdEY2n4eMulE1ORwAejDol/FoLCDEuH iFle62jPK5zRmkw7LyES4Dqpb2QdyT+dsPeTXuEKB1+AHfpV380Wjf6ou2Jpv3WufKWQu8V91ilpa r9BM/rYsAW/ZPzz+/1ulz4JsEHvWg2xvEyO6xJWqqzlQDbr/JCGxaHLL+nx7TmC82rqGnvaJPwZkj zAo8Ryfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tPWeq-000000092Ch-2dgi; Mon, 23 Dec 2024 00:50:52 +0000 Received: from mail-db8eur05on2061f.outbound.protection.outlook.com ([2a01:111:f403:2614::61f] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tPWb7-000000091og-01Tu for linux-arm-kernel@lists.infradead.org; Mon, 23 Dec 2024 00:47:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uMtDbJxh0Ul+7u7M12WHhZ2WcZLV+ZHnY27qAWF+TUfwWcnD2GE8rT1aUbOuab8y9ihIZqCH2lGv+m2oWKF86uSFpsK4GkpAHV7S3jO9CHGDddI2/CVFV1XxdNxU29bcUPigAHgYY1d88dJiinQUjPJ7B0+wzsq8f+kr2FJGPlMT0BdMcqpIOOkypl//q4eCK67TSit7ksBumI3gJug+B0rihrs4tm6e4yK8s9JU9QFiP6Bh0KkaGSHrq5YnoPG/L5h/61rCfiDlE2Sj9wohAqIRu07DMICZs0KR6yKdWSvNR1DLjkbg1n2NOnwtHobVISNuxfvcpCr+Kke5W1C2Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8xVgXFE9hKcU+iNGR3SqhVUINRKr3uSZbjYMBjDK8EY=; b=KsrVjLqnN5RrWX7QwVFBGSm/NDFBnqB/2tSL4LP8ea5xw/8X1h7IaqJ851D4QFnw4ZDgFIzJQ8G0PCEMLDqY5TOn6Dm1cgxG4s7v9iFUeiN49NctLf+aamnjH4X2Rks0cjbygnSdtq1Q6/1YUDc0PqYyS3Nac1wXuUUrl76R166LWmmo0jFgf8XIfTS5Kir0xkLeY1gS5SI8hprAn7phROhmZrrRmejG7kgCT0bnTFbeiSMaO98v375CKzWc650PWNB1vSplRYqluUFpeX8Erwazqvm71e47vsiAK91yhEl4XWmTTG0BuJYupMc8pmvS/pX13OOcrm+xYNqjHeTLFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8xVgXFE9hKcU+iNGR3SqhVUINRKr3uSZbjYMBjDK8EY=; b=ekn9GRg7KaQWV2kh9FEj+8sDecE0DhwMdtO6F9etjK65RnIHbN1362IXJgu0SJ66GbDv4THX4yAzAHmDvIJ03Kn1rNuJ0G7uyMiaQBoJRwRVCnfRV3UWhV8k8WSsnq7m2C2qRb828kjMR5hux4a28S2HpNwhx2SiIN0I3LUC1HrcRv2wj0ca4H9JPswqTYRm5GCzaxyKLICzMdqALonAf3/vB0ou0zymDzP3u9rn0s8/4V/iGnNCdwybhRcsGhBr/uouOQb7TTGvyDZx/Dm7K/Ofokc1yN/h1zKtKNjp/EjJ2ns7ZxIknqywuavUO/c/EkISBFgVjGTXnSp2p5L+UA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) by AS8PR04MB8995.eurprd04.prod.outlook.com (2603:10a6:20b:42e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.20; Mon, 23 Dec 2024 00:46:49 +0000 Received: from PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630]) by PAXPR04MB8459.eurprd04.prod.outlook.com ([fe80::165a:30a2:5835:9630%5]) with mapi id 15.20.8272.013; Mon, 23 Dec 2024 00:46:49 +0000 From: "Peng Fan (OSS)" Date: Mon, 23 Dec 2024 08:46:14 +0800 Subject: [PATCH v4 2/2] nvmem: imx-ocotp-ele: Support accessing controller for i.MX9 Message-Id: <20241223-imx-ocotp-v4-2-f504c1420640@nxp.com> References: <20241223-imx-ocotp-v4-0-f504c1420640@nxp.com> In-Reply-To: <20241223-imx-ocotp-v4-0-f504c1420640@nxp.com> To: Srinivas Kandagatla , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734914780; l=9121; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=ZbEz389bjgOA+PRwzrpvSDmNxc+V7u6O/SazhmHSomY=; b=DIWvOqcmT1B1oEY9szC/adot0AFABTpoq6axzNos1Gfky9UjXT/VSJecf1v/epmFOOhom7MAU k/gHMDZpqjlCOOViyCNCN8RON9cGxvQJMfAnLoh6ireQSEl599zE4wB X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI2PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:195::20) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|AS8PR04MB8995:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d4df582-f941-4e3e-d00d-08dd22eb492e X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|7416014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?AdtLt200LbKH0e5Ia6YlNOHaBZNQgVj?= =?utf-8?q?Ux8TA1ryXFp38ihwYrWmJUuUkq6zm0EEDWyUn1P3sPbAQV0BKPTHC3EEKIJiNc3fe?= =?utf-8?q?VTTD0WqJNyCfxrt/gFVeB4K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X86lhtUht8zkIffKnIrFXNSyn2zZ2mmPIK8UAEeVT3b5xj6?= =?utf-8?q?T0LWBudSfY/uW4LHkIY5K2tZbTuH/TI+gR/a1htwymqVGThlN/qpwbuJcQiA13iyh?= =?utf-8?q?UJwKSKRONe/A2jprA4TiAKz3sarYxT1bo2Rr/eQnbRPjsK5oK8PWPWxdSvpKzywOK?= =?utf-8?q?LNG5QaTgLKI/T9WupXdUeO6b2icbqtAk5J1Jw/cLm6gep4QqhJn5svZfmySz71N0g?= =?utf-8?q?k0e64voWUwaVItIgHT5EUaemlmLmGEGT3ua/roDyMMWdG6CobThKwyo7C6Xxc2m7u?= =?utf-8?q?93A1ANgfo/iYXQWm9UB7rUEuZI3vUOVYPfBExYlp9yjDD3zGxDW8lNu0Q3/U1RDkt?= =?utf-8?q?k9oIG6fOf74nZM1MSN40DfKCLZbm3cIP5UckPTA+vKkNR0Viere1hu8QaK4i6LgX8?= =?utf-8?q?9iqefti80KO?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB8459.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(7416014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?jqQ5KzOR8PMr3Vvcvhk3i9jusRBw?= =?utf-8?q?Mk+JyxMaJMs9NxzRtKp+LpznRBQLXZsKu2dph27nyCIleOaJU3DUfsyWh9rjKQ5lx?= =?utf-8?q?lWHf7ol0w8wUl6oSOkachEs25PMMP0blJGr/P8ho16BCLmVHOpQoK5Ur3yROJ4kj3?= =?utf-8?q?574t2GDIXazGLqo56+/WH4OybswKwA4K0plop4Q/igi34RjiuqxEeZ8qEA6fBt+AD?= =?utf-8?q?SOLDOL0rka1TRmDd4Kvyppyen0pJ2dy2mQZSqGRQxvs21uev7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djWCK7ciLhsC?= =?utf-8?q?zNKdyslpye7Il8gKXDODvB82B/YHpytKEg3JtyvCKRzoNAIzR2zxHb1jcWZME5POI?= =?utf-8?q?xjcGYYcHPhcYpnWpZcxmHZv/9Qvbcj4VSbG2vJfIps/v5JXJeJvc9JQqPHMeY5wcO?= =?utf-8?q?B0jv/jm0JBpL1Eg2s+HBcc3wo6jn0IcIZF1kj0eB0t25Uthx3kPrXM4gq19NfqjZ2?= =?utf-8?q?bnyuIjdGXxXVZgIQES7OW4oupXUeU3E2THOrN3k/ac/OjBZLrNAfrZELSBy+X60rt?= =?utf-8?q?DmOrgfETUgqqmvSmr65Gbkp9CtCqElQs2feTDvTLEvTkc6JZ2/+1uKw3SmrHSB54g?= =?utf-8?q?NHEdvQ2LLboeYRlpgL1VO3ATLuAWMPbXCgMLtPhKrJJnyWOwaFpADBPBBKihGRAFd?= =?utf-8?q?Af5GKEYZNhXh?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d4df582-f941-4e3e-d00d-08dd22eb492e X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Dec 2024 00:46:49.7914 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WwqG/a1cHh1ZgmAQbEL9D/g49DN+t+2hjumsEeeqj1hV55ukMYh3L8t8jnHmekyaVBbH/YB7w+BwDIU0DXMhtg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8995 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241222_164701_084292_E6A00226 X-CRM114-Status: GOOD ( 19.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peng Fan i.MX9 OCOTP supports a specific peripheral or function being fused which means disabled, so - Introduce ocotp_access_gates to be container of efuse gate info - Iterate all nodes to check accessing permission. If not allowed to be accessed, detach the node Signed-off-by: Peng Fan --- drivers/nvmem/imx-ocotp-ele.c | 184 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 183 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c index ca6dd71d8a2e29888c6e556aaea116c1a967cb5f..5a07d8b780ecfc13874cff338d6926d0e2a87c8a 100644 --- a/drivers/nvmem/imx-ocotp-ele.c +++ b/drivers/nvmem/imx-ocotp-ele.c @@ -5,6 +5,8 @@ * Copyright 2023 NXP */ +#include +#include #include #include #include @@ -27,6 +29,7 @@ struct ocotp_map_entry { }; struct ocotp_devtype_data { + const struct ocotp_access_gates *access_gates; u32 reg_off; char *name; u32 size; @@ -36,11 +39,26 @@ struct ocotp_devtype_data { struct ocotp_map_entry entry[]; }; +#define OCOTP_MAX_NUM_GATE_WORDS 4 +#define IMX93_OCOTP_NUM_GATES 17 +#define IMX95_OCOTP_NUM_GATES 36 + +struct ocotp_access_gates { + u32 num_words; + u32 words[OCOTP_MAX_NUM_GATE_WORDS]; + u32 num_gates; + struct access_gate { + u32 word; + u32 mask; + } gates[]; +}; + struct imx_ocotp_priv { struct device *dev; void __iomem *base; struct nvmem_config config; struct mutex lock; + u32 value[OCOTP_MAX_NUM_GATE_WORDS]; const struct ocotp_devtype_data *data; }; @@ -131,6 +149,97 @@ static void imx_ocotp_fixup_dt_cell_info(struct nvmem_device *nvmem, cell->read_post_process = imx_ocotp_cell_pp; } +static int imx_ele_ocotp_check_access(struct platform_device *pdev, u32 id) +{ + struct imx_ocotp_priv *priv = platform_get_drvdata(pdev); + const struct ocotp_access_gates *access_gates = priv->data->access_gates; + u32 word, mask; + + if (id >= access_gates->num_gates) { + dev_err(&pdev->dev, "Index %d too large\n", id); + return -EACCES; + } + + word = access_gates->gates[id].word; + mask = access_gates->gates[id].mask; + + dev_dbg(&pdev->dev, "id:%d word:%d mask:0x%08x\n", id, word, mask); + /* true means not allow access */ + if (priv->value[word] & mask) + return -EACCES; + + return 0; +} + +static int imx_ele_ocotp_grant_access(struct platform_device *pdev, struct device_node *parent) +{ + struct device *dev = &pdev->dev; + + for_each_available_child_of_node_scoped(parent, child) { + struct of_phandle_iterator it; + int err; + u32 id; + + of_for_each_phandle(&it, err, child, "access-controllers", + "#access-controller-cells", 0) { + struct of_phandle_args provider_args; + struct device_node *provider = it.node; + + if (err) { + dev_err(dev, "Unable to get access-controllers property for node %s\n, err: %d", + child->full_name, err); + of_node_put(provider); + return err; + } + + /* Only support one cell */ + if (of_phandle_iterator_args(&it, provider_args.args, 1) != 1) { + dev_err(dev, "wrong args count\n"); + of_node_put(provider); + return -EINVAL; + } + + id = provider_args.args[0]; + + dev_dbg(dev, "Checking node: %s gate: %d\n", child->full_name, id); + + if (imx_ele_ocotp_check_access(pdev, id)) { + of_detach_node(child); + dev_err(dev, "%s: Not granted, device driver will not be probed\n", + child->full_name); + } + } + + imx_ele_ocotp_grant_access(pdev, child); + } + + return 0; +} + +static int imx_ele_ocotp_access_control(struct platform_device *pdev) +{ + struct imx_ocotp_priv *priv = platform_get_drvdata(pdev); + struct device_node *root __free(device_node) = of_find_node_by_path("/"); + const struct ocotp_access_gates *access_gates = priv->data->access_gates; + void __iomem *reg = priv->base + priv->data->reg_off; + u32 off; + int i; + + if (!priv->data->access_gates) + return 0; + + /* This should never happen */ + WARN_ON(!root); + + for (i = 0; i < access_gates->num_words; i++) { + off = access_gates->words[i] << 2; + priv->value[i] = readl(reg + off); + dev_dbg(&pdev->dev, "word:%d 0x%08x\n", access_gates->words[i], priv->value[i]); + } + + return imx_ele_ocotp_grant_access(pdev, root); +} + static int imx_ele_ocotp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -161,14 +270,43 @@ static int imx_ele_ocotp_probe(struct platform_device *pdev) priv->config.fixup_dt_cell_info = imx_ocotp_fixup_dt_cell_info; mutex_init(&priv->lock); + platform_set_drvdata(pdev, priv); + nvmem = devm_nvmem_register(dev, &priv->config); if (IS_ERR(nvmem)) return PTR_ERR(nvmem); - return 0; + + return imx_ele_ocotp_access_control(pdev); } +static const struct ocotp_access_gates imx93_access_gates = { + .num_words = 3, + .words = {19, 20, 21}, + .num_gates = IMX93_OCOTP_NUM_GATES, + .gates = { + [IMX93_OCOTP_NPU_GATE] = { .word = 19, .mask = BIT(13) }, + [IMX93_OCOTP_A550_GATE] = { .word = 19, .mask = BIT(14) }, + [IMX93_OCOTP_A551_GATE] = { .word = 19, .mask = BIT(15) }, + [IMX93_OCOTP_M33_GATE] = { .word = 19, .mask = BIT(24) }, + [IMX93_OCOTP_CAN1_FD_GATE] = { .word = 19, .mask = BIT(28) }, + [IMX93_OCOTP_CAN2_FD_GATE] = { .word = 19, .mask = BIT(29) }, + [IMX93_OCOTP_CAN1_GATE] = { .word = 19, .mask = BIT(30) }, + [IMX93_OCOTP_CAN2_GATE] = { .word = 19, .mask = BIT(31) }, + [IMX93_OCOTP_USB1_GATE] = { .word = 20, .mask = BIT(3) }, + [IMX93_OCOTP_USB2_GATE] = { .word = 20, .mask = BIT(4) }, + [IMX93_OCOTP_ENET1_GATE] = { .word = 20, .mask = BIT(5) }, + [IMX93_OCOTP_ENET2_GATE] = { .word = 20, .mask = BIT(6) }, + [IMX93_OCOTP_PXP_GATE] = { .word = 20, .mask = BIT(10) }, + [IMX93_OCOTP_MIPI_CSI1_GATE] = { .word = 20, .mask = BIT(17) }, + [IMX93_OCOTP_MIPI_DSI1_GATE] = { .word = 20, .mask = BIT(19) }, + [IMX93_OCOTP_LVDS1_GATE] = { .word = 20, .mask = BIT(24) }, + [IMX93_OCOTP_ADC1_GATE] = { .word = 21, .mask = BIT(7) }, + }, +}; + static const struct ocotp_devtype_data imx93_ocotp_data = { + .access_gates = &imx93_access_gates, .reg_off = 0x8000, .reg_read = imx_ocotp_reg_read, .size = 2048, @@ -183,7 +321,51 @@ static const struct ocotp_devtype_data imx93_ocotp_data = { }, }; +static const struct ocotp_access_gates imx95_access_gates = { + .num_words = 3, + .words = {17, 18, 19}, + .num_gates = IMX95_OCOTP_NUM_GATES, + .gates = { + [IMX95_OCOTP_CANFD1_GATE] = { .word = 17, .mask = BIT(20) }, + [IMX95_OCOTP_CANFD2_GATE] = { .word = 17, .mask = BIT(21) }, + [IMX95_OCOTP_CANFD3_GATE] = { .word = 17, .mask = BIT(22) }, + [IMX95_OCOTP_CANFD4_GATE] = { .word = 17, .mask = BIT(23) }, + [IMX95_OCOTP_CANFD5_GATE] = { .word = 17, .mask = BIT(24) }, + [IMX95_OCOTP_CAN1_GATE] = { .word = 17, .mask = BIT(25) }, + [IMX95_OCOTP_CAN2_GATE] = { .word = 17, .mask = BIT(26) }, + [IMX95_OCOTP_CAN3_GATE] = { .word = 17, .mask = BIT(27) }, + [IMX95_OCOTP_CAN4_GATE] = { .word = 17, .mask = BIT(28) }, + [IMX95_OCOTP_CAN5_GATE] = { .word = 17, .mask = BIT(29) }, + [IMX95_OCOTP_NPU_GATE] = { .word = 18, .mask = BIT(0) }, + [IMX95_OCOTP_A550_GATE] = { .word = 18, .mask = BIT(1) }, + [IMX95_OCOTP_A551_GATE] = { .word = 18, .mask = BIT(2) }, + [IMX95_OCOTP_A552_GATE] = { .word = 18, .mask = BIT(3) }, + [IMX95_OCOTP_A553_GATE] = { .word = 18, .mask = BIT(4) }, + [IMX95_OCOTP_A554_GATE] = { .word = 18, .mask = BIT(5) }, + [IMX95_OCOTP_A555_GATE] = { .word = 18, .mask = BIT(6) }, + [IMX95_OCOTP_M7_GATE] = { .word = 18, .mask = BIT(9) }, + [IMX95_OCOTP_DCSS_GATE] = { .word = 18, .mask = BIT(22) }, + [IMX95_OCOTP_LVDS1_GATE] = { .word = 18, .mask = BIT(27) }, + [IMX95_OCOTP_ISP_GATE] = { .word = 18, .mask = BIT(29) }, + [IMX95_OCOTP_USB1_GATE] = { .word = 19, .mask = BIT(2) }, + [IMX95_OCOTP_USB2_GATE] = { .word = 19, .mask = BIT(3) }, + [IMX95_OCOTP_NETC_GATE] = { .word = 19, .mask = BIT(4) }, + [IMX95_OCOTP_PCIE1_GATE] = { .word = 19, .mask = BIT(6) }, + [IMX95_OCOTP_PCIE2_GATE] = { .word = 19, .mask = BIT(7) }, + [IMX95_OCOTP_ADC1_GATE] = { .word = 19, .mask = BIT(8) }, + [IMX95_OCOTP_EARC_RX_GATE] = { .word = 19, .mask = BIT(11) }, + [IMX95_OCOTP_GPU3D_GATE] = { .word = 19, .mask = BIT(16) }, + [IMX95_OCOTP_VPU_GATE] = { .word = 19, .mask = BIT(17) }, + [IMX95_OCOTP_JPEG_ENC_GATE] = { .word = 19, .mask = BIT(18) }, + [IMX95_OCOTP_JPEG_DEC_GATE] = { .word = 19, .mask = BIT(19) }, + [IMX95_OCOTP_MIPI_CSI1_GATE] = { .word = 19, .mask = BIT(21) }, + [IMX95_OCOTP_MIPI_CSI2_GATE] = { .word = 19, .mask = BIT(22) }, + [IMX95_OCOTP_MIPI_DSI1_GATE] = { .word = 19, .mask = BIT(23) }, + } +}; + static const struct ocotp_devtype_data imx95_ocotp_data = { + .access_gates = &imx95_access_gates, .reg_off = 0x8000, .reg_read = imx_ocotp_reg_read, .size = 2048,