18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 28c2ecf20Sopenharmony_ci# Copyright (C) 2020 BAIKAL ELECTRONICS, JSC 38c2ecf20Sopenharmony_ci%YAML 1.2 48c2ecf20Sopenharmony_ci--- 58c2ecf20Sopenharmony_ci$id: http://devicetree.org/schemas/clock/baikal,bt1-ccu-div.yaml# 68c2ecf20Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml# 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_cititle: Baikal-T1 Clock Control Unit Dividers 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_cimaintainers: 118c2ecf20Sopenharmony_ci - Serge Semin <fancer.lancer@gmail.com> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_cidescription: | 148c2ecf20Sopenharmony_ci Clocks Control Unit is the core of Baikal-T1 SoC System Controller 158c2ecf20Sopenharmony_ci responsible for the chip subsystems clocking and resetting. The CCU is 168c2ecf20Sopenharmony_ci connected with an external fixed rate oscillator, which signal is transformed 178c2ecf20Sopenharmony_ci into clocks of various frequencies and then propagated to either individual 188c2ecf20Sopenharmony_ci IP-blocks or to groups of blocks (clock domains). The transformation is done 198c2ecf20Sopenharmony_ci by means of an embedded into CCU PLLs and gateable/non-gateable dividers. The 208c2ecf20Sopenharmony_ci later ones are described in this binding. Each clock domain can be also 218c2ecf20Sopenharmony_ci individually reset by using the domain clocks divider configuration 228c2ecf20Sopenharmony_ci registers. Baikal-T1 CCU is logically divided into the next components: 238c2ecf20Sopenharmony_ci 1) External oscillator (normally XTAL's 25 MHz crystal oscillator, but 248c2ecf20Sopenharmony_ci in general can provide any frequency supported by the CCU PLLs). 258c2ecf20Sopenharmony_ci 2) PLLs clocks generators (PLLs). 268c2ecf20Sopenharmony_ci 3) AXI-bus clock dividers (AXI) - described in this binding file. 278c2ecf20Sopenharmony_ci 4) System devices reference clock dividers (SYS) - described in this binding 288c2ecf20Sopenharmony_ci file. 298c2ecf20Sopenharmony_ci which are connected with each other as shown on the next figure: 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci +---------------+ 328c2ecf20Sopenharmony_ci | Baikal-T1 CCU | 338c2ecf20Sopenharmony_ci | +----+------|- MIPS P5600 cores 348c2ecf20Sopenharmony_ci | +-|PLLs|------|- DDR controller 358c2ecf20Sopenharmony_ci | | +----+ | 368c2ecf20Sopenharmony_ci +----+ | | | | | 378c2ecf20Sopenharmony_ci |XTAL|--|-+ | | +---+-| 388c2ecf20Sopenharmony_ci +----+ | | | +-|AXI|-|- AXI-bus 398c2ecf20Sopenharmony_ci | | | +---+-| 408c2ecf20Sopenharmony_ci | | | | 418c2ecf20Sopenharmony_ci | | +----+---+-|- APB-bus 428c2ecf20Sopenharmony_ci | +-------|SYS|-|- Low-speed Devices 438c2ecf20Sopenharmony_ci | +---+-|- High-speed Devices 448c2ecf20Sopenharmony_ci +---------------+ 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci Each sub-block is represented as a separate DT node and has an individual 478c2ecf20Sopenharmony_ci driver to be bound with. 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci In order to create signals of wide range frequencies the external oscillator 508c2ecf20Sopenharmony_ci output is primarily connected to a set of CCU PLLs. Some of PLLs CLKOUT are 518c2ecf20Sopenharmony_ci then passed over CCU dividers to create signals required for the target clock 528c2ecf20Sopenharmony_ci domain (like AXI-bus or System Device consumers). The dividers have the 538c2ecf20Sopenharmony_ci following structure: 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci +--------------+ 568c2ecf20Sopenharmony_ci CLKIN --|->+----+ 1|\ | 578c2ecf20Sopenharmony_ci SETCLK--|--|/DIV|->| | | 588c2ecf20Sopenharmony_ci CLKDIV--|--| | | |-|->CLKLOUT 598c2ecf20Sopenharmony_ci LOCK----|--+----+ | | | 608c2ecf20Sopenharmony_ci | |/ | 618c2ecf20Sopenharmony_ci | | | 628c2ecf20Sopenharmony_ci EN------|-----------+ | 638c2ecf20Sopenharmony_ci RST-----|--------------|->RSTOUT 648c2ecf20Sopenharmony_ci +--------------+ 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci where CLKIN is the reference clock coming either from CCU PLLs or from an 678c2ecf20Sopenharmony_ci external clock oscillator, SETCLK - a command to update the output clock in 688c2ecf20Sopenharmony_ci accordance with a set divider, CLKDIV - clocks divider, LOCK - a signal of 698c2ecf20Sopenharmony_ci the output clock stabilization, EN - enable/disable the divider block, 708c2ecf20Sopenharmony_ci RST/RSTOUT - reset clocks domain signal. Depending on the consumer IP-core 718c2ecf20Sopenharmony_ci peculiarities the dividers may lack of some functionality depicted on the 728c2ecf20Sopenharmony_ci figure above (like EN, CLKDIV/LOCK/SETCLK). In this case the corresponding 738c2ecf20Sopenharmony_ci clock provider just doesn't expose either switching functions, or the rate 748c2ecf20Sopenharmony_ci configuration, or both of them. 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci The clock dividers, which output clock is then consumed by the SoC individual 778c2ecf20Sopenharmony_ci devices, are united into a single clocks provider called System Devices CCU. 788c2ecf20Sopenharmony_ci Similarly the dividers with output clocks utilized as AXI-bus reference clocks 798c2ecf20Sopenharmony_ci are called AXI-bus CCU. Both of them use the common clock bindings with no 808c2ecf20Sopenharmony_ci custom properties. The list of exported clocks and reset signals can be found 818c2ecf20Sopenharmony_ci in the files: 'include/dt-bindings/clock/bt1-ccu.h' and 828c2ecf20Sopenharmony_ci 'include/dt-bindings/reset/bt1-ccu.h'. Since System Devices and AXI-bus CCU 838c2ecf20Sopenharmony_ci are a part of the Baikal-T1 SoC System Controller their DT nodes are supposed 848c2ecf20Sopenharmony_ci to be a children of later one. 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ciif: 878c2ecf20Sopenharmony_ci properties: 888c2ecf20Sopenharmony_ci compatible: 898c2ecf20Sopenharmony_ci contains: 908c2ecf20Sopenharmony_ci const: baikal,bt1-ccu-axi 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_cithen: 938c2ecf20Sopenharmony_ci properties: 948c2ecf20Sopenharmony_ci clocks: 958c2ecf20Sopenharmony_ci items: 968c2ecf20Sopenharmony_ci - description: CCU SATA PLL output clock 978c2ecf20Sopenharmony_ci - description: CCU PCIe PLL output clock 988c2ecf20Sopenharmony_ci - description: CCU Ethernet PLL output clock 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci clock-names: 1018c2ecf20Sopenharmony_ci items: 1028c2ecf20Sopenharmony_ci - const: sata_clk 1038c2ecf20Sopenharmony_ci - const: pcie_clk 1048c2ecf20Sopenharmony_ci - const: eth_clk 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_cielse: 1078c2ecf20Sopenharmony_ci properties: 1088c2ecf20Sopenharmony_ci clocks: 1098c2ecf20Sopenharmony_ci items: 1108c2ecf20Sopenharmony_ci - description: External reference clock 1118c2ecf20Sopenharmony_ci - description: CCU SATA PLL output clock 1128c2ecf20Sopenharmony_ci - description: CCU PCIe PLL output clock 1138c2ecf20Sopenharmony_ci - description: CCU Ethernet PLL output clock 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci clock-names: 1168c2ecf20Sopenharmony_ci items: 1178c2ecf20Sopenharmony_ci - const: ref_clk 1188c2ecf20Sopenharmony_ci - const: sata_clk 1198c2ecf20Sopenharmony_ci - const: pcie_clk 1208c2ecf20Sopenharmony_ci - const: eth_clk 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ciproperties: 1238c2ecf20Sopenharmony_ci compatible: 1248c2ecf20Sopenharmony_ci enum: 1258c2ecf20Sopenharmony_ci - baikal,bt1-ccu-axi 1268c2ecf20Sopenharmony_ci - baikal,bt1-ccu-sys 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci reg: 1298c2ecf20Sopenharmony_ci maxItems: 1 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci "#clock-cells": 1328c2ecf20Sopenharmony_ci const: 1 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci "#reset-cells": 1358c2ecf20Sopenharmony_ci const: 1 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci clocks: true 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci clock-names: true 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ciadditionalProperties: false 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_cirequired: 1448c2ecf20Sopenharmony_ci - compatible 1458c2ecf20Sopenharmony_ci - "#clock-cells" 1468c2ecf20Sopenharmony_ci - clocks 1478c2ecf20Sopenharmony_ci - clock-names 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ciexamples: 1508c2ecf20Sopenharmony_ci # AXI-bus Clock Control Unit node: 1518c2ecf20Sopenharmony_ci - | 1528c2ecf20Sopenharmony_ci #include <dt-bindings/clock/bt1-ccu.h> 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci clock-controller@1f04d030 { 1558c2ecf20Sopenharmony_ci compatible = "baikal,bt1-ccu-axi"; 1568c2ecf20Sopenharmony_ci reg = <0x1f04d030 0x030>; 1578c2ecf20Sopenharmony_ci #clock-cells = <1>; 1588c2ecf20Sopenharmony_ci #reset-cells = <1>; 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci clocks = <&ccu_pll CCU_SATA_PLL>, 1618c2ecf20Sopenharmony_ci <&ccu_pll CCU_PCIE_PLL>, 1628c2ecf20Sopenharmony_ci <&ccu_pll CCU_ETH_PLL>; 1638c2ecf20Sopenharmony_ci clock-names = "sata_clk", "pcie_clk", "eth_clk"; 1648c2ecf20Sopenharmony_ci }; 1658c2ecf20Sopenharmony_ci # System Devices Clock Control Unit node: 1668c2ecf20Sopenharmony_ci - | 1678c2ecf20Sopenharmony_ci #include <dt-bindings/clock/bt1-ccu.h> 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci clock-controller@1f04d060 { 1708c2ecf20Sopenharmony_ci compatible = "baikal,bt1-ccu-sys"; 1718c2ecf20Sopenharmony_ci reg = <0x1f04d060 0x0a0>; 1728c2ecf20Sopenharmony_ci #clock-cells = <1>; 1738c2ecf20Sopenharmony_ci #reset-cells = <1>; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci clocks = <&clk25m>, 1768c2ecf20Sopenharmony_ci <&ccu_pll CCU_SATA_PLL>, 1778c2ecf20Sopenharmony_ci <&ccu_pll CCU_PCIE_PLL>, 1788c2ecf20Sopenharmony_ci <&ccu_pll CCU_ETH_PLL>; 1798c2ecf20Sopenharmony_ci clock-names = "ref_clk", "sata_clk", "pcie_clk", 1808c2ecf20Sopenharmony_ci "eth_clk"; 1818c2ecf20Sopenharmony_ci }; 1828c2ecf20Sopenharmony_ci # Required Clock Control Unit PLL node: 1838c2ecf20Sopenharmony_ci - | 1848c2ecf20Sopenharmony_ci ccu_pll: clock-controller@1f04d000 { 1858c2ecf20Sopenharmony_ci compatible = "baikal,bt1-ccu-pll"; 1868c2ecf20Sopenharmony_ci reg = <0x1f04d000 0x028>; 1878c2ecf20Sopenharmony_ci #clock-cells = <1>; 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci clocks = <&clk25m>; 1908c2ecf20Sopenharmony_ci clock-names = "ref_clk"; 1918c2ecf20Sopenharmony_ci }; 1928c2ecf20Sopenharmony_ci... 193