From patchwork Wed Feb 28 08:13:55 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: 13574993 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 BCD71C54E41 for ; Wed, 28 Feb 2024 08:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8ByqvKRETK95CHrx+J83nkUWWuGMRxpRh2yb5cHb7mA=; b=IkPRrDxkqIH9pv 6eg9b9Tyf9077j1ltFcAdRiVkAy7HTbd01EPRYBkrj6HYDwf/YnecHQfDAXcoP8L06Zm593N8ur+k tq0nZj48c+ymV+hbfpiI4grHw0SkjiUXDQWGVnznzTCDewbHEhGBQ+nG5EsbWf/HCYzUJPmYX6/l4 wNiMaFvfYhfaI0pX5AbqxGFtoxEB8oJtMrGt23/stw0cTH9G0oeMsGJz/7MM+JLg4YaRLUeJNN2HC qQPrJ4nXBqOVebg5PWpo0Q0MYGJPmcD5BharESfCt5tE8yW5dcrYeLVmHvV8pNIc1XmBg2PtXqi7X 0GLG3Dp1eW/om9RPikqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfEx7-00000008PsM-35Vx; Wed, 28 Feb 2024 08:06:09 +0000 Received: from mail-am6eur05on20600.outbound.protection.outlook.com ([2a01:111:f403:2612::600] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfEww-00000008Pnx-2jIl for linux-arm-kernel@lists.infradead.org; Wed, 28 Feb 2024 08:05:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ipqUbkjE8EAiZppQKK5yBPzhzydqlngyuJbT5HLjQfZ7cYrZ4k9lptAz93nhSmei5eV5Ama+l0r13yxw0qX34mgOLPy5spym8IrrpbSmah58VIB9WhLzdSnuplp0UUCaEVpO6WUrOMOWtkCkM9h2jTfmVk3s9cfnoL2//E7nrJTbyZ26sYq3NIAA+BijDYPp7q/fnoqp+7m712G/6TLJ3xjXk0h31zJYHT7Jqs42XaYbsytNXrAMXus6DQVNNxWxKiCPCxhHxlDdR89NSKwOlOE5sTOJmbRoqhQyofwiAxnyL/9o3Y83HDU1StWTOqODmFVYxfeZkDZxFZo70vYw6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U/Co6lVfHaDQTe/e59TK4ft18fKWGtwTJvfLgf35Yws=; b=jCjC/iB0pQAsBex2AVyhhlFwFgqlWb0YDzONcE8LuLXs59ds9ml57/2gjCvdTS5RCam+225Ixn7R0kOfhrxZT4Ul1ZsO3XwMnfXPT0sjhzGtf8Z7FJvOvvzba5jQV+f/bPRWLGDwECwd5bYinQ3E/U/DQm1fLruFImR3wAse+VbLbt/z65v3KUpASc7nXFbGjOE4oK2wJ8oUnUTdtSo6ZPZ5xPKCPoZXmVMTdHLB1Zv65Ul/8yJWX+NqUSxQ+ILzj7l/Za6IHHPLRHYvaRY/0Y7fp9yWLxb84OjFszpogAOY1ck0LS3JgeppwzoY/OMjwuf5oELb/TgALqjRSQMQpQ== 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=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U/Co6lVfHaDQTe/e59TK4ft18fKWGtwTJvfLgf35Yws=; b=RPpkq7oAelT/vwYNI448eKewKpqlB5/cCgBQEbEw/5qDIFgeFUQ+qJDlz5NHx/R5WtgkPqpYYQUCwTatjRhSWJveAnC4ksAQme1vwRpF3wN995cAAMCgd3uMjvsNiNk9zUSkUNnN2nChCvm1lX7CwlXggt0ZOJpV6QI/5Bd7MZ8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by VI1PR04MB9858.eurprd04.prod.outlook.com (2603:10a6:800:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Wed, 28 Feb 2024 08:05:53 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::1232:ed97:118f:72fd]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::1232:ed97:118f:72fd%4]) with mapi id 15.20.7316.034; Wed, 28 Feb 2024 08:05:53 +0000 From: "Peng Fan (OSS)" To: srinivas.kandagatla@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, imx@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: [PATCH 2/2] nvmem: imx-ocotp-ele: support i.MX95 Date: Wed, 28 Feb 2024 16:13:55 +0800 Message-Id: <20240228081355.1627744-2-peng.fan@oss.nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20240228081355.1627744-1-peng.fan@oss.nxp.com> References: <20240228081355.1627744-1-peng.fan@oss.nxp.com> X-ClientProxiedBy: SG3P274CA0007.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::19) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|VI1PR04MB9858:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b9363ea-8661-4f57-0a84-08dc38341574 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F7VQP42jEb/+6kldNwla/TExPr1TXp2e/HGAhAFKBAj1Oyc9U+uEDlRQXBXd3iwWiYC7AeBt383YTHAUTk+QUqsWPtq6ue5OzSuHsECJ6SfvY6aqs9J/qpTdfE1oj/CcDId10pMhNqf4UvWwZ/7IrktxIKT3Ai8dtzHx0vEAlnBkx2+Qn3+pNlFDhUXRa1mn/2fPzlruTmhR7OAs9kNhaVBSFUvc+/8AEc8SKY1XLav+9lz3Z7RI4yjPzPqeaMJ/eb8Y6XrUmlDd0Tb95H3973wh+NJmIp26PNAJ2XJ+L+ZMC52peaPY3jLrA97SAThtCaPidx6u1d93+y8ZxC1FknmqPaUCj1gSWoHwQBS2XDB/Ppvj70zgleZ8URqjlKGyBa1lqSNu3Wj6mufWKiIzEAx/uBoVkoPm3UYleG7LNMsREn+oXEMAqh6oeMuXOHug/eIZgVLHAG+5CB9ecR0xkr1HTJj1SEAyHe/g4CEuh1UL4rCOIpCaIc3liEk6IixH+1nT8I2gzHB8Kh7WD7/WBw3JYTeZ8mKl/wnN3x7VLI1LqvsaPe3pzL67znZ+DPxPEs/W/v/nYsLsZVP1UeDWhRi6jj/zTBQi/6IEA/UAgEiIej2Zm4nePjMFa0HkJ/H3wkZcdfT45+siMYlK2nEHAhyK03xpz2JWrJi6vaMaYG0pVp6oE9kkQ9e8dfDwTjQU++dKuuPJb7GZn3wAy+6o6sv+f7BdeZ31ibVKBvjSJdw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: stqzK8AMZ5Wp/ckgBU4SFwZfydWBtC5SkZfD882OF9HbIOXir0pPhBXlYsrnR0h9Xf6eiNBJ+gi0pjbC04Q1isTUB9cWn2Z7Sb6U6azyo64ylHkOtO19LUxx7lEiJT/1iV6zeK4tPo4gayxAn7HBkVWHYah4HmNzVVs1ZtaLD0FqwLBBLkZ7sCKQ/XM1T5FVkExBlh1Ui2MTAY2Gb1lW0pAJSsxA0Yvxaz20FwbiBSXw1BVGXJPniH9jcQ1KG6dolNh0NzkMNEtJazqMesWCSVxmzBltCDSLU/pOkd5v3cL2CKvLou/lf8X+rZHIqAYGoO2L2wRFEfCX6u7qDY2P0smFBE4IYQEsGzxHDbrbPsiTx1u9+4+IaWt3Vs1IU+AvIFjGNvTjKE4s7vVf854I+wmxU9eIusKd2p/zFXD18OOmtXb9tReQFHmBTEhSYV+gEGVo+D4QejE49TBhFVezjAahQ4Re0fBLBCKkW/0J0dHF418FzkvHgH7KIYritNO/ZSRY6YajWNvNlBfHSDPEb/87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X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b9363ea-8661-4f57-0a84-08dc38341574 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2024 08:05:53.1997 (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: UYDcb083oVkM82BtV/vfdAu9I3VX1+bnp18qoPVBVkkJzEZvEVdyom11sFRWGgH7c8QJsKrQ8o1GT4rC32wArg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9858 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240228_000558_719237_164A2288 X-CRM114-Status: GOOD ( 12.07 ) 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.MX95 OCOTP has same accessing method, so add an entry for i.MX95, but some fuse has ECC feature, so only read out the lower 16bits for ECC fuses. Signed-off-by: Peng Fan --- drivers/nvmem/imx-ocotp-ele.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c index cf920542f939..4f22310920a2 100644 --- a/drivers/nvmem/imx-ocotp-ele.c +++ b/drivers/nvmem/imx-ocotp-ele.c @@ -14,8 +14,9 @@ #include enum fuse_type { - FUSE_FSB = 1, - FUSE_ELE = 2, + FUSE_FSB = BIT(0), + FUSE_ELE = BIT(1), + FUSE_ECC = BIT(2), FUSE_INVALID = -1 }; @@ -93,7 +94,10 @@ static int imx_ocotp_reg_read(void *context, unsigned int offset, void *val, siz continue; } - *buf++ = readl_relaxed(reg + (i << 2)); + if (type | FUSE_ECC) + *buf++ = readl_relaxed(reg + (i << 2)) & GENMASK(15, 0); + else + *buf++ = readl_relaxed(reg + (i << 2)); } memcpy(val, (u8 *)p, bytes); @@ -155,8 +159,30 @@ static const struct ocotp_devtype_data imx93_ocotp_data = { }, }; +static const struct ocotp_devtype_data imx95_ocotp_data = { + .reg_off = 0x8000, + .reg_read = imx_ocotp_reg_read, + .size = 2048, + .num_entry = 12, + .entry = { + { 0, 1, FUSE_FSB | FUSE_ECC }, + { 7, 1, FUSE_FSB | FUSE_ECC }, + { 9, 3, FUSE_FSB | FUSE_ECC }, + { 12, 24, FUSE_FSB }, + { 36, 2, FUSE_FSB | FUSE_ECC }, + { 38, 14, FUSE_FSB }, + { 63, 1, FUSE_ELE }, + { 128, 16, FUSE_ELE }, + { 188, 1, FUSE_ELE }, + { 317, 2, FUSE_FSB | FUSE_ECC }, + { 320, 7, FUSE_FSB }, + { 328, 184, FUSE_FSB } + }, +}; + static const struct of_device_id imx_ele_ocotp_dt_ids[] = { { .compatible = "fsl,imx93-ocotp", .data = &imx93_ocotp_data, }, + { .compatible = "fsl,imx95-ocotp", .data = &imx95_ocotp_data, }, {}, }; MODULE_DEVICE_TABLE(of, imx_ele_ocotp_dt_ids);