summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDan Douglass <dan.douglass@freescale.com>2015-05-26 15:53:10 -0500
committerNitin Garg <nitin.garg@nxp.com>2016-01-20 14:28:50 -0600
commitc9ebfd68fde97b155d18603dcf9daaf1d936ab8f (patch)
tree72798e4d1e231fd8bd48c2f3c0971aca60b1df38 /drivers
parent5702e5758b3ab81474aa25f579652f6345eb73b6 (diff)
MLK-10978-1 ARM: imx6ul: Add CAAM support for i.mx6ul
There are only 3 CAAM clocks that are required for i.mx6ul. Adding logic to enable only the required clocks based on the device tree compatibility node. Signed-off-by: Dan Douglass <dan.douglass@freescale.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/caam/ctrl.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 463768426fd7..3de23f59d953 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -527,7 +527,7 @@ static int caam_probe(struct platform_device *pdev)
/* imx7d only has one caam clock */
if (!(of_find_compatible_node(NULL, NULL, "fsl,imx7d-caam"))) {
ctrlpriv->caam_mem = devm_clk_get(&ctrlpriv->pdev->dev,
- "caam_mem");
+ "caam_mem");
if (IS_ERR(ctrlpriv->caam_mem)) {
ret = PTR_ERR(ctrlpriv->caam_mem);
dev_err(&ctrlpriv->pdev->dev,
@@ -535,28 +535,26 @@ static int caam_probe(struct platform_device *pdev)
ret);
return -ENODEV;
}
- ctrlpriv->caam_aclk = devm_clk_get(&ctrlpriv->pdev->dev,
- "caam_aclk");
- if (IS_ERR(ctrlpriv->caam_aclk)) {
- ret = PTR_ERR(ctrlpriv->caam_aclk);
- dev_err(&ctrlpriv->pdev->dev,
- "can't identify CAAM aclk clk: %d\n",
+ ret = clk_prepare(ctrlpriv->caam_mem);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "can't prepare CAAM secure mem clock: %d\n",
ret);
return -ENODEV;
}
- ctrlpriv->caam_emi_slow = devm_clk_get(&ctrlpriv->pdev->dev,
- "caam_emi_slow");
- ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
+ ret = clk_enable(ctrlpriv->caam_mem);
if (ret < 0) {
- dev_err(&pdev->dev,
- "can't prepare CAAM emi slow clock: %d\n",
+ dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n",
ret);
return -ENODEV;
}
-
- ret = clk_prepare(ctrlpriv->caam_mem);
- if (ret < 0) {
- dev_err(&pdev->dev, "can't prepare CAAM secure mem clock: %d\n",
+ pr_debug("%s caam_mem clock:%d\n", __func__,
+ (int)clk_get_rate(ctrlpriv->caam_mem));
+ ctrlpriv->caam_aclk = devm_clk_get(&ctrlpriv->pdev->dev,
+ "caam_aclk");
+ if (IS_ERR(ctrlpriv->caam_aclk)) {
+ ret = PTR_ERR(ctrlpriv->caam_aclk);
+ dev_err(&ctrlpriv->pdev->dev,
+ "can't identify CAAM aclk clk: %d\n",
ret);
return -ENODEV;
}
@@ -567,25 +565,25 @@ static int caam_probe(struct platform_device *pdev)
ret);
return -ENODEV;
}
-
-
- ret = clk_enable(ctrlpriv->caam_mem);
- if (ret < 0) {
- dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n",
- ret);
- return -ENODEV;
- }
ret = clk_enable(ctrlpriv->caam_aclk);
if (ret < 0) {
dev_err(&pdev->dev, "can't enable CAAM aclk clock: %d\n",
ret);
return -ENODEV;
}
-
- pr_debug("%s caam_mem clock:%d\n", __func__,
- (int)clk_get_rate(ctrlpriv->caam_mem));
pr_debug("%s caam_aclk clock:%d\n", __func__,
(int)clk_get_rate(ctrlpriv->caam_aclk));
+ if (!(of_find_compatible_node(NULL, NULL, "fsl,imx6ul-caam"))) {
+ ctrlpriv->caam_emi_slow = devm_clk_get(&ctrlpriv->pdev->dev,
+ "caam_emi_slow");
+ ret = clk_prepare_enable(ctrlpriv->caam_emi_slow);
+ if (ret < 0) {
+ dev_err(&pdev->dev,
+ "can'to prepare CAAM emi slow clock: %d\n",
+ ret);
+ return -ENODEV;
+ }
+ }
}
#endif