Skip to contentSkip to conversation

arm nomadik: add hardware RNG driver

PATCH New Alessandro Rubini 4 participants 9 messages Dec 5, 2009 – Dec 19, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 arm nomadik: add hardware RNG driver

From: Alessandro Rubini <[email protected]>

The hardware random number generator by ST is used in both the Nomadik 8815 SoC and the U8500. It returns 16 bits every 400ns with automatic delay if a read is issued too early. It depends on PLAT_NOMADIK.

---

This V2 uses the new interface, so it depends on this patch from cryptodev-2.6.git:
commit 9996508b3353063f2d6c48c1a28a84543d72d70b
Author: Ian Molton <[email protected]>
Date: Tue Dec 1 14:47:32 2009 +0800

With dd I can fetch 3 MB/s of random data where /dev/urandom gives 0.4 M/s and /dev/zero gives 60 MB/s.

 drivers/char/hw_random/Kconfig       |   12 ++++
 drivers/char/hw_random/Makefile      |    1 +
 drivers/char/hw_random/nomadik-rng.c |  103 ++++++++++++++++++++++++++++++++++
 3 files changed, 116 insertions(+), 0 deletions(-)
 create mode 100644 drivers/char/hw_random/nomadik-rng.c
drivers/char/hw_random/Kconfig +12 -0
index 8706026..6ea1014 100644
@@ -186,3 +186,15 @@ config HW_RANDOM_MXC_RNGA
 	  module will be called mxc-rnga.
 
 	  If unsure, say Y.
+
+config HW_RANDOM_NOMADIK
+	tristate "ST-Ericsson Nomadik Random Number Generator support"
+	depends on HW_RANDOM && PLAT_NOMADIK
+	---help---
+	  This driver provides kernel-side support for the Random Number
+	  Generator hardware found on ST-Ericsson SoCs (8815 and 8500).
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called nomadik-rng.
+
+	  If unsure, say Y.
drivers/char/hw_random/Makefile +1 -0
index 5eeb130..4273308 100644
@@ -18,3 +18,4 @@ obj-$(CONFIG_HW_RANDOM_VIRTIO) += virtio-rng.o
 obj-$(CONFIG_HW_RANDOM_TX4939) += tx4939-rng.o
 obj-$(CONFIG_HW_RANDOM_MXC_RNGA) += mxc-rnga.o
 obj-$(CONFIG_HW_RANDOM_OCTEON) += octeon-rng.o
+obj-$(CONFIG_HW_RANDOM_NOMADIK) += nomadik-rng.o
drivers/char/hw_random/nomadik-rng.c new file +103 -0

103 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#1 lore raw

PATCH v2 2/2 arm nomadik: add platform device for rng in cpu-8815

From: Alessandro Rubini <[email protected]>

---
 arch/arm/mach-nomadik/cpu-8815.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-nomadik/cpu-8815.c +8 -0
index f93c596..9bf33b3 100644
@@ -86,11 +86,19 @@ static struct amba_device cpu8815_amba_gpio[] = {
 	},
 };
 
+static struct amba_device cpu8815_amba_rng = {
+	.dev = {
+		.init_name = "rng",
+	},
+	__MEM_4K_RESOURCE(NOMADIK_RNG_BASE),
+};
+
 static struct amba_device *amba_devs[] __initdata = {
 	cpu8815_amba_gpio + 0,
 	cpu8815_amba_gpio + 1,
 	cpu8815_amba_gpio + 2,
 	cpu8815_amba_gpio + 3,
+	&cpu8815_amba_rng
 };
 
 static int __init cpu8815_init(void)
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH v2 1/2 arm nomadik: add hardware RNG driver

In reply to Alessandro Rubini
Quoted 8 lines · Alessandro Rubini

From: Alessandro Rubini <[email protected]>

The hardware random number generator by ST is used in both the Nomadik 8815 SoC and the U8500. It returns 16 bits every 400ns with automatic delay if a read is issued too early. It depends on PLAT_NOMADIK.

Looks good to me.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
maintainer
#3 lore raw

PATCH v2 1/2 arm nomadik: add hardware RNG driver

Quoted 7 lines · Matt Mackall
Quoted 6 lines · Alessandro Rubini

From: Alessandro Rubini <[email protected]>

The hardware random number generator by ST is used in both the Nomadik 8815 SoC and the U8500. It returns 16 bits every 400ns with automatic delay if a read is issued too early. It depends on PLAT_NOMADIK.

Quoted 6 lines
Quoted 2 lines

Looks good to me.

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#5 lore raw

PATCH v2 1/2 arm nomadik: add hardware RNG driver

Quoted 5 lines · Alessandro Rubini
Quoted 2 lines
Quoted 1 line

So, what should my next step? I don't find the patch in any tree. Russell, should I put those two in your patch system?

Well I'm happy to pick these up as long as Russell is OK with them. I wanted to hear from him as the second patch touches the ARM tree.

Thanks,

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#6 lore raw

PATCH v2 1/2 arm nomadik: add hardware RNG driver

Quoted 10 lines · Herbert Xu
Quoted 5 lines · Alessandro Rubini
Quoted 2 lines
Quoted 1 line

So, what should my next step? I don't find the patch in any tree. Russell, should I put those two in your patch system?

Well I'm happy to pick these up as long as Russell is OK with them. I wanted to hear from him as the second patch touches the ARM tree.

It shouldn't be a problem unless there ends up being conflicting changes in that file. Currently there are none.

maintainer
#7 lore raw

PATCH v2 1/2 arm nomadik: add hardware RNG driver

Quoted 3 lines · Russell King - ARM Linux

It shouldn't be a problem unless there ends up being conflicting changes in that file. Currently there are none.

OK, I'll throw them into my tree then.

Thanks!

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer
#8 lore raw

PATCH v2 1/2 arm nomadik: add hardware RNG driver

In reply to Matt Mackall
Quoted 7 lines · Matt Mackall
Quoted 6 lines · Alessandro Rubini

From: Alessandro Rubini <[email protected]>

The hardware random number generator by ST is used in both the Nomadik 8815 SoC and the U8500. It returns 16 bits every 400ns with automatic delay if a read is issued too early. It depends on PLAT_NOMADIK.

Quoted 6 lines
Quoted 2 lines

Looks good to me.

Both patches applied to cryptodev. Thanks a lot!

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt