From patchwork Thu Dec 12 08:24:41 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: 13904821 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 AC73CE7717F for ; Thu, 12 Dec 2024 08:35:00 +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=7+vfDFtMGi9jxvlpkmEJanflaWo/l8zwRJ67GIl0uSQ=; b=2YuITgcKa+SOf9ikk3zrYJQuxm 6iltrcvEkXSZEncg8sZ0qgEkgStXQl71CkzAnlkaIW8mC6nBmfFJqMgVvGS6aFoIZMUgxYFsHagAb cD1jsum+N5+W6ry755Nf4aMTilWBi8R9SihJRruoBTJvT6ywP4nRF/lV5WJF4j6B5hvmwheS72Xaz dU4SJgd6Z8j/IpIq2Tay1vNDz10srHiy4ckZWhmxv1qmPn1OqXkb+CLn61bN98gLzMPlH/dLdvqdh hEjCG8FoVlXRPpl3haqm7DIzi3AVnOOi2mbIZsq0GOzxF8heasdqNaoJawJ7qWyrZUlzNb6Gw71bk 52ibYFZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLeej-0000000HJuk-3Ikf; Thu, 12 Dec 2024 08:34:45 +0000 Received: from mail-db8eur05on20607.outbound.protection.outlook.com ([2a01:111:f403:2614::607] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLeVf-0000000HI8b-1qeR for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 08:25:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=M5o38Im1t0ljGJtJt/pxX2R6zNs9c/zdV02GWAlMppGmSQRdK4LRo1aY3TqM5MxCqKzuZhofyseucE2yZho1WX/9Xh8KPxPgtULfI+0TGhMkprrtXRFwUULw2ObiuX2xGQs83Gml4NSS0cEIxI9FBmA87+SgVa5+Nkt/D3xRsVrCZ28uhBGm0sbYTt6m26CvAQItHXGmhA4iyORJd77SDQVs3bI0by3tTyJTK8KCQe5FtW+12aAzN7ni4KAleBmLOw7aWOJ9xIaXGM6H4HF+nInnjOYM6jDz0HY6LAUWRbcK4MYo/hcGncXbkVvFP8ybwMd1Bd3Sz9u1d6qA68K5/A== 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=7+vfDFtMGi9jxvlpkmEJanflaWo/l8zwRJ67GIl0uSQ=; b=HtsiUkIyLlrcbRqK/oe6Ao79OwO/ZRqp0h1Jcip5tySY2T8OkCZvebmgyPMIGy9GFCJfQwjjHx4araL0SMEATi5nCBqMEqay5GpgnKMEHe8jZIweAyiVbxyWOkVGzqDKJO+CDG3Xnj4YjSXscgKMMa8H8A6sI8C88IKWAgonMfCdGhVB91TXsi62vT12l3GzN8+d1qD0GJrvEoMBY5g3M3tM+5DvqxA6X6QisKN7Bwd+jw1Wrbm0HrioTZjwh7RjVZr/cPJ8yF9RUYKAkGqa+6AzFqKAPwfoa5ICkuKC6+n+hp0berexZm3x/5vzPkKknsX8/lR8S3ljwTdBlE1wNw== 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=7+vfDFtMGi9jxvlpkmEJanflaWo/l8zwRJ67GIl0uSQ=; b=Grnk0G9FOFBwj1XGTcbgQpj90fur1I1SnV0pcZZIOLB++BNGKBYcSE7/mbvnmUjcgXSf3joHpCRaOsjJZMlX+kawOH1bJmaOCczTthPVCSEJlMlNHC0WE20vhdjkWob0MsjLVA8w5RYI06M7+KotfSK/gv+UWxPy1quooU/jBg/gh/TRGiDsSTypZ9amb8pm+Mj8gJ3lipblztTbIMPhcYn3x0XRrcouzpY3ysw6K5VnCTzntprNvivUU6mMDJ6NSfJWsSkMZ149oV4yCvpDVRHmyKnhbkKwvDyPQx/Wi8FcFGX7ZEIwTfvuA652YZv2GSxWW+/sAuu507GCk2zpag== 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 PR3PR04MB7323.eurprd04.prod.outlook.com (2603:10a6:102:88::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Thu, 12 Dec 2024 08:25:12 +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.8251.015; Thu, 12 Dec 2024 08:25:12 +0000 From: "Peng Fan (OSS)" Date: Thu, 12 Dec 2024 16:24:41 +0800 Subject: [PATCH 1/2] dt-bindings: nvmem: imx-ocotp: Introduce #access-controller-cells Message-Id: <20241212-imx-ocotp-v1-1-198bb0af86a0@nxp.com> References: <20241212-imx-ocotp-v1-0-198bb0af86a0@nxp.com> In-Reply-To: <20241212-imx-ocotp-v1-0-198bb0af86a0@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=1733991891; l=3973; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=20rdcKqrSVYlqX+82KfkjLM6DPdHqIKtDAQ345wUgBM=; b=q47tND2W4Z6/ixNIGGJ8bwkJ90vGP8AepGMvEDvDYjnM1HiJhlrVxtYPkCmz7j6e2FGP4AUxi UOUauNDwBJ+D0SKDCV7srtZ8bI3eSz1Kkgq/7Ehl4wX0gKpDIe3du+d X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:1f6::14) 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_|PR3PR04MB7323:EE_ X-MS-Office365-Filtering-Correlation-Id: 11b9ea33-f85f-48e0-1788-08dd1a867f53 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|1800799024|7416014|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?mfudaXAoL1eb++lYvbYFwEQhBbDHkek?= =?utf-8?q?mu5yTJpCa6Wg8urZOMhPRDzwLX4uu+vikGG8ZWQK8+10BnXqD4lcQ+8gn6zb3MJlK?= =?utf-8?q?VZi0d9PYnoLxJuQc5afQLcIGURrgOFea+w5oHl6csQH/3inhlmIbez06dY93/ITt3?= =?utf-8?q?eHFxv9p/apcE7r/Z1iSPtaaI2XUsz23Gvlcxg863aULqBOM2OvMRghFyHBDeEPcmw?= =?utf-8?q?Ss3eYPfEqL9Fl4lyfx9MtquRSYw7bl407xHzZpgDEFO85zKNbASBQQTdxIlPsXZ43?= =?utf-8?q?on7QgRXD0oNzbxZXmYz7Xf8B3XbLH3l9O3ADzPY3ZZ2dndax+SzA/QR1BL2mrOf2z?= =?utf-8?q?fD1HqyA4cn7jPkfFoILEe12aR31M85Wq3BnmR8QFm1PbQwaRjOYVirIAlfL8mE+Rt?= =?utf-8?q?77aU6VKy9dHEsGsyeRUkGCblZ3nwHvmxXcIuclUe6SGysMFpXScDjW3XdOX8B9KQY?= =?utf-8?q?ULYk5Dus6XXS1R5GeFMqi//M+XplsNEwcBjBH1qUmVOGpZs77W2zy563a/3iPbAo4?= =?utf-8?q?ZhSqzDK/Uz7Nn97/PvG6xpqlL11u9mmbMYrVg4LZTLIdDtz3AnX0UFZ+FmrjYWUme?= =?utf-8?q?ynSDcRLEKNR31QmKFQzqeBforLlGkhBo+0mFU3YGy990T0pq4X8eb/3S52/1K+9oW?= =?utf-8?q?sOai+awfjxbKe2fZWqISXaS8t58UoNptpxi0Y5RcPqj6SHa62KxSfcnOg8xI2MyT1?= =?utf-8?q?60eSS5OvOqdUqGKKlcp4E/JCn9Y4QDTisRAUlQYyR6PMfFGWFpxbY742ZEuroX6Mn?= =?utf-8?q?+JLhJ+xjdgqu0gs2IVFC+r8J4uB2LV7hEpOdd3lkEWnROMaHPawELr0aIj3SjJxPt?= =?utf-8?q?dlQSkbRs+GcC2y3Y48ADOeoKwAbY03bfTdzRwDZl53AcMMTQfD2pMU0ct/qcsaH+M?= =?utf-8?q?580bXR5D/Mjy0/6sb6Zcgrf4ux6D8tPwgFVK0oGJM0Fjt3mwBia2PAlWMLW9TkPnT?= =?utf-8?q?yD34AlEj5kGsRG+Gcznk/b1S9B4N7uvx8jjNlSAIb0QXnwy4zqa/PGKwdnH8XfZkY?= =?utf-8?q?+6kSyfzoklnObvpJGIbQ1zK68fd+unKPedsJAEeYu8PFGvxtDqKLavEOlBMaOgo60?= =?utf-8?q?DV/UJjkkQdlINZglP8koWh4JtVJNyJJMkKts+8cjITFmmN9+jFgwZGSy6caSqsKZV?= =?utf-8?q?Q/zI2lectcJa+iYW5zVAowZv9oMoSn3ALhyKRyxz/aP3UITMM20b0QUgH9esE7PLa?= =?utf-8?q?NeYb8yDzdK9bX+6AaWfz0WKU1UgydT62ckul9Bkaijc/WPZoVwCke+R+rTOruSg4r?= =?utf-8?q?zyqB3Mb/wlR1xxe6CgTdWmmmAhxvlspk+zTsRL8s6A14jGL1gflkoAuivzwEJ9w84?= =?utf-8?q?xTZwSnv6cxAKi8u23XJV3ZgibA2PMhY4gQ=3D=3D?= 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)(1800799024)(7416014)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?O/5nY3HDPN7dyHrwi/otK/Tju4tl?= =?utf-8?q?CSiSdkworkBuui5aQrsF013gykNB8e+yu7VCDLjmpKNsRi1H7h+t3g7muvx/MXWBZ?= =?utf-8?q?S/N8dhl4JZJ4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oLW4d6x+BA8d3FI1B4k5bjhQ4zeIVqQ9brQPbJ1h/t+W782?= =?utf-8?q?trXQF2CLtwQG7ZEna7rKHPkHa34970yO3s30AOjPStDEVZBWh3HT1O4xQqTFctqY3?= =?utf-8?q?CGhgJkHoBd7sD56+3Q7T15R7KnyXRYeVLBKC/CGDD9FY5IvHj5ae8SiXeJ23+rV+t?= =?utf-8?q?39hJDZjbQSDr/rHDZIr8U0sReh/QkrFZqliQwTIW7OKkocA1k5OU/kEa3nCDz28v2?= =?utf-8?q?BhxAFvKWelXgB06az1goGquuJ3cuAzh4VGC7brqgJ1F4Opr0PGqZbkKjBUtxl81WL?= =?utf-8?q?nm8mviQ4eiV39Yn6R+bJgJiBvZqXpcChSpr9bvGOwT/xqGAdT31WjIkubjKKuNkH/?= =?utf-8?q?ZxetaG4x4D3JBiSHwCIuCPLsNjGDMk1G6lHLo1dfp/cFpIeIurp3LhWYD28e6+brl?= =?utf-8?q?1mIU1UDfHQQkysyrGcMy5hK2VMGuPaV4+6b6vm6ycNrpZdToMw8L/uAZxfO5Z1/Ie?= =?utf-8?q?bFv55iMbVZfb+Ql9HRIU0SFrf5Zjz56a3eHCmbFoNQpHeuGB6F8RrduBO5v8DF+xu?= =?utf-8?q?5t4cNqZBkSe/?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11b9ea33-f85f-48e0-1788-08dd1a867f53 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2024 08:25:12.2168 (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: gCA+YSQV6kcOHQd7FRtBaC1x0MyYvIClyB+sBrY4qzA43KIcq3L2Pw8OgHChfG1taAetAxT9wuJmUPWH1CZgaw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7323 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241212_002523_490020_841C5CF5 X-CRM114-Status: GOOD ( 11.15 ) 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. 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 Thu Dec 12 08:24:42 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: 13904811 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 E6388E7717F for ; Thu, 12 Dec 2024 08:33:54 +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=9/GwGoEswcMwP6dImfpCh/5bROjzZhO2GB4Bj2W/jlo=; b=t1IjP3dM3j2VMrlXI+4dapDx97 dQXki5HVidAslaiqWI99EENOXyoxcNvwHQApMJkNnmeS50q/s2sJH3WdiTa3DG9PD0LgJcrxTpaie dg0qDykipEFA/3bES7g7jAXGYFX99pSP2BQ91IufqHUCm0rt5ZMW/j18BZ9SF2NQfSXTrZBbrDlAh nbXI+TceBQx24E3MfnSGXzo/iSPri7h248yMoDdP8Gk/yqIii3v0q9ehc5/7vVFzzj/vv0fculCw4 Wt2voobWBKL/WiZTvnQLA4cj3zCLB9wmTaxDkn6naKzp7QKQAqhILJpMZdvqj9Q2oF1PoXyjmv+M2 ebFRbmiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLedh-0000000HJkM-0VwJ; Thu, 12 Dec 2024 08:33:41 +0000 Received: from mail-db8eur05on20607.outbound.protection.outlook.com ([2a01:111:f403:2614::607] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLeVd-0000000HI8b-3nYX for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 08:25:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rJ+pqdOWTzwD20YEzsQyAZmhn1bsrwjeTTZXqQLXPblesduHXSWRdZLBa649eGpTka88Bky0EIzVa5HwJNl1NFolafKSbMCGJiEF/Ut2fX+9Her563VySPSZA8wsF5ePKwZQl9xbsO2rVHcg0gA1Z9batryVqYMSLt8zrXLCPNqT7RKW+uQzk3qDSsLaRcNwtNSN6IPG1Wo076+JmHgy3OC1RfVD9FDxpjl/bpehwha2kizMwi3z2B8glsB8zEWTqn5/DF5xSDq62xFfmIfOIlggXhvYtpQKITWHHQnMaBkMQrVBkPfcQN2rjWNBvl0u7D0rQwRQNgKRl5jKBwCwJw== 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=9/GwGoEswcMwP6dImfpCh/5bROjzZhO2GB4Bj2W/jlo=; b=meTteteMdj5+hzNOtNC3KA7B3TZ6fFPROUgarcR6/3I4rjXmyAmlCOpQxidyoWpScFAsfZYHtpFep2N/bDveW7ys/b0F7/s3O9QAhnrxIJ3AQIl7svX5xJ6ZEjpi9C1jvyX3ehwSJj4dF0ieC4g5GXjJvP4qPv2M1FkjcsUWgzBuPM2MujxukaukE7dbO0e9nXwPiiUvjm3XFAwLCibEF2xm6Q2qk6/E+SPLdfVXi6ioSgGxd/twpetvQ2oGLWHBUSJdILQfmtpCcfK+kbTvpIjFDYRMYTJKdnZ3qIiCGaqHyLrfMvRzjVMTk8eOP38I1DO6vYhORWlV+X+MLzismg== 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=9/GwGoEswcMwP6dImfpCh/5bROjzZhO2GB4Bj2W/jlo=; b=lM6jTjgU0oz8H9xkynsFrsaG2tCH+iKI9u5r5wzAla8+OUXDtu923GWVDuYNTkIlqV6vFmbkoV6iNM8K2COtlyc0cpRj8zCplLri7g5cKd5Z5csIutyRbmEIFBpe97dfcHf7u/TizolYJmhlOgNS4pSM/owr6vf2i/rKt1woXS2X13ipXvSkeHp6AjPXCIv5BHjxCCVFocdgyFcgalT/MvQ55VF6m5Pyygsmf1PBCXBuRGVAPpA4X34nfQ1d7Q2tMDF4VBIIk9pvemd6G4TbnyrszaZtbEqaUec/BSLusTgJj+7RCCv8KYB3jWtGO363MSTK+DFrW9OMPPgGs0QRmg== 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 PR3PR04MB7323.eurprd04.prod.outlook.com (2603:10a6:102:88::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Thu, 12 Dec 2024 08:25: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.8251.015; Thu, 12 Dec 2024 08:25:16 +0000 From: "Peng Fan (OSS)" Date: Thu, 12 Dec 2024 16:24:42 +0800 Subject: [PATCH 2/2] nvmem: imx-ocotp-ele: Support accessing controller for i.MX9 Message-Id: <20241212-imx-ocotp-v1-2-198bb0af86a0@nxp.com> References: <20241212-imx-ocotp-v1-0-198bb0af86a0@nxp.com> In-Reply-To: <20241212-imx-ocotp-v1-0-198bb0af86a0@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=1733991891; l=9171; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=VGXYDR2iua2/vwS9AThGTtVqrYdCN7AqMGAxlsDi9cU=; b=CsG0WjWARWk592cZJjm36SheQz5QUOMXSOIlZ2v/0BMSfBqGJ5maR0G6vRpygPO8Y6AKFUzWE 2GXHFUFFbW8CaItf0ucA3xxiC8GMJESpDqlbIuJYSc7ytvbCqG9+CPX X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:1f6::14) 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_|PR3PR04MB7323:EE_ X-MS-Office365-Filtering-Correlation-Id: 94a7a820-8829-4131-8b30-08dd1a8681c1 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|1800799024|7416014|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?gBX4Am7NNMhnIYaCtQrKV1s9Zw8yHVV?= =?utf-8?q?+5Z3FqMt68wmxcQv2CoCzJ+b7/o01R0kPg+ZoB7s9JiUoCpSdjHO+m32Gyg9UDx8A?= =?utf-8?q?ej0KQUHuZ+6HjOrIdc3DjanUv+LVTTPWyrEEBlJN03H9FJEhLh7JxdMFTOolOCiPf?= =?utf-8?q?tk1NbbAk3KnPsxrqcT/VCv4bJJYIsQST9TOy46YwLqFq27V2+9pW+S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= =?utf-8?q?AObcQPNbXOEJfixapyxDZXsvw5cOR1oiMA+pBxlMPBJ17hq9YleOAGGwp4dSncBGe?= =?utf-8?q?YMWpqB8nxz1pV/d0Rg5cT2iTdLsKPzVMSoN7bn2c8r7fndAd47SAv3yE+WVD3hrgm?= =?utf-8?q?/uz8+3pU1Nl17EoutAsOC7lf7Gjxz47X1P3vInRIk/VpF3jeWH022Xlt5GoQ6bbjb?= =?utf-8?q?98SmNxfFW0jSPvnk1QgfiwiiUpPNJNaPl1COVsWb3sDPjCGgEgi/+RNh+8WlUgWZG?= =?utf-8?q?KeDca5ejnI9Z0WMlHGiW6vVDn5RR8BY6ew=3D=3D?= 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)(1800799024)(7416014)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?aQqsRR4JgAyJ9jftRNf6otS3eozQ?= =?utf-8?q?X15ao4YNk7+r3gdWmEzhWrdrNYfH9kXFTq/N5F6xeTwxZ5RFeoDc1hyhBDKBBKjmP?= =?utf-8?q?+81vXGrc4k9q9x7d36Cbd0qU3v47CHhLcE3oXjpSMyKi5umFgm+WfocnfUsvsX1yV?= =?utf-8?q?FTNU6++QzhSqetUZw3wBNEZ6CLsTINzY3JNk6M/34f39DLaml03HVIYFp9lsOAOJF?= =?utf-8?q?JWXuXJh8wztQcoijpUqOm8uPEiVrfnmLP/GF+2pVTu8u4U16+OaofQYd0UKt3Tjf9?= =?utf-8?q?U67imjIYf3ea7gLGh0zgAYj2V4vpf55c+CT1sd9MAXTUOYG9UV6mTRBCGKow+HJfT?= =?utf-8?q?gdBO363HkHGGuxnmwH/kRB6FWhW7Q2r/Kw9EPnHvhYfYE/4+bA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Mbtlj/rr79S6T/hyA?= =?utf-8?q?Jvgnbzs3VTmZGsyxvlvxBeJmfBwitJALuXeUIbpogyl1aUBGSW23JZTMv/X6AQIBx?= =?utf-8?q?Dz+g2XCBukakQe0bY2QRqR5Z9LTZkNDrpqzToq+MjJMlZvMbLeILxH8vxwhFRwh76?= =?utf-8?q?ix1PNopIfiSgDA33ofylhLK/ej2GbTC4P3BpNNOMwwjlFflGg8Ln6+KyJCsa73kG2?= =?utf-8?q?Fvz28nM0x0YE3ffMW6wZ7MJGBlHU6r/Bd3/SdAsr4Wq1I6XhmXl6ye47szB5i1VX+?= =?utf-8?q?mewXuiDZ/Axu?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94a7a820-8829-4131-8b30-08dd1a8681c1 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2024 08:25:16.2672 (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: oMQgxAaK/BnUEtTx8bUtR2HyODgjdNjEQ7e1pBNwa+hgIsMPp5dJ5d1RqMmiLjVgnT1eCmBpxOvDW1ge9lFAUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7323 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241212_002522_102352_6FCADFA2 X-CRM114-Status: GOOD ( 19.95 ) 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 | 187 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 186 insertions(+), 1 deletion(-) diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c index ca6dd71d8a2e29888c6e556aaea116c1a967cb5f..542539b86efd2d38be2903c1d0ea72f918ff5b75 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,100 @@ 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 *soc __free(device_node) = of_find_node_by_path("/soc"); + 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; + + if (!soc) + soc = of_find_node_by_path("/soc@0"); + + /* This should never happen */ + WARN_ON(!soc); + + 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, soc); +} + static int imx_ele_ocotp_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -161,14 +273,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 +324,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,