[PATCH] crypto: caam: check caam_emi_slow instead of re-lookup platform

2016-11-28 Thread Marcus Folkesson
Signed-off-by: Marcus Folkesson <marcus.folkes...@gmail.com>
---

Russel King, sorry, I did not see your comment until now.

 drivers/crypto/caam/ctrl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 5abaf3743b86..4993c90ceb3f 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -329,7 +329,7 @@ static int caam_remove(struct platform_device *pdev)
clk_disable_unprepare(ctrlpriv->caam_ipg);
clk_disable_unprepare(ctrlpriv->caam_mem);
clk_disable_unprepare(ctrlpriv->caam_aclk);
-   if (!of_machine_is_compatible("fsl,imx6ul"))
+   if (ctrlpriv->caam_emi_slow)
clk_disable_unprepare(ctrlpriv->caam_emi_slow);
return 0;
 }
@@ -511,7 +511,7 @@ static int caam_probe(struct platform_device *pdev)
goto disable_caam_mem;
}
 
-   if (!of_machine_is_compatible("fsl,imx6ul")) {
+   if (ctrlpriv->caam_emi_slow) {
ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
if (ret < 0) {
dev_err(>dev, "can't enable CAAM emi slow clock: 
%d\n",
@@ -833,7 +833,7 @@ caam_remove:
 iounmap_ctrl:
iounmap(ctrl);
 disable_caam_emi_slow:
-   if (!of_machine_is_compatible("fsl,imx6ul"))
+   if (ctrlpriv->caam_emi_slow)
clk_disable_unprepare(ctrlpriv->caam_emi_slow);
 disable_caam_aclk:
clk_disable_unprepare(ctrlpriv->caam_aclk);
-- 
2.11.0.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RESEND][PATCH] crypto: caam: add support for iMX6UL

2016-10-17 Thread Marcus Folkesson
i.MX6UL does only require three clocks to enable CAAM module.

Signed-off-by: Marcus Folkesson <marcus.folkes...@gmail.com>
Acked-by: Rob Herring <r...@kernel.org>
Reviewed-by: Horia Geantă <horia.gea...@nxp.com>
---
 .../devicetree/bindings/crypto/fsl-sec4.txt| 20 +
 drivers/crypto/caam/ctrl.c | 35 --
 2 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt 
b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index adeca34..10a425f 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -123,6 +123,9 @@ PROPERTIES
 
 
 EXAMPLE
+
+iMX6QDL/SX requires four clocks
+
crypto@30 {
compatible = "fsl,sec-v4.0";
fsl,sec-era = <2>;
@@ -139,6 +142,23 @@ EXAMPLE
clock-names = "mem", "aclk", "ipg", "emi_slow";
};
 
+
+iMX6UL does only require three clocks
+
+   crypto: caam@214 {
+   compatible = "fsl,sec-v4.0";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   reg = <0x214 0x3c000>;
+   ranges = <0 0x214 0x3c000>;
+   interrupts = ;
+
+   clocks = < IMX6UL_CLK_CAAM_MEM>,
+< IMX6UL_CLK_CAAM_ACLK>,
+< IMX6UL_CLK_CAAM_IPG>;
+   clock-names = "mem", "aclk", "ipg";
+   };
+
 =
 Job Ring (JR) Node
 
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 0ec112e..5abaf37 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -329,8 +329,8 @@ static int caam_remove(struct platform_device *pdev)
clk_disable_unprepare(ctrlpriv->caam_ipg);
clk_disable_unprepare(ctrlpriv->caam_mem);
clk_disable_unprepare(ctrlpriv->caam_aclk);
-   clk_disable_unprepare(ctrlpriv->caam_emi_slow);
-
+   if (!of_machine_is_compatible("fsl,imx6ul"))
+   clk_disable_unprepare(ctrlpriv->caam_emi_slow);
return 0;
 }
 
@@ -481,14 +481,16 @@ static int caam_probe(struct platform_device *pdev)
}
ctrlpriv->caam_aclk = clk;
 
-   clk = caam_drv_identify_clk(>dev, "emi_slow");
-   if (IS_ERR(clk)) {
-   ret = PTR_ERR(clk);
-   dev_err(>dev,
-   "can't identify CAAM emi_slow clk: %d\n", ret);
-   return ret;
+   if (!of_machine_is_compatible("fsl,imx6ul")) {
+   clk = caam_drv_identify_clk(>dev, "emi_slow");
+   if (IS_ERR(clk)) {
+   ret = PTR_ERR(clk);
+   dev_err(>dev,
+   "can't identify CAAM emi_slow clk: %d\n", ret);
+   return ret;
+   }
+   ctrlpriv->caam_emi_slow = clk;
}
-   ctrlpriv->caam_emi_slow = clk;
 
ret = clk_prepare_enable(ctrlpriv->caam_ipg);
if (ret < 0) {
@@ -509,11 +511,13 @@ static int caam_probe(struct platform_device *pdev)
goto disable_caam_mem;
}
 
-   ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
-   if (ret < 0) {
-   dev_err(>dev, "can't enable CAAM emi slow clock: %d\n",
-   ret);
-   goto disable_caam_aclk;
+   if (!of_machine_is_compatible("fsl,imx6ul")) {
+   ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
+   if (ret < 0) {
+   dev_err(>dev, "can't enable CAAM emi slow clock: 
%d\n",
+   ret);
+   goto disable_caam_aclk;
+   }
}
 
/* Get configuration properties from device tree */
@@ -829,7 +833,8 @@ caam_remove:
 iounmap_ctrl:
iounmap(ctrl);
 disable_caam_emi_slow:
-   clk_disable_unprepare(ctrlpriv->caam_emi_slow);
+   if (!of_machine_is_compatible("fsl,imx6ul"))
+   clk_disable_unprepare(ctrlpriv->caam_emi_slow);
 disable_caam_aclk:
clk_disable_unprepare(ctrlpriv->caam_aclk);
 disable_caam_mem:
-- 
2.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] crypto: caam: add support for iMX6UL

2016-10-04 Thread Marcus Folkesson
i.MX6UL does only require three clocks to enable CAAM module.

Signed-off-by: Marcus Folkesson <marcus.folkes...@gmail.com>
---
 .../devicetree/bindings/crypto/fsl-sec4.txt| 20 +
 drivers/crypto/caam/ctrl.c | 35 --
 2 files changed, 40 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt 
b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
index adeca34..6617e24 100644
--- a/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
+++ b/Documentation/devicetree/bindings/crypto/fsl-sec4.txt
@@ -123,6 +123,9 @@ PROPERTIES
 
 
 EXAMPLE
+
+i.MX6Q/DL/SX requires four clocks
+
crypto@30 {
compatible = "fsl,sec-v4.0";
fsl,sec-era = <2>;
@@ -139,6 +142,23 @@ EXAMPLE
clock-names = "mem", "aclk", "ipg", "emi_slow";
};
 
+
+i.MX6UL does only require three clocks
+
+   crypto: caam@214 {
+   compatible = "fsl,sec-v4.0";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   reg = <0x214 0x3c000>;
+   ranges = <0 0x214 0x3c000>;
+   interrupts = ;
+
+   clocks = < IMX6UL_CLK_CAAM_MEM>,
+< IMX6UL_CLK_CAAM_ACLK>,
+< IMX6UL_CLK_CAAM_IPG>;
+   clock-names = "mem", "aclk", "ipg";
+   };
+
 =
 Job Ring (JR) Node
 
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 0ec112e..5abaf37 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -329,8 +329,8 @@ static int caam_remove(struct platform_device *pdev)
clk_disable_unprepare(ctrlpriv->caam_ipg);
clk_disable_unprepare(ctrlpriv->caam_mem);
clk_disable_unprepare(ctrlpriv->caam_aclk);
-   clk_disable_unprepare(ctrlpriv->caam_emi_slow);
-
+   if (!of_machine_is_compatible("fsl,imx6ul"))
+   clk_disable_unprepare(ctrlpriv->caam_emi_slow);
return 0;
 }
 
@@ -481,14 +481,16 @@ static int caam_probe(struct platform_device *pdev)
}
ctrlpriv->caam_aclk = clk;
 
