All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aneesh Bansal <aneesh.bansal@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/5][v5] drivers/crypto/fsl: fix endianness issue in RNG
Date: Tue, 8 Dec 2015 13:54:30 +0530	[thread overview]
Message-ID: <1449563070-5761-5-git-send-email-aneesh.bansal@freescale.com> (raw)
In-Reply-To: <1449563070-5761-1-git-send-email-aneesh.bansal@freescale.com>

For Setting and clearing the bits in SEC Block registers
sec_clrbits32() and sec_setbits32() are used which work as
per endianness of CAAM block.
So these must be used with SEC register address as argument.
If the value is read in a local variable, then the functions
will not behave correctly where endianness of CAAM and core is
different.

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
CC: Alex Porosanu <alexandru.porosanu@freescale.com>
---
Changes in v5: None

Changes in v4: None

Changes in v3: None

Changes in v2: None (New Patch set created with an additional patch)

 drivers/crypto/fsl/jr.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c
index f63eacb..b553e3c 100644
--- a/drivers/crypto/fsl/jr.c
+++ b/drivers/crypto/fsl/jr.c
@@ -470,17 +470,13 @@ static void kick_trng(int ent_delay)
 	sec_out32(&rng->rtfreqmin, ent_delay >> 2);
 	/* disable maximum frequency count */
 	sec_out32(&rng->rtfreqmax, RTFRQMAX_DISABLE);
-	/* read the control register */
-	val = sec_in32(&rng->rtmctl);
 	/*
 	 * select raw sampling in both entropy shifter
 	 * and statistical checker
 	 */
-	sec_setbits32(&val, RTMCTL_SAMP_MODE_RAW_ES_SC);
+	sec_setbits32(&rng->rtmctl, RTMCTL_SAMP_MODE_RAW_ES_SC);
 	/* put RNG4 into run mode */
-	sec_clrbits32(&val, RTMCTL_PRGM);
-	/* write back the control register */
-	sec_out32(&rng->rtmctl, val);
+	sec_clrbits32(&rng->rtmctl, RTMCTL_PRGM);
 }
 
 static int rng_init(void)
-- 
1.8.1.4

  parent reply	other threads:[~2015-12-08  8:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-08  8:24 [U-Boot] [PATCH 1/5][v5] armv8: define usec2ticks function Aneesh Bansal
2015-12-08  8:24 ` [U-Boot] [PATCH 2/5][v5] armv8: Make SEC read/write as snoopable for LS1043 Aneesh Bansal
2015-12-15  1:07   ` York Sun
2015-12-08  8:24 ` [U-Boot] [PATCH 3/5][v5] include/linux: move typdef for uintptr_t Aneesh Bansal
2015-12-08 16:45   ` York Sun
2015-12-14  2:08     ` York Sun
2015-12-14  2:10     ` York Sun
2015-12-15  1:07   ` York Sun
2015-12-16  3:48   ` York Sun
2015-12-08  8:24 ` [U-Boot] [PATCH 4/5][v5] armv8/ls1043ardb: add SECURE BOOT target for NOR Aneesh Bansal
2015-12-15  1:10   ` York Sun
2015-12-08  8:24 ` Aneesh Bansal [this message]
2015-12-15  1:12   ` [U-Boot] [PATCH 5/5][v5] drivers/crypto/fsl: fix endianness issue in RNG York Sun
2015-12-15  1:06 ` [U-Boot] [PATCH 1/5][v5] armv8: define usec2ticks function York Sun

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=1449563070-5761-5-git-send-email-aneesh.bansal@freescale.com \
    --to=aneesh.bansal@freescale.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.