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

Message ID 20240131-mbly-clk-v4-3-bcd00510d6a0@bootlin.com
State New
Headers
Series Add support for Mobileye EyeQ5 system controller |

Commit Message

Théo Lebrun Jan. 31, 2024, 4:26 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 Feb. 2, 2024, 7:52 p.m. UTC | #1
On Wed, Jan 31, 2024 at 05:26:16PM +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.

You can drop this patch now.

Rob
  

Patch

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/pinctrl.yaml
index d471563119a9..3d977b54e260 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