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

dt-bindings: clock: renesas,r9a08g045-vbattb: Document VBATTB

The VBATTB IP of the Renesas RZ/G3S SoC controls the clock for RTC,
the tamper detector and a small general usage memory of 128B.

The VBATTB controller controls the clock for the RTC on the Renesas
RZ/G3S. The HW block diagram for the clock logic is as follows:

+----------+ XC `\
RTXIN --->| |----->| \ +----+ VBATTCLK
| 32K clock| | |----->|gate|----------->
| osc | XBYP | | +----+
RTXOUT --->| |----->| /
+----------+ ,/

One could connect as input to this HW block either a crystal or
an external clock device. This is board specific.

After discussions w/ Stephen Boyd the clock tree associated with this
hardware block was exported in Linux as:

input-xtal
xbyp
xc
mux
vbattclk

where:
- input-xtal is the input clock (connected to RTXIN, RTXOUT pins)
- xc, xbyp are mux inputs
- mux is the internal mux
- vbattclk is the gate clock that feeds in the end the RTC

to allow selecting the input of the MUX though assigned-clock DT
properties, using the already existing clock drivers and avoid adding
other DT properties.

This allows select the input of the mux based on the type of the
connected input clock:
- if the 32768 crystal is connected as input for the VBATTB,
the input of the mux should be xc
- if an external clock device is connected as input for the VBATTB the
input of the mux should be xbyp

Add bindings for the VBATTB controller.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Link: https://lore.kernel.org/20241101095720.2247815-2-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

authored by

Claudiu Beznea and committed by
Geert Uytterhoeven
cdfd5daf 49991cca

+97
+84
Documentation/devicetree/bindings/clock/renesas,r9a08g045-vbattb.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/renesas,r9a08g045-vbattb.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Renesas Battery Backup Function (VBATTB) 8 + 9 + description: 10 + Renesas VBATTB is an always on powered module (backed by battery) which 11 + controls the RTC clock (VBATTCLK), tamper detection logic and a small 12 + general usage memory (128B). 13 + 14 + maintainers: 15 + - Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> 16 + 17 + properties: 18 + compatible: 19 + const: renesas,r9a08g045-vbattb 20 + 21 + reg: 22 + maxItems: 1 23 + 24 + interrupts: 25 + items: 26 + - description: tamper detector interrupt 27 + 28 + clocks: 29 + items: 30 + - description: VBATTB module clock 31 + - description: RTC input clock (crystal or external clock device) 32 + 33 + clock-names: 34 + items: 35 + - const: bclk 36 + - const: rtx 37 + 38 + '#clock-cells': 39 + const: 1 40 + 41 + power-domains: 42 + maxItems: 1 43 + 44 + resets: 45 + items: 46 + - description: VBATTB module reset 47 + 48 + quartz-load-femtofarads: 49 + description: load capacitance of the on board crystal 50 + enum: [ 4000, 7000, 9000, 12500 ] 51 + default: 4000 52 + 53 + required: 54 + - compatible 55 + - reg 56 + - interrupts 57 + - clocks 58 + - clock-names 59 + - '#clock-cells' 60 + - power-domains 61 + - resets 62 + 63 + additionalProperties: false 64 + 65 + examples: 66 + - | 67 + #include <dt-bindings/clock/r9a08g045-cpg.h> 68 + #include <dt-bindings/clock/renesas,r9a08g045-vbattb.h> 69 + #include <dt-bindings/interrupt-controller/arm-gic.h> 70 + #include <dt-bindings/interrupt-controller/irq.h> 71 + 72 + clock-controller@1005c000 { 73 + compatible = "renesas,r9a08g045-vbattb"; 74 + reg = <0x1005c000 0x1000>; 75 + interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>; 76 + clocks = <&cpg CPG_MOD R9A08G045_VBAT_BCLK>, <&vbattb_xtal>; 77 + clock-names = "bclk", "rtx"; 78 + assigned-clocks = <&vbattb VBATTB_MUX>; 79 + assigned-clock-parents = <&vbattb VBATTB_XC>; 80 + #clock-cells = <1>; 81 + power-domains = <&cpg>; 82 + resets = <&cpg R9A08G045_VBAT_BRESETN>; 83 + quartz-load-femtofarads = <12500>; 84 + };
+13
include/dt-bindings/clock/renesas,r9a08g045-vbattb.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + * 3 + * Copyright (C) 2024 Renesas Electronics Corp. 4 + */ 5 + #ifndef __DT_BINDINGS_CLOCK_R9A08G045_VBATTB_H__ 6 + #define __DT_BINDINGS_CLOCK_R9A08G045_VBATTB_H__ 7 + 8 + #define VBATTB_XC 0 9 + #define VBATTB_XBYP 1 10 + #define VBATTB_MUX 2 11 + #define VBATTB_VBATTCLK 3 12 + 13 + #endif /* __DT_BINDINGS_CLOCK_R9A08G045_VBATTB_H__ */