Skip to content

Commit 11ea09b

Browse files
fancerbebarino
authored andcommitted
dt-bindings: clk: Add Baikal-T1 CCU Dividers binding
After being gained by the CCU PLLs the signals must be transformed to be suitable for the clock-consumers. This is done by a set of dividers embedded into the CCU. A first block of dividers is used to create reference clocks for AXI-bus of high-speed peripheral IP-cores of the chip. The second block dividers alter the PLLs output signals to be then consumed by SoC peripheral devices. Both block DT nodes are ordinary clock-providers with standard set of properties supported. But in addition to that each clock provider can be used to reset the corresponding clock domain. This makes the AXI-bus and System Devices CCU DT nodes to be also reset-providers. Signed-off-by: Serge Semin <[email protected]> Cc: Alexey Malahov <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent aec6adc commit 11ea09b

File tree

3 files changed

+245
-0
lines changed

3 files changed

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

include/dt-bindings/clock/bt1-ccu.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,36 @@
1313
#define CCU_PCIE_PLL 3
1414
#define CCU_ETH_PLL 4
1515

16+
#define CCU_AXI_MAIN_CLK 0
17+
#define CCU_AXI_DDR_CLK 1
18+
#define CCU_AXI_SATA_CLK 2
19+
#define CCU_AXI_GMAC0_CLK 3
20+
#define CCU_AXI_GMAC1_CLK 4
21+
#define CCU_AXI_XGMAC_CLK 5
22+
#define CCU_AXI_PCIE_M_CLK 6
23+
#define CCU_AXI_PCIE_S_CLK 7
24+
#define CCU_AXI_USB_CLK 8
25+
#define CCU_AXI_HWA_CLK 9
26+
#define CCU_AXI_SRAM_CLK 10
27+
28+
#define CCU_SYS_SATA_REF_CLK 0
29+
#define CCU_SYS_APB_CLK 1
30+
#define CCU_SYS_GMAC0_TX_CLK 2
31+
#define CCU_SYS_GMAC0_PTP_CLK 3
32+
#define CCU_SYS_GMAC1_TX_CLK 4
33+
#define CCU_SYS_GMAC1_PTP_CLK 5
34+
#define CCU_SYS_XGMAC_REF_CLK 6
35+
#define CCU_SYS_XGMAC_PTP_CLK 7
36+
#define CCU_SYS_USB_CLK 8
37+
#define CCU_SYS_PVT_CLK 9
38+
#define CCU_SYS_HWA_CLK 10
39+
#define CCU_SYS_UART_CLK 11
40+
#define CCU_SYS_I2C1_CLK 12
41+
#define CCU_SYS_I2C2_CLK 13
42+
#define CCU_SYS_GPIO_CLK 14
43+
#define CCU_SYS_TIMER0_CLK 15
44+
#define CCU_SYS_TIMER1_CLK 16
45+
#define CCU_SYS_TIMER2_CLK 17
46+
#define CCU_SYS_WDT_CLK 18
47+
1648
#endif /* __DT_BINDINGS_CLOCK_BT1_CCU_H */

include/dt-bindings/reset/bt1-ccu.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (C) 2020 BAIKAL ELECTRONICS, JSC
4+
*
5+
* Baikal-T1 CCU reset indices
6+
*/
7+
#ifndef __DT_BINDINGS_RESET_BT1_CCU_H
8+
#define __DT_BINDINGS_RESET_BT1_CCU_H
9+
10+
#define CCU_AXI_MAIN_RST 0
11+
#define CCU_AXI_DDR_RST 1
12+
#define CCU_AXI_SATA_RST 2
13+
#define CCU_AXI_GMAC0_RST 3
14+
#define CCU_AXI_GMAC1_RST 4
15+
#define CCU_AXI_XGMAC_RST 5
16+
#define CCU_AXI_PCIE_M_RST 6
17+
#define CCU_AXI_PCIE_S_RST 7
18+
#define CCU_AXI_USB_RST 8
19+
#define CCU_AXI_HWA_RST 9
20+
#define CCU_AXI_SRAM_RST 10
21+
22+
#define CCU_SYS_SATA_REF_RST 0
23+
#define CCU_SYS_APB_RST 1
24+
25+
#endif /* __DT_BINDINGS_RESET_BT1_CCU_H */

0 commit comments

Comments
 (0)