diff options
author | Marcin Niestroj <m.niestroj@grinn-global.com> | 2018-09-03 13:24:05 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-09-04 10:03:49 +0200 |
commit | 6454179436205e3deec969c0021b014fe0f67cd3 (patch) | |
tree | 68f24f70547ff9ea1523dc0a9d21a79685f42572 /drivers/crypto | |
parent | 4d718b72ba492281ec815b9671a899907db69f15 (diff) | |
download | barebox-6454179436205e3deec969c0021b014fe0f67cd3.tar.gz barebox-6454179436205e3deec969c0021b014fe0f67cd3.tar.xz |
crypto: caam - do not use mem and emi_slow clock for imx7x
Pick commit 699e491bac84a2069c7abeacf2f4367ecb19fa9c from Linux
upstream.
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: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/caam/ctrl.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index 6812005948..24c98df5a4 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c @@ -225,7 +225,8 @@ static void caam_remove(struct device_d *dev) /* shut clocks off before finalizing shutdown */ clk_disable(ctrlpriv->caam_ipg); - clk_disable(ctrlpriv->caam_mem); + if (ctrlpriv->caam_mem) + clk_disable(ctrlpriv->caam_mem); clk_disable(ctrlpriv->caam_aclk); if (ctrlpriv->caam_emi_slow) clk_disable(ctrlpriv->caam_emi_slow); @@ -324,11 +325,15 @@ static int caam_probe(struct device_d *dev) return -ENODEV; } - ctrlpriv->caam_mem = clk_get(dev, "mem"); - if (IS_ERR(ctrlpriv->caam_mem)) { - ret = PTR_ERR(ctrlpriv->caam_mem); - dev_err(dev, "can't identify CAAM secure mem clk: %d\n", ret); - return -ENODEV; + if (!of_machine_is_compatible("fsl,imx7d") && + !of_machine_is_compatible("fsl,imx7s")) { + ctrlpriv->caam_mem = clk_get(dev, "mem"); + if (IS_ERR(ctrlpriv->caam_mem)) { + ret = PTR_ERR(ctrlpriv->caam_mem); + dev_err(dev, + "can't identify CAAM mem clk: %d\n", ret); + return -ENODEV; + } } ctrlpriv->caam_aclk = clk_get(dev, "aclk"); @@ -339,7 +344,9 @@ static int caam_probe(struct device_d *dev) return -ENODEV; } - 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")) { ctrlpriv->caam_emi_slow = clk_get(dev, "emi_slow"); if (IS_ERR(ctrlpriv->caam_emi_slow)) { ret = PTR_ERR(ctrlpriv->caam_emi_slow); @@ -355,11 +362,13 @@ static int caam_probe(struct device_d *dev) return -ENODEV; } - ret = clk_enable(ctrlpriv->caam_mem); - if (ret < 0) { - dev_err(dev, "can't enable CAAM secure mem clock: %d\n", - ret); - return -ENODEV; + if (ctrlpriv->caam_mem) { + ret = clk_enable(ctrlpriv->caam_mem); + if (ret < 0) { + dev_err(dev, "can't enable CAAM secure mem clock: %d\n", + ret); + return -ENODEV; + } } ret = clk_enable(ctrlpriv->caam_aclk); |