xref: /freebsd/sys/contrib/device-tree/Bindings/clock/baikal,bt1-ccu-div.yaml (revision b2d2a78ad80ec68d4a17f5aef97d21686cb1e29b)
1c66ec88fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2c66ec88fSEmmanuel Vadot# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
3c66ec88fSEmmanuel Vadot%YAML 1.2
4c66ec88fSEmmanuel Vadot---
5c66ec88fSEmmanuel Vadot$id: http://devicetree.org/schemas/clock/baikal,bt1-ccu-div.yaml#
6c66ec88fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
7c66ec88fSEmmanuel Vadot
8c66ec88fSEmmanuel Vadottitle: Baikal-T1 Clock Control Unit Dividers
9c66ec88fSEmmanuel Vadot
10c66ec88fSEmmanuel Vadotmaintainers:
11c66ec88fSEmmanuel Vadot  - Serge Semin <fancer.lancer@gmail.com>
12c66ec88fSEmmanuel Vadot
13c66ec88fSEmmanuel Vadotdescription: |
14c66ec88fSEmmanuel Vadot  Clocks Control Unit is the core of Baikal-T1 SoC System Controller
15c66ec88fSEmmanuel Vadot  responsible for the chip subsystems clocking and resetting. The CCU is
16c66ec88fSEmmanuel Vadot  connected with an external fixed rate oscillator, which signal is transformed
17c66ec88fSEmmanuel Vadot  into clocks of various frequencies and then propagated to either individual
18c66ec88fSEmmanuel Vadot  IP-blocks or to groups of blocks (clock domains). The transformation is done
19c66ec88fSEmmanuel Vadot  by means of an embedded into CCU PLLs and gateable/non-gateable dividers. The
20c66ec88fSEmmanuel Vadot  later ones are described in this binding. Each clock domain can be also
21c66ec88fSEmmanuel Vadot  individually reset by using the domain clocks divider configuration
22c66ec88fSEmmanuel Vadot  registers. Baikal-T1 CCU is logically divided into the next components:
23c66ec88fSEmmanuel Vadot  1) External oscillator (normally XTAL's 25 MHz crystal oscillator, but
24c66ec88fSEmmanuel Vadot     in general can provide any frequency supported by the CCU PLLs).
25c66ec88fSEmmanuel Vadot  2) PLLs clocks generators (PLLs).
26c66ec88fSEmmanuel Vadot  3) AXI-bus clock dividers (AXI) - described in this binding file.
27c66ec88fSEmmanuel Vadot  4) System devices reference clock dividers (SYS) - described in this binding
28c66ec88fSEmmanuel Vadot     file.
29c66ec88fSEmmanuel Vadot  which are connected with each other as shown on the next figure:
30c66ec88fSEmmanuel Vadot
31c66ec88fSEmmanuel Vadot          +---------------+
32c66ec88fSEmmanuel Vadot          | Baikal-T1 CCU |
33c66ec88fSEmmanuel Vadot          |   +----+------|- MIPS P5600 cores
34c66ec88fSEmmanuel Vadot          | +-|PLLs|------|- DDR controller
35c66ec88fSEmmanuel Vadot          | | +----+      |
36c66ec88fSEmmanuel Vadot  +----+  | |  |  |       |
37c66ec88fSEmmanuel Vadot  |XTAL|--|-+  |  | +---+-|
38c66ec88fSEmmanuel Vadot  +----+  | |  |  +-|AXI|-|- AXI-bus
39c66ec88fSEmmanuel Vadot          | |  |    +---+-|
40c66ec88fSEmmanuel Vadot          | |  |          |
41c66ec88fSEmmanuel Vadot          | |  +----+---+-|- APB-bus
42c66ec88fSEmmanuel Vadot          | +-------|SYS|-|- Low-speed Devices
43c66ec88fSEmmanuel Vadot          |         +---+-|- High-speed Devices
44c66ec88fSEmmanuel Vadot          +---------------+
45c66ec88fSEmmanuel Vadot
46c66ec88fSEmmanuel Vadot  Each sub-block is represented as a separate DT node and has an individual
47c66ec88fSEmmanuel Vadot  driver to be bound with.
48c66ec88fSEmmanuel Vadot
49c66ec88fSEmmanuel Vadot  In order to create signals of wide range frequencies the external oscillator
50c66ec88fSEmmanuel Vadot  output is primarily connected to a set of CCU PLLs. Some of PLLs CLKOUT are
51c66ec88fSEmmanuel Vadot  then passed over CCU dividers to create signals required for the target clock
52c66ec88fSEmmanuel Vadot  domain (like AXI-bus or System Device consumers). The dividers have the
53c66ec88fSEmmanuel Vadot  following structure:
54c66ec88fSEmmanuel Vadot
55c66ec88fSEmmanuel Vadot          +--------------+
56c66ec88fSEmmanuel Vadot  CLKIN --|->+----+ 1|\  |
57c66ec88fSEmmanuel Vadot  SETCLK--|--|/DIV|->| | |
58c66ec88fSEmmanuel Vadot  CLKDIV--|--|    |  | |-|->CLKLOUT
59c66ec88fSEmmanuel Vadot  LOCK----|--+----+  | | |
60c66ec88fSEmmanuel Vadot          |          |/  |
61c66ec88fSEmmanuel Vadot          |           |  |
62c66ec88fSEmmanuel Vadot  EN------|-----------+  |
63c66ec88fSEmmanuel Vadot  RST-----|--------------|->RSTOUT
64c66ec88fSEmmanuel Vadot          +--------------+
65c66ec88fSEmmanuel Vadot
66c66ec88fSEmmanuel Vadot  where CLKIN is the reference clock coming either from CCU PLLs or from an
67c66ec88fSEmmanuel Vadot  external clock oscillator, SETCLK - a command to update the output clock in
68c66ec88fSEmmanuel Vadot  accordance with a set divider, CLKDIV - clocks divider, LOCK - a signal of
69c66ec88fSEmmanuel Vadot  the output clock stabilization, EN - enable/disable the divider block,
70c66ec88fSEmmanuel Vadot  RST/RSTOUT - reset clocks domain signal. Depending on the consumer IP-core
71c66ec88fSEmmanuel Vadot  peculiarities the dividers may lack of some functionality depicted on the
72c66ec88fSEmmanuel Vadot  figure above (like EN, CLKDIV/LOCK/SETCLK). In this case the corresponding
73c66ec88fSEmmanuel Vadot  clock provider just doesn't expose either switching functions, or the rate
74c66ec88fSEmmanuel Vadot  configuration, or both of them.
75c66ec88fSEmmanuel Vadot
76c66ec88fSEmmanuel Vadot  The clock dividers, which output clock is then consumed by the SoC individual
77c66ec88fSEmmanuel Vadot  devices, are united into a single clocks provider called System Devices CCU.
78c66ec88fSEmmanuel Vadot  Similarly the dividers with output clocks utilized as AXI-bus reference clocks
79c66ec88fSEmmanuel Vadot  are called AXI-bus CCU. Both of them use the common clock bindings with no
80c66ec88fSEmmanuel Vadot  custom properties. The list of exported clocks and reset signals can be found
81c66ec88fSEmmanuel Vadot  in the files: 'include/dt-bindings/clock/bt1-ccu.h' and
82c66ec88fSEmmanuel Vadot  'include/dt-bindings/reset/bt1-ccu.h'. Since System Devices and AXI-bus CCU
83c66ec88fSEmmanuel Vadot  are a part of the Baikal-T1 SoC System Controller their DT nodes are supposed
84c66ec88fSEmmanuel Vadot  to be a children of later one.
85c66ec88fSEmmanuel Vadot
86c66ec88fSEmmanuel Vadotif:
87c66ec88fSEmmanuel Vadot  properties:
88c66ec88fSEmmanuel Vadot    compatible:
89c66ec88fSEmmanuel Vadot      contains:
90c66ec88fSEmmanuel Vadot        const: baikal,bt1-ccu-axi
91c66ec88fSEmmanuel Vadot
92c66ec88fSEmmanuel Vadotthen:
93c66ec88fSEmmanuel Vadot  properties:
94c66ec88fSEmmanuel Vadot    clocks:
95c66ec88fSEmmanuel Vadot      items:
96c66ec88fSEmmanuel Vadot        - description: CCU SATA PLL output clock
97c66ec88fSEmmanuel Vadot        - description: CCU PCIe PLL output clock
98c66ec88fSEmmanuel Vadot        - description: CCU Ethernet PLL output clock
99c66ec88fSEmmanuel Vadot
100c66ec88fSEmmanuel Vadot    clock-names:
101c66ec88fSEmmanuel Vadot      items:
102c66ec88fSEmmanuel Vadot        - const: sata_clk
103c66ec88fSEmmanuel Vadot        - const: pcie_clk
104c66ec88fSEmmanuel Vadot        - const: eth_clk
105c66ec88fSEmmanuel Vadot
106c66ec88fSEmmanuel Vadotelse:
107c66ec88fSEmmanuel Vadot  properties:
108c66ec88fSEmmanuel Vadot    clocks:
109c66ec88fSEmmanuel Vadot      items:
110c66ec88fSEmmanuel Vadot        - description: External reference clock
111c66ec88fSEmmanuel Vadot        - description: CCU SATA PLL output clock
112c66ec88fSEmmanuel Vadot        - description: CCU PCIe PLL output clock
113c66ec88fSEmmanuel Vadot        - description: CCU Ethernet PLL output clock
114c66ec88fSEmmanuel Vadot
115c66ec88fSEmmanuel Vadot    clock-names:
116c66ec88fSEmmanuel Vadot      items:
117c66ec88fSEmmanuel Vadot        - const: ref_clk
118c66ec88fSEmmanuel Vadot        - const: sata_clk
119c66ec88fSEmmanuel Vadot        - const: pcie_clk
120c66ec88fSEmmanuel Vadot        - const: eth_clk
121c66ec88fSEmmanuel Vadot
122c66ec88fSEmmanuel Vadotproperties:
123c66ec88fSEmmanuel Vadot  compatible:
124c66ec88fSEmmanuel Vadot    enum:
125c66ec88fSEmmanuel Vadot      - baikal,bt1-ccu-axi
126c66ec88fSEmmanuel Vadot      - baikal,bt1-ccu-sys
127c66ec88fSEmmanuel Vadot
128c66ec88fSEmmanuel Vadot  reg:
129c66ec88fSEmmanuel Vadot    maxItems: 1
130c66ec88fSEmmanuel Vadot
131c66ec88fSEmmanuel Vadot  "#clock-cells":
132c66ec88fSEmmanuel Vadot    const: 1
133c66ec88fSEmmanuel Vadot
134c66ec88fSEmmanuel Vadot  "#reset-cells":
135c66ec88fSEmmanuel Vadot    const: 1
136c66ec88fSEmmanuel Vadot
137*b2d2a78aSEmmanuel Vadot  clocks:
138*b2d2a78aSEmmanuel Vadot    minItems: 3
139*b2d2a78aSEmmanuel Vadot    maxItems: 4
1406be33864SEmmanuel Vadot
141*b2d2a78aSEmmanuel Vadot  clock-names:
142*b2d2a78aSEmmanuel Vadot    minItems: 3
143*b2d2a78aSEmmanuel Vadot    maxItems: 4
1446be33864SEmmanuel Vadot
1456be33864SEmmanuel VadotadditionalProperties: false
146c66ec88fSEmmanuel Vadot
147c66ec88fSEmmanuel Vadotrequired:
148c66ec88fSEmmanuel Vadot  - compatible
149c66ec88fSEmmanuel Vadot  - "#clock-cells"
150c66ec88fSEmmanuel Vadot  - clocks
151c66ec88fSEmmanuel Vadot  - clock-names
152c66ec88fSEmmanuel Vadot
153c66ec88fSEmmanuel Vadotexamples:
154c66ec88fSEmmanuel Vadot  # AXI-bus Clock Control Unit node:
155c66ec88fSEmmanuel Vadot  - |
156c66ec88fSEmmanuel Vadot    #include <dt-bindings/clock/bt1-ccu.h>
157c66ec88fSEmmanuel Vadot
158c66ec88fSEmmanuel Vadot    clock-controller@1f04d030 {
159c66ec88fSEmmanuel Vadot      compatible = "baikal,bt1-ccu-axi";
160c66ec88fSEmmanuel Vadot      reg = <0x1f04d030 0x030>;
161c66ec88fSEmmanuel Vadot      #clock-cells = <1>;
162c66ec88fSEmmanuel Vadot      #reset-cells = <1>;
163c66ec88fSEmmanuel Vadot
164c66ec88fSEmmanuel Vadot      clocks = <&ccu_pll CCU_SATA_PLL>,
165c66ec88fSEmmanuel Vadot               <&ccu_pll CCU_PCIE_PLL>,
166c66ec88fSEmmanuel Vadot               <&ccu_pll CCU_ETH_PLL>;
167c66ec88fSEmmanuel Vadot      clock-names = "sata_clk", "pcie_clk", "eth_clk";
168c66ec88fSEmmanuel Vadot    };
169c66ec88fSEmmanuel Vadot  # System Devices Clock Control Unit node:
170c66ec88fSEmmanuel Vadot  - |
171c66ec88fSEmmanuel Vadot    #include <dt-bindings/clock/bt1-ccu.h>
172c66ec88fSEmmanuel Vadot
173c66ec88fSEmmanuel Vadot    clock-controller@1f04d060 {
174c66ec88fSEmmanuel Vadot      compatible = "baikal,bt1-ccu-sys";
175c66ec88fSEmmanuel Vadot      reg = <0x1f04d060 0x0a0>;
176c66ec88fSEmmanuel Vadot      #clock-cells = <1>;
177c66ec88fSEmmanuel Vadot      #reset-cells = <1>;
178c66ec88fSEmmanuel Vadot
179c66ec88fSEmmanuel Vadot      clocks = <&clk25m>,
180c66ec88fSEmmanuel Vadot               <&ccu_pll CCU_SATA_PLL>,
181c66ec88fSEmmanuel Vadot               <&ccu_pll CCU_PCIE_PLL>,
182c66ec88fSEmmanuel Vadot               <&ccu_pll CCU_ETH_PLL>;
183c66ec88fSEmmanuel Vadot      clock-names = "ref_clk", "sata_clk", "pcie_clk",
184c66ec88fSEmmanuel Vadot                    "eth_clk";
185c66ec88fSEmmanuel Vadot    };
186c66ec88fSEmmanuel Vadot  # Required Clock Control Unit PLL node:
187c66ec88fSEmmanuel Vadot  - |
188c66ec88fSEmmanuel Vadot    ccu_pll: clock-controller@1f04d000 {
189c66ec88fSEmmanuel Vadot      compatible = "baikal,bt1-ccu-pll";
190c66ec88fSEmmanuel Vadot      reg = <0x1f04d000 0x028>;
191c66ec88fSEmmanuel Vadot      #clock-cells = <1>;
192c66ec88fSEmmanuel Vadot
193c66ec88fSEmmanuel Vadot      clocks = <&clk25m>;
194c66ec88fSEmmanuel Vadot      clock-names = "ref_clk";
195c66ec88fSEmmanuel Vadot    };
196c66ec88fSEmmanuel Vadot...
197