From: Lee Jones <lee.jones@linaro.org>
To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: kernel@stlinux.com, herbert@gondor.apana.org.au,
peter@korsgaard.com, festevam@gmail.com, pankaj.dev@st.com,
daniel.thompson@linaro.org, Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 2/3] hwrng: st: Report correct FIFO size
Date: Tue, 6 Oct 2015 15:43:59 +0100 [thread overview]
Message-ID: <1444142640-14721-2-git-send-email-lee.jones@linaro.org> (raw)
In-Reply-To: <1444142640-14721-1-git-send-email-lee.jones@linaro.org>
The values supplied to the 'read random data from FIFO' arithmetic
are not correct. The value fed in to initialise the iterator
describes the FIFO depth, but then the iterator is treated in
Bytes and subsequently increased by 2 in value for every read
word. This means only 4 of the 8 available values are being read
during each invocation of .read().
This change increased the device bandwidth by a factor of 2.
Reported-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
drivers/char/hw_random/st-rng.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/char/hw_random/st-rng.c b/drivers/char/hw_random/st-rng.c
index 8c8a435..44480fe 100644
--- a/drivers/char/hw_random/st-rng.c
+++ b/drivers/char/hw_random/st-rng.c
@@ -29,8 +29,9 @@
#define ST_RNG_STATUS_BAD_ALTERNANCE BIT(1)
#define ST_RNG_STATUS_FIFO_FULL BIT(5)
-#define ST_RNG_FIFO_SIZE 8
#define ST_RNG_SAMPLE_SIZE 2 /* 2 Byte (16bit) samples */
+#define ST_RNG_FIFO_DEPTH 8
+#define ST_RNG_FIFO_SIZE (ST_RNG_FIFO_DEPTH * ST_RNG_SAMPLE_SIZE)
/* Samples are available every 0.667us, which we round to 1us */
#define ST_RNG_FILL_FIFO_TIMEOUT (1 * (ST_RNG_FIFO_SIZE / ST_RNG_SAMPLE_SIZE))
--
1.9.1
next prev parent reply other threads:[~2015-10-06 14:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 14:43 [RESEND 1/3] hwrng: st: dt: Fix trivial typo in node address Lee Jones
2015-10-06 14:43 ` Lee Jones [this message]
2015-10-06 15:48 ` [PATCH 2/3] hwrng: st: Report correct FIFO size Daniel Thompson
2015-10-06 15:23 ` Lee Jones
2015-10-06 14:44 ` [PATCH 3/3] hwrng: st: Use real-world device timings for timeout Lee Jones
2015-10-06 19:37 ` Russell King - ARM Linux
2015-10-06 20:51 ` Lee Jones
2015-10-06 20:56 ` Russell King - ARM Linux
2015-10-07 7:53 ` Lee Jones
2015-10-06 15:24 ` [RESEND 1/3] hwrng: st: dt: Fix trivial typo in node address Herbert Xu
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=1444142640-14721-2-git-send-email-lee.jones@linaro.org \
--to=lee.jones@linaro.org \
--cc=daniel.thompson@linaro.org \
--cc=festevam@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=kernel@stlinux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pankaj.dev@st.com \
--cc=peter@korsgaard.com \
/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;
as well as URLs for NNTP newsgroup(s).