Skip to contentSkip to conversation

dt-bindings: pinctrl: convert Broadcom Northstar to the json-schema

PATCH Superseded Rafał Miłecki 3 participants 6 messages Apr 21, 2021 – May 18, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dt-bindings: pinctrl: convert Broadcom Northstar to the json-schema

From: Rafał Miłecki <[email protected]>

Important: this change converts the binding as it is. It includes dependency on undocumented CRU that must be refactored. That will be handled once every CRU MFD subdevice gets documented properly (including pinmux).

---
 .../bindings/pinctrl/brcm,bcm4708-pinmux.txt  | 55 -----------
 .../bindings/pinctrl/brcm,ns-pinmux.yaml      | 98 +++++++++++++++++++
 2 files changed, 98 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt deleted +0 -55
deleted file mode 100644
index 8ab2d468dbdb..000000000000
@@ -1,55 +0,0 @@
-Broadcom Northstar pins mux controller
-
-Some of Northstar SoCs's pins can be used for various purposes thanks to the mux
-controller. This binding allows describing mux controller and listing available
-functions. They can be referenced later by other bindings to let system
-configure controller correctly.
-
-A list of pins varies across chipsets so few bindings are available.
-
-Node of the pinmux must be nested in the CRU (Central Resource Unit) "syscon"
-noce.
-
-Required properties:
-- compatible: must be one of:
-	"brcm,bcm4708-pinmux"
-	"brcm,bcm4709-pinmux"
-	"brcm,bcm53012-pinmux"
-- offset: offset of pin registers in the CRU block
-
-Functions and their groups available for all chipsets:
-- "spi": "spi_grp"
-- "i2c": "i2c_grp"
-- "pwm": "pwm0_grp", "pwm1_grp", "pwm2_grp", "pwm3_grp"
-- "uart1": "uart1_grp"
-
-Additionally available on BCM4709 and BCM53012:
-- "mdio": "mdio_grp"
-- "uart2": "uart2_grp"
-- "sdio": "sdio_pwr_grp", "sdio_1p8v_grp"
-
-For documentation of subnodes see:
-Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
-
-Example:
-	dmu@1800c000 {
-		compatible = "simple-bus";
-		ranges = <0 0x1800c000 0x1000>;
-		#address-cells = <1>;
-		#size-cells = <1>;
-
-		cru@100 {
-			compatible = "syscon", "simple-mfd";
-			reg = <0x100 0x1a4>;
-
-			pinctrl {
-				compatible = "brcm,bcm4708-pinmux";
-				offset = <0xc0>;
-
-				spi-pins {
-					function = "spi";
-					groups = "spi_grp";
-				};
-			};
-		};
-	};
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 7 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Important: this change converts the binding as it is. It includes dependency on undocumented CRU that must be refactored. That will be handled once every CRU MFD subdevice gets documented properly (including pinmux).

Quoted 8 lines
---
 .../bindings/pinctrl/brcm,bcm4708-pinmux.txt  | 55 -----------
 .../bindings/pinctrl/brcm,ns-pinmux.yaml      | 98 +++++++++++++++++++
 2 files changed, 98 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.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/linux-dt-review/Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.example.dt.yaml: dmu@1800c000: $nodename:0: 'dmu@1800c000' does not match '^([a-z][a-z0-9\\-]+-bus|bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
From schema: /usr/local/lib/python3.8/dist-packages/dtschema/schemas/simple-bus.yaml

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

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.

maintainer
#2 lore raw
In reply to Rafał Miłecki
Quoted 104 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Important: this change converts the binding as it is. It includes dependency on undocumented CRU that must be refactored. That will be handled once every CRU MFD subdevice gets documented properly (including pinmux).

---
 .../bindings/pinctrl/brcm,bcm4708-pinmux.txt  | 55 -----------
 .../bindings/pinctrl/brcm,ns-pinmux.yaml      | 98 +++++++++++++++++++
 2 files changed, 98 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt deleted +0 -55
