From patchwork Mon Apr 29 06:28:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Gupta X-Patchwork-Id: 793157 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2082.outbound.protection.outlook.com [40.107.14.82]) (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 D47D614005; Mon, 29 Apr 2024 06:31:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.82 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714372299; cv=fail; b=GCaozbvUpMZi8SxJrT5mvntehfiYy5TvshtXodOEyMzdujkqJeQFPgYmyS1tuDk4W4MUsT9Ujd4JATw86aNc5ZuEmBq1NzRjDedB0FNg3HPECXtdoFX/Gsp7qMVNAVipWJkCBM0dBA+fZeB58nchBQSwh+/LZ45zBPAoVYKRhPs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714372299; c=relaxed/simple; bh=HZjnpdqoTXPEKvzwBPW1pKQHoSOt5dasS5atxl0MdOs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=l4UUhZODouQNwNPhLggW5lbNtIghM63bfwwcTEkvi6wZnGU4NdsRr1BsLyexQlGsPTClDd6b2KW4oVjncwF+5MQ6vqQm6k5UQ1vspD22qwaMeOtzfj7I1ai5OBM64Ktd+qFk0Tf0xOxgjSHZzP0+h7D2dob/IZ11msBGAMMgEk0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=DG5QgFq2; arc=fail smtp.client-ip=40.107.14.82 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="DG5QgFq2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cCCn/93S1nWNPO2Vdxr44vy8b3YObSqlFMEoWNAuJoNK4pG0aq6GcxgB4noBcR6FggNcgjWAWvllBpASCoKIfGdAJR2CUhKpYyC+JIOBLhxcQJAQbwITJlxNLhNY7aSXxivKrECdAFVvE8KV6Ice0DAfpSIUtTwaO6puu1OPvlL+pZckem4jQKAdIOwErd+KRqmfMpPxzr1qTL4XEQkmL2fNOQB0HA02nNFgofgGZIiZo7q1nxVZ2nlRYoLtVAIzWwHu37LMDh2ofhYBBsmN9ZrDkrlEpkl9Vx9CyC/a/qIl++NTy2pV6sh4vLT2tr1mLVmu3ti7655NXN/++ihndA== 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=908o77j8T4UJZ1C/rwaUWC06rj/MZNwWxqT9RoT1sSA=; b=DSMQ9+p2npZ6sPm51iZGBo4Eu0HVUERNMbDNZ1xUVIVc+jcgw0z9MgTetGqGZzHiuD1wqhRF1Qp4KrYhF2czoOhXbP7dWabnRxCQ2PABxoEqEHyNnu8/AvRpZKb2IoGkISZRPeG3TAGdkgU5Nm138btxm65OXRvjRLfQ7ArwbIAZs5d+NS/fNmDd4p1kG3GrHWFcR+37xb2J4QFR8jcrlpqEHr56fPWtPA20hEjALOVJArK4pRWAL9fgfOBMsIsOBGSyf8H3g8HkA2aX30AiYvnugrc/VFM407FzqQZfZPprkF+fMJ9gcdByoqXE5vbM/IgDfVd33jBqeEbJ6pMPTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=908o77j8T4UJZ1C/rwaUWC06rj/MZNwWxqT9RoT1sSA=; b=DG5QgFq2gvYb+wYprOqhJVZPQF3lP4q/hHydMDfzJNpyBmDfAK2pVbLz149y7V+ouyDOwRkn51w/t3pSz59lyxnanadhLnXtu0YJMC6TxXH6VZocR3iCn6zAn2mAN2XmBWZ0Jr7spLImJCWEALL9T89MF8n1IQ0bR0LgdWzanpQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21) by DUZPR04MB9919.eurprd04.prod.outlook.com (2603:10a6:10:4d9::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Mon, 29 Apr 2024 06:31:34 +0000 Received: from AM9PR04MB8604.eurprd04.prod.outlook.com ([fe80::33cc:db75:c850:63a4]) by AM9PR04MB8604.eurprd04.prod.outlook.com ([fe80::33cc:db75:c850:63a4%2]) with mapi id 15.20.7519.031; Mon, 29 Apr 2024 06:31:34 +0000 From: Pankaj Gupta To: gaurav.jain@nxp.com, horia.geanta@nxp.com, V.Sethi@nxp.com, herbert@gondor.apana.org.au, davem@davemloft.net, iuliana.prodan@nxp.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com Cc: Pankaj Gupta Subject: [PATCH v4 1/2] caam: init-clk based on caam-page0-access Date: Mon, 29 Apr 2024 11:58:52 +0530 Message-Id: <20240429062855.923595-3-pankaj.gupta@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240429062855.923595-1-pankaj.gupta@nxp.com> References: <20240429062855.923595-1-pankaj.gupta@nxp.com> X-ClientProxiedBy: SI2PR01CA0008.apcprd01.prod.exchangelabs.com (2603:1096:4:191::10) To AM9PR04MB8604.eurprd04.prod.outlook.com (2603:10a6:20b:43b::21) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8604:EE_|DUZPR04MB9919:EE_ X-MS-Office365-Filtering-Correlation-Id: 26355f26-3b23-4f37-e80b-08dc681603e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|52116005|1800799015|376005|366007|38350700005; X-Microsoft-Antispam-Message-Info: asfsM4KmqE+Id5OdNRZDHSV1wmkGqv/rcOK6ZGi50TLmeFu2ICmt2pMlgDZ3J4U3G2+xyFuQCXC1kKaJ4aRgGf0jOIwOPdcTC86jWlzaGfSDb7l3lIERLZhhiAwAuHRErffq9DtPn2vVIfuxVx6ecC0gjEH1yP15iLNsfvVDHaEWzEmmQQQjE1AlRIoXsTggLIWgGJHoTCxioHxfUz/JoXQIRmD+ZrXYVut4vZRNDBhlDURSOygi57t9wAZkPO59cFfdhQFnr4cs9uNQGzi0Z4avVH6iU+ET4RmRt1ZtYg3d8PYIIMH018pukKT9nm2WtEDavx8hm46BzICG1jXJcs0wA5iJUECng/tr6/pNTt2crrxTbYZVq4QqTN42UCy8HBwC+DrFcycDvvAKpv/BlPzxbQELppB8LLt78fCIaQ8UASHy6zUaI1nB5s44Kid8MhXc7dk1xfZFyOU3t1wIVmI1IWstgFJM6mvLPlbVibEkbzrPOrU+63JjMvMVcxiaL0d9sM0l+UqhE8FL9fIF4P4EtmaG9JEtDchX4MjrroqgdUOrURUf111mlmTrQV+Nuv1Z6wtI6FvmfDqIOB6wVYKvgSoLXR9/xGcFeUXoe4drs+leDfMVF7QRkYhqYr3KcxVZtnHvJ+BusScn+m+zVhLkAB/U4tADyCpZ9pmseZ88l7LUdzYr6IF/fXXHe47admGe2F1AW8y7JZOKkioL15niev0/r77gj+AmxKpgaV0nnsRhIS4uXk1VlUO/cU+/21YHJd/igv2TSh7KsLvMGFGWDsfZkCGGidV00Juola8Y2IcWQBaQyPLK7NnD5H0LAjLLVjGuR/aSeIUp1NIghfUyz57Q1f69IJNr49hDcixxWSYVzndmVbAymbaG60/oEQ/wTh9WuS8FzYTX53S+NMqbX3FB0pnmuLPcirfP/Fqkv26NGxWbYmDjE99f9RXoFEsOcNXqA+Z2+3yLMiySnJn8HWON+vMmbVI0qgpTEnlVshJYzWF2eLu1goub+hZkgMW4OU62qPL0JjVtArErcm8CLAldBFplJjxsssF1qbfbImyEzu952x/NoAJFdXJ5HY06MV+URgvU5i09JBVsrxtq9l1cNa1E/zJvcA0V5DQFNZRO4XdNOt6sWrS8CtvF1wB+G/Z309xCvgufwdDo5fd03kUnNvefHZYANvy6sRE+V2+LFglBBPFTPWjCDr3HLAp8k6twQJGlNH35SLUwCgCgdUthcjKFnILj++zyjkKMA6bMpyfn5/PN2jJnf9Dfm/ikUPsShwWhRMz8pdQY7sDLfDlipyGyBKVATV5JaMy1TuzxKLyBOMMGxHgqMEOaF9Jig/rqiv7iXdbXNankbA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8604.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(1800799015)(376005)(366007)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E5Z4jiNGsn/t1Kfnd5t7HrI+qY+m80iT8PmG+76M2DPDzPxlCItcP4yeIKdSH1kUD0NL36B1wM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yoLEYomv7wIXlWS0ufgrjrFctwoRc+MbhPnQovM8NsLa6pWDqPFpEoZlxVqOYV5EvFsrDhDpzhSj9dH4QFDrklbSC2BefrWwR5shF0BcNz0Y3bJkQJwgp9e0Ep7ALCEMZo8UkbX7Acss3/R2Q6GeIIX7cSuHH1KLaFouOsiVG1q17UpVEcppfGBfNovxOAN9/IXnyYJ3ivkIoKnsJjW1YxoxZTlamzRwuwkDjnPqglHtoGJfusM4wqEmjrm+YxWuijGa9XX11275ClVQgs3Wft/uCI8HlIwXRE7A6pGKdnZb6M9PaSNAVguJ7260iY3pSXdzkuBt2atXlUwqC03DoijoPvIF7dTVqT5W5YyQ1UeGL0W10ax9UTOkgsMt1bSyuepxwbGI0PpKRHyYNs+1MSLWjFia6eNjNmJ/rbawtReOpgleX21HQSPDV/Aj X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 26355f26-3b23-4f37-e80b-08dc681603e2 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8604.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 06:31:34.8272 (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: ttUqLv5opveEYOl6dAJIQKnIt8Zj0lMDGZ/8Y8ONq8cTra2rNKe4yDrr3cLXAHbk8tzopuD5cB0YeOdhivgxAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DUZPR04MB9919 CAAM clock initializat is done based on the basis of soc specific info stored in struct caam_imx_data: - caam-page0-access flag - num_clks CAAM driver needs to be aware of access rights to CAAM control page i.e., page0, to do things differently. Signed-off-by: Pankaj Gupta Reviewed-by: Gaurav Jain --- drivers/crypto/caam/ctrl.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index bdf367f3f679..02363c467cf3 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -512,6 +512,7 @@ static const struct of_device_id caam_match[] = { MODULE_DEVICE_TABLE(of, caam_match); struct caam_imx_data { + bool page0_access; const struct clk_bulk_data *clks; int num_clks; }; @@ -524,6 +525,7 @@ static const struct clk_bulk_data caam_imx6_clks[] = { }; static const struct caam_imx_data caam_imx6_data = { + .page0_access = true, .clks = caam_imx6_clks, .num_clks = ARRAY_SIZE(caam_imx6_clks), }; @@ -534,6 +536,7 @@ static const struct clk_bulk_data caam_imx7_clks[] = { }; static const struct caam_imx_data caam_imx7_data = { + .page0_access = true, .clks = caam_imx7_clks, .num_clks = ARRAY_SIZE(caam_imx7_clks), }; @@ -545,6 +548,7 @@ static const struct clk_bulk_data caam_imx6ul_clks[] = { }; static const struct caam_imx_data caam_imx6ul_data = { + .page0_access = true, .clks = caam_imx6ul_clks, .num_clks = ARRAY_SIZE(caam_imx6ul_clks), }; @@ -554,6 +558,7 @@ static const struct clk_bulk_data caam_vf610_clks[] = { }; static const struct caam_imx_data caam_vf610_data = { + .page0_access = true, .clks = caam_vf610_clks, .num_clks = ARRAY_SIZE(caam_vf610_clks), }; @@ -860,6 +865,7 @@ static int caam_probe(struct platform_device *pdev) int pg_size; int BLOCK_OFFSET = 0; bool reg_access = true; + const struct caam_imx_data *imx_soc_data; ctrlpriv = devm_kzalloc(&pdev->dev, sizeof(*ctrlpriv), GFP_KERNEL); if (!ctrlpriv) @@ -894,12 +900,20 @@ static int caam_probe(struct platform_device *pdev) return -EINVAL; } + imx_soc_data = imx_soc_match->data; + reg_access = reg_access && imx_soc_data->page0_access; + /* + * CAAM clocks cannot be controlled from kernel. + */ + if (!imx_soc_data->num_clks) + goto iomap_ctrl; + ret = init_clocks(dev, imx_soc_match->data); if (ret) return ret; } - +iomap_ctrl: /* Get configuration properties from device tree */ /* First, get register page */ ctrl = devm_of_iomap(dev, nprop, 0, NULL);