xref: /openbmc/u-boot/doc/device-tree-bindings/clock/st,stm32-rcc.txt (revision 712f99a5ddc404f8c6eac481cfe19f82ca2ecb4f)
1*712f99a5SVikas ManochaSTMicroelectronics STM32 Reset and Clock Controller
2*712f99a5SVikas Manocha===================================================
3*712f99a5SVikas Manocha
4*712f99a5SVikas ManochaThe RCC IP is both a reset and a clock controller.
5*712f99a5SVikas Manocha
6*712f99a5SVikas ManochaPlease refer to clock-bindings.txt for common clock controller binding usage.
7*712f99a5SVikas ManochaPlease also refer to reset.txt for common reset controller binding usage.
8*712f99a5SVikas Manocha
9*712f99a5SVikas ManochaRequired properties:
10*712f99a5SVikas Manocha- compatible: Should be:
11*712f99a5SVikas Manocha  "st,stm32f42xx-rcc"
12*712f99a5SVikas Manocha  "st,stm32f469-rcc"
13*712f99a5SVikas Manocha- reg: should be register base and length as documented in the
14*712f99a5SVikas Manocha  datasheet
15*712f99a5SVikas Manocha- #reset-cells: 1, see below
16*712f99a5SVikas Manocha- #clock-cells: 2, device nodes should specify the clock in their "clocks"
17*712f99a5SVikas Manocha  property, containing a phandle to the clock device node, an index selecting
18*712f99a5SVikas Manocha  between gated clocks and other clocks and an index specifying the clock to
19*712f99a5SVikas Manocha  use.
20*712f99a5SVikas Manocha
21*712f99a5SVikas ManochaExample:
22*712f99a5SVikas Manocha
23*712f99a5SVikas Manocha	rcc: rcc@40023800 {
24*712f99a5SVikas Manocha		#reset-cells = <1>;
25*712f99a5SVikas Manocha		#clock-cells = <2>
26*712f99a5SVikas Manocha		compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
27*712f99a5SVikas Manocha		reg = <0x40023800 0x400>;
28*712f99a5SVikas Manocha	};
29*712f99a5SVikas Manocha
30*712f99a5SVikas ManochaSpecifying gated clocks
31*712f99a5SVikas Manocha=======================
32*712f99a5SVikas Manocha
33*712f99a5SVikas ManochaThe primary index must be set to 0.
34*712f99a5SVikas Manocha
35*712f99a5SVikas ManochaThe secondary index is the bit number within the RCC register bank, starting
36*712f99a5SVikas Manochafrom the first RCC clock enable register (RCC_AHB1ENR, address offset 0x30).
37*712f99a5SVikas Manocha
38*712f99a5SVikas ManochaIt is calculated as: index = register_offset / 4 * 32 + bit_offset.
39*712f99a5SVikas ManochaWhere bit_offset is the bit offset within the register (LSB is 0, MSB is 31).
40*712f99a5SVikas Manocha
41*712f99a5SVikas ManochaTo simplify the usage and to share bit definition with the reset and clock
42*712f99a5SVikas Manochadrivers of the RCC IP, macros are available to generate the index in
43*712f99a5SVikas Manochahuman-readble format.
44*712f99a5SVikas Manocha
45*712f99a5SVikas ManochaFor STM32F4 series, the macro are available here:
46*712f99a5SVikas Manocha - include/dt-bindings/mfd/stm32f4-rcc.h
47*712f99a5SVikas Manocha
48*712f99a5SVikas ManochaExample:
49*712f99a5SVikas Manocha
50*712f99a5SVikas Manocha	/* Gated clock, AHB1 bit 0 (GPIOA) */
51*712f99a5SVikas Manocha	... {
52*712f99a5SVikas Manocha		clocks = <&rcc 0 STM32F4_AHB1_CLOCK(GPIOA)>
53*712f99a5SVikas Manocha	};
54*712f99a5SVikas Manocha
55*712f99a5SVikas Manocha	/* Gated clock, AHB2 bit 4 (CRYP) */
56*712f99a5SVikas Manocha	... {
57*712f99a5SVikas Manocha		clocks = <&rcc 0 STM32F4_AHB2_CLOCK(CRYP)>
58*712f99a5SVikas Manocha	};
59*712f99a5SVikas Manocha
60*712f99a5SVikas ManochaSpecifying other clocks
61*712f99a5SVikas Manocha=======================
62*712f99a5SVikas Manocha
63*712f99a5SVikas ManochaThe primary index must be set to 1.
64*712f99a5SVikas Manocha
65*712f99a5SVikas ManochaThe secondary index is bound with the following magic numbers:
66*712f99a5SVikas Manocha
67*712f99a5SVikas Manocha	0	SYSTICK
68*712f99a5SVikas Manocha	1	FCLK
69*712f99a5SVikas Manocha
70*712f99a5SVikas ManochaExample:
71*712f99a5SVikas Manocha
72*712f99a5SVikas Manocha	/* Misc clock, FCLK */
73*712f99a5SVikas Manocha	... {
74*712f99a5SVikas Manocha		clocks = <&rcc 1 STM32F4_APB1_CLOCK(TIM2)>
75*712f99a5SVikas Manocha	};
76*712f99a5SVikas Manocha
77*712f99a5SVikas Manocha
78*712f99a5SVikas ManochaSpecifying softreset control of devices
79*712f99a5SVikas Manocha=======================================
80*712f99a5SVikas Manocha
81*712f99a5SVikas ManochaDevice nodes should specify the reset channel required in their "resets"
82*712f99a5SVikas Manochaproperty, containing a phandle to the reset device node and an index specifying
83*712f99a5SVikas Manochawhich channel to use.
84*712f99a5SVikas ManochaThe index is the bit number within the RCC registers bank, starting from RCC
85*712f99a5SVikas Manochabase address.
86*712f99a5SVikas ManochaIt is calculated as: index = register_offset / 4 * 32 + bit_offset.
87*712f99a5SVikas ManochaWhere bit_offset is the bit offset within the register.
88*712f99a5SVikas ManochaFor example, for CRC reset:
89*712f99a5SVikas Manocha  crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
90*712f99a5SVikas Manocha
91*712f99a5SVikas Manochaexample:
92*712f99a5SVikas Manocha
93*712f99a5SVikas Manocha	timer2 {
94*712f99a5SVikas Manocha		resets	= <&rcc STM32F4_APB1_RESET(TIM2)>;
95*712f99a5SVikas Manocha	};
96