2018-03-12 09:46:16 +00:00
|
|
|
STMicroelectronics STM32MP1 clock tree initialization
|
|
|
|
=====================================================
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
The STM32MP1 clock tree initialization is based on device tree information
|
|
|
|
for RCC IP node (st,stm32mp1-rcc) and on fixed-clock nodes.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
RCC IP = st,stm32mp1-rcc
|
|
|
|
========================
|
2018-03-12 09:46:16 +00:00
|
|
|
|
|
|
|
The RCC IP is both a reset and a clock controller but this documentation only
|
|
|
|
describes the fields added for clock tree initialization which are not present
|
2019-04-18 15:32:41 +00:00
|
|
|
in Linux binding for compatible "st,stm32mp1-rcc" defined in st,stm32mp1-rcc.txt
|
|
|
|
file.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2020-01-28 09:11:03 +00:00
|
|
|
This parent node may optionally have additional children nodes which define
|
|
|
|
specific init values for RCC elements.
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
The added properties for clock tree initialization are:
|
2018-03-12 09:46:16 +00:00
|
|
|
|
|
|
|
Required properties:
|
2019-04-18 15:32:41 +00:00
|
|
|
- st,clksrc : The clock sources configuration array in a platform specific
|
|
|
|
order.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
For the STM32MP15x family there are 9 clock sources selector which are
|
|
|
|
configured in the following order:
|
|
|
|
MPU AXI MCU PLL12 PLL3 PLL4 RTC MCO1 MCO2
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Clock source configuration values are defined by macros CLK_<NAME>_<SOURCE>
|
|
|
|
from dt-bindings/clock/stm32mp1-clksrc.h.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Example:
|
|
|
|
st,clksrc = <
|
|
|
|
CLK_MPU_PLL1P
|
|
|
|
CLK_AXI_PLL2P
|
|
|
|
CLK_MCU_PLL3P
|
|
|
|
CLK_PLL12_HSE
|
|
|
|
CLK_PLL3_HSE
|
|
|
|
CLK_PLL4_HSE
|
|
|
|
CLK_RTC_LSE
|
|
|
|
CLK_MCO1_DISABLED
|
|
|
|
CLK_MCO2_DISABLED
|
|
|
|
>;
|
|
|
|
|
|
|
|
- st,clkdiv : The clock main dividers value specified in an array
|
|
|
|
in a platform specific order.
|
|
|
|
|
|
|
|
When used, it shall describe the whole clock dividers tree.
|
|
|
|
|
|
|
|
For the STM32MP15x family there are 11 dividers values expected.
|
|
|
|
They shall be configured in the following order:
|
2018-03-12 09:46:16 +00:00
|
|
|
MPU AXI MCU APB1 APB2 APB3 APB4 APB5 RTC MCO1 MCO2
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
The each divider value uses the DIV coding defined in RCC associated
|
|
|
|
register RCC_xxxDIVR. In most the case, it is:
|
2018-03-12 09:46:16 +00:00
|
|
|
0x0: not divided
|
|
|
|
0x1: division by 2
|
|
|
|
0x2: division by 4
|
|
|
|
0x3: division by 8
|
|
|
|
...
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Note that for RTC MCO1 MCO2, the coding is different:
|
2018-03-12 09:46:16 +00:00
|
|
|
0x0: not divided
|
|
|
|
0x1: division by 2
|
|
|
|
0x2: division by 3
|
|
|
|
0x3: division by 4
|
|
|
|
...
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Example:
|
|
|
|
st,clkdiv = <
|
|
|
|
1 /*MPU*/
|
|
|
|
0 /*AXI*/
|
|
|
|
0 /*MCU*/
|
|
|
|
1 /*APB1*/
|
|
|
|
1 /*APB2*/
|
|
|
|
1 /*APB3*/
|
|
|
|
1 /*APB4*/
|
|
|
|
2 /*APB5*/
|
|
|
|
23 /*RTC*/
|
|
|
|
0 /*MCO1*/
|
|
|
|
0 /*MCO2*/
|
|
|
|
>;
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Optional Properties:
|
2020-01-28 09:11:03 +00:00
|
|
|
- children for a PLL configuration with "st,stm32mp1-pll" compatible
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2020-01-28 09:11:03 +00:00
|
|
|
each PLL children nodes for PLL1 to PLL4 (see ref manual for details)
|
|
|
|
are listed with associated reg 0 to 3.
|
|
|
|
PLLx is off when the associated node is absent or deactivated.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2020-05-25 10:19:44 +00:00
|
|
|
For PLL1, when the node is absent, the frequency of the OPP node is used
|
|
|
|
to compute the PLL setting (see compatible "operating-points-v2" in
|
|
|
|
opp/opp.txt for details).
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Here are the available properties for each PLL node:
|
2020-01-28 09:11:03 +00:00
|
|
|
- compatible: should be "st,stm32mp1-pll"
|
|
|
|
|
|
|
|
- reg: index of the pll instance
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
- cfg: The parameters for PLL configuration in the following order:
|
|
|
|
DIVM DIVN DIVP DIVQ DIVR Output.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
DIVx values are defined as in RCC spec:
|
|
|
|
0x0: bypass (division by 1)
|
|
|
|
0x1: division by 2
|
|
|
|
0x2: division by 3
|
|
|
|
0x3: division by 4
|
|
|
|
...
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Output contains a bitfield for each output value (1:ON/0:OFF)
|
|
|
|
BIT(0) => output P : DIVPEN
|
|
|
|
BIT(1) => output Q : DIVQEN
|
|
|
|
BIT(2) => output R : DIVREN
|
|
|
|
NB: macro PQR(p,q,r) can be used to build this value
|
|
|
|
with p,q,r = 0 or 1.
|
|
|
|
|
|
|
|
- frac : Fractional part of the multiplication factor
|
|
|
|
(optional, PLL is in integer mode when absent).
|
|
|
|
|
|
|
|
- csg : Clock Spreading Generator (optional) with parameters in the
|
|
|
|
following order: MOD_PER INC_STEP SSCG_MODE.
|
|
|
|
|
|
|
|
MOD_PER: Modulation Period Adjustment
|
|
|
|
INC_STEP: Modulation Depth Adjustment
|
|
|
|
SSCG_MODE: Spread spectrum clock generator mode, with associated
|
|
|
|
defined from stm32mp1-clksrc.h:
|
|
|
|
- SSCG_MODE_CENTER_SPREAD = 0
|
|
|
|
- SSCG_MODE_DOWN_SPREAD = 1
|
|
|
|
|
|
|
|
Example:
|
|
|
|
st,pll@0 {
|
2020-01-28 09:11:03 +00:00
|
|
|
compatible = "st,stm32mp1-pll";
|
|
|
|
reg = <0>;
|
2019-04-18 15:32:41 +00:00
|
|
|
cfg = < 1 53 0 0 0 1 >;
|
|
|
|
frac = < 0x810 >;
|
|
|
|
};
|
|
|
|
st,pll@1 {
|
2020-01-28 09:11:03 +00:00
|
|
|
compatible = "st,stm32mp1-pll";
|
|
|
|
reg = <1>;
|
2019-04-18 15:32:41 +00:00
|
|
|
cfg = < 1 43 1 0 0 PQR(0,1,1) >;
|
|
|
|
csg = < 10 20 1 >;
|
|
|
|
};
|
|
|
|
st,pll@2 {
|
2020-01-28 09:11:03 +00:00
|
|
|
compatible = "st,stm32mp1-pll";
|
|
|
|
reg = <2>;
|
2019-04-18 15:32:41 +00:00
|
|
|
cfg = < 2 85 3 13 3 0 >;
|
|
|
|
csg = < 10 20 SSCG_MODE_CENTER_SPREAD >;
|
|
|
|
};
|
|
|
|
st,pll@3 {
|
2020-01-28 09:11:03 +00:00
|
|
|
compatible = "st,stm32mp1-pll";
|
|
|
|
reg = <3>;
|
2019-04-18 15:32:41 +00:00
|
|
|
cfg = < 2 78 4 7 9 3 >;
|
|
|
|
};
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
- st,pkcs : used to configure the peripherals kernel clock selection.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
The property is a list of peripheral kernel clock source identifiers defined
|
|
|
|
by macros CLK_<KERNEL-CLOCK>_<PARENT-CLOCK> as defined by header file
|
|
|
|
dt-bindings/clock/stm32mp1-clksrc.h.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
st,pkcs may not list all the kernel clocks and has no ordering requirements.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
|
|
|
Example:
|
2019-04-18 15:32:41 +00:00
|
|
|
st,pkcs = <
|
|
|
|
CLK_STGEN_HSE
|
|
|
|
CLK_CKPER_HSI
|
|
|
|
CLK_USBPHY_PLL2P
|
|
|
|
CLK_DSI_PLL2Q
|
|
|
|
CLK_I2C46_HSI
|
|
|
|
CLK_UART1_HSI
|
|
|
|
CLK_UART24_HSI
|
|
|
|
>;
|
2018-03-12 09:46:16 +00:00
|
|
|
|
|
|
|
other clocks = fixed-clock
|
2019-04-18 15:32:41 +00:00
|
|
|
==========================
|
|
|
|
|
2018-03-12 09:46:16 +00:00
|
|
|
The clock tree is also based on 5 fixed-clock in clocks node
|
|
|
|
used to define the state of associated ST32MP1 oscillators:
|
2019-04-18 15:32:41 +00:00
|
|
|
- clk-lsi
|
|
|
|
- clk-lse
|
|
|
|
- clk-hsi
|
|
|
|
- clk-hse
|
|
|
|
- clk-csi
|
2018-03-12 09:46:16 +00:00
|
|
|
|
|
|
|
At boot the clock tree initialization will
|
2019-07-30 17:16:19 +00:00
|
|
|
- enable oscillators present in device tree and not disabled
|
|
|
|
(node with status="disabled"),
|
2019-04-18 15:32:41 +00:00
|
|
|
- disable HSI oscillator if the node is absent (always activated by bootrom)
|
2019-07-30 17:16:19 +00:00
|
|
|
and not disabled (node with status="disabled").
|
2018-03-12 09:46:16 +00:00
|
|
|
|
|
|
|
Optional properties :
|
|
|
|
|
|
|
|
a) for external oscillator: "clk-lse", "clk-hse"
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
4 optional fields are managed
|
|
|
|
- "st,bypass" configures the oscillator bypass mode (HSEBYP, LSEBYP)
|
|
|
|
- "st,digbypass" configures the bypass mode as full-swing digital
|
|
|
|
signal (DIGBYP)
|
|
|
|
- "st,css" activates the clock security system (HSECSSON, LSECSSON)
|
|
|
|
- "st,drive" (only for LSE) contains the value of the drive for the
|
|
|
|
oscillator (see LSEDRV_ defined in the file
|
|
|
|
dt-bindings/clock/stm32mp1-clksrc.h)
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Example board file:
|
2018-03-12 09:46:16 +00:00
|
|
|
/ {
|
|
|
|
clocks {
|
|
|
|
clk_hse: clk-hse {
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <64000000>;
|
|
|
|
st,bypass;
|
|
|
|
};
|
|
|
|
|
|
|
|
clk_lse: clk-lse {
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <32768>;
|
|
|
|
st,css;
|
|
|
|
st,drive = <LSEDRV_LOWEST>;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
b) for internal oscillator: "clk-hsi"
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Internally HSI clock is fixed to 64MHz for STM32MP157 SoC.
|
|
|
|
In device tree, clk-hsi is the clock after HSIDIV (clk_hsi in RCC
|
|
|
|
doc). So this clock frequency is used to compute the expected HSI_DIV
|
|
|
|
for the clock tree initialization.
|
2018-03-12 09:46:16 +00:00
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Example with HSIDIV = /1:
|
2018-03-12 09:46:16 +00:00
|
|
|
/ {
|
|
|
|
clocks {
|
|
|
|
clk_hsi: clk-hsi {
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <64000000>;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-04-18 15:32:41 +00:00
|
|
|
Example with HSIDIV = /2
|
2018-03-12 09:46:16 +00:00
|
|
|
/ {
|
|
|
|
clocks {
|
|
|
|
clk_hsi: clk-hsi {
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <32000000>;
|
|
|
|
};
|
|
|
|
};
|
2019-04-18 15:32:41 +00:00
|
|
|
|
|
|
|
Example of clock tree initialization
|
|
|
|
====================================
|
|
|
|
|
|
|
|
/ {
|
|
|
|
clocks {
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
clk_hse: clk-hse {
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <24000000>;
|
|
|
|
st,digbypass;
|
|
|
|
};
|
|
|
|
|
|
|
|
clk_hsi: clk-hsi {
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <64000000>;
|
|
|
|
};
|
|
|
|
|
|
|
|
clk_lse: clk-lse {
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <32768>;
|
|
|
|
};
|
|
|
|
|
|
|
|
clk_lsi: clk-lsi {
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <32000>;
|
|
|
|
};
|
|
|
|
|
|
|
|
clk_csi: clk-csi {
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
#clock-cells = <0>;
|
|
|
|
compatible = "fixed-clock";
|
|
|
|
clock-frequency = <4000000>;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
soc {
|
|
|
|
|
|
|
|
rcc: rcc@50000000 {
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
compatible = "st,stm32mp1-rcc", "syscon";
|
|
|
|
reg = <0x50000000 0x1000>;
|
2020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C_LSE
|
|
|
|
CLK_I2C12_HSI
|
|
|
|
CLK_I2C35_HSI
|
|
|
|
CLK_UART1_HSI
|
|
|
|
CLK_UART24_HSI
|
|
|
|
CLK_UART35_HSI
|
|
|
|
CLK_UART6_HSI
|
|
|
|
CLK_UART78_HSI
|
|
|
|
CLK_SPDIF_PLL4P
|
|
|
|
CLK_FDCAN_PLL4Q
|
|
|
|
CLK_SAI1_PLL3Q
|
|
|
|
CLK_SAI2_PLL3Q
|
|
|
|
CLK_SAI3_PLL3Q
|
|
|
|
CLK_SAI4_PLL3Q
|
|
|
|
CLK_RNG1_LSI
|
|
|
|
CLK_RNG2_LSI
|
|
|
|
CLK_LPTIM1_PCLK1
|
|
|
|
CLK_LPTIM23_PCLK3
|
|
|
|
CLK_LPTIM45_LSE
|
|
|
|
>;
|
|
|
|
|
|
|
|
/* VCO = 1300.0 MHz => P = 650 (CPU) */
|
|
|
|
pll1: st,pll@0 {
|
2020-01-28 09:11:03 +00:00
|
|
|
compatible = "st,stm32mp1-pll";
|
|
|
|
reg = <0>;
|
2019-04-18 15:32:41 +00:00
|
|
|
cfg = < 2 80 0 0 0 PQR(1,0,0) >;
|
|
|
|
frac = < 0x800 >;
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU),
|
|
|
|
R = 533 (DDR) */
|
|
|
|
pll2: st,pll@1 {
|
2020-01-28 09:11:03 +00:00
|
|
|
compatible = "st,stm32mp1-pll";
|
|
|
|
reg = <1>;
|
2019-04-18 15:32:41 +00:00
|
|
|
cfg = < 2 65 1 0 0 PQR(1,1,1) >;
|
|
|
|
frac = < 0x1400 >;
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* VCO = 417.8 MHz => P = 209, Q = 24, R = 11 */
|
|
|
|
pll3: st,pll@2 {
|
2020-01-28 09:11:03 +00:00
|
|
|
compatible = "st,stm32mp1-pll";
|
|
|
|
reg = <2>;
|
2019-04-18 15:32:41 +00:00
|
|
|
cfg = < 1 33 1 16 36 PQR(1,1,1) >;
|
|
|
|
frac = < 0x1a04 >;
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* VCO = 594.0 MHz => P = 99, Q = 74, R = 74 */
|
|
|
|
pll4: st,pll@3 {
|
2020-01-28 09:11:03 +00:00
|
|
|
compatible = "st,stm32mp1-pll";
|
|
|
|
reg = <3>;
|
2019-04-18 15:32:41 +00:00
|
|
|
cfg = < 3 98 5 7 7 PQR(1,1,1) >;
|
|
|
|
u-boot,dm-pre-reloc;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|