st,stm32-rcc.txt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. STMicroelectronics STM32 Reset and Clock Controller
  2. ===================================================
  3. The RCC IP is both a reset and a clock controller.
  4. Please refer to clock-bindings.txt for common clock controller binding usage.
  5. Please also refer to reset.txt for common reset controller binding usage.
  6. Required properties:
  7. - compatible: Should be:
  8. "st,stm32f42xx-rcc"
  9. "st,stm32f469-rcc"
  10. "st,stm32f746-rcc"
  11. - reg: should be register base and length as documented in the
  12. datasheet
  13. - #reset-cells: 1, see below
  14. - #clock-cells: 2, device nodes should specify the clock in their "clocks"
  15. property, containing a phandle to the clock device node, an index selecting
  16. between gated clocks and other clocks and an index specifying the clock to
  17. use.
  18. - clocks: External oscillator clock phandle
  19. - high speed external clock signal (HSE)
  20. - external I2S clock (I2S_CKIN)
  21. Example:
  22. rcc: rcc@40023800 {
  23. #reset-cells = <1>;
  24. #clock-cells = <2>
  25. compatible = "st,stm32f42xx-rcc", "st,stm32-rcc";
  26. reg = <0x40023800 0x400>;
  27. clocks = <&clk_hse>, <&clk_i2s_ckin>;
  28. };
  29. Specifying gated clocks
  30. =======================
  31. The primary index must be set to 0.
  32. The secondary index is the bit number within the RCC register bank, starting
  33. from the first RCC clock enable register (RCC_AHB1ENR, address offset 0x30).
  34. It is calculated as: index = register_offset / 4 * 32 + bit_offset.
  35. Where bit_offset is the bit offset within the register (LSB is 0, MSB is 31).
  36. To simplify the usage and to share bit definition with the reset and clock
  37. drivers of the RCC IP, macros are available to generate the index in
  38. human-readble format.
  39. For STM32F4 series, the macro are available here:
  40. - include/dt-bindings/mfd/stm32f4-rcc.h
  41. Example:
  42. /* Gated clock, AHB1 bit 0 (GPIOA) */
  43. ... {
  44. clocks = <&rcc 0 STM32F4_AHB1_CLOCK(GPIOA)>
  45. };
  46. /* Gated clock, AHB2 bit 4 (CRYP) */
  47. ... {
  48. clocks = <&rcc 0 STM32F4_AHB2_CLOCK(CRYP)>
  49. };
  50. Specifying other clocks
  51. =======================
  52. The primary index must be set to 1.
  53. The secondary index is bound with the following magic numbers:
  54. 0 SYSTICK
  55. 1 FCLK
  56. 2 CLK_LSI (low-power clock source)
  57. 3 CLK_LSE (generated from a 32.768 kHz low-speed external
  58. crystal or ceramic resonator)
  59. 4 CLK_HSE_RTC (HSE division factor for RTC clock)
  60. 5 CLK_RTC (real-time clock)
  61. 6 PLL_VCO_I2S (vco frequency of I2S pll)
  62. 7 PLL_VCO_SAI (vco frequency of SAI pll)
  63. 8 CLK_LCD (LCD-TFT)
  64. 9 CLK_I2S (I2S clocks)
  65. 10 CLK_SAI1 (audio clocks)
  66. 11 CLK_SAI2
  67. 12 CLK_I2SQ_PDIV (post divisor of pll i2s q divisor)
  68. 13 CLK_SAIQ_PDIV (post divisor of pll sai q divisor)
  69. 14 CLK_HSI (Internal ocscillator clock)
  70. 15 CLK_SYSCLK (System Clock)
  71. 16 CLK_HDMI_CEC (HDMI-CEC clock)
  72. 17 CLK_SPDIF (SPDIF-Rx clock)
  73. 18 CLK_USART1 (U(s)arts clocks)
  74. 19 CLK_USART2
  75. 20 CLK_USART3
  76. 21 CLK_UART4
  77. 22 CLK_UART5
  78. 23 CLK_USART6
  79. 24 CLK_UART7
  80. 25 CLK_UART8
  81. 26 CLK_I2C1 (I2S clocks)
  82. 27 CLK_I2C2
  83. 28 CLK_I2C3
  84. 29 CLK_I2C4
  85. 30 CLK_LPTIMER (LPTimer1 clock)
  86. )
  87. Example:
  88. /* Misc clock, FCLK */
  89. ... {
  90. clocks = <&rcc 1 STM32F4_APB1_CLOCK(TIM2)>
  91. };
  92. Specifying softreset control of devices
  93. =======================================
  94. Device nodes should specify the reset channel required in their "resets"
  95. property, containing a phandle to the reset device node and an index specifying
  96. which channel to use.
  97. The index is the bit number within the RCC registers bank, starting from RCC
  98. base address.
  99. It is calculated as: index = register_offset / 4 * 32 + bit_offset.
  100. Where bit_offset is the bit offset within the register.
  101. For example, for CRC reset:
  102. crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140
  103. example:
  104. timer2 {
  105. resets = <&rcc STM32F4_APB1_RESET(TIM2)>;
  106. };