1 STMicroelectronics STM32MP1 clock tree initialization
2 =====================================================
4 The STM32MP1 clock tree initialization is based on device tree information
5 for RCC IP node (st,stm32mp1-rcc) and on fixed-clock nodes.
7 RCC IP = st,stm32mp1-rcc
8 ========================
10 The RCC IP is both a reset and a clock controller but this documentation only
11 describes the fields added for clock tree initialization which are not present
12 in Linux binding for compatible "st,stm32mp1-rcc" defined in st,stm32mp1-rcc.txt
15 This parent node may optionally have additional children nodes which define
16 specific init values for RCC elements.
18 The added properties for clock tree initialization are:
21 - st,clksrc : The clock sources configuration array in a platform specific
24 For the STM32MP15x family there are 9 clock sources selector which are
25 configured in the following order:
26 MPU AXI MCU PLL12 PLL3 PLL4 RTC MCO1 MCO2
28 Clock source configuration values are defined by macros CLK_<NAME>_<SOURCE>
29 from dt-bindings/clock/stm32mp1-clksrc.h.
44 - st,clkdiv : The clock main dividers value specified in an array
45 in a platform specific order.
47 When used, it shall describe the whole clock dividers tree.
49 For the STM32MP15x family there are 11 dividers values expected.
50 They shall be configured in the following order:
51 MPU AXI MCU APB1 APB2 APB3 APB4 APB5 RTC MCO1 MCO2
53 The each divider value uses the DIV coding defined in RCC associated
54 register RCC_xxxDIVR. In most the case, it is:
61 Note that for RTC MCO1 MCO2, the coding is different:
84 - children for a PLL configuration with "st,stm32mp1-pll" compatible
86 each PLL children nodes for PLL1 to PLL4 (see ref manual for details)
87 are listed with associated reg 0 to 3.
88 PLLx is off when the associated node is absent or deactivated.
90 Here are the available properties for each PLL node:
91 - compatible: should be "st,stm32mp1-pll"
93 - reg: index of the pll instance
95 - cfg: The parameters for PLL configuration in the following order:
96 DIVM DIVN DIVP DIVQ DIVR Output.
98 DIVx values are defined as in RCC spec:
99 0x0: bypass (division by 1)
105 Output contains a bitfield for each output value (1:ON/0:OFF)
106 BIT(0) => output P : DIVPEN
107 BIT(1) => output Q : DIVQEN
108 BIT(2) => output R : DIVREN
109 NB: macro PQR(p,q,r) can be used to build this value
112 - frac : Fractional part of the multiplication factor
113 (optional, PLL is in integer mode when absent).
115 - csg : Clock Spreading Generator (optional) with parameters in the
116 following order: MOD_PER INC_STEP SSCG_MODE.
118 MOD_PER: Modulation Period Adjustment
119 INC_STEP: Modulation Depth Adjustment
120 SSCG_MODE: Spread spectrum clock generator mode, with associated
121 defined from stm32mp1-clksrc.h:
122 - SSCG_MODE_CENTER_SPREAD = 0
123 - SSCG_MODE_DOWN_SPREAD = 1
127 compatible = "st,stm32mp1-pll";
129 cfg = < 1 53 0 0 0 1 >;
133 compatible = "st,stm32mp1-pll";
135 cfg = < 1 43 1 0 0 PQR(0,1,1) >;
139 compatible = "st,stm32mp1-pll";
141 cfg = < 2 85 3 13 3 0 >;
142 csg = < 10 20 SSCG_MODE_CENTER_SPREAD >;
145 compatible = "st,stm32mp1-pll";
147 cfg = < 2 78 4 7 9 3 >;
150 - st,pkcs : used to configure the peripherals kernel clock selection.
152 The property is a list of peripheral kernel clock source identifiers defined
153 by macros CLK_<KERNEL-CLOCK>_<PARENT-CLOCK> as defined by header file
154 dt-bindings/clock/stm32mp1-clksrc.h.
156 st,pkcs may not list all the kernel clocks and has no ordering requirements.
169 other clocks = fixed-clock
170 ==========================
172 The clock tree is also based on 5 fixed-clock in clocks node
173 used to define the state of associated ST32MP1 oscillators:
180 At boot the clock tree initialization will
181 - enable oscillators present in device tree and not disabled
182 (node with status="disabled"),
183 - disable HSI oscillator if the node is absent (always activated by bootrom)
184 and not disabled (node with status="disabled").
186 Optional properties :
188 a) for external oscillator: "clk-lse", "clk-hse"
190 4 optional fields are managed
191 - "st,bypass" configures the oscillator bypass mode (HSEBYP, LSEBYP)
192 - "st,digbypass" configures the bypass mode as full-swing digital
194 - "st,css" activates the clock security system (HSECSSON, LSECSSON)
195 - "st,drive" (only for LSE) contains the value of the drive for the
196 oscillator (see LSEDRV_ defined in the file
197 dt-bindings/clock/stm32mp1-clksrc.h)
204 compatible = "fixed-clock";
205 clock-frequency = <64000000>;
211 compatible = "fixed-clock";
212 clock-frequency = <32768>;
214 st,drive = <LSEDRV_LOWEST>;
218 b) for internal oscillator: "clk-hsi"
220 Internally HSI clock is fixed to 64MHz for STM32MP157 SoC.
221 In device tree, clk-hsi is the clock after HSIDIV (clk_hsi in RCC
222 doc). So this clock frequency is used to compute the expected HSI_DIV
223 for the clock tree initialization.
225 Example with HSIDIV = /1:
230 compatible = "fixed-clock";
231 clock-frequency = <64000000>;
235 Example with HSIDIV = /2
240 compatible = "fixed-clock";
241 clock-frequency = <32000000>;
245 Example of clock tree initialization
246 ====================================
254 compatible = "fixed-clock";
255 clock-frequency = <24000000>;
262 compatible = "fixed-clock";
263 clock-frequency = <64000000>;
269 compatible = "fixed-clock";
270 clock-frequency = <32768>;
276 compatible = "fixed-clock";
277 clock-frequency = <32000>;
283 compatible = "fixed-clock";
284 clock-frequency = <4000000>;
292 compatible = "st,stm32mp1-rcc", "syscon";
293 reg = <0x50000000 0x1000>;
294 #address-cells = <1>;
298 interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
364 /* VCO = 1300.0 MHz => P = 650 (CPU) */
366 compatible = "st,stm32mp1-pll";
368 cfg = < 2 80 0 0 0 PQR(1,0,0) >;
373 /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU),
376 compatible = "st,stm32mp1-pll";
378 cfg = < 2 65 1 0 0 PQR(1,1,1) >;
383 /* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
385 compatible = "st,stm32mp1-pll";
387 cfg = < 1 33 1 16 36 PQR(1,1,1) >;
392 /* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
394 compatible = "st,stm32mp1-pll";
396 cfg = < 3 98 5 7 7 PQR(1,1,1) >;