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

title: Broadcom Kona family clock control units (CCU)

maintainers:
  - Florian Fainelli <florian.fainelli@broadcom.com>
  - Ray Jui <rjui@broadcom.com>
  - Scott Branden <sbranden@broadcom.com>

description: |
  Broadcom "Kona" style clock control unit (CCU) is a clock provider that
  manages a set of clock signals.

  All available clock IDs are defined in
  - include/dt-bindings/clock/bcm281xx.h for BCM281XX family
  - include/dt-bindings/clock/bcm21664.h for BCM21664 family

properties:
  compatible:
    enum:
      - brcm,bcm11351-aon-ccu
      - brcm,bcm11351-hub-ccu
      - brcm,bcm11351-master-ccu
      - brcm,bcm11351-root-ccu
      - brcm,bcm11351-slave-ccu
      - brcm,bcm21664-aon-ccu
      - brcm,bcm21664-master-ccu
      - brcm,bcm21664-root-ccu
      - brcm,bcm21664-slave-ccu

  reg:
    maxItems: 1

  '#clock-cells':
    const: 1

  clock-output-names:
    minItems: 1
    maxItems: 10

required:
  - compatible
  - reg
  - '#clock-cells'
  - clock-output-names

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: brcm,bcm11351-aon-ccu
    then:
      properties:
        clock-output-names:
          items:
            - const: hub_timer
            - const: pmu_bsc
            - const: pmu_bsc_var
  - if:
      properties:
        compatible:
          contains:
            const: brcm,bcm11351-hub-ccu
    then:
      properties:
        clock-output-names:
          const: tmon_1m
  - if:
      properties:
        compatible:
          contains:
            const: brcm,bcm11351-master-ccu
    then:
      properties:
        clock-output-names:
          items:
            - const: sdio1
            - const: sdio2
            - const: sdio3
            - const: sdio4
            - const: usb_ic
            - const: hsic2_48m
            - const: hsic2_12m
  - if:
      properties:
        compatible:
          contains:
            enum:
              - brcm,bcm11351-root-ccu
              - brcm,bcm21664-root-ccu
    then:
      properties:
        clock-output-names:
          const: frac_1m
  - if:
      properties:
        compatible:
          contains:
            const: brcm,bcm11351-slave-ccu
    then:
      properties:
        clock-output-names:
          items:
            - const: uartb
            - const: uartb2
            - const: uartb3
            - const: uartb4
            - const: ssp0
            - const: ssp2
            - const: bsc1
            - const: bsc2
            - const: bsc3
            - const: pwm
  - if:
      properties:
        compatible:
          contains:
            const: brcm,bcm21664-aon-ccu
    then:
      properties:
        clock-output-names:
          const: hub_timer
  - if:
      properties:
        compatible:
          contains:
            const: brcm,bcm21664-master-ccu
    then:
      properties:
        clock-output-names:
          items:
            - const: sdio1
            - const: sdio2
            - const: sdio3
            - const: sdio4
            - const: sdio1_sleep
            - const: sdio2_sleep
            - const: sdio3_sleep
            - const: sdio4_sleep
  - if:
      properties:
        compatible:
          contains:
            const: brcm,bcm21664-slave-ccu
    then:
      properties:
        clock-output-names:
          items:
            - const: uartb
            - const: uartb2
            - const: uartb3
            - const: bsc1
            - const: bsc2
            - const: bsc3
            - const: bsc4

additionalProperties: false

examples:
  - |
    clock-controller@3e011000 {
      compatible = "brcm,bcm11351-slave-ccu";
      reg = <0x3e011000 0x0f00>;
      #clock-cells = <1>;
      clock-output-names = "uartb",
                           "uartb2",
                           "uartb3",
                           "uartb4",
                           "ssp0",
                           "ssp2",
                           "bsc1",
                           "bsc2",
                           "bsc3",
                           "pwm";
    };
...