deleted file mode 100644
index 8ab2d468dbdb..000000000000
@@ -1,55 +0,0 @@
-Broadcom Northstar pins mux controller
-
-Some of Northstar SoCs's pins can be used for various purposes thanks to the mux
-controller. This binding allows describing mux controller and listing available
-functions. They can be referenced later by other bindings to let system
-configure controller correctly.
-
-A list of pins varies across chipsets so few bindings are available.
-
-Node of the pinmux must be nested in the CRU (Central Resource Unit) "syscon"
-noce.
-
-Required properties:
-- compatible: must be one of:
-	"brcm,bcm4708-pinmux"
-	"brcm,bcm4709-pinmux"
-	"brcm,bcm53012-pinmux"
-- offset: offset of pin registers in the CRU block
-
-Functions and their groups available for all chipsets:
-- "spi": "spi_grp"
-- "i2c": "i2c_grp"
-- "pwm": "pwm0_grp", "pwm1_grp", "pwm2_grp", "pwm3_grp"
-- "uart1": "uart1_grp"
-
-Additionally available on BCM4709 and BCM53012:
-- "mdio": "mdio_grp"
-- "uart2": "uart2_grp"
-- "sdio": "sdio_pwr_grp", "sdio_1p8v_grp"
-
-For documentation of subnodes see:
-Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
-
-Example:
-	dmu@1800c000 {
-		compatible = "simple-bus";
-		ranges = <0 0x1800c000 0x1000>;
-		#address-cells = <1>;
-		#size-cells = <1>;
-
-		cru@100 {
-			compatible = "syscon", "simple-mfd";
-			reg = <0x100 0x1a4>;
-
-			pinctrl {
-				compatible = "brcm,bcm4708-pinmux";
-				offset = <0xc0>;
-
-				spi-pins {
-					function = "spi";
-					groups = "spi_grp";
-				};
-			};
-		};
-	};
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +22 -0
new file mode 100644
index 000000000000..1cba8f0db5c1
@@ -0,0 +1,98 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,ns-pinmux.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom Northstar pins mux controller
+
+maintainers:
+  - Rafał Miłecki <[email protected]>
+
+description:
+  Some of Northstar SoCs's pins can be used for various purposes thanks to the
+  mux controller. This binding allows describing mux controller and listing
+  available functions. They can be referenced later by other bindings to let
+  system configure controller correctly.
+
+  A list of pins varies across chipsets so few bindings are available.
+
+  Node of the pinmux must be nested in the CRU (Central Resource Unit) "syscon"
+  node.
+

Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml line 32

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +10 -0
+properties:
+  compatible:
+    enum:
+      - brcm,bcm4708-pinmux
+      - brcm,bcm4709-pinmux
+      - brcm,bcm53012-pinmux
+
+  offset:
+    description: offset of pin registers in the CRU block
+    $ref: /schemas/types.yaml#/definitions/uint32-array

How many entries are valid?

Really, this should have been just 'reg'.

Quoted 4 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +4 -0
+
+patternProperties:
+  '-pins$':
+    type: object

Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +10 -0
+    description: pin node
+    $ref: pinmux-node.yaml#
+
+    properties:
+      function:
+        enum: [ spi, i2c, pwm, uart1, mdio, uart2, sdio ]
+      groups:
+        items:
+          enum: [ spi_grp, i2c_grp, pwm0_grp, pwm1_grp, pwm2_grp, pwm3_grp,
+                  uart1_grp, mdio_grp, uart2_grp, sdio_pwr_grp, sdio_1p8v_grp ]

How many items are valid?

I thought I made the meta-schema require an 'items' schema to also have minItems/maxItems. I'll have to check...

Quoted 23 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +23 -0
+
+    required:
+      - function
+      - groups
+
+    additionalProperties: false
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: brcm,bcm4708-pinmux
+    then:
+      patternProperties:
+        '-pins$':
+          properties:
+            function:
+              enum: [ spi, i2c, pwm, uart1 ]
+            groups:
+              items:
+                enum: [ spi_grp, i2c_grp, pwm0_grp, pwm1_grp, pwm2_grp, pwm3_grp,
+                        uart1_grp ]

Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml line 79

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +10 -0
+
+required:
+  - offset
+
+additionalProperties: false
+
+examples:
+  - |
+    dmu@1800c000 {
+        compatible = "simple-bus";

No need to show this node in examples.

Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml line 85

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +6 -0
+        ranges = <0 0x1800c000 0x1000>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        cru@100 {
+            compatible = "syscon", "simple-mfd";

Is this the same CRU as your other patch?

Quoted 16 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +13 -0
+            reg = <0x100 0x1a4>;
+
+            pinctrl {
+                compatible = "brcm,bcm4708-pinmux";
+                offset = <0xc0>;
+
+                spi-pins {
+                    function = "spi";
+                    groups = "spi_grp";
+                };
+            };
+        };
+    };
Signature · 1 line
2.26.2
#3 lore raw

