diff mbox series

[v3,4/4] dt-bindings: firmware: arm,scmi: Add support for pinctrl protocol

Message ID a2be28c0aec04fdc3684f56801c78bcc498c3471.1686063941.git.oleksii_moisieiev@epam.com
State New
Headers show
Series firmware: arm_scmi: Add SCMI v3.2 pincontrol protocol basic support | expand

Commit Message

Oleksii Moisieiev June 6, 2023, 4:22 p.m. UTC
Add new SCMI v3.2 pinctrl protocol bindings definitions and example.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
---
 .../bindings/firmware/arm,scmi.yaml           | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)

Comments

Linus Walleij June 9, 2023, 7:35 a.m. UTC | #1
On Tue, Jun 6, 2023 at 6:22 PM Oleksii Moisieiev
<Oleksii_Moisieiev@epam.com> wrote:

> Add new SCMI v3.2 pinctrl protocol bindings definitions and example.
>
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>

This looks very good to me! The DT is very readable which is exactly
according to my philosophy when I designed these abstractions and bindings.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Rob Herring June 14, 2023, 10:36 p.m. UTC | #2
On Tue, Jun 06, 2023 at 04:22:28PM +0000, Oleksii Moisieiev wrote:
> Add new SCMI v3.2 pinctrl protocol bindings definitions and example.
> 
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> ---
>  .../bindings/firmware/arm,scmi.yaml           | 53 +++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
> index 5824c43e9893..a19aa184bbd1 100644
> --- a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
> +++ b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
> @@ -233,6 +233,39 @@ properties:
>        reg:
>          const: 0x18
>  
> +  protocol@19:
> +    $ref: '#/$defs/protocol-node'

       unevaluatedProperties: false

> +
> +    properties:
> +      reg:
> +        const: 0x19
> +
> +      '#pinctrl-cells':
> +        const: 0
> +
> +    allOf:
> +      - $ref: /schemas/pinctrl/pinctrl.yaml#

Group this and the '#/$defs/protocol-node' $ref under allOf.

> +
> +    required:
> +      - reg
> +
> +    additionalProperties:
> +      anyOf:

Don't need anyOf with only 1 entry.

But the use of additionalProperties is usually for existing cases where 
the pin config nodes had no naming convention. For new bindings, define 
a node name pattern (under patternProperties). I'd suggest '-pins$' as 
used elsewhere.

> +        - type: object
> +          allOf:
> +            - $ref: /schemas/pinctrl/pincfg-node.yaml#
> +            - $ref: /schemas/pinctrl/pinmux-node.yaml#
> +
> +          description:
> +            A pin multiplexing sub-node describe how to configure a
> +            set of pins is some desired function.
> +            A single sub-node may define several pin configurations.
> +            This sub-node is using default pinctrl bindings to configure
> +            pin multiplexing and using SCMI protocol to apply specified
> +            configuration using SCMI protocol.
> +
> +          unevaluatedProperties: false
> +
>  additionalProperties: false
>  
>  $defs:
> @@ -384,6 +417,26 @@ examples:
>              scmi_powercap: protocol@18 {
>                  reg = <0x18>;
>              };
> +
> +            scmi_pinctrl: protocol@19 {
> +                reg = <0x19>;
> +                #pinctrl-cells = <0>;
> +
> +                i2c2 {
> +                    groups = "i2c2_a", "i2c2_b";
> +                    function = "i2c2";
> +                };
> +
> +                pins_mdio {
> +                    groups = "avb_mdio";
> +                    drive-strength = <24>;
> +                };
> +
> +                keys_pins: keys {
> +                    pins = "GP_5_17", "GP_5_20", "GP_5_22", "GP_2_1";
> +                    bias-pull-up;
> +                };
> +            };
>          };
>      };
>  
> -- 
> 2.25.1
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
index 5824c43e9893..a19aa184bbd1 100644
--- a/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
+++ b/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
@@ -233,6 +233,39 @@  properties:
       reg:
         const: 0x18
 
+  protocol@19:
+    $ref: '#/$defs/protocol-node'
+
+    properties:
+      reg:
+        const: 0x19
+
+      '#pinctrl-cells':
+        const: 0
+
+    allOf:
+      - $ref: /schemas/pinctrl/pinctrl.yaml#
+
+    required:
+      - reg
+
+    additionalProperties:
+      anyOf:
+        - type: object
+          allOf:
+            - $ref: /schemas/pinctrl/pincfg-node.yaml#
+            - $ref: /schemas/pinctrl/pinmux-node.yaml#
+
+          description:
+            A pin multiplexing sub-node describe how to configure a
+            set of pins is some desired function.
+            A single sub-node may define several pin configurations.
+            This sub-node is using default pinctrl bindings to configure
+            pin multiplexing and using SCMI protocol to apply specified
+            configuration using SCMI protocol.
+
+          unevaluatedProperties: false
+
 additionalProperties: false
 
 $defs:
@@ -384,6 +417,26 @@  examples:
             scmi_powercap: protocol@18 {
                 reg = <0x18>;
             };
+
+            scmi_pinctrl: protocol@19 {
+                reg = <0x19>;
+                #pinctrl-cells = <0>;
+
+                i2c2 {
+                    groups = "i2c2_a", "i2c2_b";
+                    function = "i2c2";
+                };
+
+                pins_mdio {
+                    groups = "avb_mdio";
+                    drive-strength = <24>;
+                };
+
+                keys_pins: keys {
+                    pins = "GP_5_17", "GP_5_20", "GP_5_22", "GP_2_1";
+                    bias-pull-up;
+                };
+            };
         };
     };