Skip to content

Commit

Permalink
dt-bindings: clock: convert stm32 rcc bindings to json-schema
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>

Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stephen Boyd <[email protected]>
  • Loading branch information
passgat authored and bebarino committed Jan 15, 2025
1 parent 40384c8 commit ebca397
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 140 deletions.
138 changes: 0 additions & 138 deletions Documentation/devicetree/bindings/clock/st,stm32-rcc.txt

This file was deleted.

108 changes: 108 additions & 0 deletions Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/st,stm32-rcc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: STMicroelectronics STM32 Reset Clock Controller

maintainers:
- Dario Binacchi <[email protected]>

description: |
The RCC IP is both a reset and a clock controller.
The reset phandle argument is the bit number within the RCC registers bank,
starting from RCC base address.
properties:
compatible:
oneOf:
- items:
- enum:
- st,stm32f42xx-rcc
- st,stm32f746-rcc
- st,stm32h743-rcc
- const: st,stm32-rcc
- items:
- enum:
- st,stm32f469-rcc
- const: st,stm32f42xx-rcc
- const: st,stm32-rcc
- items:
- enum:
- st,stm32f769-rcc
- const: st,stm32f746-rcc
- const: st,stm32-rcc

reg:
maxItems: 1

'#reset-cells':
const: 1

'#clock-cells':
enum: [1, 2]

clocks:
minItems: 2
maxItems: 3

st,syscfg:
$ref: /schemas/types.yaml#/definitions/phandle
description:
Phandle to system configuration controller. It can be used to control the
power domain circuitry.

required:
- compatible
- reg
- '#reset-cells'
- '#clock-cells'
- clocks
- st,syscfg

allOf:
- if:
properties:
compatible:
contains:
const: st,stm32h743-rcc
then:
properties:
'#clock-cells':
const: 1
description: |
The clock index for the specified type.
clocks:
items:
- description: high speed external (HSE) clock input
- description: low speed external (LSE) clock input
- description: Inter-IC sound (I2S) clock input
else:
properties:
'#clock-cells':
const: 2
description: |
- The first cell is the clock type, possible values are 0 for
gated clocks and 1 otherwise.
- The second cell is the clock index for the specified type.
clocks:
items:
- description: high speed external (HSE) clock input
- description: Inter-IC sound (I2S) clock input

additionalProperties: false

examples:
# Reset and Clock Control Module node:
- |
clock-controller@58024400 {
compatible = "st,stm32h743-rcc", "st,stm32-rcc";
reg = <0x58024400 0x400>;
#clock-cells = <1>;
#reset-cells = <1>;
clocks = <&clk_hse>, <&clk_lse>, <&clk_i2s>;
st,syscfg = <&pwrcfg>;
};
...
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/reset/st,stm32-rcc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ STMicroelectronics STM32 Peripheral Reset Controller

The RCC IP is both a reset and a clock controller.

Please see Documentation/devicetree/bindings/clock/st,stm32-rcc.txt
Please see Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml
2 changes: 1 addition & 1 deletion include/dt-bindings/clock/stm32fx-clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* List of clocks which are not derived from system clock (SYSCLOCK)
*
* The index of these clocks is the secondary index of DT bindings
* (see Documentation/devicetree/bindings/clock/st,stm32-rcc.txt)
* (see Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml)
*
* e.g:
<assigned-clocks = <&rcc 1 CLK_LSE>;
Expand Down

0 comments on commit ebca397

Please sign in to comment.