[v3,03/17] dt-bindings: pinctrl: allow pin controller device without unit address

Message ID 20240123-mbly-clk-v3-3-392b010b8281@bootlin.com
State New
Headers
Series Add support for Mobileye EyeQ5 system controller |

Commit Message

Théo Lebrun Jan. 23, 2024, 6:46 p.m. UTC
  Allow a pin controller device to have no address, therefore no unit
address.

The previous $nodename was enforcing a unit address, but
scripts/dtc/checks.c enforced that names with unit addresses have reg
or ranges:

   Warning (unit_address_vs_reg): .../pinctrl@0: node has a unit
   name, but no reg or ranges property

Fix pinctrl.yaml to adopt a (pinctrl|pinmux)(-[a-z]+)? node name when
neither reg nor ranges are required. Use [a-z]+ to avoid conflicts with
pinctrl-consumer.yaml.

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
 Documentation/devicetree/bindings/pinctrl/pinctrl.yaml | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
  

Comments

Rob Herring Jan. 23, 2024, 8:57 p.m. UTC | #1
On Tue, 23 Jan 2024 19:46:48 +0100, Théo Lebrun wrote:
> Allow a pin controller device to have no address, therefore no unit
> address.
> 
> The previous $nodename was enforcing a unit address, but
> scripts/dtc/checks.c enforced that names with unit addresses have reg
> or ranges:
> 
>    Warning (unit_address_vs_reg): .../pinctrl@0: node has a unit
>    name, but no reg or ranges property
> 
> Fix pinctrl.yaml to adopt a (pinctrl|pinmux)(-[a-z]+)? node name when
> neither reg nor ranges are required. Use [a-z]+ to avoid conflicts with
> pinctrl-consumer.yaml.
> 
> Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
> ---
>  Documentation/devicetree/bindings/pinctrl/pinctrl.yaml | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 

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:
/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml:45:8: [warning] wrong indentation: expected 8 but found 7 (indentation)
/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml:47:8: [warning] wrong indentation: expected 8 but found 7 (indentation)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240123-mbly-clk-v3-3-392b010b8281@bootlin.com

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.
  

Patch

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml
index d471563119a9..1f1239c9b94d 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml
@@ -26,9 +26,6 @@  description: |
   controller device.
 
 properties:
-  $nodename:
-    pattern: "^(pinctrl|pinmux)(@[0-9a-f]+)?$"
-
   "#pinctrl-cells":
     description: >
       Number of pin control cells in addition to the index within the pin
@@ -42,4 +39,19 @@  properties:
       This property can be set either globally for the pin controller or in
       child nodes for individual pin group control.
 
+if:
+  anyOf:
+    - required:
+       - reg
+    - required:
+       - ranges
+then:
+  properties:
+    $nodename:
+      pattern: "^(pinctrl|pinmux)(@[0-9a-f]+)?$"
+else:
+  properties:
+    $nodename:
+      pattern: "^(pinctrl|pinmux)(-[a-z]+)?$"
+
 additionalProperties: true