Skip to contentSkip to conversation

hwrng: bcm74110 - Add Broadcom BCM74110 RNG driver

PATCH Superseded Markus Mayer 4 participants 10 messages Oct 30, 2024 – Nov 1, 2024

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover hwrng: bcm74110 - Add Broadcom BCM74110 RNG driver

This series adds a driver for the random number generator found on the BCM74110 SoC.

Markus Mayer (2):
dt-bindings: rng: add binding for BCM74110 RNG
hwrng: bcm74110 - Add Broadcom BCM74110 RNG driver

 .../bindings/rng/brcm,bcm74110.yaml           |  35 +++++
 drivers/char/hw_random/Kconfig                |  14 ++
 drivers/char/hw_random/Makefile               |   1 +
 drivers/char/hw_random/bcm74110-rng.c         | 125 ++++++++++++++++++
 4 files changed, 175 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml
 create mode 100644 drivers/char/hw_random/bcm74110-rng.c
Signature · 1 line
2.46.0
#1 lore raw

PATCH 1/2 dt-bindings: rng: add binding for BCM74110 RNG

Add a binding for the random number generator used on the BCM74110.

---
 .../bindings/rng/brcm,bcm74110.yaml           | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +35 -0
new file mode 100644
index 000000000000..acd0856cee72
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rng/brcm,bcm74110.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: BCM74110 Random number generator
+
+description: |
+  Random number generator used on the BCM74110.
+
+maintainers:
+  - Markus Mayer <[email protected]>
+  - Florian Fainelli <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm74110-rng
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    rng: rng@83ba000 {
+        compatible = "brcm,bcm74110-trng";
+        reg = <0x83ba000 0x14>;
+    };
Signature · 1 line
2.46.0
#2 lore raw

Re: [PATCH 1/2] dt-bindings: rng: add binding for BCM74110 RNG

Quoted 7 lines · Markus Mayer

Add a binding for the random number generator used on the BCM74110.

---
  .../bindings/rng/brcm,bcm74110.yaml           | 35 +++++++++++++++++++
  1 file changed, 35 insertions(+)

create mode 100644 Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml

This file should be named, brcm,bcm74110-rng.yaml, I believe. --
Florian

#3 lore raw

Re: [PATCH 1/2] dt-bindings: rng: add binding for BCM74110 RNG

In reply to Markus Mayer
Quoted 8 lines · Markus Mayer

Add a binding for the random number generator used on the BCM74110.

---
 .../bindings/rng/brcm,bcm74110.yaml           | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/rng/brcm,bcm74110.example.dtb: /example-0/rng@83ba000: failed to match any schema with compatible: ['brcm,bcm74110-trng']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#4 lore raw

Re: [PATCH 1/2] dt-bindings: rng: add binding for BCM74110 RNG

In reply to Markus Mayer

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml

Quoted 13 lines · Markus Mayer

Add a binding for the random number generator used on the BCM74110.

---
 .../bindings/rng/brcm,bcm74110.yaml           | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +0 -0
new file mode 100644
index 000000000000..acd0856cee72

Filename as compatible.

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml line 9

Quoted 10 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +9 -0
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rng/brcm,bcm74110.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: BCM74110 Random number generator
+
+description: |

Do not need '|' unless you need to preserve formatting.

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml line 19

Quoted 10 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +10 -0
+  Random number generator used on the BCM74110.
+
+maintainers:
+  - Markus Mayer <[email protected]>
+  - Florian Fainelli <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm74110-rng

That's not what you have in DTS.

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml line 32

Quoted 13 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +13 -0
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    rng: rng@83ba000 {

Drop unused label.

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH 1/2] dt-bindings: rng: add binding for BCM74110 RNG

Quoted 10 lines · Krzysztof Kozlowski
Quoted 8 lines · Markus Mayer

Add a binding for the random number generator used on the BCM74110.

---
 .../bindings/rng/brcm,bcm74110.yaml           | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml
Quoted 7 lines

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml

Quoted 5 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +0 -0
new file mode 100644
index 000000000000..acd0856cee72

Filename as compatible.

