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 06/18] crypto: caam - fix sparse warnings
Date: Mon,  3 Sep 2018 13:23:56 +0200	[thread overview]
Message-ID: <20180903112408.2086-7-m.niestroj@grinn-global.com> (raw)
In-Reply-To: <20180903112408.2086-1-m.niestroj@grinn-global.com>

Pick commit 8439e94fceb3812989bae41922567123cffd1cf7 from Linux
upstream.

    crypto: caam - fix sparse warnings

    Fix the following sparse warning (note that endianness issues
    are not not addressed in current patch):

    drivers/crypto/caam/ctrl.c:388:24: warning: incorrect type in argument 1 (different address spaces)
    drivers/crypto/caam/ctrl.c:388:24:    expected void [noderef] <asn:2>*reg
    drivers/crypto/caam/ctrl.c:388:24:    got unsigned int *<noident>
    drivers/crypto/caam/ctrl.c:390:24: warning: incorrect type in argument 1 (different address spaces)
    drivers/crypto/caam/ctrl.c:390:24:    expected void [noderef] <asn:2>*reg
    drivers/crypto/caam/ctrl.c:390:24:    got unsigned int *<noident>
    drivers/crypto/caam/ctrl.c:548:24: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/ctrl.c:548:24:    expected struct caam_ctrl [noderef] <asn:2>*ctrl
    drivers/crypto/caam/ctrl.c:548:24:    got struct caam_ctrl *<noident>
    drivers/crypto/caam/ctrl.c:550:30: warning: cast removes address space of expression
    drivers/crypto/caam/ctrl.c:549:26: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/ctrl.c:549:26:    expected struct caam_assurance [noderef] <asn:2>*assure
    drivers/crypto/caam/ctrl.c:549:26:    got struct caam_assurance *<noident>
    drivers/crypto/caam/ctrl.c:554:28: warning: cast removes address space of expression
    drivers/crypto/caam/ctrl.c:553:24: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/ctrl.c:553:24:    expected struct caam_deco [noderef] <asn:2>*deco
    drivers/crypto/caam/ctrl.c:553:24:    got struct caam_deco *<noident>
    drivers/crypto/caam/ctrl.c:634:48: warning: cast removes address space of expression
    drivers/crypto/caam/ctrl.c:633:44: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/ctrl.c:633:44:    expected struct caam_job_ring [noderef] <asn:2>*<noident>
    drivers/crypto/caam/ctrl.c:633:44:    got struct caam_job_ring *<noident>
    drivers/crypto/caam/ctrl.c:648:34: warning: cast removes address space of expression
    drivers/crypto/caam/ctrl.c:647:30: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/ctrl.c:647:30:    expected struct caam_queue_if [noderef] <asn:2>*qi
    drivers/crypto/caam/ctrl.c:647:30:    got struct caam_queue_if *<noident>
    drivers/crypto/caam/ctrl.c:806:37: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/ctrl.c:806:37:    expected void *data
    drivers/crypto/caam/ctrl.c:806:37:    got unsigned int [noderef] <asn:2>*
    drivers/crypto/caam/ctrl.c:814:38: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/ctrl.c:814:38:    expected void *data
    drivers/crypto/caam/ctrl.c:814:38:    got unsigned int [noderef] <asn:2>*
    drivers/crypto/caam/ctrl.c:822:38: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/ctrl.c:822:38:    expected void *data
    drivers/crypto/caam/ctrl.c:822:38:    got unsigned int [noderef] <asn:2>*
    drivers/crypto/caam/jr.c:492:23: warning: incorrect type in assignment (different address spaces)
    drivers/crypto/caam/jr.c:492:23:    expected struct caam_job_ring [noderef] <asn:2>*rregs
    drivers/crypto/caam/jr.c:492:23:    got struct caam_job_ring *<noident>
    drivers/crypto/caam/caampkc.c:398:35: warning: Using plain integer as NULL pointer
    drivers/crypto/caam/caampkc.c:444:35: warning: Using plain integer as NULL pointer

    Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
    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 | 34 ++++++++++++++--------------------
 drivers/crypto/caam/jr.c   |  2 +-
 2 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 55193f6ef..0f9ad328e 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -257,11 +257,8 @@ static void kick_trng(struct device_d *ctrldev, int ent_delay)
 	 */
 	val = (rd_reg32(&r4tst->rtsdctl) & RTSDCTL_ENT_DLY_MASK)
 	      >> RTSDCTL_ENT_DLY_SHIFT;
