Linux-Crypto Archive mirror
 help / color / mirror / Atom feed
From: Pankaj Gupta <pankaj.gupta@nxp.com>
To: Gaurav Jain <gaurav.jain@nxp.com>,
	Horia Geanta <horia.geanta@nxp.com>,
	Varun Sethi <V.Sethi@nxp.com>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Iuliana Prodan <iuliana.prodan@nxp.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH v3 1/2] caam: init-clk based on caam-page0-access
Date: Mon, 13 May 2024 06:09:49 +0000	[thread overview]
Message-ID: <AM9PR04MB86046A94F0CF06AFFE5DE3B895E22@AM9PR04MB8604.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20240416053303.421259-2-pankaj.gupta@nxp.com>

If there are no further comments, request Herbert to merge the patch-set.

Regards
Pankaj


> -----Original Message-----
> From: Pankaj Gupta
> Sent: Tuesday, April 16, 2024 11:05 AM
> To: Gaurav Jain <gaurav.jain@nxp.com>; Horia Geanta
> <horia.geanta@nxp.com>; Varun Sethi <V.Sethi@nxp.com>;
> herbert@gondor.apana.org.au; davem@davemloft.net; Iuliana Prodan
> <iuliana.prodan@nxp.com>; linux-crypto@vger.kernel.org; linux-
> kernel@vger.kernel.org; dl-linux-imx <linux-imx@nxp.com>
> Cc: Pankaj Gupta <pankaj.gupta@nxp.com>
> Subject: [PATCH v3 1/2] caam: init-clk based on caam-page0-access
> 
> 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 <pankaj.gupta@nxp.com>
> ---
>  drivers/crypto/caam/ctrl.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index
> bdf367f3f679..247d42aa32df 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)
> @@ -889,17 +895,25 @@ static int caam_probe(struct platform_device
> *pdev)
> 
>  		reg_access = !ctrlpriv->optee_en;
> 
> -		if (!imx_soc_match->data) {
> +		if (imx_soc_match->data) {
>  			dev_err(dev, "No clock data provided for i.MX SoC");
>  			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);
> --
> 2.34.1


  parent reply	other threads:[~2024-05-13  6:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  5:33 [PATCH v3 0/2] caam: init-clk based on caam-page0-access Pankaj Gupta
2024-04-16  5:33 ` [PATCH v3 1/2] " Pankaj Gupta
2024-04-18 14:49   ` Horia Geanta
2024-04-19  5:29     ` Pankaj Gupta
2024-05-13  6:09   ` Pankaj Gupta [this message]
2024-04-16  5:33 ` [PATCH v3 2/2] drivers: crypto: caam: i.MX8ULP donot have CAAM page0 access Pankaj Gupta
2024-04-18 14:53   ` Horia Geanta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM9PR04MB86046A94F0CF06AFFE5DE3B895E22@AM9PR04MB8604.eurprd04.prod.outlook.com \
    --to=pankaj.gupta@nxp.com \
    --cc=V.Sethi@nxp.com \
    --cc=davem@davemloft.net \
    --cc=gaurav.jain@nxp.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horia.geanta@nxp.com \
    --cc=iuliana.prodan@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).