Skip to contentSkip to conversation

hwrng: npcm: add NPCM RNG driver support

PATCH In review Tomer Maimon 3 participants 5 messages Jul 22, 2019 – Aug 18, 2019

Subsystems (4)
lore
Share & tools
lore

Tomer Maimon

author maintainer
#0 lore raw

cover hwrng: npcm: add NPCM RNG driver support

This patch set adds Randon Number Generator (RNG) support for the Nuvoton NPCM Baseboard Management Controller (BMC).

The RNG driver we use power consumption when the RNG is not required.

The NPCM RNG driver tested on NPCM750 evaluation board.

Tomer Maimon (2):
dt-binding: hwrng: add NPCM RNG documentation
hwrng: npcm: add NPCM RNG driver

 .../bindings/rng/nuvoton,npcm-rng.txt         |  17 ++
 drivers/char/hw_random/Kconfig                |  13 ++
 drivers/char/hw_random/Makefile               |   1 +
 drivers/char/hw_random/npcm-rng.c             | 207 ++++++++++++++++++
 4 files changed, 238 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt
 create mode 100644 drivers/char/hw_random/npcm-rng.c
Signature · 1 line
2.18.0
author maintainer
#1 lore raw

PATCH 1/2 dt-binding: hwrng: add NPCM RNG documentation

Added device tree binding documentation for Nuvoton BMC NPCM Random Number Generator (RNG).

---
 .../bindings/rng/nuvoton,npcm-rng.txt           | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt
Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt new file +17 -0
new file mode 100644
index 000000000000..a697b4425fb3
@@ -0,0 +1,17 @@
+NPCM SoC Random Number Generator
+
+Required properties:
+- compatible  : "nuvoton,npcm750-rng" for the NPCM7XX BMC.
+- reg         : Specifies physical base address and size of the registers.
+
+Optional property:
+- quality : estimated number of bits of true entropy per 1024 bits
+			read from the rng.
+			If this property is not defined, it defaults to 1000.
+
+Example:
+
+rng: rng@f000b000 {
+	compatible = "nuvoton,npcm750-rng";
+	reg = <0xf000b000 0x8>;
+};
Signature · 1 line
2.18.0
maintainer
#2 lore raw

Re: [PATCH v1 1/2] dt-binding: hwrng: add NPCM RNG documentation

Quoted 15 lines · Tomer Maimon

Added device tree binding documentation for Nuvoton BMC NPCM Random Number Generator (RNG).

---
 .../bindings/rng/nuvoton,npcm-rng.txt           | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt
Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt new file +0 -0
new file mode 100644
index 000000000000..a697b4425fb3

Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt line 10

Quoted 10 lines
Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt new file +10 -0
@@ -0,0 +1,17 @@
+NPCM SoC Random Number Generator
+
+Required properties:
+- compatible  : "nuvoton,npcm750-rng" for the NPCM7XX BMC.
+- reg         : Specifies physical base address and size of the registers.
+
+Optional property:
+- quality : estimated number of bits of true entropy per 1024 bits
+			read from the rng.
+			If this property is not defined, it defaults to 1000.

This would need a vendor prefix, however, I think it should be implied by the compatible string. It is fixed per SoC, right?

maintainer
#3 lore raw

Re: [PATCH v1 1/2] dt-binding: hwrng: add NPCM RNG documentation

Quoted 22 lines · Rob Herring
Quoted 20 lines · Tomer Maimon

Added device tree binding documentation for Nuvoton BMC NPCM Random Number Generator (RNG).

---
 .../bindings/rng/nuvoton,npcm-rng.txt           | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt
Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt new file +5 -0
new file mode 100644
index 000000000000..a697b4425fb3
@@ -0,0 +1,17 @@
+NPCM SoC Random Number Generator
+
+Required properties:
+- compatible  : "nuvoton,npcm750-rng" for the NPCM7XX BMC.
+- reg         : Specifies physical base address and size of the registers.
Quoted 8 lines

Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt line 10

Quoted 5 lines
Documentation/devicetree/bindings/rng/nuvoton,npcm-rng.txt new file +5 -0
+
+Optional property:
+- quality : estimated number of bits of true entropy per 1024 bits
+                     read from the rng.
+                     If this property is not defined, it defaults to 1000.

This would need a vendor prefix, however, I think it should be implied by the compatible string. It is fixed per SoC, right?

Tomer is on vacation, so I answer instead:
This value is the same for all our SoC flavor that contains this RNG HW.

Signature · 2 lines
Regards,
Avi
author maintainer
#4 lore raw

PATCH 2/2 hwrng: npcm: add NPCM RNG driver

In reply to Tomer Maimon

Add Nuvoton NPCM BMC Random Number Generator(RNG) driver.

---
 drivers/char/hw_random/Kconfig    |  13 ++
 drivers/char/hw_random/Makefile   |   1 +
 drivers/char/hw_random/npcm-rng.c | 207 ++++++++++++++++++++++++++++++
 3 files changed, 221 insertions(+)
 create mode 100644 drivers/char/hw_random/npcm-rng.c
drivers/char/hw_random/Kconfig +13 -0
index 59f25286befe..87a1c30e7958 100644
@@ -440,6 +440,19 @@ config HW_RANDOM_OPTEE
 
 	  If unsure, say Y.
 
+config HW_RANDOM_NPCM
+	tristate "NPCM Random Number Generator support"
+	depends on ARCH_NPCM || COMPILE_TEST
+	default HW_RANDOM
+	help
+ 	  This driver provides support for the Random Number
+	  Generator hardware available in Nuvoton NPCM SoCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called npcm-rng.
+
+ 	  If unsure, say Y.
+
 endif # HW_RANDOM
 
 config UML_RANDOM
drivers/char/hw_random/Makefile +1 -0
index 7c9ef4a7667f..17b6d4e6d591 100644
@@ -39,3 +39,4 @@ obj-$(CONFIG_HW_RANDOM_MTK)	+= mtk-rng.o
 obj-$(CONFIG_HW_RANDOM_S390) += s390-trng.o
 obj-$(CONFIG_HW_RANDOM_KEYSTONE) += ks-sa-rng.o
 obj-$(CONFIG_HW_RANDOM_OPTEE) += optee-rng.o
+obj-$(CONFIG_HW_RANDOM_NPCM) += npcm-rng.o
drivers/char/hw_random/npcm-rng.c new file +207 -0

207 lines not on this page · raw message

Signature · 1 line
2.18.0