# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/allwinner,sun4i-a10-usb-clk.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Allwinner A10 USB Clock

maintainers:
  - Chen-Yu Tsai <wens@csie.org>
  - Maxime Ripard <mripard@kernel.org>

deprecated: true

properties:
  "#clock-cells":
    const: 1
    description: >
      The additional ID argument passed to the clock shall refer to
      the index of the output.

  "#reset-cells":
    const: 1

  compatible:
    enum:
      - allwinner,sun4i-a10-usb-clk
      - allwinner,sun5i-a13-usb-clk
      - allwinner,sun6i-a31-usb-clk
      - allwinner,sun8i-a23-usb-clk
      - allwinner,sun8i-h3-usb-clk

  reg:
    maxItems: 1

  clocks:
    maxItems: 1

  clock-output-names:
    minItems: 2
    maxItems: 8

required:
  - "#clock-cells"
  - "#reset-cells"
  - compatible
  - reg
  - clocks
  - clock-output-names

additionalProperties: false

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: allwinner,sun4i-a10-usb-clk

    then:
      properties:
        clock-output-names:
          maxItems: 3

  - if:
      properties:
        compatible:
          contains:
            const: allwinner,sun5i-a13-usb-clk

    then:
      properties:
        clock-output-names:
          maxItems: 2

  - if:
      properties:
        compatible:
          contains:
            const: allwinner,sun6i-a31-usb-clk

    then:
      properties:
        clock-output-names:
          maxItems: 6

  - if:
      properties:
        compatible:
          contains:
            const: allwinner,sun8i-a23-usb-clk

    then:
      properties:
        clock-output-names:
          maxItems: 5

  - if:
      properties:
        compatible:
          contains:
            const: allwinner,sun8i-h3-usb-clk

    then:
      properties:
        clock-output-names:
          maxItems: 8

examples:
  - |
    clk@1c200cc {
        #clock-cells = <1>;
        #reset-cells = <1>;
        compatible = "allwinner,sun4i-a10-usb-clk";
        reg = <0x01c200cc 0x4>;
        clocks = <&pll6 1>;
        clock-output-names = "usb_ohci0", "usb_ohci1", "usb_phy";
    };

  - |
    clk@1c200cc {
        #clock-cells = <1>;
        #reset-cells = <1>;
        compatible = "allwinner,sun5i-a13-usb-clk";
        reg = <0x01c200cc 0x4>;
        clocks = <&pll6 1>;
        clock-output-names = "usb_ohci0", "usb_phy";
    };

  - |
    clk@1c200cc {
        #clock-cells = <1>;
        #reset-cells = <1>;
        compatible = "allwinner,sun6i-a31-usb-clk";
        reg = <0x01c200cc 0x4>;
        clocks = <&osc24M>;
        clock-output-names = "usb_phy0", "usb_phy1", "usb_phy2",
                             "usb_ohci0", "usb_ohci1",
                             "usb_ohci2";
    };

  - |
    clk@1c200cc {
        #clock-cells = <1>;
        #reset-cells = <1>;
        compatible = "allwinner,sun8i-a23-usb-clk";
        reg = <0x01c200cc 0x4>;
        clocks = <&osc24M>;
        clock-output-names = "usb_phy0", "usb_phy1", "usb_hsic",
                             "usb_hsic_12M", "usb_ohci0";
    };

  - |
    clk@1c200cc {
        #clock-cells = <1>;
        #reset-cells = <1>;
        compatible = "allwinner,sun8i-h3-usb-clk";
        reg = <0x01c200cc 0x4>;
        clocks = <&osc24M>;
        clock-output-names = "usb_phy0", "usb_phy1",
                             "usb_phy2", "usb_phy3",
                             "usb_ohci0", "usb_ohci1",
                             "usb_ohci2", "usb_ohci3";
    };

...