summaryrefslogtreecommitdiff
path: root/drivers/crypto/caam
diff options
context:
space:
mode:
authorAdrian Alonso <aalonso@freescale.com>2015-06-02 15:08:52 -0500
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commitcbf59093f9142ca570585d4bcafa4d22f20eea14 (patch)
treed6b2f64ff9485686f94e38e388cdcc56114dc60b /drivers/crypto/caam
parent0cb0698e58ebb70390ecb9b14e33823745cfd47d (diff)
MLK-11020: arm: imx: caam: imx7d caam_aclk clock dependency
* Add caam_aclk clock root dependency, imx7d caam ip module needs caam_aclk and caam_ipg clock signals to operate add additional clock signal. Signed-off-by: Adrian Alonso <aalonso@freescale.com> Signed-off-by: Dan Douglass <dan.douglass@freescale.com> [Octavian: since the clk API skips NULL args use a single disable label] Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r--drivers/crypto/caam/ctrl.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 0d5126e6b00f..e2ae60f63efb 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -513,7 +513,22 @@ static int caam_probe(struct platform_device *pdev)
return ret;
}
- /* imx7d only has one caam clock */
+ clk = caam_drv_identify_clk(&pdev->dev, "aclk");
+ if (IS_ERR(clk)) {
+ ret = PTR_ERR(clk);
+ dev_err(&pdev->dev,
+ "can't identify CAAM aclk clk: %d\n", ret);
+ goto disable_clocks;
+ }
+ ctrlpriv->caam_aclk = clk;
+
+ ret = clk_prepare_enable(ctrlpriv->caam_aclk);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "can't enable CAAM aclk clock: %d\n",
+ ret);
+ goto disable_clocks;
+ }
+
if (!(of_find_compatible_node(NULL, NULL, "fsl,imx7d-caam"))) {
clk = caam_drv_identify_clk(&pdev->dev, "mem");
@@ -521,7 +536,7 @@ static int caam_probe(struct platform_device *pdev)
ret = PTR_ERR(clk);
dev_err(&pdev->dev,
"can't identify CAAM mem clk: %d\n", ret);
- goto disable_caam_ipg;
+ goto disable_clocks;
}
ctrlpriv->caam_mem = clk;
@@ -529,23 +544,7 @@ static int caam_probe(struct platform_device *pdev)
if (ret < 0) {
dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n",
ret);
- goto disable_caam_ipg;
- }
-
- clk = caam_drv_identify_clk(&pdev->dev, "aclk");
- if (IS_ERR(clk)) {
- ret = PTR_ERR(clk);
- dev_err(&pdev->dev,
- "can't identify CAAM aclk clk: %d\n", ret);
- goto disable_caam_mem;
- }
- ctrlpriv->caam_aclk = clk;
-
- ret = clk_prepare_enable(ctrlpriv->caam_aclk);
- if (ret < 0) {
- dev_err(&pdev->dev, "can't enable CAAM aclk clock: %d\n",
- ret);
- goto disable_caam_mem;
+ goto disable_clocks;
}
if (!(of_find_compatible_node(NULL, NULL, "fsl,imx6ul-caam"))) {
@@ -554,7 +553,7 @@ static int caam_probe(struct platform_device *pdev)
ret = PTR_ERR(clk);
dev_err(&pdev->dev,
"can't identify CAAM emi_slow clk: %d\n", ret);
- goto disable_caam_aclk;
+ goto disable_clocks;
}
ctrlpriv->caam_emi_slow = clk;
@@ -562,7 +561,7 @@ static int caam_probe(struct platform_device *pdev)
if (ret < 0) {
dev_err(&pdev->dev, "can't enable CAAM emi slow clock: %d\n",
ret);
- goto disable_caam_aclk;
+ goto disable_clocks;
}
}
}
@@ -573,7 +572,7 @@ static int caam_probe(struct platform_device *pdev)
if (ctrl == NULL) {
dev_err(dev, "caam: of_iomap() failed\n");
ret = -ENOMEM;
- goto disable_caam_emi_slow;
+ goto disable_clocks;
}
caam_little_end = !(bool)(rd_reg32(&ctrl->perfmon.status) &
@@ -904,13 +903,10 @@ caam_remove:
iounmap_ctrl:
iounmap(ctrl);
-disable_caam_emi_slow:
+disable_clocks:
clk_disable_unprepare(ctrlpriv->caam_emi_slow);
-disable_caam_aclk:
clk_disable_unprepare(ctrlpriv->caam_aclk);
-disable_caam_mem:
clk_disable_unprepare(ctrlpriv->caam_mem);
-disable_caam_ipg:
clk_disable_unprepare(ctrlpriv->caam_ipg);
return ret;
}