Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1240645

[RESEND 3/3] hwrng: st: Report correct FIFO size

From Lee Jones <lee.jones@linaro.org>
Newsgroups linux.kernel
Subject [RESEND 3/3] hwrng: st: Report correct FIFO size
Date 2015-10-06 18:20 +0200
Message-ID <qgD86-2O1-43@gated-at.bofh.it> (permalink)
References <qgD85-2O1-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
Reviewed-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 a1ff080..3b1432c 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 documented to be available every 0.667us, so in theory
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RESEND 1/3] hwrng: st: dt: Fix trivial typo in node address Lee Jones <lee.jones@linaro.org> - 2015-10-06 18:20 +0200
  [RESEND 3/3] hwrng: st: Report correct FIFO size Lee Jones <lee.jones@linaro.org> - 2015-10-06 18:20 +0200
  [RESEND 2/3] hwrng: st: Use real-world device timings for timeout Lee Jones <lee.jones@linaro.org> - 2015-10-06 18:20 +0200

csiph-web