Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dt-bindings: clock: convert stm32 rcc bindings to json-schema

The patch converts st,stm32-rcc.txt to the JSON schema, but it does more
than that. The old bindings, in fact, only covered the stm32f{4,7}
platforms and not the stm32h7. Therefore, to avoid patch submission tests
failing, it was necessary to add the corresponding compatible (i. e.
st,stm32h743-rcc) and specify that, in this case, 3 are the clocks instead
of the 2 required for the stm32f{4,7} platforms.
Additionally, the old bindings made no mention of the st,syscfg property,
which is used by both the stm32f{4,7} and the stm32h7 platforms.

The patch also fixes the files referencing to the old st,stm32-rcc.txt.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Link: https://lore.kernel.org/r/20250114182021.670435-2-dario.binacchi@amarulasolutions.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Dario Binacchi and committed by
Stephen Boyd
ebca3970 40384c84

+110 -140
-138
Documentation/devicetree/bindings/clock/st,stm32-rcc.txt
··· 1 - STMicroelectronics STM32 Reset and Clock Controller 2 - =================================================== 3 - 4 - The RCC IP is both a reset and a clock controller. 5 - 6 - Please refer to clock-bindings.txt for common clock controller binding usage. 7 - Please also refer to reset.txt for common reset controller binding usage. 8 - 9 - Required properties: 10 - - compatible: Should be: 11 - "st,stm32f42xx-rcc" 12 - "st,stm32f469-rcc" 13 - "st,stm32f746-rcc" 14 - "st,stm32f769-rcc" 15 - 16 - - reg: should be register base and length as documented in the 17 - datasheet 18 - - #reset-cells: 1, see below 19 - - #clock-cells: 2, device nodes should specify the clock in their "clocks" 20 - property, containing a phandle to the clock device node, an index selecting 21 - between gated clocks and other clocks and an index specifying the clock to 22 - use. 23 - - clocks: External oscillator clock phandle 24 - - high speed external clock signal (HSE) 25 - - external I2S clock (I2S_CKIN) 26 - 27 - Example: 28 - 29 - rcc: rcc@40023800 { 30 - #reset-cells = <1>; 31 - #clock-cells = <2> 32 - compatible = "st,stm32f42xx-rcc", "st,stm32-rcc"; 33 - reg = <0x40023800 0x400>; 34 - clocks = <&clk_hse>, <&clk_i2s_ckin>; 35 - }; 36 - 37 - Specifying gated clocks 38 - ======================= 39 - 40 - The primary index must be set to 0. 41 - 42 - The secondary index is the bit number within the RCC register bank, starting 43 - from the first RCC clock enable register (RCC_AHB1ENR, address offset 0x30). 44 - 45 - It is calculated as: index = register_offset / 4 * 32 + bit_offset. 46 - Where bit_offset is the bit offset within the register (LSB is 0, MSB is 31). 47 - 48 - To simplify the usage and to share bit definition with the reset and clock 49 - drivers of the RCC IP, macros are available to generate the index in 50 - human-readble format. 51 - 52 - For STM32F4 series, the macro are available here: 53 - - include/dt-bindings/mfd/stm32f4-rcc.h 54 - 55 - Example: 56 - 57 - /* Gated clock, AHB1 bit 0 (GPIOA) */ 58 - ... { 59 - clocks = <&rcc 0 STM32F4_AHB1_CLOCK(GPIOA)> 60 - }; 61 - 62 - /* Gated clock, AHB2 bit 4 (CRYP) */ 63 - ... { 64 - clocks = <&rcc 0 STM32F4_AHB2_CLOCK(CRYP)> 65 - }; 66 - 67 - Specifying other clocks 68 - ======================= 69 - 70 - The primary index must be set to 1. 71 - 72 - The secondary index is bound with the following magic numbers: 73 - 74 - 0 SYSTICK 75 - 1 FCLK 76 - 2 CLK_LSI (low-power clock source) 77 - 3 CLK_LSE (generated from a 32.768 kHz low-speed external 78 - crystal or ceramic resonator) 79 - 4 CLK_HSE_RTC (HSE division factor for RTC clock) 80 - 5 CLK_RTC (real-time clock) 81 - 6 PLL_VCO_I2S (vco frequency of I2S pll) 82 - 7 PLL_VCO_SAI (vco frequency of SAI pll) 83 - 8 CLK_LCD (LCD-TFT) 84 - 9 CLK_I2S (I2S clocks) 85 - 10 CLK_SAI1 (audio clocks) 86 - 11 CLK_SAI2 87 - 12 CLK_I2SQ_PDIV (post divisor of pll i2s q divisor) 88 - 13 CLK_SAIQ_PDIV (post divisor of pll sai q divisor) 89 - 90 - 14 CLK_HSI (Internal ocscillator clock) 91 - 15 CLK_SYSCLK (System Clock) 92 - 16 CLK_HDMI_CEC (HDMI-CEC clock) 93 - 17 CLK_SPDIF (SPDIF-Rx clock) 94 - 18 CLK_USART1 (U(s)arts clocks) 95 - 19 CLK_USART2 96 - 20 CLK_USART3 97 - 21 CLK_UART4 98 - 22 CLK_UART5 99 - 23 CLK_USART6 100 - 24 CLK_UART7 101 - 25 CLK_UART8 102 - 26 CLK_I2C1 (I2S clocks) 103 - 27 CLK_I2C2 104 - 28 CLK_I2C3 105 - 29 CLK_I2C4 106 - 30 CLK_LPTIMER (LPTimer1 clock) 107 - 31 CLK_PLL_SRC 108 - 32 CLK_DFSDM1 109 - 33 CLK_ADFSDM1 110 - 34 CLK_F769_DSI 111 - ) 112 - 113 - Example: 114 - 115 - /* Misc clock, FCLK */ 116 - ... { 117 - clocks = <&rcc 1 STM32F4_APB1_CLOCK(TIM2)> 118 - }; 119 - 120 - 121 - Specifying softreset control of devices 122 - ======================================= 123 - 124 - Device nodes should specify the reset channel required in their "resets" 125 - property, containing a phandle to the reset device node and an index specifying 126 - which channel to use. 127 - The index is the bit number within the RCC registers bank, starting from RCC 128 - base address. 129 - It is calculated as: index = register_offset / 4 * 32 + bit_offset. 130 - Where bit_offset is the bit offset within the register. 131 - For example, for CRC reset: 132 - crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140 133 - 134 - example: 135 - 136 - timer2 { 137 - resets = <&rcc STM32F4_APB1_RESET(TIM2)>; 138 - };
+108
Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/clock/st,stm32-rcc.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: STMicroelectronics STM32 Reset Clock Controller 8 + 9 + maintainers: 10 + - Dario Binacchi <dario.binacchi@amarulasolutions.com> 11 + 12 + description: | 13 + The RCC IP is both a reset and a clock controller. 14 + The reset phandle argument is the bit number within the RCC registers bank, 15 + starting from RCC base address. 16 + 17 + properties: 18 + compatible: 19 + oneOf: 20 + - items: 21 + - enum: 22 + - st,stm32f42xx-rcc 23 + - st,stm32f746-rcc 24 + - st,stm32h743-rcc 25 + - const: st,stm32-rcc 26 + - items: 27 + - enum: 28 + - st,stm32f469-rcc 29 + - const: st,stm32f42xx-rcc 30 + - const: st,stm32-rcc 31 + - items: 32 + - enum: 33 + - st,stm32f769-rcc 34 + - const: st,stm32f746-rcc 35 + - const: st,stm32-rcc 36 + 37 + reg: 38 + maxItems: 1 39 + 40 + '#reset-cells': 41 + const: 1 42 + 43 + '#clock-cells': 44 + enum: [1, 2] 45 + 46 + clocks: 47 + minItems: 2 48 + maxItems: 3 49 + 50 + st,syscfg: 51 + $ref: /schemas/types.yaml#/definitions/phandle 52 + description: 53 + Phandle to system configuration controller. It can be used to control the 54 + power domain circuitry. 55 + 56 + required: 57 + - compatible 58 + - reg 59 + - '#reset-cells' 60 + - '#clock-cells' 61 + - clocks 62 + - st,syscfg 63 + 64 + allOf: 65 + - if: 66 + properties: 67 + compatible: 68 + contains: 69 + const: st,stm32h743-rcc 70 + then: 71 + properties: 72 + '#clock-cells': 73 + const: 1 74 + description: | 75 + The clock index for the specified type. 76 + clocks: 77 + items: 78 + - description: high speed external (HSE) clock input 79 + - description: low speed external (LSE) clock input 80 + - description: Inter-IC sound (I2S) clock input 81 + else: 82 + properties: 83 + '#clock-cells': 84 + const: 2 85 + description: | 86 + - The first cell is the clock type, possible values are 0 for 87 + gated clocks and 1 otherwise. 88 + - The second cell is the clock index for the specified type. 89 + clocks: 90 + items: 91 + - description: high speed external (HSE) clock input 92 + - description: Inter-IC sound (I2S) clock input 93 + 94 + additionalProperties: false 95 + 96 + examples: 97 + # Reset and Clock Control Module node: 98 + - | 99 + clock-controller@58024400 { 100 + compatible = "st,stm32h743-rcc", "st,stm32-rcc"; 101 + reg = <0x58024400 0x400>; 102 + #clock-cells = <1>; 103 + #reset-cells = <1>; 104 + clocks = <&clk_hse>, <&clk_lse>, <&clk_i2s>; 105 + st,syscfg = <&pwrcfg>; 106 + }; 107 + 108 + ...
+1 -1
Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
··· 3 3 4 4 The RCC IP is both a reset and a clock controller. 5 5 6 - Please see Documentation/devicetree/bindings/clock/st,stm32-rcc.txt 6 + Please see Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml
+1 -1
include/dt-bindings/clock/stm32fx-clock.h
··· 10 10 * List of clocks which are not derived from system clock (SYSCLOCK) 11 11 * 12 12 * The index of these clocks is the secondary index of DT bindings 13 - * (see Documentation/devicetree/bindings/clock/st,stm32-rcc.txt) 13 + * (see Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml) 14 14 * 15 15 * e.g: 16 16 <assigned-clocks = <&rcc 1 CLK_LSE>;