From patchwork Tue Dec 17 08:43:36 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: 13911402 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 79D13E7716A for ; Tue, 17 Dec 2024 08:49:55 +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=cfl+6fu6j/buxkWTqIhOBZn8JuDX5zw9xNawUWw+yqM=; b=lhew6MeZgkQ1b+ZmzPFtUdeJuf L/uk46efPW5dlQGvSyW/Y8LGlm22afe1psoWd9Sl2dCKFMZ0tKQqZYU0y+ZLzSHD4E7KiOR2DvVfy htrfohvTrq3g1zSQZDIltZqNF4WYBmYW/1mYsT78JAvon3EFLHKc0NjSoKKBYran3WIsjilERdzkQ 9NAJqXE+lxPT2D2xJ0wrF4PXblszbSQJBsxN3Y8scqiwxw2BEDdFVB0qMy5FvVMEfbLzqiJrOm1GA wKamGLmg2FhFUI1MVbkeHFlwaZns3HOp3J/Re9fqGZZq6byAcOoK9DiA12iZQT/hEFBthimUXfCku w9VecOaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNTGy-0000000ClmZ-1rGW; Tue, 17 Dec 2024 08:49:44 +0000 Received: from mail-vi1eur05on20604.outbound.protection.outlook.com ([2a01:111:f403:2613::604] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNTBh-0000000CkL4-2KOo for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 08:44:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=exb119cH5et7+y329upNaLuCtdkiRmx2ggrfKVhadZLTiTEJgiUiDJenAHrFsK7NXgz2QTJG9hljJwgftCgXEItpCtYHLDxOiBkKRDbueIPuhktltVxcrFX0n1rwOKEtIQYxrxjp7rd9vbLBvtrcyj/PTfZLNzsrm8DHQlAtuTW4hV1R1eYoFMX50Uur9rsCZlyY0pEc8B18S+WRUqIu+bQ+qeATEin33saZbixiar8bmoW8m+oKtinhKFmP/yW89Gia62dnLoQYN+HzceJSznPtZS5EiDdZ7AEbkx4gwjjp+tp5zZ7qvaj2iBCJ2X5jNLQBlJpEb1mjTZmOEFYm0g== 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=cfl+6fu6j/buxkWTqIhOBZn8JuDX5zw9xNawUWw+yqM=; b=gznVf0Vbk5Sv37Nl7BDMHpqIyusmHxeZI7y+qU1+H508Xr/feXHVuLFfvTG4e6AYLCanIIXBWPimUG3v5c47X0fer7kqIX+HAweCojo9qW3bK72VJj7aZAE53d+IzXHNgJfNhWVQZcs/M8JmR25YZHoEqYOaQQeiyvpXNT2lF+j3Anb2qRl6B7MVjHmK6r9DqaBjEnFb6TLMmWhfF6ec+PkNrXRpIYTLDPTu6ThzRiBIdV78FrSKtJsr5bj6nZ1c07DdyB9nrXu5PM6EDbLjVpHlte6KDAO2sh0OEMaCJuSiY+Nu4AGAdhmqRsSXPJq5vY3NUel5jNnajZf8fMVFug== 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=cfl+6fu6j/buxkWTqIhOBZn8JuDX5zw9xNawUWw+yqM=; b=DDGCDnvA8AkJzVgjRaCffd6u0ifL+2xS22QxFM8JyzxEm9YR0E4ow4sztX1+rTpPbdsKqPDZvsdi8jglHSpQAb97Jji+3C0W8ewV68vKQ0LmGBLFEah+UqLXcu3l2cpM/88JcbyRzzUqKbMuZDZ3QLZZezXAhN/+30VT3n8F6SP85CPY+Rgxaf9fMRTqD5qMF3ubDQdKjAnZznOIkM+4dKxOZOfkLvM1wvu92Ydcfl70s9iS4tB0nkPOQEUn5xuN81o1hvMEib8aJPkZwG+ArOq9Up3LbUYS5izHPWq5wSBa2R5Ajl5rD7k3v/kYpdZEFcKZC56gkH8pywK5I0cmjw== 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 DU4PR04MB11054.eurprd04.prod.outlook.com (2603:10a6:10:581::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.22; Tue, 17 Dec 2024 08:44:13 +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.005; Tue, 17 Dec 2024 08:44:13 +0000 From: "Peng Fan (OSS)" Date: Tue, 17 Dec 2024 16:43:36 +0800 Subject: [PATCH v2 1/2] dt-bindings: nvmem: imx-ocotp: Introduce #access-controller-cells Message-Id: <20241217-imx-ocotp-v2-1-3faa6cbff41b@nxp.com> References: <20241217-imx-ocotp-v2-0-3faa6cbff41b@nxp.com> In-Reply-To: <20241217-imx-ocotp-v2-0-3faa6cbff41b@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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1734425027; l=4015; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=dKaDD9hIu9R5UEg3RwIF9YElE6ysMwqpQ3PJh/tH63Q=; b=YMyi70X1QlTs+/deaZqCVrBs5Huzsv+LN5kdxrjWDGTpeYIk0lsyVGG1BW9LZUnDI8vYRsvns Pu6nRhA1BUgCKIkMPYaWdd0AYlJeH+hopni00Bo9K27RalQQDxcQl0Y X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0101.apcprd02.prod.outlook.com (2603:1096:4:92::17) 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_|DU4PR04MB11054:EE_ X-MS-Office365-Filtering-Correlation-Id: ab5a6757-2ce3-4cb9-d25e-08dd1e76fb64 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|7416014|376014|1800799024|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?tgJqXBp6kc7sz/lhcemLSIbERuVRd8r?= =?utf-8?q?Z7kQ0OFr68Le34DgAPVSoz2IteYTgy5vsclD4fqth2DVkBad3PJi4k3gLHRAcX29e?= =?utf-8?q?HDBN1fxUcyVXCLQTukmJf4IRID6djYSNyK7Lwj6oN0lUtT4PRcy7bKk+hQhhch5nr?= =?utf-8?q?faq9ED6tCXDblpHqjufRFLiZaVsVWPMoaPpB0Ay6+FxiKS1Dhr2PVZuMtReAhestV?= =?utf-8?q?oQaNF/zSZCTZQ5kdUhcxLsc0yPAr2ogNbeOBTBAE6v3rKqDCKLaNT1+WGbMFxJIQo?= =?utf-8?q?bRrzgC9POjAKwfi+KvXv1N0VN/OIP/By8GdPFlDK0jWpH80sRfMxBeoKNY5YL0jfa?= =?utf-8?q?Ya5svwGXDayvM8nNcICUgaTroRL5Z7PsIcc6ekzHmJ6nyISOBeDeAjcEvcV6uSHIk?= =?utf-8?q?BlfsLu09F7GDPurO+ww1LT2s3WyO1qviGbm3GRPzPdPxwJ++24TpGC/2P2JfCyRW4?= =?utf-8?q?wgENFFi/trNrbisOiLGCMetOCJFjbwL4T2l4l6Ml+1tAIU2Y6XJTnsRABqIOT0lP5?= =?utf-8?q?anWziIoOuYVDeGz0ZBUFUG6pAik7TIalyqIN9i+cg2L0MFLWdzhxSPROsdOaKSLbG?= =?utf-8?q?J2MYRrZPNpY0UMun21WCKoOelqEBxprdm3EN9cpFqrrSd53nhUvdl5LBV2GKKr9qp?= =?utf-8?q?erTYMbmgSe6EQHrQ5ALwcTmq3Wl2+gouMogqZ68cWtk7WO1DtmomKWxYedBjj5nXc?= =?utf-8?q?Jty9g4n8yKlE/w6saKjqO7hsy0nQy8slYR8aq/dR0qD5nPKavO4/O/ImL2S8yBAD/?= =?utf-8?q?y/vt3EMTt/FuvxL0rWMdtgQ0Ys3dz1mauq8omfhi3/x0OCv0fqkXbBhs7n3Bfi2xu?= =?utf-8?q?9Qe3tb35nqoWwYJF/JJZ3wyNvqPIGiNylhfLjxRFZV/acuRhUkiW4bay8T0Jr9l98?= =?utf-8?q?LgVICQL+gYPCz4D6szBA823DUK47t1PZE80JJw/ARDf+VXlekDM6//uaYf3olGRWX?= =?utf-8?q?fj5Z5+BUCisudhgqnORXpgWa1Nshaf7+yS5DXbkN3LZ5HyKUP8w2P9XGr4QEcCmNU?= =?utf-8?q?dooiFOY7VUEGRvM6cguELy+Jj1Xw8/ajnH9Q5CSDh2ZRRyRQbprErpjny94Tz2T4v?= =?utf-8?q?lDHnQ5SXQIbVdhSgTJKDGMnydZ+g1RbNBSkY4jGHhf6pYeqc6egGb33oqQr7aFGBl?= =?utf-8?q?/5MjB7/Q3dkok9roa3Q/UQpKP2dhP16URvSpXbN7GURdcHtnJRnfgwq7pdtaXJoxm?= =?utf-8?q?l2Kd2U7G5L2t528TaKH4EGYXmnnpOGhJHoQRvSso1oFcLz92MHDIplYDA08kAa2ow?= =?utf-8?q?DbkeLr0xTmo0qUlZtkV6xz5eZN6z/ycJgkMnbiWX9Ll+M7W2R+QG+bobTH9n8Fyzq?= =?utf-8?q?0edR3jFsSHijWmbnS4wp/YuI4f8oVBA90D5dtfYKSNRgX5oVF7wDJf0UjEaBKLc7d?= =?utf-8?q?VITxQiRjkoZ?= 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)(7416014)(376014)(1800799024)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?iwK97nhyVinRa+OxYTYTR3lLb5ri?= =?utf-8?q?tcPu1r398fG3uKKhKmeGafp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8mC0ztQdDlcHwrd+C6fH7HNk0S0aaIYW3q+urmEA?= =?utf-8?q?5kuSwhnnkE0mFZNaSjppuQLq/CyTmVeQL1DewbfcGwYJ3lmw2nBjV0sSLrxCGID0w?= =?utf-8?q?ojsJRffPOXXTqtbPpwcnTD3yLg+HzeAECUgf38wAAcT7d1TM1bTIwlIa+zfmN9CvY?= =?utf-8?q?P117KZjVV9EVztxZA3WHuGXhPDDIS+xccsc+G5LYVYH76I7vjdzCtcno1SSNi78bJ?= =?utf-8?q?tGkJBEk1G9ykCTopQkPcx0T+QKuZRpOmMddDs/I11iWfPA5Mpw96eu0h11a/ASnEh?= =?utf-8?q?7xN34mrJ+n74gaLZ/4t3rPhCIyk7OwdKgBBoHxArohW8Aq+EPxXlEPpx3S+6vCk1s?= =?utf-8?q?+rUDvEZ0zAcR6lGMWizN7kFiXjfg3/YPsGXGYT5n5bEzB45U7FOe4dERp/Bd4WHQ7?= =?utf-8?q?/A7eXqBbfL+SnzLT/oOHoHndTLWchy/HXKvaGt1WbnRrFWHpptB+1FU6CjOjJxk/4?= =?utf-8?q?cjhB5OzW7ahClrPLzaxLLZnnZF9dfDlg2om+r2J+rEGpJU2BtiJEIJCIFusod7C2x?= =?utf-8?q?wUutWZCABYjIKCEcK3RKc5vSvznQifh6kqRAPsBQjdM30SB2RBaTxFh+xNlhbO1T8?= =?utf-8?q?YRUPjURQO/1V?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab5a6757-2ce3-4cb9-d25e-08dd1e76fb64 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 08:44:13.0465 (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: cGKWOxrYVAsRwH9lLpu+1J7xse79So8lVhmM1P15Xf9fXj5QtCXiMHFaaoPRoxo0F2TNtcydt2USQctk0NYFGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4PR04MB11054 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241217_004417_603949_E08B91B9 X-CRM114-Status: GOOD ( 11.05 ) 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 Signed-off-by: Peng Fan Acked-by: Conor Dooley --- .../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 Tue Dec 17 08:43:37 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: 13911403 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 82F8AE7716A for ; Tue, 17 Dec 2024 08:51:04 +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=GKqYYMZ0dll4o/xlOunswmWr380CZWxAgBUCCt5iNNQ=; b=YKFuuhP8F3On1dIQA8Q5UUTaS8 is5/6/uHvE2ikoO5NOcFV3ePInJs0YJMCkSA1jjuZ+gXXcqrG5ZmnIAx3Wikq5hkM9CGpzCqGamf/ Tmn0QdccIZALuWygLaAv89dMPiO7vQSYprh/7rmaFBcSAZ32UN4+gmWRG3zGeKhYEHjIesgeAp+kh utSO7wWC3QoGiZOY42NjMKxqXthO+NM+rJ5lLwtLCQZCuivI8JxUsI/GaA3y7OnLUXDT6sKnu327T RG+8XlpcECojVDtvXaVPzt9yzCcoL7crXoLqBqfsxedxPk7g03w9Gx9U3wK+VcRHL3mWNEAXNZ2U6 8cTKIGBw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNTI2-0000000Cm4g-0BBq; Tue, 17 Dec 2024 08:50:50 +0000 Received: from mail-vi1eur05on20604.outbound.protection.outlook.com ([2a01:111:f403:2613::604] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNTBj-0000000CkL4-1DG3 for linux-arm-kernel@lists.infradead.org; Tue, 17 Dec 2024 08:44:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BwfK/m5+XntlAXsSFZehDrQykky7ePIQMybzj4/pSmtfW9iaQSPslo7eujb0dkFrRXmMsDylUYvrZ8HpIuzT67Ej/mRTgh+2IIEJ6BTQgdIR6XbLB4Lbd5oJwzy+Y7sM/pwWWz2rUJl6YsijOqziwebux8GvTzJse9cynJqx+vcobkvxi9DoxUNx0DSiCGvjw5zfKirR8VDTVAuwaU3MIAP+qX+VScwA64+fo6rk4u0SZLDSp4REJIn0eFftwJgWH6DKXSNTYjW0QMoezN7dMe61cIRiXvehrQgApkV2O/je/6t64DZKk/jK/vG8pFDC8GTzqPRPb8NqozJjJ3AQbw== 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=GKqYYMZ0dll4o/xlOunswmWr380CZWxAgBUCCt5iNNQ=; b=mTM5KjJ2mkiJ3eIAfDhFBZnbGNf2s+iNGVg63SByuZOYk/c5247bZ9jnpoucDdgD+N+M9aNgcMrITRZ1IGR1AT6tTAi2kidFuwubldk9bKXeuUWcMARw5v0ZVCvKU/dpS9JfGRUuRzPTR/rwGECBGe0ouJEKtUFBvzJO2m5DEXJeAjISs/bRfnv00DK+SPm31tQEgUuDlSTjsP0kGw5UNcV7cK9yAtajealsEG4T/n4Zxs+2XxOyfGAzQbuXW/pTC/B9aSUDRIpgBHz/TMU2f/4dHvj1ap8KLb03/p7KYFKbXh9ksGo14NW3wB9Tf1sFidec/lwWmhijpZMnYX56Ig== 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=GKqYYMZ0dll4o/xlOunswmWr380CZWxAgBUCCt5iNNQ=; b=R6qu6BQA0E4lTCDK7J+NEHqEUd12geavQuPe7s59mD/AZ0gqPv2lnrGV2G18IDDQfwMDSOLrHxLsPf4wkUJjeLEQuAwePst8eEplN+eaWW8sMglcDPd8bfX5kXXwVjO6QCwkK505KQy0ARGDa51Z1hFc/HX/vLU2wjuFG1/ftmyN46anwwt8c8/U9IvJXb9rK+McdSICcRcI0rsEjkns18wyq/972qTrX5D2zm+FnxruPpkX+LPh64Wv/3hdYylTMfEw6k6zuEaRwWs8KGBDKFxwLfexhn8cmYsFLR/Sg4MCi0Z5mVBuO/LQYwCUDuAwG313H6c9PBl4am0V0gSfbQ== 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 DU4PR04MB11054.eurprd04.prod.outlook.com (2603:10a6:10:581::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.22; Tue, 17 Dec 2024 08:44:16 +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.005; Tue, 17 Dec 2024 08:44:16 +0000 From: "Peng Fan (OSS)" Date: Tue, 17 Dec 2024 16:43:37 +0800 Subject: [PATCH v2 2/2] nvmem: imx-ocotp-ele: Support accessing controller for i.MX9 Message-Id: <20241217-imx-ocotp-v2-2-3faa6cbff41b@nxp.com> References: <20241217-imx-ocotp-v2-0-3faa6cbff41b@nxp.com> In-Reply-To: <20241217-imx-ocotp-v2-0-3faa6cbff41b@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=1734425027; l=9112; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=Piq5sVdSYED7IC9ZoL2zyr8SbeoLnUS3/Uj4YKL+I/Q=; b=8YC/hCOExDRy9NMJVOiQc3ikw5yJ4NVB90QaDnT7diUdsN3WCnhGPiC0BFQN3UredBaUr9aof RrCalOAjU0AAMrTIqSI+wWAg/mUXvPWHzoUioN2anUevROkcE9HSVmD X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0101.apcprd02.prod.outlook.com (2603:1096:4:92::17) 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_|DU4PR04MB11054:EE_ X-MS-Office365-Filtering-Correlation-Id: 95b1b9eb-0918-474b-a349-08dd1e76fd99 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|7416014|376014|1800799024|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?acc3unHYZf/F9BDJObLggukPtHHdBYm?= =?utf-8?q?hJvLvG+7Qbz+SQ12SwOjeBFkKus1LR0+h4+Tue5FaYEI5xf7JJLyohmXAR1ubbjkt?= =?utf-8?q?V4KRNQoSzrIiaSg89KhxZjnIMdHrA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2xktXQ8JVgWXe3zDJVk0YF7nkZ4C?= =?utf-8?q?ydwl0ETO2irbI5fuj0ygIogAVomXOuB0zWO3YrA/RLak910uns+1y2FpcKgR9yOK1?= =?utf-8?q?s2tdksrCOz/6fHsBI1yaAOVkZ3TAPHEf5lXrwVK4o9t07TAybuaVNcyqJ+i0EsCdj?= =?utf-8?q?Gamiv39d8bVBwAgqWEwKYDAEzSgV5yj8FXhdLIp9l6Zv5OfugYLF9IInMJKkkbnt7?= =?utf-8?q?xwDTK+WJ8oKpgYTkxIHmcoVOb97oOWJxJYVNiXJfcscNRT4SfRkC+em8ijfoO/uIr?= =?utf-8?q?BgERR1tSmdl9BErKKHE49sIAhIPGYSsVX5OgRPcfX3FU+Ip8df7NfZLKGwVgzz7X2?= =?utf-8?q?AsF1+Z/DfV561ngtK0iaXyAJKCHG+3yD5TInRHVFs6uV8+EOtiYM3WB5u6BhlBq8r?= =?utf-8?q?hY4oLXHECo+?= 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)(7416014)(376014)(1800799024)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?DyWjh/7PWw1MxIY5eoSUkuemNLDh?= =?utf-8?q?h6l8CG7KB6mvfzb0c2weY5BFGLF3IrzNbMAJ+6DimGFI5qyuhMikVxD45rJHq4A99?= =?utf-8?q?rPispkhJ0JbR0mbP6Fj1I3jxJ2aZepss5dHcLiq7HENXysaVM8Ki+vQswcn5Bskfa?= =?utf-8?q?Jq7BfKPJTfVlKEzsfxATcnV5O3AIga4XBtPQ5oF4csMR92ZUlBxQWGfLeqq3Is6VW?= =?utf-8?q?BKb/A5lfcNu4hUqppW7CwG1DtWvjVnwZiuZLGEHPOblpcFFXiB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LqOIqrB+AZN4Dej17?= =?utf-8?q?VHpYShVBdc/MvFhNznxMZS8Zt+o4lgA5u/ohGU7m/IzS5EMP3QuC79XlVTqm+vmvg?= =?utf-8?q?/0kJlSozH8V1Jg5/vwIqn0B1nLWMWDMXQZ/VNBk/elv97s5quVPr+yPdDLgg+Av18?= =?utf-8?q?t+LHLSZeE0qj+VfoYDV6Pjs05VQth68+PUbSNIO31vS+ftPkSpFPm6WGUG6iBJGQc?= =?utf-8?q?RfrjtcrxkDqlpfzACqOAUaumFc+/ugnZ6mC6Klg4A6/ACftbl9FGivmUlSC5fXOUd?= =?utf-8?q?wro13s+6gFKQuXJjmOOahvpPoAXDZkvUj/YHnyWAR+8jOUMyJPZOiwTNUmEXfwUmL?= =?utf-8?q?u6cUPziRDqYiCXHVW1JEzT/GJi+c93KdOrTn7K+mXaVVEet8kn16lg7huqrDQrKrx?= =?utf-8?q?7QE2OHDFakIj?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95b1b9eb-0918-474b-a349-08dd1e76fd99 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2024 08:44:16.7753 (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: 5asnvvcSVRa8o8vgOdX4Kri9UnBD8FFXQHhWRKK2sNv2GOcoty8VIvb/k/2b1fGVW9mk7GtgxnHzHFWyeWVxnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4PR04MB11054 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241217_004419_352410_534C1DBE X-CRM114-Status: GOOD ( 19.93 ) 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 each node under '/soc' 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..2c7b698ae4da0ec22eeeabf4ed35d1b703771f6c 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_node *child; + struct device *dev = &pdev->dev; + + for_each_available_child_of_node(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"); + 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,