Commit 699e491b authored by Rui Miguel Silva's avatar Rui Miguel Silva Committed by Herbert Xu

crypto: caam - do not use mem and emi_slow clock for imx7x

I.MX7x only use two clocks for the CAAM module, so make sure we do not try to
use the mem and the emi_slow clock when running in that imx7d and imx7s machine
type.

Cc: "Horia Geantă" <horia.geanta@nxp.com>
Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Signed-off-by: default avatarRui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b85149f6
...@@ -337,7 +337,8 @@ static int caam_remove(struct platform_device *pdev) ...@@ -337,7 +337,8 @@ static int caam_remove(struct platform_device *pdev)
/* shut clocks off before finalizing shutdown */ /* shut clocks off before finalizing shutdown */
clk_disable_unprepare(ctrlpriv->caam_ipg); clk_disable_unprepare(ctrlpriv->caam_ipg);
clk_disable_unprepare(ctrlpriv->caam_mem); if (ctrlpriv->caam_mem)
clk_disable_unprepare(ctrlpriv->caam_mem);
clk_disable_unprepare(ctrlpriv->caam_aclk); clk_disable_unprepare(ctrlpriv->caam_aclk);
if (ctrlpriv->caam_emi_slow) if (ctrlpriv->caam_emi_slow)
clk_disable_unprepare(ctrlpriv->caam_emi_slow); clk_disable_unprepare(ctrlpriv->caam_emi_slow);
...@@ -466,14 +467,17 @@ static int caam_probe(struct platform_device *pdev) ...@@ -466,14 +467,17 @@ static int caam_probe(struct platform_device *pdev)
} }
ctrlpriv->caam_ipg = clk; ctrlpriv->caam_ipg = clk;
clk = caam_drv_identify_clk(&pdev->dev, "mem"); if (!of_machine_is_compatible("fsl,imx7d") &&
if (IS_ERR(clk)) { !of_machine_is_compatible("fsl,imx7s")) {
ret = PTR_ERR(clk); clk = caam_drv_identify_clk(&pdev->dev, "mem");
dev_err(&pdev->dev, if (IS_ERR(clk)) {
"can't identify CAAM mem clk: %d\n", ret); ret = PTR_ERR(clk);
return ret; dev_err(&pdev->dev,
"can't identify CAAM mem clk: %d\n", ret);
return ret;
}
ctrlpriv->caam_mem = clk;
} }
ctrlpriv->caam_mem = clk;
clk = caam_drv_identify_clk(&pdev->dev, "aclk"); clk = caam_drv_identify_clk(&pdev->dev, "aclk");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
...@@ -484,7 +488,9 @@ static int caam_probe(struct platform_device *pdev) ...@@ -484,7 +488,9 @@ static int caam_probe(struct platform_device *pdev)
} }
ctrlpriv->caam_aclk = clk; ctrlpriv->caam_aclk = clk;
if (!of_machine_is_compatible("fsl,imx6ul")) { if (!of_machine_is_compatible("fsl,imx6ul") &&
!of_machine_is_compatible("fsl,imx7d") &&
!of_machine_is_compatible("fsl,imx7s")) {
clk = caam_drv_identify_clk(&pdev->dev, "emi_slow"); clk = caam_drv_identify_clk(&pdev->dev, "emi_slow");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
...@@ -501,11 +507,13 @@ static int caam_probe(struct platform_device *pdev) ...@@ -501,11 +507,13 @@ static int caam_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = clk_prepare_enable(ctrlpriv->caam_mem); if (ctrlpriv->caam_mem) {
if (ret < 0) { ret = clk_prepare_enable(ctrlpriv->caam_mem);
dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n", if (ret < 0) {
ret); dev_err(&pdev->dev, "can't enable CAAM secure mem clock: %d\n",
goto disable_caam_ipg; ret);
goto disable_caam_ipg;
}
} }
ret = clk_prepare_enable(ctrlpriv->caam_aclk); ret = clk_prepare_enable(ctrlpriv->caam_aclk);
...@@ -826,7 +834,8 @@ static int caam_probe(struct platform_device *pdev) ...@@ -826,7 +834,8 @@ static int caam_probe(struct platform_device *pdev)
disable_caam_aclk: disable_caam_aclk:
clk_disable_unprepare(ctrlpriv->caam_aclk); clk_disable_unprepare(ctrlpriv->caam_aclk);
disable_caam_mem: disable_caam_mem:
clk_disable_unprepare(ctrlpriv->caam_mem); if (ctrlpriv->caam_mem)
clk_disable_unprepare(ctrlpriv->caam_mem);
disable_caam_ipg: disable_caam_ipg:
clk_disable_unprepare(ctrlpriv->caam_ipg); clk_disable_unprepare(ctrlpriv->caam_ipg);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment