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

title: ZTE zx297520v3 SoC matrix clock and reset controller

maintainers:
  - Stefan Dösinger <stefandoesinger@gmail.com>

description: |
  This controller contains clock and reset controls for high speed devices on
  the zx297520v3 board: The CPU, RAM, SDIO and Ethernet clocks and resets are
  found here. This controller requires PLL-generated clocks from Topcrm as well
  as the fixed 26 MHz and 32 kHz oscillators found on this board.

  This controller also contains hardware mutex registers for synchronization
  with different processors on this board.

  An additional curiosity are registers that allow setting (but not reading) the
  ARM architected timer's CNTVAL. This is not exposed in the binding because
  there shouldn't be a need to access it.

  All available clocks are defined as preprocessor macros in the
  "include/dt-bindings/clock/zte,zx297520v3-clk.h" header. Resets are defined in
  the "include/dt-bindings/reset/zte,zx297520v3-reset.h" header.

properties:
  compatible:
    const: zte,zx297520v3-matrixcrm

  reg:
    maxItems: 1

  clocks:
    items:
      - description: 26 MHz external oscillator
      - description: 32 kHz external oscillator
      - description: AHB clock from topcrm
      - description: Main PLL output from topcrm (usually 624 MHz)
      - description: Main PLL subdivision factor 5
      - description: Dpll output from topcrm (usually 491.52 MHz)
      - description: Gpll output from topcrm (usually 200 MHz)
      - description: Gpll subdivision factor 2
      - description: osc26m work clock from topcrm

  clock-names:
    items:
      - const: osc26m
      - const: osc32k
      - const: ahb
      - const: mpll
      - const: mpll-d5
      - const: dpll
      - const: gpll
      - const: gpll-d2
      - const: wclk-osc26m

  "#clock-cells":
    const: 1

  "#hwlock-cells":
    const: 1

  "#reset-cells":
    const: 1

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

additionalProperties: false

examples:
  - |
    #include <dt-bindings/clock/zte,zx297520v3-clk.h>
    #include <dt-bindings/reset/zte,zx297520v3-reset.h>

    clock-controller@1306000 {
        compatible = "zte,zx297520v3-matrixcrm";
        reg = <0x01306000 0x400>;
        #clock-cells = <1>;
        clocks = <&osc26m>, <&osc32k>, <&topcrm ZX297520V3_AHB_PCLK>,
                 <&topcrm ZX297520V3_MPLL>, <&topcrm ZX297520V3_MPLL_D5>,
                 <&topcrm ZX297520V3_DPLL>, <&topcrm ZX297520V3_GPLL>,
                 <&topcrm ZX297520V3_GPLL_D2>,
                 <&topcrm ZX297520V3_GATED_OSC26M>;
        clock-names = "osc26m", "osc32k", "ahb", "mpll", "mpll-d5", "dpll",
                      "gpll", "gpll-d2", "wclk-osc26m";
        #hwlock-cells = <1>;
        #reset-cells = <1>;
    };