[v1,1/3] dt-bindings: RNG: Add Rockchip RNG bindings

Message ID 20221112141059.3802506-2-aurelien@aurel32.net
State New
Headers
Series hwrng: add hwrng support for Rockchip RK3568 |

Commit Message

Aurelien Jarno Nov. 12, 2022, 2:10 p.m. UTC
  Add the RNG bindings for the RK3568 SoC from Rockchip

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 .../devicetree/bindings/rng/rockchip-rng.yaml | 62 +++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/rng/rockchip-rng.yaml
  

Comments

Rob Herring Nov. 13, 2022, 2 p.m. UTC | #1
On Sat, 12 Nov 2022 15:10:57 +0100, Aurelien Jarno wrote:
> Add the RNG bindings for the RK3568 SoC from Rockchip
> 
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  .../devicetree/bindings/rng/rockchip-rng.yaml | 62 +++++++++++++++++++
>  1 file changed, 62 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/rng/rockchip-rng.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/rng/rockchip-rng.yaml: properties:compatible:oneOf: [{'const': 'rockchip,rk3568-rng'}] should not be valid under {'items': {'propertyNames': {'const': 'const'}, 'required': ['const']}}
	hint: Use 'enum' rather than 'oneOf' + 'const' entries
	from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
./Documentation/devicetree/bindings/rng/rockchip-rng.yaml: $id: relative path/filename doesn't match actual path or filename
	expected: http://devicetree.org/schemas/rng/rockchip-rng.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/rng/rockchip-rng.example.dtb: rng@fe388000: reg: [[0, 4265115648], [0, 16384]] is too long
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/rng/rockchip-rng.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/rng/rockchip-rng.example.dtb: rng@fe388000: clock-names:0: 'clk' was expected
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/rng/rockchip-rng.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/rng/rockchip-rng.example.dtb: rng@fe388000: clock-names:1: 'hclk' was expected
	From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/rng/rockchip-rng.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

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.
  
Krzysztof Kozlowski Nov. 14, 2022, 8:33 a.m. UTC | #2
On 12/11/2022 15:10, Aurelien Jarno wrote:
> Add the RNG bindings for the RK3568 SoC from Rockchip
> 
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> ---
>  .../devicetree/bindings/rng/rockchip-rng.yaml | 62 +++++++++++++++++++
>  1 file changed, 62 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/rng/rockchip-rng.yaml
> 
> diff --git a/Documentation/devicetree/bindings/rng/rockchip-rng.yaml b/Documentation/devicetree/bindings/rng/rockchip-rng.yaml
> new file mode 100644
> index 000000000000..87d80e8ff7f2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/rng/rockchip-rng.yaml

Filename matching compatible, so "rockchip,rk3568-rng.yaml"

> @@ -0,0 +1,62 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/rng/rockchip,rk-rng.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Rockchip TRNG bindings

Drop "bindings"

> +
> +description:
> +  This driver interface with the True Random Number Generator present in some

Drop "This driver interface" and make it a proper sentence. Bindings are
not about drivers.


> +  Rockchip SoCs.
> +
> +maintainers:
> +  - Aurelien Jarno <aurelien@aurel32.net>
> +
> +properties:
> +  compatible:
> +    oneOf:

It's not a oneOf. Drop.

> +      - const: rockchip,rk3568-rng
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    minItems: 2

Drop minItems.

> +    maxItems: 2
> +
> +  clock-names:
> +    items:
> +      - const: clk
> +      - const: hclk

You need to explain what are these in clocks. Also you need better
names. A clock name "clk" is useless.

> +
> +  resets:
> +    maxItems: 1
> +
> +  reset-names:
> +    items:
> +      - const: reset

Drop reset-names entirely, not useful.

> +
> +required:
> +  - compatible
> +  - reg
> +  - clocks
> +  - clock-names
> +  - resets
> +  - reset-names

Best regards,
Krzysztof
  

Patch

diff --git a/Documentation/devicetree/bindings/rng/rockchip-rng.yaml b/Documentation/devicetree/bindings/rng/rockchip-rng.yaml
new file mode 100644
index 000000000000..87d80e8ff7f2
--- /dev/null
+++ b/Documentation/devicetree/bindings/rng/rockchip-rng.yaml
@@ -0,0 +1,62 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/rng/rockchip,rk-rng.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip TRNG bindings
+
+description:
+  This driver interface with the True Random Number Generator present in some
+  Rockchip SoCs.
+
+maintainers:
+  - Aurelien Jarno <aurelien@aurel32.net>
+
+properties:
+  compatible:
+    oneOf:
+      - const: rockchip,rk3568-rng
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    minItems: 2
+    maxItems: 2
+
+  clock-names:
+    items:
+      - const: clk
+      - const: hclk
+
+  resets:
+    maxItems: 1
+
+  reset-names:
+    items:
+      - const: reset
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rk3568-cru.h>
+    rng@fe388000 {
+      compatible = "rockchip,rk3568-rng";
+      reg = <0x0 0xfe388000 0x0 0x4000>;
+      clocks = <&cru CLK_TRNG_NS>, <&cru HCLK_TRNG_NS>;
+      clock-names = "trng_clk", "trng_hclk";
+      resets = <&cru SRST_TRNG_NS>;
+      reset-names = "reset";
+    };
+
+...