-	if (ent_delay <= val) {
-		/* put RNG4 into run mode */
-		clrsetbits_32(&r4tst->rtmctl, RTMCTL_PRGM, 0);
-		return;
-	}
+	if (ent_delay <= val)
+		goto start_rng;
 
 	val = rd_reg32(&r4tst->rtsdctl);
 	val = (val & ~RTSDCTL_ENT_DLY_MASK) |
@@ -273,15 +270,12 @@ static void kick_trng(struct device_d *ctrldev, int ent_delay)
 	wr_reg32(&r4tst->rtfrqmax, RTFRQMAX_DISABLE);
 	/* read the control register */
 	val = rd_reg32(&r4tst->rtmctl);
+start_rng:
 	/*
 	 * select raw sampling in both entropy shifter
-	 * and statistical checker
+	 * and statistical checker; ; put RNG4 into run mode
 	 */
-	clrsetbits_32(&val, 0, RTMCTL_SAMP_MODE_RAW_ES_SC);
-	/* put RNG4 into run mode */
-	clrsetbits_32(&val, RTMCTL_PRGM, 0);
-	/* write back the control register */
-	wr_reg32(&r4tst->rtmctl, val);
+	clrsetbits_32(&r4tst->rtmctl, RTMCTL_PRGM, RTMCTL_SAMP_MODE_RAW_ES_SC);
 }
 
 /**
@@ -403,12 +397,12 @@ static int caam_probe(struct device_d *dev)
 	else
 		BLOCK_OFFSET = PG_SIZE_64K;
 
-	ctrlpriv->ctrl = (struct caam_ctrl __force *)ctrl;
-	ctrlpriv->assure = (struct caam_assurance __force *)
-			   ((uint8_t *)ctrl +
+	ctrlpriv->ctrl = (struct caam_ctrl __iomem __force *)ctrl;
+	ctrlpriv->assure = (struct caam_assurance __iomem __force *)
+			   ((__force uint8_t *)ctrl +
 			    BLOCK_OFFSET * ASSURE_BLOCK_NUMBER);
-	ctrlpriv->deco = (struct caam_deco __force *)
-			 ((uint8_t *)ctrl +
+	ctrlpriv->deco = (struct caam_deco __iomem __force *)
+			 ((__force uint8_t *)ctrl +
 			  BLOCK_OFFSET * DECO_BLOCK_NUMBER);
 
 	/*
@@ -489,8 +483,8 @@ static int caam_probe(struct device_d *dev)
 			}
 
 			ctrlpriv->jrpdev[ring] = jrdev;
-			ctrlpriv->jr[ring] = (struct caam_job_ring __force *)
-					     ((uint8_t *)ctrl +
+			ctrlpriv->jr[ring] = (struct caam_job_ring __iomem __force *)
+					     ((__force uint8_t *)ctrl +
 					     (ring + JR_BLOCK_NUMBER) *
 					      BLOCK_OFFSET);
 			ctrlpriv->total_jobrs++;
@@ -501,8 +495,8 @@ static int caam_probe(struct device_d *dev)
 	/* Check to see if QI present. If so, enable */
 	ctrlpriv->qi_present = !!(comp_params & CTPR_MS_QI_MASK);
 	if (ctrlpriv->qi_present) {
-		ctrlpriv->qi = (struct caam_queue_if __force *)
-			       ((uint8_t *)ctrl +
+		ctrlpriv->qi = (struct caam_queue_if __iomem __force *)
+			       ((__force uint8_t *)ctrl +
 				 BLOCK_OFFSET * QI_BLOCK_NUMBER);
 		/* This is all that's required to physically enable QI */
 		wr_reg32(&ctrlpriv->qi->qi_control_lo, QICTL_DQEN);
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 84396e41e..b602a7b0e 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -309,7 +309,7 @@ int caam_jr_probe(struct device_d *dev)
 	if (IS_ERR(ctrl))
 		return PTR_ERR(ctrl);
 
-	jrpriv->rregs = (struct caam_job_ring __force *)ctrl;
+	jrpriv->rregs = (struct caam_job_ring __iomem __force *)ctrl;
 
 	/* Now do the platform independent part */
 	error = caam_jr_init(dev); /* now turn on hardware */
-- 
2.18.0


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

  parent reply	other threads:[~2018-09-03 11:25 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 ` Marcin Niestroj [this message]
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   ` [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-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=20180903112408.2086-7-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