diff mbox series

[2/5] dt-bindings: rtc: Add optional property "prescaler" in APM X-Gene RTC Document

Message ID 20240412080238.134191-3-wefu@redhat.com
State Changes Requested
Headers show
Series RTC: update APM X-Gene RTC driver by adding the pre-scaler support | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success

Commit Message

Wei Fu April 12, 2024, 8:01 a.m. UTC
From: Wei Fu <wefu@redhat.com>

Add optional property "prescaler" for APM X-Gene RTC.
The clock source on some platform to RTC is NOT 1HZ,
so we need to prescale the clock to make the input clock become 1HZ,
like (32K/prescaler) = 1HZ on the XuanTie TH1520 AP sub-system RTC.

Signed-off-by: Wei Fu <wefu@redhat.com>
---
 .../devicetree/bindings/rtc/xgene-rtc.txt        | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Alexandre Belloni April 12, 2024, 8:20 a.m. UTC | #1
On 12/04/2024 16:01:44+0800, wefu@redhat.com wrote:
> From: Wei Fu <wefu@redhat.com>
> 
> Add optional property "prescaler" for APM X-Gene RTC.
> The clock source on some platform to RTC is NOT 1HZ,
> so we need to prescale the clock to make the input clock become 1HZ,
> like (32K/prescaler) = 1HZ on the XuanTie TH1520 AP sub-system RTC.
> 
> Signed-off-by: Wei Fu <wefu@redhat.com>
> ---
>  .../devicetree/bindings/rtc/xgene-rtc.txt        | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/rtc/xgene-rtc.txt b/Documentation/devicetree/bindings/rtc/xgene-rtc.txt
> index fd195c358446..25ba8cf0cc31 100644
> --- a/Documentation/devicetree/bindings/rtc/xgene-rtc.txt
> +++ b/Documentation/devicetree/bindings/rtc/xgene-rtc.txt
> @@ -10,6 +10,9 @@ Required properties:
>  - #clock-cells: Should be 1.
>  - clocks: Reference to the clock entry.
>  
> +Optional properties:
> +- prescaler: Reference to the Value of Counter Prescaler.

What about getting the input clock rate and calculate the needed
prescaler instead of having it in the device tree?
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/rtc/xgene-rtc.txt b/Documentation/devicetree/bindings/rtc/xgene-rtc.txt
index fd195c358446..25ba8cf0cc31 100644
--- a/Documentation/devicetree/bindings/rtc/xgene-rtc.txt
+++ b/Documentation/devicetree/bindings/rtc/xgene-rtc.txt
@@ -10,6 +10,9 @@  Required properties:
 - #clock-cells: Should be 1.
 - clocks: Reference to the clock entry.
 
+Optional properties:
+- prescaler: Reference to the Value of Counter Prescaler.
+
 Example:
 
 rtcclk: rtcclk {
@@ -26,3 +29,16 @@  rtc: rtc@10510000 {
 	#clock-cells = <1>;
 	clocks = <&rtcclk 0>;
 };
+
+Example XuanTie TH1520 RTC node with Counter Prescaler(prescaler):
+
+rtc: rtc@fffff40000 {
+	compatible = "snps,dw-apb-rtc";
+	reg = <0xff 0xfff40000 0x0 0x1000>;
+	interrupts = <74 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&osc_32k>;
+	clock-names = "osc_32k";
+	wakeup-source;
+	prescaler = <0x8000>;
+	status = "okay";
+};