Linux-Crypto Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] crypto: caam - make soc match data optional
@ 2020-05-16  4:23 Andrey Smirnov
  2020-05-16 16:42 ` Chris Healy
  2020-05-18 18:59 ` Horia Geantă
  0 siblings, 2 replies; 4+ messages in thread
From: Andrey Smirnov @ 2020-05-16  4:23 UTC (permalink / raw)
  To: linux-crypto
  Cc: Andrey Smirnov, Chris Healy, Horia Geantă,
	Herbert Xu, Fabio Estevam, linux-imx, linux-kernel

Vyrbrid devices don't have any clock that need to be taken care of, so
make clock data optional on i.MX.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: Horia Geantă <horia.geanta@nxp.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: linux-imx@nxp.com
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 drivers/crypto/caam/ctrl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 4fcdd262e581..6aba430793cc 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -630,12 +630,7 @@ static int caam_probe(struct platform_device *pdev)
 	imx_soc_match = soc_device_match(caam_imx_soc_table);
 	caam_imx = (bool)imx_soc_match;

-	if (imx_soc_match) {
-		if (!imx_soc_match->data) {
-			dev_err(dev, "No clock data provided for i.MX SoC");
-			return -EINVAL;
-		}
-
+	if (imx_soc_match && imx_soc_match->data) {
 		ret = init_clocks(dev, imx_soc_match->data);
 		if (ret)
 			return ret;
--
2.21.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: caam - make soc match data optional
  2020-05-16  4:23 [PATCH] crypto: caam - make soc match data optional Andrey Smirnov
@ 2020-05-16 16:42 ` Chris Healy
  2020-05-18 18:59 ` Horia Geantă
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Healy @ 2020-05-16 16:42 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: linux-crypto, Horia Geantă,
	Herbert Xu, Fabio Estevam, linux-imx, linux-kernel

With all four of Vybrid VF610, i.MX6q, i.MX6qp, and i.MX8M, this patch
caused no regressions for me.  Additionally, with the VF610 and a
follow on devicetree patch, the CAAM is detected and works.

Tested by: Chris Healy <cphealy@gmail.com>

On Fri, May 15, 2020 at 9:23 PM Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
>
> Vyrbrid devices don't have any clock that need to be taken care of, so
> make clock data optional on i.MX.
>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: Horia Geantă <horia.geanta@nxp.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: linux-imx@nxp.com
> Cc: linux-crypto@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  drivers/crypto/caam/ctrl.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
> index 4fcdd262e581..6aba430793cc 100644
> --- a/drivers/crypto/caam/ctrl.c
> +++ b/drivers/crypto/caam/ctrl.c
> @@ -630,12 +630,7 @@ static int caam_probe(struct platform_device *pdev)
>         imx_soc_match = soc_device_match(caam_imx_soc_table);
>         caam_imx = (bool)imx_soc_match;
>
> -       if (imx_soc_match) {
> -               if (!imx_soc_match->data) {
> -                       dev_err(dev, "No clock data provided for i.MX SoC");
> -                       return -EINVAL;
> -               }
> -
> +       if (imx_soc_match && imx_soc_match->data) {
>                 ret = init_clocks(dev, imx_soc_match->data);
>                 if (ret)
>                         return ret;
> --
> 2.21.3

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: caam - make soc match data optional
  2020-05-16  4:23 [PATCH] crypto: caam - make soc match data optional Andrey Smirnov
  2020-05-16 16:42 ` Chris Healy
@ 2020-05-18 18:59 ` Horia Geantă
  2020-05-20  3:16   ` Andrey Smirnov
  1 sibling, 1 reply; 4+ messages in thread
From: Horia Geantă @ 2020-05-18 18:59 UTC (permalink / raw)
  To: Andrey Smirnov, linux-crypto
  Cc: Chris Healy, Herbert Xu, Fabio Estevam, dl-linux-imx, linux-kernel

On 5/16/2020 7:23 AM, Andrey Smirnov wrote:
> Vyrbrid devices don't have any clock that need to be taken care of, so
> make clock data optional on i.MX.
> 
Vybrid Security RM states that IPG clock used by CAAM
can be gated by CCM_CCGR11[CG176].

Clock driver needs to be updated accordingly,
and so will CAAM driver and DT node.

I don't have a board at hand, so patch below is not tested.

Horia

------ >8 ------

Subject: [PATCH] clk: imx: vf610: add CAAM clock

According to Vybrid Security RM, CCM_CCGR11[CG176] can be used to
gate CAAM ipg clock.

Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
 drivers/clk/imx/clk-vf610.c             | 2 ++
 include/dt-bindings/clock/vf610-clock.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-vf610.c b/drivers/clk/imx/clk-vf610.c
index cd04e7dc1878..4f3066cf1b89 100644
--- a/drivers/clk/imx/clk-vf610.c
+++ b/drivers/clk/imx/clk-vf610.c
@@ -439,6 +439,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
        clk[VF610_CLK_DAP] = imx_clk_gate("dap", "platform_bus", CCM_CCSR, 24);
        clk[VF610_CLK_OCOTP] = imx_clk_gate("ocotp", "ipg_bus", CCM_CCGR6, CCM_CCGRx_CGn(5));

+       clk[VF610_CLK_CAAM] = imx_clk_gate2("caam", "ipg_bus", CCM_CCGR11, CCM_CCGRx_CGn(0));
+
        imx_check_clocks(clk, ARRAY_SIZE(clk));

        clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]);
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
index 95394f35a74a..0f2d60e884dc 100644
--- a/include/dt-bindings/clock/vf610-clock.h
+++ b/include/dt-bindings/clock/vf610-clock.h
@@ -195,6 +195,7 @@
 #define VF610_CLK_WKPU                 186
 #define VF610_CLK_TCON0                        187
 #define VF610_CLK_TCON1                        188
-#define VF610_CLK_END                  189
+#define VF610_CLK_CAAM                 189
+#define VF610_CLK_END                  190

 #endif /* __DT_BINDINGS_CLOCK_VF610_H */
--
2.17.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: caam - make soc match data optional
  2020-05-18 18:59 ` Horia Geantă
@ 2020-05-20  3:16   ` Andrey Smirnov
  0 siblings, 0 replies; 4+ messages in thread
From: Andrey Smirnov @ 2020-05-20  3:16 UTC (permalink / raw)
  To: Horia Geantă
  Cc: linux-crypto, Chris Healy, Herbert Xu, Fabio Estevam,
	dl-linux-imx, linux-kernel

On Mon, May 18, 2020 at 6:59 PM Horia Geantă <horia.geanta@nxp.com> wrote:
>
> On 5/16/2020 7:23 AM, Andrey Smirnov wrote:
> > Vyrbrid devices don't have any clock that need to be taken care of, so
> > make clock data optional on i.MX.
> >
> Vybrid Security RM states that IPG clock used by CAAM
> can be gated by CCM_CCGR11[CG176].
>

Cool, looks like I missed this when I was looking through RM.

> Clock driver needs to be updated accordingly,
> and so will CAAM driver and DT node.
>
> I don't have a board at hand, so patch below is not tested.
>

I'll take it from here and test/submit appropriate patches. Thanks!

> Horia
>
> ------ >8 ------
>
> Subject: [PATCH] clk: imx: vf610: add CAAM clock
>
> According to Vybrid Security RM, CCM_CCGR11[CG176] can be used to
> gate CAAM ipg clock.
>
> Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
> ---
>  drivers/clk/imx/clk-vf610.c             | 2 ++
>  include/dt-bindings/clock/vf610-clock.h | 3 ++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clk/imx/clk-vf610.c b/drivers/clk/imx/clk-vf610.c
> index cd04e7dc1878..4f3066cf1b89 100644
> --- a/drivers/clk/imx/clk-vf610.c
> +++ b/drivers/clk/imx/clk-vf610.c
> @@ -439,6 +439,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node)
>         clk[VF610_CLK_DAP] = imx_clk_gate("dap", "platform_bus", CCM_CCSR, 24);
>         clk[VF610_CLK_OCOTP] = imx_clk_gate("ocotp", "ipg_bus", CCM_CCGR6, CCM_CCGRx_CGn(5));
>
> +       clk[VF610_CLK_CAAM] = imx_clk_gate2("caam", "ipg_bus", CCM_CCGR11, CCM_CCGRx_CGn(0));
> +
>         imx_check_clocks(clk, ARRAY_SIZE(clk));
>
>         clk_set_parent(clk[VF610_CLK_QSPI0_SEL], clk[VF610_CLK_PLL1_PFD4]);
> diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h
> index 95394f35a74a..0f2d60e884dc 100644
> --- a/include/dt-bindings/clock/vf610-clock.h
> +++ b/include/dt-bindings/clock/vf610-clock.h
> @@ -195,6 +195,7 @@
>  #define VF610_CLK_WKPU                 186
>  #define VF610_CLK_TCON0                        187
>  #define VF610_CLK_TCON1                        188
> -#define VF610_CLK_END                  189
> +#define VF610_CLK_CAAM                 189
> +#define VF610_CLK_END                  190
>
>  #endif /* __DT_BINDINGS_CLOCK_VF610_H */
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16  4:23 [PATCH] crypto: caam - make soc match data optional Andrey Smirnov
2020-05-16 16:42 ` Chris Healy
2020-05-18 18:59 ` Horia Geantă
2020-05-20  3:16   ` Andrey Smirnov

Linux-Crypto Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-crypto/0 linux-crypto/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-crypto linux-crypto/ https://lore.kernel.org/linux-crypto \
		linux-crypto@vger.kernel.org
	public-inbox-index linux-crypto

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-crypto


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git