diff mbox series

dt-bindings: pinctrl: uniphier: Add child node definitions to describe pin mux and configuration

Message ID 1634136848-20091-1-git-send-email-hayashi.kunihiko@socionext.com
State New
Headers show
Series dt-bindings: pinctrl: uniphier: Add child node definitions to describe pin mux and configuration | expand

Commit Message

Kunihiko Hayashi Oct. 13, 2021, 2:54 p.m. UTC
In arch/arm/boot/dts/uniphier-pinctrl.dtsi, there are child nodes of
pinctrl that defines pinmux and pincfg, however, there are no rules about
that in dt-bindings.

'make dtbs_check' results an error with the following message:

   pinctrl: 'ain1', 'ain2', 'ainiec1', 'aout', 'aout1', 'aout2', ...
   ... 'usb2', 'usb3' do not match any of the regexes: 'pinctrl-[0-9]+'

To avoid this issue, add the rules of pinmux and pincfg in each child node
and grandchild node.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 .../pinctrl/socionext,uniphier-pinctrl.yaml        | 46 +++++++++++++++++++++-
 1 file changed, 44 insertions(+), 2 deletions(-)

Comments

Rob Herring Oct. 26, 2021, 8:31 p.m. UTC | #1
On Wed, Oct 13, 2021 at 11:54:08PM +0900, Kunihiko Hayashi wrote:
> In arch/arm/boot/dts/uniphier-pinctrl.dtsi, there are child nodes of
> pinctrl that defines pinmux and pincfg, however, there are no rules about
> that in dt-bindings.
> 
> 'make dtbs_check' results an error with the following message:
> 
>    pinctrl: 'ain1', 'ain2', 'ainiec1', 'aout', 'aout1', 'aout2', ...
>    ... 'usb2', 'usb3' do not match any of the regexes: 'pinctrl-[0-9]+'
> 
> To avoid this issue, add the rules of pinmux and pincfg in each child node
> and grandchild node.
> 
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
>  .../pinctrl/socionext,uniphier-pinctrl.yaml        | 46 +++++++++++++++++++++-
>  1 file changed, 44 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml
> index a804d9bc1602..4567330fe536 100644
> --- a/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml
> +++ b/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml
> @@ -26,11 +26,53 @@ properties:
>        - socionext,uniphier-pxs3-pinctrl
>        - socionext,uniphier-nx1-pinctrl
>  
> -required:
> -  - compatible
> +patternProperties:
> +  "^.*$":
> +    if:
> +      type: object
> +    then:

After coming up with this hack, I found a better way using 
additionalProperties:

additionalProperties:
  type: object

and then all this:

> +      allOf:
> +        - $ref: pincfg-node.yaml#
> +        - $ref: pinmux-node.yaml#
> +
> +      properties:
> +        phandle: true
> +        function: true
> +        groups: true
> +        pins: true
> +        bias-pull-up: true
> +        bias-pull-down: true
> +        bias-pull-pin-default: true
> +        drive-strength: true
> +
> +      patternProperties:
> +        "^.*$":
> +          if:
> +            type: object
> +          then:

Same thing here.

> +            allOf:
> +              - $ref: pincfg-node.yaml#
> +              - $ref: pinmux-node.yaml#
> +
> +            properties:
> +              phandle: true
> +              function: true
> +              groups: true
> +              pins: true
> +              bias-pull-up: true
> +              bias-pull-down: true
> +              bias-pull-pin-default: true
> +              drive-strength: true
> +
> +            unevaluatedProperties: false
> +
> +      unevaluatedProperties: false
>  
>  additionalProperties: false
>  
> +required:
> +  - compatible
> +
>  examples:
>    - |
>      // The UniPhier pinctrl should be a subnode of a "syscon" compatible node.
> -- 
> 2.7.4
> 
>
Kunihiko Hayashi Oct. 27, 2021, 5:56 a.m. UTC | #2
Hi Rob,
Thank you for your comment,

