mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marcin Niestroj <m.niestroj@grinn-global.com>
To: barebox@lists.infradead.org
Cc: Marcin Niestroj <m.niestroj@grinn-global.com>
Subject: [PATCH 15/18] crypto: caam - do not use mem and emi_slow clock for imx7x
Date: Mon,  3 Sep 2018 13:44:49 +0200	[thread overview]
Message-ID: <20180903114452.4611-25-m.niestroj@grinn-global.com> (raw)
In-Reply-To: <20180903114452.4611-1-m.niestroj@grinn-global.com>

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>
---
 drivers/crypto/caam/ctrl.c | 33 +++++++++++++++++++++------------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 681200594..24c98df5a 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);
-- 
2.18.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-09-03 12:17 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-03 11:23 [PATCH 00/18] crypto: caam: Pull CAAM support improvements from Linux Marcin Niestroj
2018-09-03 11:23 ` [PATCH 01/18] crypto: caam - fix RNG init descriptor ret. code checking Marcin Niestroj
2018-09-03 11:23 ` [PATCH 02/18] crypto: caam - fix warning in APPEND_MATH_IMM_u64 Marcin Niestroj
2018-09-03 11:23 ` [PATCH 03/18] crypto: caam - fix writing to JQCR_MS when using service interface Marcin Niestroj
2018-09-03 11:23 ` [PATCH 04/18] crypto: caam - handle core endianness != caam endianness Marcin Niestroj
2018-09-03 11:23 ` [PATCH 05/18] crypto: caam - add support for iMX6UL Marcin Niestroj
2018-09-03 11:23 ` [PATCH 06/18] crypto: caam - fix sparse warnings Marcin Niestroj
2018-09-03 11:23 ` [PATCH 07/18] crypto: caam - trivial code clean-up Marcin Niestroj
2018-09-03 11:23 ` [PATCH 08/18] crypto: caam - remove unreachable code in report_ccb_status() Marcin Niestroj
2018-09-03 11:23 ` [PATCH 09/18] crypto: caam - constify pointer to descriptor buffer Marcin Niestroj
2018-09-03 11:24 ` [PATCH 10/18] crypto: caam - avoid double inclusion in desc_constr.h Marcin Niestroj
2018-09-03 11:24 ` [PATCH 11/18] crypto: caam - clean-up in caam_init_rng() Marcin Niestroj
2018-09-03 11:24 ` [PATCH 12/18] crypto: caam - fix incorrect define Marcin Niestroj
2018-09-03 11:24 ` [PATCH 13/18] crypto: caam - constify key data Marcin Niestroj
2018-09-03 11:24 ` [PATCH 14/18] crypto: caam - fix endless loop when DECO acquire fails Marcin Niestroj
2018-09-03 11:24 ` [PATCH 15/18] crypto: caam - do not use mem and emi_slow clock for imx7x Marcin Niestroj
2018-09-03 11:24 ` [PATCH 16/18] crypto: caam - sync desc.h with Linux Marcin Niestroj
2018-09-03 11:24 ` [PATCH 17/18] crypto: caam - staticize caam_get_era() Marcin Niestroj
2018-09-03 11:24 ` [PATCH 18/18] crypto: caam - allow retrieving 'era' from register Marcin Niestroj
2018-09-03 11:44 ` [PATCH 10/18] crypto: caam - avoid double inclusion in desc_constr.h Marcin Niestroj
2018-09-03 11:44   ` [PATCH 11/18] crypto: caam - clean-up in caam_init_rng() Marcin Niestroj
2018-09-03 11:44   ` [PATCH 12/18] crypto: caam - fix incorrect define Marcin Niestroj
2018-09-03 11:44   ` [PATCH 13/18] crypto: caam - constify key data Marcin Niestroj
2018-09-03 11:44   ` [PATCH 14/18] crypto: caam - fix endless loop when DECO acquire fails Marcin Niestroj
2018-09-03 11:44   ` [PATCH 15/18] crypto: caam - do not use mem and emi_slow clock for imx7x Marcin Niestroj
2018-09-03 11:44   ` [PATCH 16/18] crypto: caam - sync desc.h with Linux Marcin Niestroj
2018-09-03 11:44   ` [PATCH 17/18] crypto: caam - staticize caam_get_era() Marcin Niestroj
2018-09-03 11:44   ` [PATCH 18/18] crypto: caam - allow retrieving 'era' from register Marcin Niestroj
2018-09-03 11:44   ` [PATCH 00/18] crypto: caam: Pull CAAM support improvements from Linux Marcin Niestroj
2018-09-03 11:44   ` [PATCH 01/18] crypto: caam - fix RNG init descriptor ret. code checking Marcin Niestroj
2018-09-03 11:44   ` [PATCH 02/18] crypto: caam - fix warning in APPEND_MATH_IMM_u64 Marcin Niestroj
2018-09-03 11:44   ` [PATCH 03/18] crypto: caam - fix writing to JQCR_MS when using service interface Marcin Niestroj
2018-09-03 11:44   ` [PATCH 04/18] crypto: caam - handle core endianness != caam endianness Marcin Niestroj
2018-09-03 11:44   ` [PATCH 05/18] crypto: caam - add support for iMX6UL Marcin Niestroj
2018-09-03 11:44   ` [PATCH 06/18] crypto: caam - fix sparse warnings Marcin Niestroj
2018-09-03 11:44   ` [PATCH 07/18] crypto: caam - trivial code clean-up Marcin Niestroj
2018-09-03 11:44   ` [PATCH 08/18] crypto: caam - remove unreachable code in report_ccb_status() Marcin Niestroj
2018-09-03 11:44   ` [PATCH 09/18] crypto: caam - constify pointer to descriptor buffer Marcin Niestroj
2018-09-03 11:44   ` [PATCH 10/18] crypto: caam - avoid double inclusion in desc_constr.h Marcin Niestroj
2018-09-03 11:44   ` [PATCH 11/18] crypto: caam - clean-up in caam_init_rng() Marcin Niestroj
2018-09-03 11:44   ` [PATCH 12/18] crypto: caam - fix incorrect define Marcin Niestroj
2018-09-03 11:44   ` [PATCH 13/18] crypto: caam - constify key data Marcin Niestroj
2018-09-03 11:44   ` [PATCH 14/18] crypto: caam - fix endless loop when DECO acquire fails Marcin Niestroj
2018-09-03 11:44   ` Marcin Niestroj [this message]
2018-09-03 11:44   ` [PATCH 16/18] crypto: caam - sync desc.h with Linux Marcin Niestroj
2018-09-03 11:44   ` [PATCH 17/18] crypto: caam - staticize caam_get_era() Marcin Niestroj
2018-09-03 11:44   ` [PATCH 18/18] crypto: caam - allow retrieving 'era' from register Marcin Niestroj
2018-09-04  8:05 ` [PATCH 00/18] crypto: caam: Pull CAAM support improvements from Linux Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180903114452.4611-25-m.niestroj@grinn-global.com \
    --to=m.niestroj@grinn-global.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox