Skip to contentSkip to conversation

crypto: caam - make soc match data optional

PATCH In review Andrey Smirnov 3 participants 4 messages May 16, 2020 – May 20, 2020

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: caam - make soc match data optional

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

---
 drivers/crypto/caam/ctrl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/crypto/caam/ctrl.c +1 -6
index 4fcdd262e581..6aba430793cc 100644
@@ -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

#1 lore raw

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 <[email protected]>

Quoted 36 lines · Andrey Smirnov

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

---
 drivers/crypto/caam/ctrl.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/crypto/caam/ctrl.c +1 -7
index 4fcdd262e581..6aba430793cc 100644
@@ -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

maintainer
#2 lore raw
In reply to Andrey Smirnov
Quoted 3 lines · Andrey Smirnov

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.

---
 drivers/clk/imx/clk-vf610.c             | 2 ++
 include/dt-bindings/clock/vf610-clock.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-vf610.c +2 -0
index cd04e7dc1878..4f3066cf1b89 100644
@@ -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]);
include/dt-bindings/clock/vf610-clock.h +2 -1
index 95394f35a74a..0f2d60e884dc 100644
@@ -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

#3 lore raw
Quoted 8 lines · Horia Geantă
Quoted 3 lines · Andrey Smirnov

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.

Quoted 5 lines

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!

Quoted 43 lines

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.

---
 drivers/clk/imx/clk-vf610.c             | 2 ++
 include/dt-bindings/clock/vf610-clock.h | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/clk/imx/clk-vf610.c +2 -0
index cd04e7dc1878..4f3066cf1b89 100644
@@ -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]);
include/dt-bindings/clock/vf610-clock.h +2 -2
index 95394f35a74a..0f2d60e884dc 100644
@@ -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