From patchwork Thu Dec 19 14:25:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 13915121 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2081.outbound.protection.outlook.com [40.107.104.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 023B8222D6B for ; Thu, 19 Dec 2024 14:25:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734618354; cv=fail; b=VnzUGAssHQdH4i+8ImzW2iGcjwhNvy24SlQhDtDyV+IqaKxSp0oNM7MxqzXzLllYWiooRE2+x/QYQp8ax/K59ni3V/8FmFmsXmjBaOPnao4EW0UuAIbaZljo/P8/i4yWWcLndKnE9rxtReIgERFfa9idAIkkY6IGUzSsE/Xj4ZY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734618354; c=relaxed/simple; bh=0GQrZe6HNWbn7RJu9FBiIh8HYZRLm/OirKtagERSiQk=; h=From:Subject:Date:Message-Id:Content-Type:To:Cc:MIME-Version; b=s4ydFi8T/dTS9muWj9/TPEU3Vzu4JWmGahBUov60P+G4pIB0w9z4Exm/6t4IsjBQSKBSYJneJpqeLwkQItJlD0PNAY35RSdVA1zLeu2+kRDbwC4+zYPaFQu8894nLresebqB1UP7/LYcAIG09XOUmzC4+VqPAwrgkwD9bTIu+EA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=pWjy9Zxk; arc=fail smtp.client-ip=40.107.104.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="pWjy9Zxk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H0bKrSmlhfKu0/yycmayoBDUeyetMR62QOkxhmZ0yoAo5vHlMrlQbmPs50ug3Fju/gUq15LeMxbhB3eIPx7wh6ZCJplVqwcHuHwgW07ZfQoWXCJM1FBAD7TCYztPwGuVoIu6ULFAsQHkxHQOTD4BtSbASbgpOxOBnBMpPBTAB80qNDs02Mycb8QqkSKk7WZjHC5RfVBdwE+NnCRvG4QPnmzZMuEE4p1brPFiJnR1IrH8VdwhPdfNEHMIJQD/+CzXDUbKmDzGpaDappegoTyordJ0uC9lPJq94R9jrcdeJEvOWGieNJu8LKRfQ+pYFychp1J4lSFypQRoY6ut/5YuXw== 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=F7Z60RgDa/a2gj95a/zvtoiqKycskB/G54sm0Qv9tPI=; b=aSgUZ6BCAQXgZBRkCRHywLQx+1xCpXbxmg1lhUlqkVVmE/m6rEnFcl3yL/us4W/aeFpy9gNPUBORR8Y2pxKHToGSzyLfbtbFCeBsmazvTIVr35XR13gxUwRnvOOxA1KlUKZRsohauE3lAnLG+FbN99aCey3pc3EJ7PTzXhEyP19JXr7dUASPmUdgAsyjX6VgA5T3iKGdn9ov2SdkX7K+NMTabwyu1foUc3Y7xGzxibELdAhhPALdpPtgLdD1zMdIKGd8UjTU0yP31/RiLTTn/JXQ8B/2JcMitPYKfx8eNtr2feX0rYU0ufFaEpCZVbPO9FXaLBGnZunZt1bAEqwumw== 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=F7Z60RgDa/a2gj95a/zvtoiqKycskB/G54sm0Qv9tPI=; b=pWjy9ZxkDaTN4AgwNIlW+/B7YiwQ95wXfkkxKX1QIICTL9wa3FrJWNjM3k8zjou+vE+hyleo66DlT2bkzt3Q4IvlRKPvEoBF3SsJLhCnNFrSda8iYwzQERSH4S0c1wGtyBkMm5eE9H5o0ftwFJ+EbI/mS+DEnEXebgfMRmo5yxycPkCCGP58ShmmMTd0GAOdSgUSJgMdGAi129mMTZroNhWJrrfSGDHN7x/zftzLGvO08czLdhr39Q+zV35+B0AVTBcd0RC5W6/r7IWVncnMxDTV+4Rj7v6CHrAFPJgUSOILKN8Fkdj6XV0cRQvbmP+Nf/BtnaCj+pHSHmaaITHy0w== 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 DU2PR04MB8950.eurprd04.prod.outlook.com (2603:10a6:10:2e1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8272.14; Thu, 19 Dec 2024 14:25: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; Thu, 19 Dec 2024 14:25:48 +0000 From: "Peng Fan (OSS)" Subject: [PATCH v3 0/2] Make i.MX9 OCOTP work as accessing controller Date: Thu, 19 Dec 2024 22:25:16 +0800 Message-Id: <20241219-imx-ocotp-v3-0-b22371098071@nxp.com> X-B4-Tracking: v=1; b=H4sIAMwsZGcC/22MQQ6CMBBFr0JmbU2nVERX3sO4aGtHZgElLWkwh Ltb2OjC5fv57y2QfGSf4FotEH3mxGEoUB8qcJ0ZXl7wszAoqTQqVIL7WQQXplE466mWGrWkE5T /GD3xvLfuj8IdpynE957OuK3/KhmFFHhprZWG2sbI2zCPRxd62BpZ/XrnX08VryZjGmeJNNqvt 67rBzf3LvDYAAAA X-Change-ID: 20241212-imx-ocotp-cbef304140f5 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=1734618328; l=2294; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=0GQrZe6HNWbn7RJu9FBiIh8HYZRLm/OirKtagERSiQk=; b=oBzaFkLgEA3wVxZG+QAIrpnDQ1iJyee5r2mHdHxOxS+3tfAUOazapdM+BcssyP9EXpq0Nla9F XJHGCaAahAdBryyMY1iVzVPob55LEskt+7cjKORQbpD3IPwa8gM6YuX X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0054.apcprd02.prod.outlook.com (2603:1096:4:1f5::13) To PAXPR04MB8459.eurprd04.prod.outlook.com (2603:10a6:102:1da::15) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8459:EE_|DU2PR04MB8950:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d3644af-8ec9-4561-5314-08dd20390888 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|7416014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?DqxaAQtZsdetZ0DCHvOxv8ggyG7Vqfv?= =?utf-8?q?y0/Jz1/lBom0K32VA5/D38M2yuZLtmMhZD5nCptJDw9nS0FVtzcw7o+R45V8AJOcn?= =?utf-8?q?+5pnUC1I5TLjMoED4zJuD/szPw1SQKqnEhl9otW/CA8Q0u4jnb6iMsACLHWipresn?= =?utf-8?q?+w9aonW1GVfFA5tkgm7J1X9B1+2jNmGDNeH9ifSEUZ1wyD4o9X4VYKtncnVoRhJYL?= =?utf-8?q?mgBG1uGPXLYufJhahm/F0ET6eHfevuvwJdMPLHSno6dk3yffPKG6WLRuf/f2w3mjk?= =?utf-8?q?hsTtsqOHK3ijUemabx/8AV5TYvEteFMk9mfl+5wkLbnHDIkOdRnNFaIrlRm0VN27h?= =?utf-8?q?6Ub2lX4lToGBqjcOY2V6rKY+9h3ddV89OUm5o0hD1BUleVydN+2okEKa+U2j3J0UQ?= =?utf-8?q?SYtj4jBlNjB6d0sc2g5Lvthp2DOYoKnlaGKye5rFYeyVodyKqzUfnorQLmAdF0Azu?= =?utf-8?q?VcFvNdtwVSctPVRTVOjJvTdQRl8H2OpBBRniDl+7FHXgPS+aXH9729T6m1O0NmyAB?= =?utf-8?q?Ps06YIojzMTW7ka3ctage4LpNZYpsamueva8XJXrR3SQj7yrhIJ4QIMNbDXU3qGyJ?= =?utf-8?q?0A9HcwBnBqP8msbr1H5jPqacDVNpYRFHfM3wH/eH9z6ct519bczzOdSWZPcEMXMeX?= =?utf-8?q?PMpfp+jHjicuNsfWZZjkmw3UEqsE4TOylHYaoUVKJITMcu+UQdgVX/HRylEjDQD2m?= =?utf-8?q?vK5z0+opEATov5c0LjGhVU0Cp1pFPrZHwJ0DuURMB9Do23BB7USO7kVqac91JqhAF?= =?utf-8?q?3CT/hTJZ5PZcMSn+66ifVjoP1dfDvYi75KZB8iLWdRMH99cIssxYMw7bEWCjZqIH0?= =?utf-8?q?fyxWyZEakn/35011iJrP7NrAWdHeXAxbaFVVu1ydHax69peBvk/vN1xSCWg+TfJ+k?= =?utf-8?q?Eq1MlTR54srXbVuQx5GIRkS4DJk60Ci6+5L0fBMkXu3DjwYeNCXp+BNkRA568ybSI?= =?utf-8?q?9Oqs2AZXwsZS6P7AdhKpnBskdGxRJNqqrIZupZ80sFKkvpumeek5QHwUV1dZ19vK/?= =?utf-8?q?EMaDZvZNsvIDnWkSVS7BqNGII+hYX738tOnvZK21F6ArZFaEtSxA+I/hsUdOOodHv?= =?utf-8?q?AFJe3Ox4iNxEFg66nBwnICa27wntc8gLV3d5ex1izJk9uvPt1O5IrBShN1hsJZa3q?= =?utf-8?q?qgfjWmNl+ZuVBqc/XUTyXHVoovq3dvpLP11ZAeUgrLREyjIeA23d7EuDGVvxj4lf4?= =?utf-8?q?AF5yKk6txJpo2byDpNjF0CHa/m63nWpOb8rg1AXoh44PKpJyPmXzNzuQqWh/2rChu?= =?utf-8?q?t1UiLAnVTbldD3+Hooi/LATLB97625vAoLHd22TvmXselcwCa9lOg8e/VdVr1c4l1?= =?utf-8?q?kDDQCxII3JUe6zf5JloWd8RVkF7ej28a0BshbjjGn+fPFA/wGMC+g1VcbIFsO9cuW?= =?utf-8?q?8emomX4g3yDpc2tJ/7NLNJ4kyVItmYEsw=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)(52116014)(7416014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?u2C6gqgGi2HJo4p+taO3NIMkE3Pz?= =?utf-8?q?ZiQdup5/qUIJqEZL4CeRPOSdeQ/mpS8tPilATctDxIsV+R+2IDYLOsWiZbngWUNeK?= =?utf-8?q?gEeXfU5fAlLX98uCAw8vzwHFKK1lniuV3cZ/26go8KlHAhUGDStNwZI0SendzjdyB?= =?utf-8?q?Kyi3HQuSlGj1HbZMhdT9i0/q7owUuNUDr66U9MOnZktoZdXwCwHD0jFSZNQfUwMeL?= =?utf-8?q?VA4lYFnb49JOaYgAsKRHQewBnkFnEyj81EtxcrLm/1YDMH35sjrfoRDZ4A5Wm51Mn?= =?utf-8?q?kX95Bvxzzn58L0OziGv65i0t9hiodXpJJg/EUl+u4/TnoNUtE8dceodKfrObOUz3K?= =?utf-8?q?g7FQdxXtNbdVRPgfionIhjEFlX94zB/UkBMl/1Cu/3/d4XLKbpQH2P9qmTUeoJzuN?= =?utf-8?q?+3hOk3+4bax7ObjWXSrw7d+k5vqjZnzpcgBm5w01OHu4DUpgThQEcqjXkI11XsfZs?= =?utf-8?q?Yjgd3TeClxv8b2bUmkau7UfVFWOKsPcarEdxw97LjNehlDZ8uLk+1MqYIQdVee2LU?= =?utf-8?q?bDV5lyvsbwBoISTbBWVrqZPXx1taqiGXp23wuZI7fCrZxYFxkTT4CoLMIIAuEzrB6?= =?utf-8?q?eZMwdcFvjXcYprof+NJZtysZJTTHqLO9NZCoEJQlJF/Ata+H317oy/sBUdTYERLG1?= =?utf-8?q?exLgLJ+O0LDBNFwi5gJCv8j6K9FACuDI6qBBfxsi8XQVw+VQjkD1YqbUaOh0Np91w?= =?utf-8?q?vFTOVGG0TXUTnRSd8RrZyG73va3EZtZ6mjfU7UZo1OER76whnffCUozn6mBsnfnrR?= =?utf-8?q?wkMYOAef3PV2IujWM11UU2SZFfHLGwOngB8KVWZ3lnm3/t+8JZu3hhm1NWOAhECRh?= =?utf-8?q?5HLWFDoevD8KLyeTCz4kqrxajIA/wUCMSHC7zS+xjb+AbvCpgD2knlgXnfqkVU8b+?= =?utf-8?q?OFsvpdJjTP14/+8YV0ODMvneQ+8YMbVqWtyaTH0eXFtIuK2VQS/5+BNzh373ABCQa?= =?utf-8?q?QnLBQrxV8SvKVZ4W2+gVS0RqVnlcecj32vv0nqz4uW6ODRqe+r/tBMYzgUD15aYx/?= =?utf-8?q?KW8pwQ3dYizRbQGpYHmXzUArmJU1fqsywSbvPAh32h+ASG2FaShZdXh7ffo/oo2h0?= =?utf-8?q?OJeRr5fyAtgUh8Is2TYHgRc3zdDkXlQsDfYWJzLFKo3ZXLmPOOiEZYiCVJ0h5V1BH?= =?utf-8?q?XxK16NJ8Ww2Y/UtZEedZLOprr1adiLWk5vdYxfm1WIEWZw0DGi7AdGit0t1AgYJLd?= =?utf-8?q?g/U5/Aab6mk5oGKxfww1nfEygty9QaBmGCZ7nzXr63cEXDL/lz4mvHkVqF18iGFbe?= =?utf-8?q?TFIODR4FF+ARd+FmFJ8QwE/ANvIRVk8Kq6G6Va9OVm3lu1riBisdyyX9I1OX4okio?= =?utf-8?q?6xZx4JIbUcK1dA/4cbAqm3x6X8M449YfXg0uxHPw297gEhCtw7ZBab6ANHJlF/f9j?= =?utf-8?q?bLWlVIXXHVXK+pbRFndW1qZvM7xteZ75+TbAXPOLMpbzA2FXLCqu6Iu8i+Tyqfrwi?= =?utf-8?q?CxjK3hqrqj6lj5wqfwqzNZ1BbhebwdCzU/DErxoNRyyEpP6rancpDKgx9eL5gOhCx?= =?utf-8?q?tRsGZ+goQ21j?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9d3644af-8ec9-4561-5314-08dd20390888 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8459.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2024 14:25:48.6747 (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: YCLNDlnAgNJO/4hlzFzj9MFUGcOIi6eEGe2m6QJwJx1yD8xjIMhzTL/lAzU+e7A27J6Yd1MTcY1ANdPCpwk7RQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8950 Previously there was discussion on using "feature-controller" or adding a specific node to group the fuse information for U-Boot to parse and update node. But rejected by DT maintainer(Rob). Since the STM32 engineers added access controller concept and landed the support in Linux Kernel, reuse the concept for i.MX. i.MX OCOTP eFuse has some bits to indicate a specific periphral or function is avaiable for current chip, for example i.MX93 has variants that not have NPU. So introduce '#access-controller-cells' for OCOTP, and add "#access-controllers = <&ocotp [gate_index]>" for periphrals that needs accessing control checking. In OCOTP driver, the nodes under "/" will be iterated, and checked if property "#access-controllers" exsits. If not allow access, detach the node. In the end, cpu nodes should still be handled by bootloader. And I may also update i.MX8M to use same method to support variants if this patchset is good. Signed-off-by: Peng Fan --- Changes in v3: - Add A-b for patch 1 - Use scoped API when iterate nodes and address build warning in patch 2 - I am also thinking that to drop patch 2 to let bootloader to iterate the nodes that have access-controllers property and update the nodes before booting the kernel. Then just need patch 1 for the binding updates. Anyway, comments are welcomed. - Link to v2: https://lore.kernel.org/r/20241217-imx-ocotp-v2-0-3faa6cbff41b@nxp.com Changes in v2: - Add R-b for patch 1 - Use '/' root node instead of '/soc' or '/soc@0' for patch 2 - Link to v1: https://lore.kernel.org/r/20241212-imx-ocotp-v1-0-198bb0af86a0@nxp.com --- Peng Fan (2): dt-bindings: nvmem: imx-ocotp: Introduce #access-controller-cells nvmem: imx-ocotp-ele: Support accessing controller for i.MX9 .../devicetree/bindings/nvmem/imx-ocotp.yaml | 5 + drivers/nvmem/imx-ocotp-ele.c | 183 ++++++++++++++++++++- include/dt-bindings/nvmem/fsl,imx93-ocotp.h | 24 +++ include/dt-bindings/nvmem/fsl,imx95-ocotp.h | 43 +++++ 4 files changed, 254 insertions(+), 1 deletion(-) --- base-commit: 6d13015b67d58ddba56631c56e0a6f376ade0867 change-id: 20241212-imx-ocotp-cbef304140f5 Best regards,