On 2021/10/27 5:31, Rob Herring wrote:
> On Wed, Oct 13, 2021 at 11:54:08PM +0900, Kunihiko Hayashi wrote:
>> In arch/arm/boot/dts/uniphier-pinctrl.dtsi, there are child nodes of
>> pinctrl that defines pinmux and pincfg, however, there are no rules
> about
>> that in dt-bindings.
>>
>> 'make dtbs_check' results an error with the following message:
>>
>>     pinctrl: 'ain1', 'ain2', 'ainiec1', 'aout', 'aout1', 'aout2', ...
>>     ... 'usb2', 'usb3' do not match any of the regexes: 'pinctrl-[0-9]+'
>>
>> To avoid this issue, add the rules of pinmux and pincfg in each child
> node
>> and grandchild node.
>>
>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
>> ---
>>   .../pinctrl/socionext,uniphier-pinctrl.yaml        | 46
> +++++++++++++++++++++-
>>   1 file changed, 44 insertions(+), 2 deletions(-)
>>
>> diff --git
> a/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yam
> l
> b/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yam
> l
>> index a804d9bc1602..4567330fe536 100644
>> ---
> a/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yam
> l
>> +++
> b/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yam
> l
>> @@ -26,11 +26,53 @@ properties:
>>         - socionext,uniphier-pxs3-pinctrl
>>         - socionext,uniphier-nx1-pinctrl
>>   
>> -required:
>> -  - compatible
>> +patternProperties:
>> +  "^.*$":
>> +    if:
>> +      type: object
>> +    then:
> 
> After coming up with this hack, I found a better way using
> additionalProperties:
> 
> additionalProperties:
>    type: object

I see. I'll add it next.

> and then all this:
> 
>> +      allOf:
>> +        - $ref: pincfg-node.yaml#
>> +        - $ref: pinmux-node.yaml#
>> +
>> +      properties:
>> +        phandle: true
>> +        function: true
>> +        groups: true
>> +        pins: true
>> +        bias-pull-up: true
>> +        bias-pull-down: true
>> +        bias-pull-pin-default: true
>> +        drive-strength: true
>> +
>> +      patternProperties:
>> +        "^.*$":
>> +          if:
>> +            type: object
>> +          then:
> 
> Same thing here.

Yes. I'll add it, too.

Thank you,

---
Best Regards
Kunihiko Hayashi
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml
index a804d9bc1602..4567330fe536 100644
--- a/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml
+++ b/Documentation/devicetree/bindings/pinctrl/socionext,uniphier-pinctrl.yaml
@@ -26,11 +26,53 @@  properties:
       - socionext,uniphier-pxs3-pinctrl
       - socionext,uniphier-nx1-pinctrl
 
-required:
-  - compatible
+patternProperties:
+  "^.*$":
+    if:
+      type: object
+    then:
+      allOf:
+        - $ref: pincfg-node.yaml#
+        - $ref: pinmux-node.yaml#
+
+      properties:
+        phandle: true
+        function: true
+        groups: true
+        pins: true
+        bias-pull-up: true
+        bias-pull-down: true
+        bias-pull-pin-default: true
+        drive-strength: true
+
+      patternProperties:
+        "^.*$":
+          if:
+            type: object
+          then:
+            allOf:
+              - $ref: pincfg-node.yaml#
+              - $ref: pinmux-node.yaml#
+
+            properties:
+              phandle: true
+              function: true
+              groups: true
+              pins: true
+              bias-pull-up: true
+              bias-pull-down: true
+              bias-pull-pin-default: true
+              drive-strength: true
+
+            unevaluatedProperties: false
+
+      unevaluatedProperties: false
 
 additionalProperties: false
 
+required:
+  - compatible
+
 examples:
   - |
     // The UniPhier pinctrl should be a subnode of a "syscon" compatible node.