-   clk = caam_drv_identify_clk(>dev, "emi_slow");
-   if (IS_ERR(clk)) {
-   ret = PTR_ERR(clk);
-   dev_err(>dev,
-   "can't identify CAAM emi_slow clk: %d\n", ret);
-   return ret;
+   if (!of_machine_is_compatible("fsl,imx6ul")) {
+   clk = caam_drv_identify_clk(>dev, "emi_slow");
+   if (IS_ERR(clk)) {
+   ret = PTR_ERR(clk);
+   dev_err(>dev,
+   "can't identify CAAM emi_slow clk: %d\n", ret);
+   return ret;
+   }
+   ctrlpriv->caam_emi_slow = clk;
}
-   ctrlpriv->caam_emi_slow = clk;
 
ret = clk_prepare_enable(ctrlpriv->caam_ipg);
if (ret < 0) {
@@ -509,11 +511,13 @@ static int caam_probe(struct platform_device *pdev)
goto disable_caam_mem;
}
 
-   ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
-   if (ret < 0) {
-   dev_err(>dev, "can't enable CAAM emi slow clock: %d\n",
-   ret);
-   goto disable_caam_aclk;
+   if (!of_machine_is_compatible("fsl,imx6ul")) {
+   ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
+   if (ret < 0) {
+   dev_err(>dev, "can't enable CAAM emi slow clock: 
%d\n",
+   ret);
+   goto disable_caam_aclk;
+   }
}
 
/* Get configuration properties from device tree */
@@ -829,7 +833,8 @@ caam_remove:
 iounmap_ctrl:
iounmap(ctrl);
 disable_caam_emi_slow:
-   clk_disable_unprepare(ctrlpriv->caam_emi_slow);
+   if (!of_machine_is_compatible("fsl,imx6ul"))
+   clk_disable_unprepare(ctrlpriv->caam_emi_slow);
 disable_caam_aclk:
clk_disable_unprepare(ctrlpriv->caam_aclk);
 disable_caam_mem:
-- 
2.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html