I am not sure what you mean by this. That the filename should match the compatible string? I did change the filename to brcm,bcm74110-rng.yaml the ID to

http://devicetree.org/schemas/rng/brcm,bcm74110-rng.yaml# in response
to Florian's comment from yesterday.
Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +3 -0
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
Quoted 8 lines

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml line 9

Quoted 6 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +6 -0
+$id: http://devicetree.org/schemas/rng/brcm,bcm74110.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: BCM74110 Random number generator
+
+description: |

Do not need '|' unless you need to preserve formatting.

Removed.

Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +4 -0
+  Random number generator used on the BCM74110.
+
+maintainers:
+  - Markus Mayer <[email protected]>
Quoted 8 lines

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml line 19

Quoted 6 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +6 -0
+  - Florian Fainelli <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - brcm,bcm74110-rng

That's not what you have in DTS.

Fixed in the DTS to be "brcm,bcm74110-rng" everywhere.

Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +7 -0
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
Quoted 8 lines

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml line 32

Quoted 6 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +6 -0
+
+additionalProperties: false
+
+examples:
+  - |
+    rng: rng@83ba000 {

Drop unused label.

Done.

I am giving it a bit more time for additional feedback (on the driver and the binding) and will send v2 in a few days. Meanwhile, the generated DTS (with the changes incorporated) is now looking like this:

$ cat ./Documentation/devicetree/bindings/rng/brcm,bcm74110-rng.example.dts
/dts-v1/;
/plugin/; // silence any missing phandle references
/{
    compatible = "foo";
    model = "foo";
    #address-cells = <1>;
    #size-cells = <1>;

    example-0 {
        #address-cells = <1>;
        #size-cells = <1>;

        rng@83ba000 {
            compatible = "brcm,bcm74110-rng";
            reg = <0x83ba000 0x14>;
        };
    };
};

Thanks,
-Markus

#6 lore raw

Re: [PATCH 1/2] dt-bindings: rng: add binding for BCM74110 RNG

Quoted 20 lines · Markus Mayer
Quoted 10 lines · Krzysztof Kozlowski
Quoted 8 lines · Markus Mayer

Add a binding for the random number generator used on the BCM74110.

---
 .../bindings/rng/brcm,bcm74110.yaml           | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml
Quoted 7 lines

Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml

Quoted 5 lines
Documentation/devicetree/bindings/rng/brcm,bcm74110.yaml new file +0 -0
new file mode 100644
index 000000000000..acd0856cee72

Filename as compatible.

Quoted 2 lines

I am not sure what you mean by this. That the filename should match the compatible string? I did change the filename to

Yes.

Best regards,
Krzysztof

#7 lore raw

PATCH 2/2 hwrng: bcm74110 - Add Broadcom BCM74110 RNG driver

In reply to Markus Mayer

Add a driver for the random number generator present on the Broadcom BCM74110 SoC.

---
 drivers/char/hw_random/Kconfig        |  14 +++
 drivers/char/hw_random/Makefile       |   1 +
 drivers/char/hw_random/bcm74110-rng.c | 125 ++++++++++++++++++++++++++
 3 files changed, 140 insertions(+)
 create mode 100644 drivers/char/hw_random/bcm74110-rng.c
drivers/char/hw_random/Kconfig +14 -0
index b51d9e243f35..90ae35aeb23a 100644
@@ -99,6 +99,20 @@ config HW_RANDOM_BCM2835
 
 	  If unsure, say Y.
 
+config HW_RANDOM_BCM74110
+	tristate "Broadcom BCM74110 Random Number Generator support"
+	depends on ARCH_BCM2835 || ARCH_BCM_NSP || ARCH_BCM_5301X || \
+		   ARCH_BCMBCA || BCM63XX || ARCH_BRCMSTB || COMPILE_TEST
+	default HW_RANDOM
+	help
+	  This driver provides kernel-side support for the Random Number
+	  Generator hardware found on the Broadcom BCM74110 SoCs.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called bcm74110-rng
+
+	  If unsure, say Y.
+
 config HW_RANDOM_IPROC_RNG200
 	tristate "Broadcom iProc/STB RNG200 support"
 	depends on ARCH_BCM_IPROC || ARCH_BCM2835 || ARCH_BRCMSTB || COMPILE_TEST
drivers/char/hw_random/Makefile +1 -0
index 01f012eab440..283791f5462d 100644
@@ -31,6 +31,7 @@ obj-$(CONFIG_HW_RANDOM_POWERNV) += powernv-rng.o
 obj-$(CONFIG_HW_RANDOM_HISI)	+= hisi-rng.o
 obj-$(CONFIG_HW_RANDOM_HISTB) += histb-rng.o
 obj-$(CONFIG_HW_RANDOM_BCM2835) += bcm2835-rng.o
+obj-$(CONFIG_HW_RANDOM_BCM74110) += bcm74110-rng.o
 obj-$(CONFIG_HW_RANDOM_IPROC_RNG200) += iproc-rng200.o
 obj-$(CONFIG_HW_RANDOM_ST) += st-rng.o
 obj-$(CONFIG_HW_RANDOM_XGENE) += xgene-rng.o
drivers/char/hw_random/bcm74110-rng.c new file +125 -0

125 lines not on this page · raw message

Signature · 1 line
2.46.0
#8 lore raw
Quoted 16 lines · Markus Mayer

Add a driver for the random number generator present on the Broadcom BCM74110 SoC.

---
  drivers/char/hw_random/Kconfig        |  14 +++
  drivers/char/hw_random/Makefile       |   1 +
  drivers/char/hw_random/bcm74110-rng.c | 125 ++++++++++++++++++++++++++
  3 files changed, 140 insertions(+)

create mode 100644 drivers/char/hw_random/bcm74110-rng.c

drivers/char/hw_random/Kconfig +0 -0
index b51d9e243f35..90ae35aeb23a 100644

drivers/char/hw_random/Kconfig config HW_RANDOM_BCM2835 · line 105

Quoted 7 lines
drivers/char/hw_random/Kconfig +4 -0
@@ -99,6 +99,20 @@ config HW_RANDOM_BCM2835
 
  	  If unsure, say Y.
 
+config HW_RANDOM_BCM74110
+	tristate "Broadcom BCM74110 Random Number Generator support"
+	depends on ARCH_BCM2835 || ARCH_BCM_NSP || ARCH_BCM_5301X || \
+		   ARCH_BCMBCA || BCM63XX || ARCH_BRCMSTB || COMPILE_TEST

AFAICT this driver is only present on STB chips so limiting to ARCH_BRCMSTB || COMPILE_TEST should suffice for now.

Signature · 1 line
Florian
#9 lore raw
Quoted 21 lines · Florian Fainelli
Quoted 19 lines · Markus Mayer

Add a driver for the random number generator present on the Broadcom BCM74110 SoC.

---
  drivers/char/hw_random/Kconfig        |  14 +++
  drivers/char/hw_random/Makefile       |   1 +
  drivers/char/hw_random/bcm74110-rng.c | 125 ++++++++++++++++++++++++++
  3 files changed, 140 insertions(+)

create mode 100644 drivers/char/hw_random/bcm74110-rng.c

drivers/char/hw_random/Kconfig +0 -0
index b51d9e243f35..90ae35aeb23a 100644
@@ -99,6 +99,20 @@ config HW_RANDOM_BCM2835
 
        If unsure, say Y.
 
Quoted 7 lines

drivers/char/hw_random/Kconfig config HW_RANDOM_BCM2835 · line 105

Quoted 4 lines
drivers/char/hw_random/Kconfig +4 -0
+config HW_RANDOM_BCM74110
+     tristate "Broadcom BCM74110 Random Number Generator support"
+     depends on ARCH_BCM2835 || ARCH_BCM_NSP || ARCH_BCM_5301X || \
+                ARCH_BCMBCA || BCM63XX || ARCH_BRCMSTB || COMPILE_TEST

AFAICT this driver is only present on STB chips so limiting to ARCH_BRCMSTB || COMPILE_TEST should suffice for now.

This is now fixed in my tree. I will resend in a few days.

Regards,
-Markus