# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/allwinner,sun55i-a523-ccu.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Allwinner A523 Clock Control Unit

maintainers:
  - Andre Przywara <andre.przywara@arm.com>

properties:
  "#clock-cells":
    const: 1

  "#reset-cells":
    const: 1

  compatible:
    enum:
      - allwinner,sun55i-a523-ccu
      - allwinner,sun55i-a523-r-ccu

  reg:
    maxItems: 1

  clocks:
    minItems: 4
    maxItems: 5

  clock-names:
    minItems: 4
    maxItems: 5

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

allOf:
  - if:
      properties:
        compatible:
          enum:
            - allwinner,sun55i-a523-ccu

    then:
      properties:
        clocks:
          items:
            - description: High Frequency Oscillator (usually at 24MHz)
            - description: Low Frequency Oscillator (usually at 32kHz)
            - description: Internal Oscillator
            - description: Low Frequency Oscillator fanout

        clock-names:
          items:
            - const: hosc
            - const: losc
            - const: iosc
            - const: losc-fanout

  - if:
      properties:
        compatible:
          enum:
            - allwinner,sun55i-a523-r-ccu

    then:
      properties:
        clocks:
          items:
            - description: High Frequency Oscillator (usually at 24MHz)
            - description: Low Frequency Oscillator (usually at 32kHz)
            - description: Internal Oscillator
            - description: Peripherals PLL
            - description: Audio PLL

        clock-names:
          items:
            - const: hosc
            - const: losc
            - const: iosc
            - const: pll-periph
            - const: pll-audio

additionalProperties: false

examples:
  - |
    clock-controller@2001000 {
        compatible = "allwinner,sun55i-a523-ccu";
        reg = <0x02001000 0x1000>;
        clocks = <&osc24M>, <&osc32k>, <&iosc>, <&r_ccu 1>;
        clock-names = "hosc", "losc", "iosc", "losc-fanout";
        #clock-cells = <1>;
        #reset-cells = <1>;
    };

...
