Skip to contentSkip to conversation

Need help converting usb/faraday,fotg210.yaml to yaml

PATCH Corentin Labbe 2 participants 2 messages Apr 16, 2021

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

Hello

I am converting Documentation/devicetree/bindings/usb/faraday,fotg210.txt to yaml with the patch attached below.
But validating it give me:
Documentation/devicetree/bindings/usb/faraday,fotg210.example.dt.yaml: usb@68000000: 'syscon', 'wakeup-source' do not match any of the regexes: 'pinctrl-[0-9]+'

I dont know from where came this pinctrl regex.
I think this is perhaps due to the if not matched, but still didnt find any solution.

Thanks

Documentation/devicetree/bindings/usb/faraday,fotg210.txt deleted +0 -35
@@ -1,35 +0,0 @@
-Faraday FOTG Host controller
-
-This OTG-capable USB host controller is found in Cortina Systems
-Gemini and other SoC products.
-
-Required properties:
-- compatible: should be one of:
-  "faraday,fotg210"
-  "cortina,gemini-usb", "faraday,fotg210"
-- reg: should contain one register range i.e. start and length
-- interrupts: description of the interrupt line
-
-Optional properties:
-- clocks: should contain the IP block clock
-- clock-names: should be "PCLK" for the IP block clock
-
-Required properties for "cortina,gemini-usb" compatible:
-- syscon: a phandle to the system controller to access PHY registers
-
-Optional properties for "cortina,gemini-usb" compatible:
-- cortina,gemini-mini-b: boolean property that indicates that a Mini-B
-  OTG connector is in use
-- wakeup-source: see power/wakeup-source.txt
-
-Example for Gemini:
-
-usb@68000000 {
-	compatible = "cortina,gemini-usb", "faraday,fotg210";
-	reg = <0x68000000 0x1000>;
-	interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
-	clocks = <&cc 12>;
-	clock-names = "PCLK";
-	syscon = <&syscon>;
-	wakeup-source;
-};
Documentation/devicetree/bindings/usb/faraday,fotg210.yaml new file +78 -0

78 lines not on this page · raw message

#1 lore raw
Quoted 6 lines · Corentin Labbe

Hello

I am converting Documentation/devicetree/bindings/usb/faraday,fotg210.txt to yaml with the patch attached below.
But validating it give me:
Documentation/devicetree/bindings/usb/faraday,fotg210.example.dt.yaml: usb@68000000: 'syscon', 'wakeup-source' do not match any of the regexes: 'pinctrl-[0-9]+'

These have to be defined at the top level, not just the if/then schema. More below...

Quoted 2 lines

I dont know from where came this pinctrl regex.

The tooling adds it.

Quoted 98 lines

I think this is perhaps due to the if not matched, but still didnt find any solution.

Thanks

Documentation/devicetree/bindings/usb/faraday,fotg210.txt deleted +0 -35
@@ -1,35 +0,0 @@
-Faraday FOTG Host controller
-
-This OTG-capable USB host controller is found in Cortina Systems
-Gemini and other SoC products.
-
-Required properties:
-- compatible: should be one of:
-  "faraday,fotg210"
-  "cortina,gemini-usb", "faraday,fotg210"
-- reg: should contain one register range i.e. start and length
-- interrupts: description of the interrupt line
-
-Optional properties:
-- clocks: should contain the IP block clock
-- clock-names: should be "PCLK" for the IP block clock
-
-Required properties for "cortina,gemini-usb" compatible:
-- syscon: a phandle to the system controller to access PHY registers
-
-Optional properties for "cortina,gemini-usb" compatible:
-- cortina,gemini-mini-b: boolean property that indicates that a Mini-B
-  OTG connector is in use
-- wakeup-source: see power/wakeup-source.txt
-
-Example for Gemini:
-
-usb@68000000 {
-       compatible = "cortina,gemini-usb", "faraday,fotg210";
-       reg = <0x68000000 0x1000>;
-       interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
-       clocks = <&cc 12>;
-       clock-names = "PCLK";
-       syscon = <&syscon>;
-       wakeup-source;
-};
Documentation/devicetree/bindings/usb/faraday,fotg210.yaml new file +50 -0
new file mode 100644
index 000000000000..b5418f29745e
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/usb/faraday,fotg210.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Faraday FOTG Host controller
+
+maintainers:
+  - Linus Walleij <[email protected]>
+
+description: |
+    This OTG-capable USB host controller is found in Cortina Systems
+    Gemini and other SoC products.
+
+properties:
+  compatible:
+    oneOf:
+      - const: faraday,fotg210
+      - items:
+        - const: cortina,gemini-usb
+        - const: faraday,fotg210
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: PCLK
+
+  resets:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+if:
+  properties:
+    compatible:
+      contains:
+        const: cortina,gemini-usb
+then:
+  properties:

Documentation/devicetree/bindings/usb/faraday,fotg210.yaml line 60

Quoted 10 lines
Documentation/devicetree/bindings/usb/faraday,fotg210.yaml new file +10 -0
+    syscon:
+      maxItems: 1
+      $ref: /schemas/types.yaml#/definitions/phandle
+      description: Phandle to the system controller to access PHY registers
+    cortina,gemini-mini-b:
+      type: boolean
+      description: boolean property that indicates that a Mini-B OTG connector is in use
+    wakeup-source:
+      type: boolean
+      description: see power/wakeup-source.txt

Move these definitions to the top level 'properties'. Then add an else clause:

else:
properties:
syscon: false
cortina,gemini-mini-b: false
wakeup-source: false

Quoted 19 lines
Documentation/devicetree/bindings/usb/faraday,fotg210.yaml new file +18 -0
+  required:
+    - syscon
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    usb@68000000 {
+      compatible = "cortina,gemini-usb", "faraday,fotg210";
+      reg = <0x68000000 0x1000>;
+      interrupts = <10 IRQ_TYPE_LEVEL_HIGH>;
+      clocks = <&cc 12>;
+      clock-names = "PCLK";
+      syscon = <&syscon>;
+      wakeup-source;
+    };
+...