st,stm32mp1.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. STMicroelectronics STM32MP1 clock tree initialization
  2. =====================================================
  3. The STM32MP clock tree initialization is based on device tree information
  4. for RCC IP and on fixed clocks.
  5. -------------------------------
  6. RCC CLOCK = st,stm32mp1-rcc-clk
  7. -------------------------------
  8. The RCC IP is both a reset and a clock controller but this documentation only
  9. describes the fields added for clock tree initialization which are not present
  10. in Linux binding.
  11. Please refer to ../mfd/st,stm32-rcc.txt for all the other properties common
  12. with Linux.
  13. Required properties:
  14. - compatible: Should be "st,stm32mp1-rcc-clk"
  15. - st,clksrc : The clock source in this order
  16. for STM32MP15x: 9 clock sources are requested
  17. MPU AXI MCU PLL12 PLL3 PLL4 RTC MCO1 MCO2
  18. with value equals to RCC clock specifier as defined in
  19. dt-bindings/clock/stm32mp1-clksrc.h: CLK_<NAME>_<SOURCE>
  20. - st,clkdiv : The div parameters in this order
  21. for STM32MP15x: 11 dividers value are requested
  22. MPU AXI MCU APB1 APB2 APB3 APB4 APB5 RTC MCO1 MCO2
  23. with DIV coding defined in RCC associated register RCC_xxxDIVR
  24. most the case, it is:
  25. 0x0: not divided
  26. 0x1: division by 2
  27. 0x2: division by 4
  28. 0x3: division by 8
  29. ...
  30. but for RTC MCO1 MCO2, the coding is different:
  31. 0x0: not divided
  32. 0x1: division by 2
  33. 0x2: division by 3
  34. 0x3: division by 4
  35. ...
  36. Optional Properties:
  37. - st,pll
  38. PLL children node for PLL1 to PLL4 : (see ref manual for details)
  39. with associated index 0 to 3 (st,pll@0 to st,pll@4)
  40. PLLx is off when the associated node is absent
  41. - Sub-nodes:
  42. - cfg: The parameters for PLL configuration in this order:
  43. DIVM DIVN DIVP DIVQ DIVR Output
  44. with DIV value as defined in RCC spec:
  45. 0x0: bypass (division by 1)
  46. 0x1: division by 2
  47. 0x2: division by 3
  48. 0x3: division by 4
  49. ...
  50. and Output = bitfield for each output value = 1:ON/0:OFF
  51. BIT(0) => output P : DIVPEN
  52. BIT(1) => output Q : DIVQEN
  53. BIT(2) => output R : DIVREN
  54. NB : macro PQR(p,q,r) can be used to build this value
  55. with p,p,r = 0 or 1
  56. - frac : Fractional part of the multiplication factor
  57. (optional, PLL is in integer mode when absent)
  58. - csg : Clock Spreading Generator (optional)
  59. with parameters in this order:
  60. MOD_PER INC_STEP SSCG_MODE
  61. * MOD_PER: Modulation Period Adjustment
  62. * INC_STEP: Modulation Depth Adjustment
  63. * SSCG_MODE: Spread spectrum clock generator mode
  64. you can use associated defines from stm32mp1-clksrc.h
  65. * SSCG_MODE_CENTER_SPREAD = 0
  66. * SSCG_MODE_DOWN_SPREAD = 1
  67. - st,pkcs : used to configure the peripherals kernel clock selection
  68. containing a list of peripheral kernel clock source identifier as defined
  69. in the file dt-bindings/clock/stm32mp1-clksrc.h
  70. Example:
  71. rcc: rcc@50000000 {
  72. compatible = "syscon", "simple-mfd";
  73. reg = <0x50000000 0x1000>;
  74. rcc_clk: rcc-clk@50000000 {
  75. #clock-cells = <1>;
  76. compatible = "st,stm32mp1-rcc-clk";
  77. st,clksrc = < CLK_MPU_PLL1P
  78. CLK_AXI_PLL2P
  79. CLK_MCU_HSI
  80. CLK_PLL12_HSE
  81. CLK_PLL3_HSE
  82. CLK_PLL4_HSE
  83. CLK_RTC_HSE
  84. CLK_MCO1_DISABLED
  85. CLK_MCO2_DISABLED
  86. >;
  87. st,clkdiv = <
  88. 1 /*MPU*/
  89. 0 /*AXI*/
  90. 0 /*MCU*/
  91. 1 /*APB1*/
  92. 1 /*APB2*/
  93. 1 /*APB3*/
  94. 1 /*APB4*/
  95. 5 /*APB5*/
  96. 23 /*RTC*/
  97. 0 /*MCO1*/
  98. 0 /*MCO2*/
  99. >;
  100. st,pll@0 {
  101. cfg = < 1 53 0 0 0 1 >;
  102. frac = < 0x810 >;
  103. };
  104. st,pll@1 {
  105. cfg = < 1 43 1 0 0 PQR(0,1,1)>;
  106. csg = <10 20 1>;
  107. };
  108. st,pll@2 {
  109. cfg = < 2 85 3 13 3 0>;
  110. csg = <10 20 SSCG_MODE_CENTER_SPREAD>;
  111. };
  112. st,pll@3 {
  113. cfg = < 2 78 4 7 9 3>;
  114. };
  115. st,pkcs = <
  116. CLK_STGEN_HSE
  117. CLK_CKPER_HSI
  118. CLK_USBPHY_PLL2P
  119. CLK_DSI_PLL2Q
  120. >;
  121. };
  122. };
  123. --------------------------
  124. other clocks = fixed-clock
  125. --------------------------
  126. The clock tree is also based on 5 fixed-clock in clocks node
  127. used to define the state of associated ST32MP1 oscillators:
  128. - clk-lsi
  129. - clk-lse
  130. - clk-hsi
  131. - clk-hse
  132. - clk-csi
  133. At boot the clock tree initialization will
  134. - enable the oscillator present in device tree
  135. - disable HSI oscillator if the node is absent (always activated by bootrom)
  136. Optional properties :
  137. a) for external oscillator: "clk-lse", "clk-hse"
  138. 3 optional fields are managed
  139. - "st,bypass" Configure the oscillator bypass mode (HSEBYP, LSEBYP)
  140. - "st,css" Activate the clock security system (HSECSSON, LSECSSON)
  141. - "st,drive" (only for LSE) value of the drive for the oscillator
  142. (see LSEDRV_ define in the file dt-bindings/clock/stm32mp1-clksrc.h)
  143. Example board file:
  144. / {
  145. clocks {
  146. clk_hse: clk-hse {
  147. #clock-cells = <0>;
  148. compatible = "fixed-clock";
  149. clock-frequency = <64000000>;
  150. st,bypass;
  151. };
  152. clk_lse: clk-lse {
  153. #clock-cells = <0>;
  154. compatible = "fixed-clock";
  155. clock-frequency = <32768>;
  156. st,css;
  157. st,drive = <LSEDRV_LOWEST>;
  158. };
  159. };
  160. b) for internal oscillator: "clk-hsi"
  161. internally HSI clock is fixed to 64MHz for STM32MP157 soc
  162. in device tree clk-hsi is the clock after HSIDIV (ck_hsi in RCC doc)
  163. So this clock frequency is used to compute the expected HSI_DIV
  164. for the clock tree initialisation
  165. ex: for HSIDIV = /1
  166. / {
  167. clocks {
  168. clk_hsi: clk-hsi {
  169. #clock-cells = <0>;
  170. compatible = "fixed-clock";
  171. clock-frequency = <64000000>;
  172. };
  173. };
  174. ex: for HSIDIV = /2
  175. / {
  176. clocks {
  177. clk_hsi: clk-hsi {
  178. #clock-cells = <0>;
  179. compatible = "fixed-clock";
  180. clock-frequency = <32000000>;
  181. };
  182. };