linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dt-bindings: document how to setup rockchip timers as clocksource
@ 2016-11-24 22:12 Alexander Kochetkov
  2016-11-30 21:30 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kochetkov @ 2016-11-24 22:12 UTC (permalink / raw)
  To: robh+dt, mark.rutland, wxt, daniel.lezcano, huangtao, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel
  Cc: Alexander Kochetkov

The patch describes how to setup rockchip timers in device tree
so they can be used as clocksource.

I'm going to implement this feature.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
 .../bindings/timer/rockchip,rk-timer.txt           |   35 +++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
index 7bc9691..15f8fed 100644
--- a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
+++ b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
@@ -16,7 +16,18 @@ Required properties:
 - clock-names : must include the following entries:
   "timer", "pclk"
 
-Example:
+Note:
+If device tree contain only one timer, than the timer will be intialized
+as clockevent provider. If device tree contain two timers, than first timer
+will be initialized as clockevent provider and second one as clocksource.
+
+If you want to bind specific timer as clockevent (i.e. one from alive subsystem)
+and specific timer as clocksource, you can number the timers in "aliases" node.
+
+If device tree contain only one timer and the timer is named as timer1 in
+"aliases" node, then the timer will be initialized as clocksource.
+
+Example (clockevent only):
 	timer: timer@ff810000 {
 		compatible = "rockchip,rk3288-timer";
 		reg = <0xff810000 0x20>;
@@ -24,3 +35,25 @@ Example:
 		clocks = <&xin24m>, <&cru PCLK_TIMER>;
 		clock-names = "timer", "pclk";
 	};
+
+Example (clockevent and clocksource with explicit numbering):
+	aliases {
+		timer0 = &timer6;
+		timer1 = &timer5;
+	};
+
+	timer5: timer@20038080 {
+		compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer";
+		reg = <0x20038080 0x20>;
+		interrupts = <GIC_SPI 60 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_TIMER5>, <&cru PCLK_TIMER0>;
+		clock-names = "timer", "pclk";
+	};
+
+	timer6: timer@200380A0 {
+		compatible = ""rockchip,rk3188-timer", rockchip,rk3288-timer";
+		reg = <0x200380A0 0x20>;
+		interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_TIMER6>, <&cru PCLK_TIMER0>;
+		clock-names = "timer", "pclk";
+	};
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dt-bindings: document how to setup rockchip timers as clocksource
  2016-11-24 22:12 [PATCH] dt-bindings: document how to setup rockchip timers as clocksource Alexander Kochetkov
@ 2016-11-30 21:30 ` Rob Herring
  2016-11-30 21:40   ` Alexander Kochetkov
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2016-11-30 21:30 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: mark.rutland, wxt, daniel.lezcano, huangtao, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel

On Fri, Nov 25, 2016 at 01:12:16AM +0300, Alexander Kochetkov wrote:
> The patch describes how to setup rockchip timers in device tree
> so they can be used as clocksource.
> 
> I'm going to implement this feature.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
> ---
>  .../bindings/timer/rockchip,rk-timer.txt           |   35 +++++++++++++++++++-
>  1 file changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
> index 7bc9691..15f8fed 100644
> --- a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
> +++ b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
> @@ -16,7 +16,18 @@ Required properties:
>  - clock-names : must include the following entries:
>    "timer", "pclk"
>  
> -Example:
> +Note:
> +If device tree contain only one timer, than the timer will be intialized
> +as clockevent provider. If device tree contain two timers, than first timer
> +will be initialized as clockevent provider and second one as clocksource.

1st and 2nd are ambiguous. Plus this is an OS implementation detail that 
doesn't belong in the binding.

> +If you want to bind specific timer as clockevent (i.e. one from alive subsystem)
> +and specific timer as clocksource, you can number the timers in "aliases" node.

No. 

Use and/or describe what are the features of a timer to make the 
decision. There has to be some reason you care which one. One has an 
interrupt and the other doesn't. One is always on. Etc.

Rob

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dt-bindings: document how to setup rockchip timers as clocksource
  2016-11-30 21:30 ` Rob Herring
@ 2016-11-30 21:40   ` Alexander Kochetkov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Kochetkov @ 2016-11-30 21:40 UTC (permalink / raw)
  To: Rob Herring
  Cc: mark.rutland, wxt, daniel.lezcano, huangtao, devicetree,
	linux-arm-kernel, linux-rockchip, linux-kernel


> 1 дек. 2016 г., в 0:30, Rob Herring <robh@kernel.org> написал(а):
> 
> 1st and 2nd are ambiguous. Plus this is an OS implementation detail that 
> doesn't belong in the binding.
> 
>> +If you want to bind specific timer as clockevent (i.e. one from alive subsystem)
>> +and specific timer as clocksource, you can number the timers in "aliases" node.
> 
> No. 
> 
> Use and/or describe what are the features of a timer to make the 
> decision. There has to be some reason you care which one. One has an 
> interrupt and the other doesn't. One is always on. Etc.

Thank you, Rob.

Eventually I abandoned this decision.
I left only one patch, which you confirmed recently.

And sorry for making noise with duplicate patches.

Alexander.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-30 21:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-24 22:12 [PATCH] dt-bindings: document how to setup rockchip timers as clocksource Alexander Kochetkov
2016-11-30 21:30 ` Rob Herring
2016-11-30 21:40   ` Alexander Kochetkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).