PATCH v2 1/1 dt-bindings: pinctrl: convert Broadcom Northstar to the json-schema

In reply to Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Important: this change converts the binding as it is. It includes dependency on undocumented CRU that must be refactored. CRU must get documented and offset property has to be reworked.

Above can (and will be) be handled once every CRU MFD subdevice gets documented properly (including the pinmux).

---
V2: Add "maxItems" to the "offset"
Add "minItems" & "maxItems" to the "groups"
Drop "DMU" simple-bus node from the example Improve commit description (mention ugly "offset" property)

CRU ("Clock and Reset Unit" or "Central Resource Unit") binding is being worked on, for details see:
[PATCH robh dt/next] dt-bindings: mfd: add Broadcom CRU
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/

---
 .../bindings/pinctrl/brcm,bcm4708-pinmux.txt  | 55 -----------
 .../bindings/pinctrl/brcm,ns-pinmux.yaml      | 94 +++++++++++++++++++
 2 files changed, 94 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt deleted +0 -55
deleted file mode 100644
index 8ab2d468dbdb..000000000000
@@ -1,55 +0,0 @@
-Broadcom Northstar pins mux controller
-
-Some of Northstar SoCs's pins can be used for various purposes thanks to the mux
-controller. This binding allows describing mux controller and listing available
-functions. They can be referenced later by other bindings to let system
-configure controller correctly.
-
-A list of pins varies across chipsets so few bindings are available.
-
-Node of the pinmux must be nested in the CRU (Central Resource Unit) "syscon"
-noce.
-
-Required properties:
-- compatible: must be one of:
-	"brcm,bcm4708-pinmux"
-	"brcm,bcm4709-pinmux"
-	"brcm,bcm53012-pinmux"
-- offset: offset of pin registers in the CRU block
-
-Functions and their groups available for all chipsets:
-- "spi": "spi_grp"
-- "i2c": "i2c_grp"
-- "pwm": "pwm0_grp", "pwm1_grp", "pwm2_grp", "pwm3_grp"
-- "uart1": "uart1_grp"
-
-Additionally available on BCM4709 and BCM53012:
-- "mdio": "mdio_grp"
-- "uart2": "uart2_grp"
-- "sdio": "sdio_pwr_grp", "sdio_1p8v_grp"
-
-For documentation of subnodes see:
-Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
-
-Example:
-	dmu@1800c000 {
-		compatible = "simple-bus";
-		ranges = <0 0x1800c000 0x1000>;
-		#address-cells = <1>;
-		#size-cells = <1>;
-
-		cru@100 {
-			compatible = "syscon", "simple-mfd";
-			reg = <0x100 0x1a4>;
-
-			pinctrl {
-				compatible = "brcm,bcm4708-pinmux";
-				offset = <0xc0>;
-
-				spi-pins {
-					function = "spi";
-					groups = "spi_grp";
-				};
-			};
-		};
-	};
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml new file +94 -0

94 lines not on this page · raw message

Signature · 1 line
2.26.2
maintainer Reviewed-by on v2 1/1
#4 lore raw
Quoted 20 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Important: this change converts the binding as it is. It includes dependency on undocumented CRU that must be refactored. CRU must get documented and offset property has to be reworked.

Above can (and will be) be handled once every CRU MFD subdevice gets documented properly (including the pinmux).

---
V2: Add "maxItems" to the "offset"
Add "minItems" & "maxItems" to the "groups"
Drop "DMU" simple-bus node from the example Improve commit description (mention ugly "offset" property)

CRU ("Clock and Reset Unit" or "Central Resource Unit") binding is being worked on, for details see:
[PATCH robh dt/next] dt-bindings: mfd: add Broadcom CRU
https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/

Quoted 7 lines
---
 .../bindings/pinctrl/brcm,bcm4708-pinmux.txt  | 55 -----------
 .../bindings/pinctrl/brcm,ns-pinmux.yaml      | 94 +++++++++++++++++++
 2 files changed, 94 insertions(+), 55 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.yaml
#5 lore raw
In reply to Rafał Miłecki
Quoted 10 lines · Rafał Miłecki

From: Rafał Miłecki <[email protected]>

Important: this change converts the binding as it is. It includes dependency on undocumented CRU that must be refactored. CRU must get documented and offset property has to be reworked.

Above can (and will be) be handled once every CRU MFD subdevice gets documented properly (including the pinmux).

This v2 version applied!

Yours,
Linus Walleij