Re: Need help converting usb/faraday,fotg210.yaml to yaml
From: Rob Herring
Date: Fri Apr 16 2021 - 09:47:05 EST
On Fri, Apr 16, 2021 at 8:18 AM Corentin Labbe
<clabbe.montjoie@xxxxxxxxx> wrote:
>
> 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...
>
> I dont know from where came this pinctrl regex.
The tooling adds it.
> I think this is perhaps due to the if not matched, but still didnt find any solution.
>
> Thanks
>
> --- a/Documentation/devicetree/bindings/usb/faraday,fotg210.txt
> +++ /dev/null
> @@ -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;
> -};
> diff --git a/Documentation/devicetree/bindings/usb/faraday,fotg210.yaml b/Documentation/devicetree/bindings/usb/faraday,fotg210.yaml
> new file mode 100644
> index 000000000000..b5418f29745e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/faraday,fotg210.yaml
> @@ -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 <linus.walleij@xxxxxxxxxx>
> +
> +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:
> + 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
> + 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;
> + };
> +...
>