162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
362306a36Sopenharmony_ci%YAML 1.2
462306a36Sopenharmony_ci---
562306a36Sopenharmony_ci$id: http://devicetree.org/schemas/clock/baikal,bt1-ccu-div.yaml#
662306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
762306a36Sopenharmony_ci
862306a36Sopenharmony_cititle: Baikal-T1 Clock Control Unit Dividers
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cimaintainers:
1162306a36Sopenharmony_ci  - Serge Semin <fancer.lancer@gmail.com>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cidescription: |
1462306a36Sopenharmony_ci  Clocks Control Unit is the core of Baikal-T1 SoC System Controller
1562306a36Sopenharmony_ci  responsible for the chip subsystems clocking and resetting. The CCU is
1662306a36Sopenharmony_ci  connected with an external fixed rate oscillator, which signal is transformed
1762306a36Sopenharmony_ci  into clocks of various frequencies and then propagated to either individual
1862306a36Sopenharmony_ci  IP-blocks or to groups of blocks (clock domains). The transformation is done
1962306a36Sopenharmony_ci  by means of an embedded into CCU PLLs and gateable/non-gateable dividers. The
2062306a36Sopenharmony_ci  later ones are described in this binding. Each clock domain can be also
2162306a36Sopenharmony_ci  individually reset by using the domain clocks divider configuration
2262306a36Sopenharmony_ci  registers. Baikal-T1 CCU is logically divided into the next components:
2362306a36Sopenharmony_ci  1) External oscillator (normally XTAL's 25 MHz crystal oscillator, but
2462306a36Sopenharmony_ci     in general can provide any frequency supported by the CCU PLLs).
2562306a36Sopenharmony_ci  2) PLLs clocks generators (PLLs).
2662306a36Sopenharmony_ci  3) AXI-bus clock dividers (AXI) - described in this binding file.
2762306a36Sopenharmony_ci  4) System devices reference clock dividers (SYS) - described in this binding
2862306a36Sopenharmony_ci     file.
2962306a36Sopenharmony_ci  which are connected with each other as shown on the next figure:
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci          +---------------+
3262306a36Sopenharmony_ci          | Baikal-T1 CCU |
3362306a36Sopenharmony_ci          |   +----+------|- MIPS P5600 cores
3462306a36Sopenharmony_ci          | +-|PLLs|------|- DDR controller
3562306a36Sopenharmony_ci          | | +----+      |
3662306a36Sopenharmony_ci  +----+  | |  |  |       |
3762306a36Sopenharmony_ci  |XTAL|--|-+  |  | +---+-|
3862306a36Sopenharmony_ci  +----+  | |  |  +-|AXI|-|- AXI-bus
3962306a36Sopenharmony_ci          | |  |    +---+-|
4062306a36Sopenharmony_ci          | |  |          |
4162306a36Sopenharmony_ci          | |  +----+---+-|- APB-bus
4262306a36Sopenharmony_ci          | +-------|SYS|-|- Low-speed Devices
4362306a36Sopenharmony_ci          |         +---+-|- High-speed Devices
4462306a36Sopenharmony_ci          +---------------+
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci  Each sub-block is represented as a separate DT node and has an individual
4762306a36Sopenharmony_ci  driver to be bound with.
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci  In order to create signals of wide range frequencies the external oscillator
5062306a36Sopenharmony_ci  output is primarily connected to a set of CCU PLLs. Some of PLLs CLKOUT are
5162306a36Sopenharmony_ci  then passed over CCU dividers to create signals required for the target clock
5262306a36Sopenharmony_ci  domain (like AXI-bus or System Device consumers). The dividers have the
5362306a36Sopenharmony_ci  following structure:
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci          +--------------+
5662306a36Sopenharmony_ci  CLKIN --|->+----+ 1|\  |
5762306a36Sopenharmony_ci  SETCLK--|--|/DIV|->| | |
5862306a36Sopenharmony_ci  CLKDIV--|--|    |  | |-|->CLKLOUT
5962306a36Sopenharmony_ci  LOCK----|--+----+  | | |
6062306a36Sopenharmony_ci          |          |/  |
6162306a36Sopenharmony_ci          |           |  |
6262306a36Sopenharmony_ci  EN------|-----------+  |
6362306a36Sopenharmony_ci  RST-----|--------------|->RSTOUT
6462306a36Sopenharmony_ci          +--------------+
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci  where CLKIN is the reference clock coming either from CCU PLLs or from an
6762306a36Sopenharmony_ci  external clock oscillator, SETCLK - a command to update the output clock in
6862306a36Sopenharmony_ci  accordance with a set divider, CLKDIV - clocks divider, LOCK - a signal of
6962306a36Sopenharmony_ci  the output clock stabilization, EN - enable/disable the divider block,
7062306a36Sopenharmony_ci  RST/RSTOUT - reset clocks domain signal. Depending on the consumer IP-core
7162306a36Sopenharmony_ci  peculiarities the dividers may lack of some functionality depicted on the
7262306a36Sopenharmony_ci  figure above (like EN, CLKDIV/LOCK/SETCLK). In this case the corresponding
7362306a36Sopenharmony_ci  clock provider just doesn't expose either switching functions, or the rate
7462306a36Sopenharmony_ci  configuration, or both of them.
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci  The clock dividers, which output clock is then consumed by the SoC individual
7762306a36Sopenharmony_ci  devices, are united into a single clocks provider called System Devices CCU.
7862306a36Sopenharmony_ci  Similarly the dividers with output clocks utilized as AXI-bus reference clocks
7962306a36Sopenharmony_ci  are called AXI-bus CCU. Both of them use the common clock bindings with no
8062306a36Sopenharmony_ci  custom properties. The list of exported clocks and reset signals can be found
8162306a36Sopenharmony_ci  in the files: 'include/dt-bindings/clock/bt1-ccu.h' and
8262306a36Sopenharmony_ci  'include/dt-bindings/reset/bt1-ccu.h'. Since System Devices and AXI-bus CCU
8362306a36Sopenharmony_ci  are a part of the Baikal-T1 SoC System Controller their DT nodes are supposed
8462306a36Sopenharmony_ci  to be a children of later one.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciif:
8762306a36Sopenharmony_ci  properties:
8862306a36Sopenharmony_ci    compatible:
8962306a36Sopenharmony_ci      contains:
9062306a36Sopenharmony_ci        const: baikal,bt1-ccu-axi
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_cithen:
9362306a36Sopenharmony_ci  properties:
9462306a36Sopenharmony_ci    clocks:
9562306a36Sopenharmony_ci      items:
9662306a36Sopenharmony_ci        - description: CCU SATA PLL output clock
9762306a36Sopenharmony_ci        - description: CCU PCIe PLL output clock
9862306a36Sopenharmony_ci        - description: CCU Ethernet PLL output clock
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci    clock-names:
10162306a36Sopenharmony_ci      items:
10262306a36Sopenharmony_ci        - const: sata_clk
10362306a36Sopenharmony_ci        - const: pcie_clk
10462306a36Sopenharmony_ci        - const: eth_clk
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_cielse:
10762306a36Sopenharmony_ci  properties:
10862306a36Sopenharmony_ci    clocks:
10962306a36Sopenharmony_ci      items:
11062306a36Sopenharmony_ci        - description: External reference clock
11162306a36Sopenharmony_ci        - description: CCU SATA PLL output clock
11262306a36Sopenharmony_ci        - description: CCU PCIe PLL output clock
11362306a36Sopenharmony_ci        - description: CCU Ethernet PLL output clock
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci    clock-names:
11662306a36Sopenharmony_ci      items:
11762306a36Sopenharmony_ci        - const: ref_clk
11862306a36Sopenharmony_ci        - const: sata_clk
11962306a36Sopenharmony_ci        - const: pcie_clk
12062306a36Sopenharmony_ci        - const: eth_clk
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ciproperties:
12362306a36Sopenharmony_ci  compatible:
12462306a36Sopenharmony_ci    enum:
12562306a36Sopenharmony_ci      - baikal,bt1-ccu-axi
12662306a36Sopenharmony_ci      - baikal,bt1-ccu-sys
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci  reg:
12962306a36Sopenharmony_ci    maxItems: 1
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci  "#clock-cells":
13262306a36Sopenharmony_ci    const: 1
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci  "#reset-cells":
13562306a36Sopenharmony_ci    const: 1
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci  clocks: true
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci  clock-names: true
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ciadditionalProperties: false
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_cirequired:
14462306a36Sopenharmony_ci  - compatible
14562306a36Sopenharmony_ci  - "#clock-cells"
14662306a36Sopenharmony_ci  - clocks
14762306a36Sopenharmony_ci  - clock-names
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ciexamples:
15062306a36Sopenharmony_ci  # AXI-bus Clock Control Unit node:
15162306a36Sopenharmony_ci  - |
15262306a36Sopenharmony_ci    #include <dt-bindings/clock/bt1-ccu.h>
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci    clock-controller@1f04d030 {
15562306a36Sopenharmony_ci      compatible = "baikal,bt1-ccu-axi";
15662306a36Sopenharmony_ci      reg = <0x1f04d030 0x030>;
15762306a36Sopenharmony_ci      #clock-cells = <1>;
15862306a36Sopenharmony_ci      #reset-cells = <1>;
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci      clocks = <&ccu_pll CCU_SATA_PLL>,
16162306a36Sopenharmony_ci               <&ccu_pll CCU_PCIE_PLL>,
16262306a36Sopenharmony_ci               <&ccu_pll CCU_ETH_PLL>;
16362306a36Sopenharmony_ci      clock-names = "sata_clk", "pcie_clk", "eth_clk";
16462306a36Sopenharmony_ci    };
16562306a36Sopenharmony_ci  # System Devices Clock Control Unit node:
16662306a36Sopenharmony_ci  - |
16762306a36Sopenharmony_ci    #include <dt-bindings/clock/bt1-ccu.h>
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci    clock-controller@1f04d060 {
17062306a36Sopenharmony_ci      compatible = "baikal,bt1-ccu-sys";
17162306a36Sopenharmony_ci      reg = <0x1f04d060 0x0a0>;
17262306a36Sopenharmony_ci      #clock-cells = <1>;
17362306a36Sopenharmony_ci      #reset-cells = <1>;
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci      clocks = <&clk25m>,
17662306a36Sopenharmony_ci               <&ccu_pll CCU_SATA_PLL>,
17762306a36Sopenharmony_ci               <&ccu_pll CCU_PCIE_PLL>,
17862306a36Sopenharmony_ci               <&ccu_pll CCU_ETH_PLL>;
17962306a36Sopenharmony_ci      clock-names = "ref_clk", "sata_clk", "pcie_clk",
18062306a36Sopenharmony_ci                    "eth_clk";
18162306a36Sopenharmony_ci    };
18262306a36Sopenharmony_ci  # Required Clock Control Unit PLL node:
18362306a36Sopenharmony_ci  - |
18462306a36Sopenharmony_ci    ccu_pll: clock-controller@1f04d000 {
18562306a36Sopenharmony_ci      compatible = "baikal,bt1-ccu-pll";
18662306a36Sopenharmony_ci      reg = <0x1f04d000 0x028>;
18762306a36Sopenharmony_ci      #clock-cells = <1>;
18862306a36Sopenharmony_ci
18962306a36Sopenharmony_ci      clocks = <&clk25m>;
19062306a36Sopenharmony_ci      clock-names = "ref_clk";
19162306a36Sopenharmony_ci    };
19262306a36Sopenharmony_ci...
193