All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer
@ 2017-01-31 12:43 ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, linux-kernel, devicetree,
	linux-arm-kernel, linux-rockchip
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

From: Alexander Kochetkov <akochetkov@lintech.ru>

Hello, Daniel, Heiko.

Here is try 6 :) Thanks a lot for helping me to bring the code
into kernel!

This patch series contain:
- devicetree bindings clarification for rockchip timers
- dts files fixes for rk3228-evb, rk3229-evb and rk3188
- implementation of clocksource and sched clock for rockchip SoC

The clock supplying the arm-global-timer on the rk3188 is coming from the
the cpu clock itself and thus changes its rate everytime cpufreq adjusts
the cpu frequency making this timer unsuitable as a stable clocksource.

The rk3188, rk3288 and following socs share a separate timer block already
handled by the rockchip-timer driver. Therefore adapt this driver to also
be able to act as clocksource on rk3188.

In order to test clocksource you can run following commands and check
how much time it take in real. On rk3188 it take about ~45 seconds.

       cpufreq-set -f 1.6GHZ
       date; sleep 60; date

rk3288 (and probably anything newer) is irrelevant to this patch,
as it has the arch timer interface. This patch may be usefull
for Cortex-A9/A5 based parts.

Regards,
Alexander.

Changes in v6:
- Removed Reviewed-by: Heiko Stübner <heiko@sntech.de> tag
- Merge 5/8, 6/8, 7/8, 8/9 into single file
- split init paths into rk_clkevt_init() and rk_clksrc_init()
  so the driver code could be adopted to CLOCKEVENT_OF_DECLARE()
- clockevents implemented using clocksource_mmio_init()
- fixed commit message for 4/8 (thanks a lot Daniel)

Changes in v5:
- Add Acked-by: Rob Herring <robh at kernel.org> to 1/8
  http://lists.infradead.org/pipermail/linux-rockchip/2016-December/013308.html
- Add Reviwed-by: Heiko Stübner <heiko@sntech.de> to series
- change timer compatible property in the rk322x.dtsi 2/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013784.html
- updated comment message for 4/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013786.html
- updated comment message for 5/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013787.html
- fixed build error for 8/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013789.html

Alexander Kochetkov (5):
  dt-bindings: clarify compatible property for rockchip timers
  ARM: dts: rockchip: update compatible property for rk322x timer
  clocksource/drivers/rockchip_timer: implement clocksource timer
  ARM: dts: rockchip: add timer entries to rk3188 SoC
  ARM: dts: rockchip: disable arm-global-timer for rk3188

 .../bindings/timer/rockchip,rk-timer.txt           |   12 +-
 arch/arm/boot/dts/rk3188.dtsi                      |   17 ++
 arch/arm/boot/dts/rk322x.dtsi                      |    2 +-
 drivers/clocksource/Kconfig                        |    1 +
 drivers/clocksource/rockchip_timer.c               |  218 ++++++++++++++------
 5 files changed, 185 insertions(+), 65 deletions(-)

-- 
1.7.9.5

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

* [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer
@ 2017-01-31 12:43 ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

From: Alexander Kochetkov <akochetkov-KJfikXucm3wvJsYlp49lxw@public.gmane.org>

Hello, Daniel, Heiko.

Here is try 6 :) Thanks a lot for helping me to bring the code
into kernel!

This patch series contain:
- devicetree bindings clarification for rockchip timers
- dts files fixes for rk3228-evb, rk3229-evb and rk3188
- implementation of clocksource and sched clock for rockchip SoC

The clock supplying the arm-global-timer on the rk3188 is coming from the
the cpu clock itself and thus changes its rate everytime cpufreq adjusts
the cpu frequency making this timer unsuitable as a stable clocksource.

The rk3188, rk3288 and following socs share a separate timer block already
handled by the rockchip-timer driver. Therefore adapt this driver to also
be able to act as clocksource on rk3188.

In order to test clocksource you can run following commands and check
how much time it take in real. On rk3188 it take about ~45 seconds.

       cpufreq-set -f 1.6GHZ
       date; sleep 60; date

rk3288 (and probably anything newer) is irrelevant to this patch,
as it has the arch timer interface. This patch may be usefull
for Cortex-A9/A5 based parts.

Regards,
Alexander.

Changes in v6:
- Removed Reviewed-by: Heiko Stübner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org> tag
- Merge 5/8, 6/8, 7/8, 8/9 into single file
- split init paths into rk_clkevt_init() and rk_clksrc_init()
  so the driver code could be adopted to CLOCKEVENT_OF_DECLARE()
- clockevents implemented using clocksource_mmio_init()
- fixed commit message for 4/8 (thanks a lot Daniel)

Changes in v5:
- Add Acked-by: Rob Herring <robh at kernel.org> to 1/8
  http://lists.infradead.org/pipermail/linux-rockchip/2016-December/013308.html
- Add Reviwed-by: Heiko Stübner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org> to series
- change timer compatible property in the rk322x.dtsi 2/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013784.html
- updated comment message for 4/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013786.html
- updated comment message for 5/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013787.html
- fixed build error for 8/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013789.html

Alexander Kochetkov (5):
  dt-bindings: clarify compatible property for rockchip timers
  ARM: dts: rockchip: update compatible property for rk322x timer
  clocksource/drivers/rockchip_timer: implement clocksource timer
  ARM: dts: rockchip: add timer entries to rk3188 SoC
  ARM: dts: rockchip: disable arm-global-timer for rk3188

 .../bindings/timer/rockchip,rk-timer.txt           |   12 +-
 arch/arm/boot/dts/rk3188.dtsi                      |   17 ++
 arch/arm/boot/dts/rk322x.dtsi                      |    2 +-
 drivers/clocksource/Kconfig                        |    1 +
 drivers/clocksource/rockchip_timer.c               |  218 ++++++++++++++------
 5 files changed, 185 insertions(+), 65 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer
@ 2017-01-31 12:43 ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

From: Alexander Kochetkov <akochetkov@lintech.ru>

Hello, Daniel, Heiko.

Here is try 6 :) Thanks a lot for helping me to bring the code
into kernel!

This patch series contain:
- devicetree bindings clarification for rockchip timers
- dts files fixes for rk3228-evb, rk3229-evb and rk3188
- implementation of clocksource and sched clock for rockchip SoC

The clock supplying the arm-global-timer on the rk3188 is coming from the
the cpu clock itself and thus changes its rate everytime cpufreq adjusts
the cpu frequency making this timer unsuitable as a stable clocksource.

The rk3188, rk3288 and following socs share a separate timer block already
handled by the rockchip-timer driver. Therefore adapt this driver to also
be able to act as clocksource on rk3188.

In order to test clocksource you can run following commands and check
how much time it take in real. On rk3188 it take about ~45 seconds.

       cpufreq-set -f 1.6GHZ
       date; sleep 60; date

rk3288 (and probably anything newer) is irrelevant to this patch,
as it has the arch timer interface. This patch may be usefull
for Cortex-A9/A5 based parts.

Regards,
Alexander.

Changes in v6:
- Removed Reviewed-by: Heiko St?bner <heiko@sntech.de> tag
- Merge 5/8, 6/8, 7/8, 8/9 into single file
- split init paths into rk_clkevt_init() and rk_clksrc_init()
  so the driver code could be adopted to CLOCKEVENT_OF_DECLARE()
- clockevents implemented using clocksource_mmio_init()
- fixed commit message for 4/8 (thanks a lot Daniel)

Changes in v5:
- Add Acked-by: Rob Herring <robh@kernel.org> to 1/8
  http://lists.infradead.org/pipermail/linux-rockchip/2016-December/013308.html
- Add Reviwed-by: Heiko St?bner <heiko@sntech.de> to series
- change timer compatible property in the rk322x.dtsi 2/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013784.html
- updated comment message for 4/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013786.html
- updated comment message for 5/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013787.html
- fixed build error for 8/8
  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013789.html

Alexander Kochetkov (5):
  dt-bindings: clarify compatible property for rockchip timers
  ARM: dts: rockchip: update compatible property for rk322x timer
  clocksource/drivers/rockchip_timer: implement clocksource timer
  ARM: dts: rockchip: add timer entries to rk3188 SoC
  ARM: dts: rockchip: disable arm-global-timer for rk3188

 .../bindings/timer/rockchip,rk-timer.txt           |   12 +-
 arch/arm/boot/dts/rk3188.dtsi                      |   17 ++
 arch/arm/boot/dts/rk322x.dtsi                      |    2 +-
 drivers/clocksource/Kconfig                        |    1 +
 drivers/clocksource/rockchip_timer.c               |  218 ++++++++++++++------
 5 files changed, 185 insertions(+), 65 deletions(-)

-- 
1.7.9.5

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

* [PATCH v6 1/5] dt-bindings: clarify compatible property for rockchip timers
  2017-01-31 12:43 ` Alexander Kochetkov
@ 2017-01-31 12:43   ` Alexander Kochetkov
  -1 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, linux-kernel, devicetree,
	linux-arm-kernel, linux-rockchip
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

Make all properties description in form '"rockchip,<chip>-timer",
"rockchip,rk3288-timer"' for all chips found in linux kernel.

Suggested-by: Heiko Stübner <heiko@sntech.de>
Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../bindings/timer/rockchip,rk-timer.txt           |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
index a41b184..16a5f45 100644
--- a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
+++ b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
@@ -1,9 +1,15 @@
 Rockchip rk timer
 
 Required properties:
-- compatible: shall be one of:
-  "rockchip,rk3288-timer" - for rk3066, rk3036, rk3188, rk322x, rk3288, rk3368
-  "rockchip,rk3399-timer" - for rk3399
+- compatible: should be:
+  "rockchip,rk3036-timer", "rockchip,rk3288-timer": for Rockchip RK3036
+  "rockchip,rk3066-timer", "rockchip,rk3288-timer": for Rockchip RK3066
+  "rockchip,rk3188-timer", "rockchip,rk3288-timer": for Rockchip RK3188
+  "rockchip,rk3228-timer", "rockchip,rk3288-timer": for Rockchip RK3228
+  "rockchip,rk3229-timer", "rockchip,rk3288-timer": for Rockchip RK3229
+  "rockchip,rk3288-timer": for Rockchip RK3288
+  "rockchip,rk3368-timer", "rockchip,rk3288-timer": for Rockchip RK3368
+  "rockchip,rk3399-timer": for Rockchip RK3399
 - reg: base address of the timer register starting with TIMERS CONTROL register
 - interrupts: should contain the interrupts for Timer0
 - clocks : must contain an entry for each entry in clock-names
-- 
1.7.9.5

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

* [PATCH v6 1/5] dt-bindings: clarify compatible property for rockchip timers
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

Make all properties description in form '"rockchip,<chip>-timer",
"rockchip,rk3288-timer"' for all chips found in linux kernel.

Suggested-by: Heiko St?bner <heiko@sntech.de>
Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../bindings/timer/rockchip,rk-timer.txt           |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
index a41b184..16a5f45 100644
--- a/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
+++ b/Documentation/devicetree/bindings/timer/rockchip,rk-timer.txt
@@ -1,9 +1,15 @@
 Rockchip rk timer
 
 Required properties:
-- compatible: shall be one of:
-  "rockchip,rk3288-timer" - for rk3066, rk3036, rk3188, rk322x, rk3288, rk3368
-  "rockchip,rk3399-timer" - for rk3399
+- compatible: should be:
+  "rockchip,rk3036-timer", "rockchip,rk3288-timer": for Rockchip RK3036
+  "rockchip,rk3066-timer", "rockchip,rk3288-timer": for Rockchip RK3066
+  "rockchip,rk3188-timer", "rockchip,rk3288-timer": for Rockchip RK3188
+  "rockchip,rk3228-timer", "rockchip,rk3288-timer": for Rockchip RK3228
+  "rockchip,rk3229-timer", "rockchip,rk3288-timer": for Rockchip RK3229
+  "rockchip,rk3288-timer": for Rockchip RK3288
+  "rockchip,rk3368-timer", "rockchip,rk3288-timer": for Rockchip RK3368
+  "rockchip,rk3399-timer": for Rockchip RK3399
 - reg: base address of the timer register starting with TIMERS CONTROL register
 - interrupts: should contain the interrupts for Timer0
 - clocks : must contain an entry for each entry in clock-names
-- 
1.7.9.5

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

* [PATCH v6 2/5] ARM: dts: rockchip: update compatible property for rk322x timer
  2017-01-31 12:43 ` Alexander Kochetkov
  (?)
@ 2017-01-31 12:43   ` Alexander Kochetkov
  -1 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, linux-kernel, devicetree,
	linux-arm-kernel, linux-rockchip
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

Property set to '"rockchip,rk3228-timer", "rockchip,rk3288-timer"'
to match devicetree bindings.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Suggested-by: Heiko Stübner <heiko@sntech.de>
---
 arch/arm/boot/dts/rk322x.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi
index 9e6bf0e..2a4eee2 100644
--- a/arch/arm/boot/dts/rk322x.dtsi
+++ b/arch/arm/boot/dts/rk322x.dtsi
@@ -323,7 +323,7 @@
 	};
 
 	timer: timer@110c0000 {
-		compatible = "rockchip,rk3288-timer";
+		compatible = "rockchip,rk3228-timer", "rockchip,rk3288-timer";
 		reg = <0x110c0000 0x20>;
 		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&xin24m>, <&cru PCLK_TIMER>;
-- 
1.7.9.5

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

* [PATCH v6 2/5] ARM: dts: rockchip: update compatible property for rk322x timer
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, linux-kernel, devicetree,
	linux-arm-kernel, linux-rockchip
  Cc: Mark Rutland, Huang Tao, Alexander Kochetkov, Russell King,
	Rob Herring, Thomas Gleixner, Caesar Wang

Property set to '"rockchip,rk3228-timer", "rockchip,rk3288-timer"'
to match devicetree bindings.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Suggested-by: Heiko Stübner <heiko@sntech.de>
---
 arch/arm/boot/dts/rk322x.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi
index 9e6bf0e..2a4eee2 100644
--- a/arch/arm/boot/dts/rk322x.dtsi
+++ b/arch/arm/boot/dts/rk322x.dtsi
@@ -323,7 +323,7 @@
 	};
 
 	timer: timer@110c0000 {
-		compatible = "rockchip,rk3288-timer";
+		compatible = "rockchip,rk3228-timer", "rockchip,rk3288-timer";
 		reg = <0x110c0000 0x20>;
 		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&xin24m>, <&cru PCLK_TIMER>;
-- 
1.7.9.5


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v6 2/5] ARM: dts: rockchip: update compatible property for rk322x timer
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

Property set to '"rockchip,rk3228-timer", "rockchip,rk3288-timer"'
to match devicetree bindings.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Suggested-by: Heiko St?bner <heiko@sntech.de>
---
 arch/arm/boot/dts/rk322x.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk322x.dtsi b/arch/arm/boot/dts/rk322x.dtsi
index 9e6bf0e..2a4eee2 100644
--- a/arch/arm/boot/dts/rk322x.dtsi
+++ b/arch/arm/boot/dts/rk322x.dtsi
@@ -323,7 +323,7 @@
 	};
 
 	timer: timer at 110c0000 {
-		compatible = "rockchip,rk3288-timer";
+		compatible = "rockchip,rk3228-timer", "rockchip,rk3288-timer";
 		reg = <0x110c0000 0x20>;
 		interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&xin24m>, <&cru PCLK_TIMER>;
-- 
1.7.9.5

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

* [PATCH v6 3/5] clocksource/drivers/rockchip_timer: implement clocksource timer
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, linux-kernel, devicetree,
	linux-arm-kernel, linux-rockchip
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

The clock supplying the arm-global-timer on the rk3188 is coming from the
the cpu clock itself and thus changes its rate everytime cpufreq adjusts
the cpu frequency making this timer unsuitable as a stable clocksource
and sched clock.

The rk3188, rk3288 and following socs share a separate timer block already
handled by the rockchip-timer driver. Therefore adapt this driver to also
be able to act as clocksource and sched clock on rk3188.

In order to test clocksource you can run following commands and check
how much time it take in real. On rk3188 it take about ~45 seconds.

    cpufreq-set -f 1.6GHZ
    date; sleep 60; date

In order to use the patch you need to declare two timers in the dts
file. The first timer will be initialized as clockevent provider
and the second one as clocksource. The clockevent must be from
alive subsystem as it used as backup for the local timers at sleep
time.

The patch does not break compatibility with older device tree files.
The older device tree files contain only one timer. The timer
will be initialized as clockevent, as expected.

rk3288 (and probably anything newer) is irrelevant to this patch,
as it has the arch timer interface. This patch may be useful
for Cortex-A9/A5 based parts.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
 drivers/clocksource/Kconfig          |    1 +
 drivers/clocksource/rockchip_timer.c |  218 ++++++++++++++++++++++++----------
 2 files changed, 158 insertions(+), 61 deletions(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 5677886..e34d4ac 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -64,6 +64,7 @@ config ROCKCHIP_TIMER
 	bool "Rockchip timer driver" if COMPILE_TEST
 	depends on ARM || ARM64
 	select CLKSRC_OF
+	select CLKSRC_MMIO
 	help
 	  Enables the support for the rockchip timer driver.
 
diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index 23e267a..49c02be 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -11,6 +11,8 @@
 #include <linux/clockchips.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/sched_clock.h>
+#include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -19,6 +21,8 @@
 
 #define TIMER_LOAD_COUNT0	0x00
 #define TIMER_LOAD_COUNT1	0x04
+#define TIMER_CURRENT_VALUE0	0x08
+#define TIMER_CURRENT_VALUE1	0x0C
 #define TIMER_CONTROL_REG3288	0x10
 #define TIMER_CONTROL_REG3399	0x1c
 #define TIMER_INT_STATUS	0x18
@@ -29,103 +33,118 @@
 #define TIMER_MODE_USER_DEFINED_COUNT		(1 << 1)
 #define TIMER_INT_UNMASK			(1 << 2)
 
-struct bc_timer {
-	struct clock_event_device ce;
+struct rk_timer {
 	void __iomem *base;
 	void __iomem *ctrl;
+	struct clk *clk;
+	struct clk *pclk;
 	u32 freq;
+	int irq;
 };
 
-static struct bc_timer bc_timer;
-
-static inline struct bc_timer *rk_timer(struct clock_event_device *ce)
-{
-	return container_of(ce, struct bc_timer, ce);
-}
+struct rk_clkevt {
+	struct clock_event_device ce;
+	struct rk_timer timer;
+};
 
-static inline void __iomem *rk_base(struct clock_event_device *ce)
-{
-	return rk_timer(ce)->base;
-}
+static struct rk_clkevt *rk_clkevt;
+static struct rk_timer *rk_clksrc;
 
-static inline void __iomem *rk_ctrl(struct clock_event_device *ce)
+static inline struct rk_timer *rk_timer(struct clock_event_device *ce)
 {
-	return rk_timer(ce)->ctrl;
+	return &container_of(ce, struct rk_clkevt, ce)->timer;
 }
 
-static inline void rk_timer_disable(struct clock_event_device *ce)
+static inline void rk_timer_disable(struct rk_timer *timer)
 {
-	writel_relaxed(TIMER_DISABLE, rk_ctrl(ce));
+	writel_relaxed(TIMER_DISABLE, timer->ctrl);
 }
 
-static inline void rk_timer_enable(struct clock_event_device *ce, u32 flags)
+static inline void rk_timer_enable(struct rk_timer *timer, u32 flags)
 {
-	writel_relaxed(TIMER_ENABLE | TIMER_INT_UNMASK | flags,
-		       rk_ctrl(ce));
+	writel_relaxed(TIMER_ENABLE | flags, timer->ctrl);
 }
 
 static void rk_timer_update_counter(unsigned long cycles,
-				    struct clock_event_device *ce)
+				    struct rk_timer *timer)
 {
-	writel_relaxed(cycles, rk_base(ce) + TIMER_LOAD_COUNT0);
-	writel_relaxed(0, rk_base(ce) + TIMER_LOAD_COUNT1);
+	writel_relaxed(cycles, timer->base + TIMER_LOAD_COUNT0);
+	writel_relaxed(0, timer->base + TIMER_LOAD_COUNT1);
 }
 
-static void rk_timer_interrupt_clear(struct clock_event_device *ce)
+static void rk_timer_interrupt_clear(struct rk_timer *timer)
 {
-	writel_relaxed(1, rk_base(ce) + TIMER_INT_STATUS);
+	writel_relaxed(1, timer->base + TIMER_INT_STATUS);
 }
 
 static inline int rk_timer_set_next_event(unsigned long cycles,
 					  struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
-	rk_timer_update_counter(cycles, ce);
-	rk_timer_enable(ce, TIMER_MODE_USER_DEFINED_COUNT);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
+	rk_timer_update_counter(cycles, timer);
+	rk_timer_enable(timer, TIMER_MODE_USER_DEFINED_COUNT |
+			       TIMER_INT_UNMASK);
 	return 0;
 }
 
 static int rk_timer_shutdown(struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
 	return 0;
 }
 
 static int rk_timer_set_periodic(struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
-	rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce);
-	rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
+	rk_timer_update_counter(timer->freq / HZ - 1, timer);
+	rk_timer_enable(timer, TIMER_MODE_FREE_RUNNING | TIMER_INT_UNMASK);
 	return 0;
 }
 
 static irqreturn_t rk_timer_interrupt(int irq, void *dev_id)
 {
 	struct clock_event_device *ce = dev_id;
+	struct rk_timer *timer = rk_timer(ce);
 
-	rk_timer_interrupt_clear(ce);
+	rk_timer_interrupt_clear(timer);
 
 	if (clockevent_state_oneshot(ce))
-		rk_timer_disable(ce);
+		rk_timer_disable(timer);
 
 	ce->event_handler(ce);
 
 	return IRQ_HANDLED;
 }
 
-static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
+static u64 notrace rk_timer_sched_read(void)
+{
+	return ~readl_relaxed(rk_clksrc->base + TIMER_CURRENT_VALUE0);
+}
+
+static int __init
+rk_timer_probe(struct rk_timer *timer, struct device_node *np)
 {
-	struct clock_event_device *ce = &bc_timer.ce;
 	struct clk *timer_clk;
 	struct clk *pclk;
 	int ret = -EINVAL, irq;
+	u32 ctrl_reg = TIMER_CONTROL_REG3288;
 
-	bc_timer.base = of_iomap(np, 0);
-	if (!bc_timer.base) {
+	timer->base = of_iomap(np, 0);
+	if (!timer->base) {
 		pr_err("Failed to get base address for '%s'\n", TIMER_NAME);
 		return -ENXIO;
 	}
-	bc_timer.ctrl = bc_timer.base + ctrl_reg;
+
+	if (of_device_is_compatible(np, "rockchip,rk3399-timer"))
+		ctrl_reg = TIMER_CONTROL_REG3399;
+
+	timer->ctrl = timer->base + ctrl_reg;
 
 	pclk = of_clk_get_by_name(np, "pclk");
 	if (IS_ERR(pclk)) {
@@ -139,6 +158,7 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to enable pclk for '%s'\n", TIMER_NAME);
 		goto out_unmap;
 	}
+	timer->pclk = pclk;
 
 	timer_clk = of_clk_get_by_name(np, "timer");
 	if (IS_ERR(timer_clk)) {
@@ -152,8 +172,9 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to enable timer clock\n");
 		goto out_timer_clk;
 	}
+	timer->clk = timer_clk;
 
-	bc_timer.freq = clk_get_rate(timer_clk);
+	timer->freq = clk_get_rate(timer_clk);
 
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
@@ -161,51 +182,126 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
 		goto out_irq;
 	}
+	timer->irq = irq;
+
+	rk_timer_interrupt_clear(timer);
+	rk_timer_disable(timer);
+	return 0;
+
+out_irq:
+	clk_disable_unprepare(timer_clk);
+out_timer_clk:
+	clk_disable_unprepare(pclk);
+out_unmap:
+	iounmap(timer->base);
+
+	return ret;
+}
+
+static void __init rk_timer_cleanup(struct rk_timer *timer)
+{
+	clk_disable_unprepare(timer->clk);
+	clk_disable_unprepare(timer->pclk);
+	iounmap(timer->base);
+}
+
+static int __init rk_clkevt_init(struct device_node *np)
+{
+	struct clock_event_device *ce;
+	int ret = -EINVAL;
+
+	rk_clkevt = kzalloc(sizeof(struct rk_clkevt), GFP_KERNEL);
+	if (!rk_clkevt) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
+	ret = rk_timer_probe(&rk_clkevt->timer, np);
+	if (ret)
+		goto out_probe;
+
+	ce = &rk_clkevt->ce;
 	ce->name = TIMER_NAME;
 	ce->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
 		       CLOCK_EVT_FEAT_DYNIRQ;
 	ce->set_next_event = rk_timer_set_next_event;
 	ce->set_state_shutdown = rk_timer_shutdown;
 	ce->set_state_periodic = rk_timer_set_periodic;
-	ce->irq = irq;
+	ce->irq = rk_clkevt->timer.irq;
 	ce->cpumask = cpu_possible_mask;
 	ce->rating = 250;
 
-	rk_timer_interrupt_clear(ce);
-	rk_timer_disable(ce);
-
-	ret = request_irq(irq, rk_timer_interrupt, IRQF_TIMER, TIMER_NAME, ce);
+	ret = request_irq(rk_clkevt->timer.irq, rk_timer_interrupt, IRQF_TIMER,
+			  TIMER_NAME, ce);
 	if (ret) {
-		pr_err("Failed to initialize '%s': %d\n", TIMER_NAME, ret);
+		pr_err("Failed to initialize '%s': %d\n",
+			TIMER_NAME, ret);
 		goto out_irq;
 	}
 
-	clockevents_config_and_register(ce, bc_timer.freq, 1, UINT_MAX);
-
+	clockevents_config_and_register(&rk_clkevt->ce,
+					rk_clkevt->timer.freq, 1, UINT_MAX);
 	return 0;
 
 out_irq:
-	clk_disable_unprepare(timer_clk);
-out_timer_clk:
-	clk_disable_unprepare(pclk);
-out_unmap:
-	iounmap(bc_timer.base);
-
+	rk_timer_cleanup(&rk_clkevt->timer);
+out_probe:
+	kfree(rk_clkevt);
+out:
+	/* Leave rk_clkevt not NULL to prevent future init */
+	rk_clkevt = ERR_PTR(ret);
 	return ret;
 }
 
-static int __init rk3288_timer_init(struct device_node *np)
+static int __init rk_clksrc_init(struct device_node *np)
 {
-	return rk_timer_init(np, TIMER_CONTROL_REG3288);
+	int ret = -EINVAL;
+
+	rk_clksrc = kzalloc(sizeof(struct rk_timer), GFP_KERNEL);
+	if (!rk_clksrc) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	ret = rk_timer_probe(rk_clksrc, np);
+	if (ret)
+		goto out_probe;
+
+	rk_timer_update_counter(UINT_MAX, rk_clksrc);
+	rk_timer_enable(rk_clksrc, 0);
+
+	ret = clocksource_mmio_init(rk_clksrc->base + TIMER_CURRENT_VALUE0,
+		TIMER_NAME, rk_clksrc->freq, 250, 32,
+		clocksource_mmio_readl_down);
+	if (ret) {
+		pr_err("Failed to register clocksource");
+		goto out_clocksource;
+	}
+
+	sched_clock_register(rk_timer_sched_read, 32, rk_clksrc->freq);
+	return 0;
+
+out_clocksource:
+	rk_timer_cleanup(rk_clksrc);
+out_probe:
+	kfree(rk_clksrc);
+out:
+	/* Leave rk_clksrc not NULL to prevent future init */
+	rk_clksrc = ERR_PTR(ret);
+	return ret;
 }
 
-static int __init rk3399_timer_init(struct device_node *np)
+static int __init rk_timer_init(struct device_node *np)
 {
-	return rk_timer_init(np, TIMER_CONTROL_REG3399);
+	if (!rk_clkevt)
+		return rk_clkevt_init(np);
+
+	if (!rk_clksrc)
+		return rk_clksrc_init(np);
+
+	pr_err("Too many timer definitions for '%s'\n", TIMER_NAME);
+	return -EINVAL;
 }
 
-CLOCKSOURCE_OF_DECLARE(rk3288_timer, "rockchip,rk3288-timer",
-		       rk3288_timer_init);
-CLOCKSOURCE_OF_DECLARE(rk3399_timer, "rockchip,rk3399-timer",
-		       rk3399_timer_init);
+CLOCKSOURCE_OF_DECLARE(rk3288_timer, "rockchip,rk3288-timer", rk_timer_init);
+CLOCKSOURCE_OF_DECLARE(rk3399_timer, "rockchip,rk3399-timer", rk_timer_init);
-- 
1.7.9.5

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

* [PATCH v6 3/5] clocksource/drivers/rockchip_timer: implement clocksource timer
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

The clock supplying the arm-global-timer on the rk3188 is coming from the
the cpu clock itself and thus changes its rate everytime cpufreq adjusts
the cpu frequency making this timer unsuitable as a stable clocksource
and sched clock.

The rk3188, rk3288 and following socs share a separate timer block already
handled by the rockchip-timer driver. Therefore adapt this driver to also
be able to act as clocksource and sched clock on rk3188.

In order to test clocksource you can run following commands and check
how much time it take in real. On rk3188 it take about ~45 seconds.

    cpufreq-set -f 1.6GHZ
    date; sleep 60; date

In order to use the patch you need to declare two timers in the dts
file. The first timer will be initialized as clockevent provider
and the second one as clocksource. The clockevent must be from
alive subsystem as it used as backup for the local timers at sleep
time.

The patch does not break compatibility with older device tree files.
The older device tree files contain only one timer. The timer
will be initialized as clockevent, as expected.

rk3288 (and probably anything newer) is irrelevant to this patch,
as it has the arch timer interface. This patch may be useful
for Cortex-A9/A5 based parts.

Signed-off-by: Alexander Kochetkov <al.kochet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/clocksource/Kconfig          |    1 +
 drivers/clocksource/rockchip_timer.c |  218 ++++++++++++++++++++++++----------
 2 files changed, 158 insertions(+), 61 deletions(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 5677886..e34d4ac 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -64,6 +64,7 @@ config ROCKCHIP_TIMER
 	bool "Rockchip timer driver" if COMPILE_TEST
 	depends on ARM || ARM64
 	select CLKSRC_OF
+	select CLKSRC_MMIO
 	help
 	  Enables the support for the rockchip timer driver.
 
diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index 23e267a..49c02be 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -11,6 +11,8 @@
 #include <linux/clockchips.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/sched_clock.h>
+#include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -19,6 +21,8 @@
 
 #define TIMER_LOAD_COUNT0	0x00
 #define TIMER_LOAD_COUNT1	0x04
+#define TIMER_CURRENT_VALUE0	0x08
+#define TIMER_CURRENT_VALUE1	0x0C
 #define TIMER_CONTROL_REG3288	0x10
 #define TIMER_CONTROL_REG3399	0x1c
 #define TIMER_INT_STATUS	0x18
@@ -29,103 +33,118 @@
 #define TIMER_MODE_USER_DEFINED_COUNT		(1 << 1)
 #define TIMER_INT_UNMASK			(1 << 2)
 
-struct bc_timer {
-	struct clock_event_device ce;
+struct rk_timer {
 	void __iomem *base;
 	void __iomem *ctrl;
+	struct clk *clk;
+	struct clk *pclk;
 	u32 freq;
+	int irq;
 };
 
-static struct bc_timer bc_timer;
-
-static inline struct bc_timer *rk_timer(struct clock_event_device *ce)
-{
-	return container_of(ce, struct bc_timer, ce);
-}
+struct rk_clkevt {
+	struct clock_event_device ce;
+	struct rk_timer timer;
+};
 
-static inline void __iomem *rk_base(struct clock_event_device *ce)
-{
-	return rk_timer(ce)->base;
-}
+static struct rk_clkevt *rk_clkevt;
+static struct rk_timer *rk_clksrc;
 
-static inline void __iomem *rk_ctrl(struct clock_event_device *ce)
+static inline struct rk_timer *rk_timer(struct clock_event_device *ce)
 {
-	return rk_timer(ce)->ctrl;
+	return &container_of(ce, struct rk_clkevt, ce)->timer;
 }
 
-static inline void rk_timer_disable(struct clock_event_device *ce)
+static inline void rk_timer_disable(struct rk_timer *timer)
 {
-	writel_relaxed(TIMER_DISABLE, rk_ctrl(ce));
+	writel_relaxed(TIMER_DISABLE, timer->ctrl);
 }
 
-static inline void rk_timer_enable(struct clock_event_device *ce, u32 flags)
+static inline void rk_timer_enable(struct rk_timer *timer, u32 flags)
 {
-	writel_relaxed(TIMER_ENABLE | TIMER_INT_UNMASK | flags,
-		       rk_ctrl(ce));
+	writel_relaxed(TIMER_ENABLE | flags, timer->ctrl);
 }
 
 static void rk_timer_update_counter(unsigned long cycles,
-				    struct clock_event_device *ce)
+				    struct rk_timer *timer)
 {
-	writel_relaxed(cycles, rk_base(ce) + TIMER_LOAD_COUNT0);
-	writel_relaxed(0, rk_base(ce) + TIMER_LOAD_COUNT1);
+	writel_relaxed(cycles, timer->base + TIMER_LOAD_COUNT0);
+	writel_relaxed(0, timer->base + TIMER_LOAD_COUNT1);
 }
 
-static void rk_timer_interrupt_clear(struct clock_event_device *ce)
+static void rk_timer_interrupt_clear(struct rk_timer *timer)
 {
-	writel_relaxed(1, rk_base(ce) + TIMER_INT_STATUS);
+	writel_relaxed(1, timer->base + TIMER_INT_STATUS);
 }
 
 static inline int rk_timer_set_next_event(unsigned long cycles,
 					  struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
-	rk_timer_update_counter(cycles, ce);
-	rk_timer_enable(ce, TIMER_MODE_USER_DEFINED_COUNT);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
+	rk_timer_update_counter(cycles, timer);
+	rk_timer_enable(timer, TIMER_MODE_USER_DEFINED_COUNT |
+			       TIMER_INT_UNMASK);
 	return 0;
 }
 
 static int rk_timer_shutdown(struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
 	return 0;
 }
 
 static int rk_timer_set_periodic(struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
-	rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce);
-	rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
+	rk_timer_update_counter(timer->freq / HZ - 1, timer);
+	rk_timer_enable(timer, TIMER_MODE_FREE_RUNNING | TIMER_INT_UNMASK);
 	return 0;
 }
 
 static irqreturn_t rk_timer_interrupt(int irq, void *dev_id)
 {
 	struct clock_event_device *ce = dev_id;
+	struct rk_timer *timer = rk_timer(ce);
 
-	rk_timer_interrupt_clear(ce);
+	rk_timer_interrupt_clear(timer);
 
 	if (clockevent_state_oneshot(ce))
-		rk_timer_disable(ce);
+		rk_timer_disable(timer);
 
 	ce->event_handler(ce);
 
 	return IRQ_HANDLED;
 }
 
-static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
+static u64 notrace rk_timer_sched_read(void)
+{
+	return ~readl_relaxed(rk_clksrc->base + TIMER_CURRENT_VALUE0);
+}
+
+static int __init
+rk_timer_probe(struct rk_timer *timer, struct device_node *np)
 {
-	struct clock_event_device *ce = &bc_timer.ce;
 	struct clk *timer_clk;
 	struct clk *pclk;
 	int ret = -EINVAL, irq;
+	u32 ctrl_reg = TIMER_CONTROL_REG3288;
 
-	bc_timer.base = of_iomap(np, 0);
-	if (!bc_timer.base) {
+	timer->base = of_iomap(np, 0);
+	if (!timer->base) {
 		pr_err("Failed to get base address for '%s'\n", TIMER_NAME);
 		return -ENXIO;
 	}
-	bc_timer.ctrl = bc_timer.base + ctrl_reg;
+
+	if (of_device_is_compatible(np, "rockchip,rk3399-timer"))
+		ctrl_reg = TIMER_CONTROL_REG3399;
+
+	timer->ctrl = timer->base + ctrl_reg;
 
 	pclk = of_clk_get_by_name(np, "pclk");
 	if (IS_ERR(pclk)) {
@@ -139,6 +158,7 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to enable pclk for '%s'\n", TIMER_NAME);
 		goto out_unmap;
 	}
+	timer->pclk = pclk;
 
 	timer_clk = of_clk_get_by_name(np, "timer");
 	if (IS_ERR(timer_clk)) {
@@ -152,8 +172,9 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to enable timer clock\n");
 		goto out_timer_clk;
 	}
+	timer->clk = timer_clk;
 
-	bc_timer.freq = clk_get_rate(timer_clk);
+	timer->freq = clk_get_rate(timer_clk);
 
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
@@ -161,51 +182,126 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
 		goto out_irq;
 	}
+	timer->irq = irq;
+
+	rk_timer_interrupt_clear(timer);
+	rk_timer_disable(timer);
+	return 0;
+
+out_irq:
+	clk_disable_unprepare(timer_clk);
+out_timer_clk:
+	clk_disable_unprepare(pclk);
+out_unmap:
+	iounmap(timer->base);
+
+	return ret;
+}
+
+static void __init rk_timer_cleanup(struct rk_timer *timer)
+{
+	clk_disable_unprepare(timer->clk);
+	clk_disable_unprepare(timer->pclk);
+	iounmap(timer->base);
+}
+
+static int __init rk_clkevt_init(struct device_node *np)
+{
+	struct clock_event_device *ce;
+	int ret = -EINVAL;
+
+	rk_clkevt = kzalloc(sizeof(struct rk_clkevt), GFP_KERNEL);
+	if (!rk_clkevt) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
+	ret = rk_timer_probe(&rk_clkevt->timer, np);
+	if (ret)
+		goto out_probe;
+
+	ce = &rk_clkevt->ce;
 	ce->name = TIMER_NAME;
 	ce->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
 		       CLOCK_EVT_FEAT_DYNIRQ;
 	ce->set_next_event = rk_timer_set_next_event;
 	ce->set_state_shutdown = rk_timer_shutdown;
 	ce->set_state_periodic = rk_timer_set_periodic;
-	ce->irq = irq;
+	ce->irq = rk_clkevt->timer.irq;
 	ce->cpumask = cpu_possible_mask;
 	ce->rating = 250;
 
-	rk_timer_interrupt_clear(ce);
-	rk_timer_disable(ce);
-
-	ret = request_irq(irq, rk_timer_interrupt, IRQF_TIMER, TIMER_NAME, ce);
+	ret = request_irq(rk_clkevt->timer.irq, rk_timer_interrupt, IRQF_TIMER,
+			  TIMER_NAME, ce);
 	if (ret) {
-		pr_err("Failed to initialize '%s': %d\n", TIMER_NAME, ret);
+		pr_err("Failed to initialize '%s': %d\n",
+			TIMER_NAME, ret);
 		goto out_irq;
 	}
 
-	clockevents_config_and_register(ce, bc_timer.freq, 1, UINT_MAX);
-
+	clockevents_config_and_register(&rk_clkevt->ce,
+					rk_clkevt->timer.freq, 1, UINT_MAX);
 	return 0;
 
 out_irq:
-	clk_disable_unprepare(timer_clk);
-out_timer_clk:
-	clk_disable_unprepare(pclk);
-out_unmap:
-	iounmap(bc_timer.base);
-
+	rk_timer_cleanup(&rk_clkevt->timer);
+out_probe:
+	kfree(rk_clkevt);
+out:
+	/* Leave rk_clkevt not NULL to prevent future init */
+	rk_clkevt = ERR_PTR(ret);
 	return ret;
 }
 
-static int __init rk3288_timer_init(struct device_node *np)
+static int __init rk_clksrc_init(struct device_node *np)
 {
-	return rk_timer_init(np, TIMER_CONTROL_REG3288);
+	int ret = -EINVAL;
+
+	rk_clksrc = kzalloc(sizeof(struct rk_timer), GFP_KERNEL);
+	if (!rk_clksrc) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	ret = rk_timer_probe(rk_clksrc, np);
+	if (ret)
+		goto out_probe;
+
+	rk_timer_update_counter(UINT_MAX, rk_clksrc);
+	rk_timer_enable(rk_clksrc, 0);
+
+	ret = clocksource_mmio_init(rk_clksrc->base + TIMER_CURRENT_VALUE0,
+		TIMER_NAME, rk_clksrc->freq, 250, 32,
+		clocksource_mmio_readl_down);
+	if (ret) {
+		pr_err("Failed to register clocksource");
+		goto out_clocksource;
+	}
+
+	sched_clock_register(rk_timer_sched_read, 32, rk_clksrc->freq);
+	return 0;
+
+out_clocksource:
+	rk_timer_cleanup(rk_clksrc);
+out_probe:
+	kfree(rk_clksrc);
+out:
+	/* Leave rk_clksrc not NULL to prevent future init */
+	rk_clksrc = ERR_PTR(ret);
+	return ret;
 }
 
-static int __init rk3399_timer_init(struct device_node *np)
+static int __init rk_timer_init(struct device_node *np)
 {
-	return rk_timer_init(np, TIMER_CONTROL_REG3399);
+	if (!rk_clkevt)
+		return rk_clkevt_init(np);
+
+	if (!rk_clksrc)
+		return rk_clksrc_init(np);
+
+	pr_err("Too many timer definitions for '%s'\n", TIMER_NAME);
+	return -EINVAL;
 }
 
-CLOCKSOURCE_OF_DECLARE(rk3288_timer, "rockchip,rk3288-timer",
-		       rk3288_timer_init);
-CLOCKSOURCE_OF_DECLARE(rk3399_timer, "rockchip,rk3399-timer",
-		       rk3399_timer_init);
+CLOCKSOURCE_OF_DECLARE(rk3288_timer, "rockchip,rk3288-timer", rk_timer_init);
+CLOCKSOURCE_OF_DECLARE(rk3399_timer, "rockchip,rk3399-timer", rk_timer_init);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 3/5] clocksource/drivers/rockchip_timer: implement clocksource timer
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

The clock supplying the arm-global-timer on the rk3188 is coming from the
the cpu clock itself and thus changes its rate everytime cpufreq adjusts
the cpu frequency making this timer unsuitable as a stable clocksource
and sched clock.

The rk3188, rk3288 and following socs share a separate timer block already
handled by the rockchip-timer driver. Therefore adapt this driver to also
be able to act as clocksource and sched clock on rk3188.

In order to test clocksource you can run following commands and check
how much time it take in real. On rk3188 it take about ~45 seconds.

    cpufreq-set -f 1.6GHZ
    date; sleep 60; date

In order to use the patch you need to declare two timers in the dts
file. The first timer will be initialized as clockevent provider
and the second one as clocksource. The clockevent must be from
alive subsystem as it used as backup for the local timers at sleep
time.

The patch does not break compatibility with older device tree files.
The older device tree files contain only one timer. The timer
will be initialized as clockevent, as expected.

rk3288 (and probably anything newer) is irrelevant to this patch,
as it has the arch timer interface. This patch may be useful
for Cortex-A9/A5 based parts.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
 drivers/clocksource/Kconfig          |    1 +
 drivers/clocksource/rockchip_timer.c |  218 ++++++++++++++++++++++++----------
 2 files changed, 158 insertions(+), 61 deletions(-)

diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 5677886..e34d4ac 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -64,6 +64,7 @@ config ROCKCHIP_TIMER
 	bool "Rockchip timer driver" if COMPILE_TEST
 	depends on ARM || ARM64
 	select CLKSRC_OF
+	select CLKSRC_MMIO
 	help
 	  Enables the support for the rockchip timer driver.
 
diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index 23e267a..49c02be 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -11,6 +11,8 @@
 #include <linux/clockchips.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/sched_clock.h>
+#include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -19,6 +21,8 @@
 
 #define TIMER_LOAD_COUNT0	0x00
 #define TIMER_LOAD_COUNT1	0x04
+#define TIMER_CURRENT_VALUE0	0x08
+#define TIMER_CURRENT_VALUE1	0x0C
 #define TIMER_CONTROL_REG3288	0x10
 #define TIMER_CONTROL_REG3399	0x1c
 #define TIMER_INT_STATUS	0x18
@@ -29,103 +33,118 @@
 #define TIMER_MODE_USER_DEFINED_COUNT		(1 << 1)
 #define TIMER_INT_UNMASK			(1 << 2)
 
-struct bc_timer {
-	struct clock_event_device ce;
+struct rk_timer {
 	void __iomem *base;
 	void __iomem *ctrl;
+	struct clk *clk;
+	struct clk *pclk;
 	u32 freq;
+	int irq;
 };
 
-static struct bc_timer bc_timer;
-
-static inline struct bc_timer *rk_timer(struct clock_event_device *ce)
-{
-	return container_of(ce, struct bc_timer, ce);
-}
+struct rk_clkevt {
+	struct clock_event_device ce;
+	struct rk_timer timer;
+};
 
-static inline void __iomem *rk_base(struct clock_event_device *ce)
-{
-	return rk_timer(ce)->base;
-}
+static struct rk_clkevt *rk_clkevt;
+static struct rk_timer *rk_clksrc;
 
-static inline void __iomem *rk_ctrl(struct clock_event_device *ce)
+static inline struct rk_timer *rk_timer(struct clock_event_device *ce)
 {
-	return rk_timer(ce)->ctrl;
+	return &container_of(ce, struct rk_clkevt, ce)->timer;
 }
 
-static inline void rk_timer_disable(struct clock_event_device *ce)
+static inline void rk_timer_disable(struct rk_timer *timer)
 {
-	writel_relaxed(TIMER_DISABLE, rk_ctrl(ce));
+	writel_relaxed(TIMER_DISABLE, timer->ctrl);
 }
 
-static inline void rk_timer_enable(struct clock_event_device *ce, u32 flags)
+static inline void rk_timer_enable(struct rk_timer *timer, u32 flags)
 {
-	writel_relaxed(TIMER_ENABLE | TIMER_INT_UNMASK | flags,
-		       rk_ctrl(ce));
+	writel_relaxed(TIMER_ENABLE | flags, timer->ctrl);
 }
 
 static void rk_timer_update_counter(unsigned long cycles,
-				    struct clock_event_device *ce)
+				    struct rk_timer *timer)
 {
-	writel_relaxed(cycles, rk_base(ce) + TIMER_LOAD_COUNT0);
-	writel_relaxed(0, rk_base(ce) + TIMER_LOAD_COUNT1);
+	writel_relaxed(cycles, timer->base + TIMER_LOAD_COUNT0);
+	writel_relaxed(0, timer->base + TIMER_LOAD_COUNT1);
 }
 
-static void rk_timer_interrupt_clear(struct clock_event_device *ce)
+static void rk_timer_interrupt_clear(struct rk_timer *timer)
 {
-	writel_relaxed(1, rk_base(ce) + TIMER_INT_STATUS);
+	writel_relaxed(1, timer->base + TIMER_INT_STATUS);
 }
 
 static inline int rk_timer_set_next_event(unsigned long cycles,
 					  struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
-	rk_timer_update_counter(cycles, ce);
-	rk_timer_enable(ce, TIMER_MODE_USER_DEFINED_COUNT);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
+	rk_timer_update_counter(cycles, timer);
+	rk_timer_enable(timer, TIMER_MODE_USER_DEFINED_COUNT |
+			       TIMER_INT_UNMASK);
 	return 0;
 }
 
 static int rk_timer_shutdown(struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
 	return 0;
 }
 
 static int rk_timer_set_periodic(struct clock_event_device *ce)
 {
-	rk_timer_disable(ce);
-	rk_timer_update_counter(rk_timer(ce)->freq / HZ - 1, ce);
-	rk_timer_enable(ce, TIMER_MODE_FREE_RUNNING);
+	struct rk_timer *timer = rk_timer(ce);
+
+	rk_timer_disable(timer);
+	rk_timer_update_counter(timer->freq / HZ - 1, timer);
+	rk_timer_enable(timer, TIMER_MODE_FREE_RUNNING | TIMER_INT_UNMASK);
 	return 0;
 }
 
 static irqreturn_t rk_timer_interrupt(int irq, void *dev_id)
 {
 	struct clock_event_device *ce = dev_id;
+	struct rk_timer *timer = rk_timer(ce);
 
-	rk_timer_interrupt_clear(ce);
+	rk_timer_interrupt_clear(timer);
 
 	if (clockevent_state_oneshot(ce))
-		rk_timer_disable(ce);
+		rk_timer_disable(timer);
 
 	ce->event_handler(ce);
 
 	return IRQ_HANDLED;
 }
 
-static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
+static u64 notrace rk_timer_sched_read(void)
+{
+	return ~readl_relaxed(rk_clksrc->base + TIMER_CURRENT_VALUE0);
+}
+
+static int __init
+rk_timer_probe(struct rk_timer *timer, struct device_node *np)
 {
-	struct clock_event_device *ce = &bc_timer.ce;
 	struct clk *timer_clk;
 	struct clk *pclk;
 	int ret = -EINVAL, irq;
+	u32 ctrl_reg = TIMER_CONTROL_REG3288;
 
-	bc_timer.base = of_iomap(np, 0);
-	if (!bc_timer.base) {
+	timer->base = of_iomap(np, 0);
+	if (!timer->base) {
 		pr_err("Failed to get base address for '%s'\n", TIMER_NAME);
 		return -ENXIO;
 	}
-	bc_timer.ctrl = bc_timer.base + ctrl_reg;
+
+	if (of_device_is_compatible(np, "rockchip,rk3399-timer"))
+		ctrl_reg = TIMER_CONTROL_REG3399;
+
+	timer->ctrl = timer->base + ctrl_reg;
 
 	pclk = of_clk_get_by_name(np, "pclk");
 	if (IS_ERR(pclk)) {
@@ -139,6 +158,7 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to enable pclk for '%s'\n", TIMER_NAME);
 		goto out_unmap;
 	}
+	timer->pclk = pclk;
 
 	timer_clk = of_clk_get_by_name(np, "timer");
 	if (IS_ERR(timer_clk)) {
@@ -152,8 +172,9 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to enable timer clock\n");
 		goto out_timer_clk;
 	}
+	timer->clk = timer_clk;
 
-	bc_timer.freq = clk_get_rate(timer_clk);
+	timer->freq = clk_get_rate(timer_clk);
 
 	irq = irq_of_parse_and_map(np, 0);
 	if (!irq) {
@@ -161,51 +182,126 @@ static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
 		pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
 		goto out_irq;
 	}
+	timer->irq = irq;
+
+	rk_timer_interrupt_clear(timer);
+	rk_timer_disable(timer);
+	return 0;
+
+out_irq:
+	clk_disable_unprepare(timer_clk);
+out_timer_clk:
+	clk_disable_unprepare(pclk);
+out_unmap:
+	iounmap(timer->base);
+
+	return ret;
+}
+
+static void __init rk_timer_cleanup(struct rk_timer *timer)
+{
+	clk_disable_unprepare(timer->clk);
+	clk_disable_unprepare(timer->pclk);
+	iounmap(timer->base);
+}
+
+static int __init rk_clkevt_init(struct device_node *np)
+{
+	struct clock_event_device *ce;
+	int ret = -EINVAL;
+
+	rk_clkevt = kzalloc(sizeof(struct rk_clkevt), GFP_KERNEL);
+	if (!rk_clkevt) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
+	ret = rk_timer_probe(&rk_clkevt->timer, np);
+	if (ret)
+		goto out_probe;
+
+	ce = &rk_clkevt->ce;
 	ce->name = TIMER_NAME;
 	ce->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
 		       CLOCK_EVT_FEAT_DYNIRQ;
 	ce->set_next_event = rk_timer_set_next_event;
 	ce->set_state_shutdown = rk_timer_shutdown;
 	ce->set_state_periodic = rk_timer_set_periodic;
-	ce->irq = irq;
+	ce->irq = rk_clkevt->timer.irq;
 	ce->cpumask = cpu_possible_mask;
 	ce->rating = 250;
 
-	rk_timer_interrupt_clear(ce);
-	rk_timer_disable(ce);
-
-	ret = request_irq(irq, rk_timer_interrupt, IRQF_TIMER, TIMER_NAME, ce);
+	ret = request_irq(rk_clkevt->timer.irq, rk_timer_interrupt, IRQF_TIMER,
+			  TIMER_NAME, ce);
 	if (ret) {
-		pr_err("Failed to initialize '%s': %d\n", TIMER_NAME, ret);
+		pr_err("Failed to initialize '%s': %d\n",
+			TIMER_NAME, ret);
 		goto out_irq;
 	}
 
-	clockevents_config_and_register(ce, bc_timer.freq, 1, UINT_MAX);
-
+	clockevents_config_and_register(&rk_clkevt->ce,
+					rk_clkevt->timer.freq, 1, UINT_MAX);
 	return 0;
 
 out_irq:
-	clk_disable_unprepare(timer_clk);
-out_timer_clk:
-	clk_disable_unprepare(pclk);
-out_unmap:
-	iounmap(bc_timer.base);
-
+	rk_timer_cleanup(&rk_clkevt->timer);
+out_probe:
+	kfree(rk_clkevt);
+out:
+	/* Leave rk_clkevt not NULL to prevent future init */
+	rk_clkevt = ERR_PTR(ret);
 	return ret;
 }
 
-static int __init rk3288_timer_init(struct device_node *np)
+static int __init rk_clksrc_init(struct device_node *np)
 {
-	return rk_timer_init(np, TIMER_CONTROL_REG3288);
+	int ret = -EINVAL;
+
+	rk_clksrc = kzalloc(sizeof(struct rk_timer), GFP_KERNEL);
+	if (!rk_clksrc) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	ret = rk_timer_probe(rk_clksrc, np);
+	if (ret)
+		goto out_probe;
+
+	rk_timer_update_counter(UINT_MAX, rk_clksrc);
+	rk_timer_enable(rk_clksrc, 0);
+
+	ret = clocksource_mmio_init(rk_clksrc->base + TIMER_CURRENT_VALUE0,
+		TIMER_NAME, rk_clksrc->freq, 250, 32,
+		clocksource_mmio_readl_down);
+	if (ret) {
+		pr_err("Failed to register clocksource");
+		goto out_clocksource;
+	}
+
+	sched_clock_register(rk_timer_sched_read, 32, rk_clksrc->freq);
+	return 0;
+
+out_clocksource:
+	rk_timer_cleanup(rk_clksrc);
+out_probe:
+	kfree(rk_clksrc);
+out:
+	/* Leave rk_clksrc not NULL to prevent future init */
+	rk_clksrc = ERR_PTR(ret);
+	return ret;
 }
 
-static int __init rk3399_timer_init(struct device_node *np)
+static int __init rk_timer_init(struct device_node *np)
 {
-	return rk_timer_init(np, TIMER_CONTROL_REG3399);
+	if (!rk_clkevt)
+		return rk_clkevt_init(np);
+
+	if (!rk_clksrc)
+		return rk_clksrc_init(np);
+
+	pr_err("Too many timer definitions for '%s'\n", TIMER_NAME);
+	return -EINVAL;
 }
 
-CLOCKSOURCE_OF_DECLARE(rk3288_timer, "rockchip,rk3288-timer",
-		       rk3288_timer_init);
-CLOCKSOURCE_OF_DECLARE(rk3399_timer, "rockchip,rk3399-timer",
-		       rk3399_timer_init);
+CLOCKSOURCE_OF_DECLARE(rk3288_timer, "rockchip,rk3288-timer", rk_timer_init);
+CLOCKSOURCE_OF_DECLARE(rk3399_timer, "rockchip,rk3399-timer", rk_timer_init);
-- 
1.7.9.5

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

* [PATCH v6 4/5] ARM: dts: rockchip: add timer entries to rk3188 SoC
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, linux-kernel, devicetree,
	linux-arm-kernel, linux-rockchip
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

The patch add two timers to all rk3188 based boards.

The first timer is from alive subsystem and it act as a backup
for the local timers at sleep time. It act the same as other
SoC rockchip timers already present in kernel.

The second timer is from CPU subsystem and act as replacement
for the arm-global-timer clocksource and sched clock. It run
at stable frequency 24MHz.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
 arch/arm/boot/dts/rk3188.dtsi |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index 31f81b2..0dc52fe 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -106,6 +106,22 @@
 		};
 	};
 
+	timer3: timer@2000e000 {
+		compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer";
+		reg = <0x2000e000 0x20>;
+		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_TIMER3>, <&cru PCLK_TIMER3>;
+		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";
+	};
+
 	i2s0: i2s@1011a000 {
 		compatible = "rockchip,rk3188-i2s", "rockchip,rk3066-i2s";
 		reg = <0x1011a000 0x2000>;
-- 
1.7.9.5

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

* [PATCH v6 4/5] ARM: dts: rockchip: add timer entries to rk3188 SoC
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

The patch add two timers to all rk3188 based boards.

The first timer is from alive subsystem and it act as a backup
for the local timers at sleep time. It act the same as other
SoC rockchip timers already present in kernel.

The second timer is from CPU subsystem and act as replacement
for the arm-global-timer clocksource and sched clock. It run
at stable frequency 24MHz.

Signed-off-by: Alexander Kochetkov <al.kochet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 arch/arm/boot/dts/rk3188.dtsi |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index 31f81b2..0dc52fe 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -106,6 +106,22 @@
 		};
 	};
 
+	timer3: timer@2000e000 {
+		compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer";
+		reg = <0x2000e000 0x20>;
+		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_TIMER3>, <&cru PCLK_TIMER3>;
+		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";
+	};
+
 	i2s0: i2s@1011a000 {
 		compatible = "rockchip,rk3188-i2s", "rockchip,rk3066-i2s";
 		reg = <0x1011a000 0x2000>;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 4/5] ARM: dts: rockchip: add timer entries to rk3188 SoC
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

The patch add two timers to all rk3188 based boards.

The first timer is from alive subsystem and it act as a backup
for the local timers at sleep time. It act the same as other
SoC rockchip timers already present in kernel.

The second timer is from CPU subsystem and act as replacement
for the arm-global-timer clocksource and sched clock. It run
at stable frequency 24MHz.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
 arch/arm/boot/dts/rk3188.dtsi |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index 31f81b2..0dc52fe 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -106,6 +106,22 @@
 		};
 	};
 
+	timer3: timer at 2000e000 {
+		compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer";
+		reg = <0x2000e000 0x20>;
+		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_TIMER3>, <&cru PCLK_TIMER3>;
+		clock-names = "timer", "pclk";
+	};
+
+	timer6: timer at 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";
+	};
+
 	i2s0: i2s at 1011a000 {
 		compatible = "rockchip,rk3188-i2s", "rockchip,rk3066-i2s";
 		reg = <0x1011a000 0x2000>;
-- 
1.7.9.5

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

* [PATCH v6 5/5] ARM: dts: rockchip: disable arm-global-timer for rk3188
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, linux-kernel, devicetree,
	linux-arm-kernel, linux-rockchip
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

The clocksource and the sched_clock provided by the arm_global_timer
are quite unstable because their rates depend on the cpu frequency.

On the other side, the arm_global_timer has a higher rating than the
rockchip_timer, it will be selected by default by the time framework
while we want to use the stable rockchip clocksource.

Let's disable the arm_global_timer in order to have the rockchip
clocksource selected by default.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
 arch/arm/boot/dts/rk3188.dtsi |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index 0dc52fe..44da3d42 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -546,6 +546,7 @@
 
 &global_timer {
 	interrupts = <GIC_PPI 11 0xf04>;
+	status = "disabled";
 };
 
 &local_timer {
-- 
1.7.9.5

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

* [PATCH v6 5/5] ARM: dts: rockchip: disable arm-global-timer for rk3188
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao, Alexander Kochetkov

The clocksource and the sched_clock provided by the arm_global_timer
are quite unstable because their rates depend on the cpu frequency.

On the other side, the arm_global_timer has a higher rating than the
rockchip_timer, it will be selected by default by the time framework
while we want to use the stable rockchip clocksource.

Let's disable the arm_global_timer in order to have the rockchip
clocksource selected by default.

Signed-off-by: Alexander Kochetkov <al.kochet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 arch/arm/boot/dts/rk3188.dtsi |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index 0dc52fe..44da3d42 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -546,6 +546,7 @@
 
 &global_timer {
 	interrupts = <GIC_PPI 11 0xf04>;
+	status = "disabled";
 };
 
 &local_timer {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 5/5] ARM: dts: rockchip: disable arm-global-timer for rk3188
@ 2017-01-31 12:43   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-01-31 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

The clocksource and the sched_clock provided by the arm_global_timer
are quite unstable because their rates depend on the cpu frequency.

On the other side, the arm_global_timer has a higher rating than the
rockchip_timer, it will be selected by default by the time framework
while we want to use the stable rockchip clocksource.

Let's disable the arm_global_timer in order to have the rockchip
clocksource selected by default.

Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
---
 arch/arm/boot/dts/rk3188.dtsi |    1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
index 0dc52fe..44da3d42 100644
--- a/arch/arm/boot/dts/rk3188.dtsi
+++ b/arch/arm/boot/dts/rk3188.dtsi
@@ -546,6 +546,7 @@
 
 &global_timer {
 	interrupts = <GIC_PPI 11 0xf04>;
+	status = "disabled";
 };
 
 &local_timer {
-- 
1.7.9.5

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

* Re: [PATCH v6 1/5] dt-bindings: clarify compatible property for rockchip timers
@ 2017-02-01  9:33     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:33 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: Daniel Lezcano, linux-kernel, devicetree, linux-arm-kernel,
	linux-rockchip, Thomas Gleixner, Mark Rutland, Rob Herring,
	Russell King, Caesar Wang, Huang Tao

Am Dienstag, 31. Januar 2017, 15:43:12 CET schrieb Alexander Kochetkov:
> Make all properties description in form '"rockchip,<chip>-timer",
> "rockchip,rk3288-timer"' for all chips found in linux kernel.
> 
> Suggested-by: Heiko Stübner <heiko@sntech.de>
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
> Acked-by: Rob Herring <robh@kernel.org>

looks good

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

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

* Re: [PATCH v6 1/5] dt-bindings: clarify compatible property for rockchip timers
@ 2017-02-01  9:33     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:33 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: Daniel Lezcano, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Thomas Gleixner,
	Mark Rutland, Rob Herring, Russell King, Caesar Wang, Huang Tao

Am Dienstag, 31. Januar 2017, 15:43:12 CET schrieb Alexander Kochetkov:
> Make all properties description in form '"rockchip,<chip>-timer",
> "rockchip,rk3288-timer"' for all chips found in linux kernel.
> 
> Suggested-by: Heiko Stübner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
> Signed-off-by: Alexander Kochetkov <al.kochet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

looks good

Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>



--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 1/5] dt-bindings: clarify compatible property for rockchip timers
@ 2017-02-01  9:33     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:33 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 31. Januar 2017, 15:43:12 CET schrieb Alexander Kochetkov:
> Make all properties description in form '"rockchip,<chip>-timer",
> "rockchip,rk3288-timer"' for all chips found in linux kernel.
> 
> Suggested-by: Heiko St?bner <heiko@sntech.de>
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
> Acked-by: Rob Herring <robh@kernel.org>

looks good

Reviewed-by: Heiko Stuebner <heiko@sntech.de>

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

* Re: [PATCH v6 2/5] ARM: dts: rockchip: update compatible property for rk322x timer
@ 2017-02-01  9:34     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:34 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: Daniel Lezcano, linux-kernel, devicetree, linux-arm-kernel,
	linux-rockchip, Thomas Gleixner, Mark Rutland, Rob Herring,
	Russell King, Caesar Wang, Huang Tao

Am Dienstag, 31. Januar 2017, 15:43:13 CET schrieb Alexander Kochetkov:
> Property set to '"rockchip,rk3228-timer", "rockchip,rk3288-timer"'
> to match devicetree bindings.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
> Suggested-by: Heiko Stübner <heiko@sntech.de>

depending on who is picking that up, they can add my
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

if needed

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

* Re: [PATCH v6 2/5] ARM: dts: rockchip: update compatible property for rk322x timer
@ 2017-02-01  9:34     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:34 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: Daniel Lezcano, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Thomas Gleixner,
	Mark Rutland, Rob Herring, Russell King, Caesar Wang, Huang Tao

Am Dienstag, 31. Januar 2017, 15:43:13 CET schrieb Alexander Kochetkov:
> Property set to '"rockchip,rk3228-timer", "rockchip,rk3288-timer"'
> to match devicetree bindings.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Suggested-by: Heiko Stübner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

depending on who is picking that up, they can add my
Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

if needed
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 2/5] ARM: dts: rockchip: update compatible property for rk322x timer
@ 2017-02-01  9:34     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:34 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 31. Januar 2017, 15:43:13 CET schrieb Alexander Kochetkov:
> Property set to '"rockchip,rk3228-timer", "rockchip,rk3288-timer"'
> to match devicetree bindings.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
> Suggested-by: Heiko St?bner <heiko@sntech.de>

depending on who is picking that up, they can add my
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

if needed

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

* Re: [PATCH v6 4/5] ARM: dts: rockchip: add timer entries to rk3188 SoC
  2017-01-31 12:43   ` Alexander Kochetkov
@ 2017-02-01  9:43     ` Heiko Stuebner
  -1 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:43 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: Daniel Lezcano, linux-kernel, devicetree, linux-arm-kernel,
	linux-rockchip, Thomas Gleixner, Mark Rutland, Rob Herring,
	Russell King, Caesar Wang, Huang Tao

Am Dienstag, 31. Januar 2017, 15:43:15 CET schrieb Alexander Kochetkov:
> The patch add two timers to all rk3188 based boards.
> 
> The first timer is from alive subsystem and it act as a backup
> for the local timers at sleep time. It act the same as other
> SoC rockchip timers already present in kernel.
> 
> The second timer is from CPU subsystem and act as replacement
> for the arm-global-timer clocksource and sched clock. It run
> at stable frequency 24MHz.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
> ---
>  arch/arm/boot/dts/rk3188.dtsi |   16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
> index 31f81b2..0dc52fe 100644
> --- a/arch/arm/boot/dts/rk3188.dtsi
> +++ b/arch/arm/boot/dts/rk3188.dtsi
> @@ -106,6 +106,22 @@
>  		};
>  	};
> 
> +	timer3: timer@2000e000 {
> +		compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer";
> +		reg = <0x2000e000 0x20>;
> +		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
> +		clocks = <&cru SCLK_TIMER3>, <&cru PCLK_TIMER3>;
> +		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";
> +	};
> +

depending on who is picking that up, they can add my
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

if needed.

I've also double checked the timer clocks - especially the pclks.
Timer3 has its own separate pclk, while all other timers are supplied by 
pclk_timer0.


Heiko

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

* [PATCH v6 4/5] ARM: dts: rockchip: add timer entries to rk3188 SoC
@ 2017-02-01  9:43     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:43 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 31. Januar 2017, 15:43:15 CET schrieb Alexander Kochetkov:
> The patch add two timers to all rk3188 based boards.
> 
> The first timer is from alive subsystem and it act as a backup
> for the local timers at sleep time. It act the same as other
> SoC rockchip timers already present in kernel.
> 
> The second timer is from CPU subsystem and act as replacement
> for the arm-global-timer clocksource and sched clock. It run
> at stable frequency 24MHz.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
> ---
>  arch/arm/boot/dts/rk3188.dtsi |   16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi
> index 31f81b2..0dc52fe 100644
> --- a/arch/arm/boot/dts/rk3188.dtsi
> +++ b/arch/arm/boot/dts/rk3188.dtsi
> @@ -106,6 +106,22 @@
>  		};
>  	};
> 
> +	timer3: timer at 2000e000 {
> +		compatible = "rockchip,rk3188-timer", "rockchip,rk3288-timer";
> +		reg = <0x2000e000 0x20>;
> +		interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
> +		clocks = <&cru SCLK_TIMER3>, <&cru PCLK_TIMER3>;
> +		clock-names = "timer", "pclk";
> +	};
> +
> +	timer6: timer at 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";
> +	};
> +

depending on who is picking that up, they can add my
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

if needed.

I've also double checked the timer clocks - especially the pclks.
Timer3 has its own separate pclk, while all other timers are supplied by 
pclk_timer0.


Heiko

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

* Re: [PATCH v6 5/5] ARM: dts: rockchip: disable arm-global-timer for rk3188
@ 2017-02-01  9:48     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:48 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: Daniel Lezcano, linux-kernel, devicetree, linux-arm-kernel,
	linux-rockchip, Thomas Gleixner, Mark Rutland, Rob Herring,
	Russell King, Caesar Wang, Huang Tao

Am Dienstag, 31. Januar 2017, 15:43:16 CET schrieb Alexander Kochetkov:
> The clocksource and the sched_clock provided by the arm_global_timer
> are quite unstable because their rates depend on the cpu frequency.
> 
> On the other side, the arm_global_timer has a higher rating than the
> rockchip_timer, it will be selected by default by the time framework
> while we want to use the stable rockchip clocksource.
> 
> Let's disable the arm_global_timer in order to have the rockchip
> clocksource selected by default.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>

depending on who is picking that up, they can add my
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

if needed.

Later on we might need to look at the rk3066 as well, as it might have the 
same issue.

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

* Re: [PATCH v6 5/5] ARM: dts: rockchip: disable arm-global-timer for rk3188
@ 2017-02-01  9:48     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:48 UTC (permalink / raw)
  To: Alexander Kochetkov
  Cc: Daniel Lezcano, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Thomas Gleixner,
	Mark Rutland, Rob Herring, Russell King, Caesar Wang, Huang Tao

Am Dienstag, 31. Januar 2017, 15:43:16 CET schrieb Alexander Kochetkov:
> The clocksource and the sched_clock provided by the arm_global_timer
> are quite unstable because their rates depend on the cpu frequency.
> 
> On the other side, the arm_global_timer has a higher rating than the
> rockchip_timer, it will be selected by default by the time framework
> while we want to use the stable rockchip clocksource.
> 
> Let's disable the arm_global_timer in order to have the rockchip
> clocksource selected by default.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

depending on who is picking that up, they can add my
Reviewed-by: Heiko Stuebner <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>

if needed.

Later on we might need to look at the rk3066 as well, as it might have the 
same issue.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 5/5] ARM: dts: rockchip: disable arm-global-timer for rk3188
@ 2017-02-01  9:48     ` Heiko Stuebner
  0 siblings, 0 replies; 33+ messages in thread
From: Heiko Stuebner @ 2017-02-01  9:48 UTC (permalink / raw)
  To: linux-arm-kernel

Am Dienstag, 31. Januar 2017, 15:43:16 CET schrieb Alexander Kochetkov:
> The clocksource and the sched_clock provided by the arm_global_timer
> are quite unstable because their rates depend on the cpu frequency.
> 
> On the other side, the arm_global_timer has a higher rating than the
> rockchip_timer, it will be selected by default by the time framework
> while we want to use the stable rockchip clocksource.
> 
> Let's disable the arm_global_timer in order to have the rockchip
> clocksource selected by default.
> 
> Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>

depending on who is picking that up, they can add my
Reviewed-by: Heiko Stuebner <heiko@sntech.de>

if needed.

Later on we might need to look at the rk3066 as well, as it might have the 
same issue.

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

* Re: [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer
  2017-01-31 12:43 ` Alexander Kochetkov
  (?)
@ 2017-03-20 13:18   ` Alexander Kochetkov
  -1 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-03-20 13:18 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, LKML, devicetree, LAK, linux-rockchip
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao

Hello, Daniel.

Sorry for bothering you, but could you please take a look at v6[1] series and tell what do you think about it?
I see your commit[2] in the git, but I don’t understand well how to use it in rockchip driver.

[1] https://lkml.org/lkml/2017/1/31/401
[2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/clocksource?id=376bc27150f180d9f5eddec6a14117780177589d

Regards,
Alexander.

> 31 янв. 2017 г., в 15:43, Alexander Kochetkov <al.kochet@gmail.com> написал(а):
> 
> From: Alexander Kochetkov <akochetkov@lintech.ru>
> 
> Hello, Daniel, Heiko.
> 
> Here is try 6 :) Thanks a lot for helping me to bring the code
> into kernel!
> 
> This patch series contain:
> - devicetree bindings clarification for rockchip timers
> - dts files fixes for rk3228-evb, rk3229-evb and rk3188
> - implementation of clocksource and sched clock for rockchip SoC
> 
> The clock supplying the arm-global-timer on the rk3188 is coming from the
> the cpu clock itself and thus changes its rate everytime cpufreq adjusts
> the cpu frequency making this timer unsuitable as a stable clocksource.
> 
> The rk3188, rk3288 and following socs share a separate timer block already
> handled by the rockchip-timer driver. Therefore adapt this driver to also
> be able to act as clocksource on rk3188.
> 
> In order to test clocksource you can run following commands and check
> how much time it take in real. On rk3188 it take about ~45 seconds.
> 
>       cpufreq-set -f 1.6GHZ
>       date; sleep 60; date
> 
> rk3288 (and probably anything newer) is irrelevant to this patch,
> as it has the arch timer interface. This patch may be usefull
> for Cortex-A9/A5 based parts.
> 
> Regards,
> Alexander.
> 
> Changes in v6:
> - Removed Reviewed-by: Heiko Stübner <heiko@sntech.de> tag
> - Merge 5/8, 6/8, 7/8, 8/9 into single file
> - split init paths into rk_clkevt_init() and rk_clksrc_init()
>  so the driver code could be adopted to CLOCKEVENT_OF_DECLARE()
> - clockevents implemented using clocksource_mmio_init()
> - fixed commit message for 4/8 (thanks a lot Daniel)
> 
> Changes in v5:
> - Add Acked-by: Rob Herring <robh at kernel.org> to 1/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2016-December/013308.html
> - Add Reviwed-by: Heiko Stübner <heiko@sntech.de> to series
> - change timer compatible property in the rk322x.dtsi 2/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013784.html
> - updated comment message for 4/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013786.html
> - updated comment message for 5/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013787.html
> - fixed build error for 8/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013789.html
> 
> Alexander Kochetkov (5):
>  dt-bindings: clarify compatible property for rockchip timers
>  ARM: dts: rockchip: update compatible property for rk322x timer
>  clocksource/drivers/rockchip_timer: implement clocksource timer
>  ARM: dts: rockchip: add timer entries to rk3188 SoC
>  ARM: dts: rockchip: disable arm-global-timer for rk3188
> 
> .../bindings/timer/rockchip,rk-timer.txt           |   12 +-
> arch/arm/boot/dts/rk3188.dtsi                      |   17 ++
> arch/arm/boot/dts/rk322x.dtsi                      |    2 +-
> drivers/clocksource/Kconfig                        |    1 +
> drivers/clocksource/rockchip_timer.c               |  218 ++++++++++++++------
> 5 files changed, 185 insertions(+), 65 deletions(-)
> 
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer
@ 2017-03-20 13:18   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-03-20 13:18 UTC (permalink / raw)
  To: Daniel Lezcano, Heiko Stuebner, LKML, devicetree, LAK, linux-rockchip
  Cc: Mark Rutland, Huang Tao, Russell King, Rob Herring,
	Thomas Gleixner, Caesar Wang

Hello, Daniel.

Sorry for bothering you, but could you please take a look at v6[1] series and tell what do you think about it?
I see your commit[2] in the git, but I don’t understand well how to use it in rockchip driver.

[1] https://lkml.org/lkml/2017/1/31/401
[2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/clocksource?id=376bc27150f180d9f5eddec6a14117780177589d

Regards,
Alexander.

> 31 янв. 2017 г., в 15:43, Alexander Kochetkov <al.kochet@gmail.com> написал(а):
> 
> From: Alexander Kochetkov <akochetkov@lintech.ru>
> 
> Hello, Daniel, Heiko.
> 
> Here is try 6 :) Thanks a lot for helping me to bring the code
> into kernel!
> 
> This patch series contain:
> - devicetree bindings clarification for rockchip timers
> - dts files fixes for rk3228-evb, rk3229-evb and rk3188
> - implementation of clocksource and sched clock for rockchip SoC
> 
> The clock supplying the arm-global-timer on the rk3188 is coming from the
> the cpu clock itself and thus changes its rate everytime cpufreq adjusts
> the cpu frequency making this timer unsuitable as a stable clocksource.
> 
> The rk3188, rk3288 and following socs share a separate timer block already
> handled by the rockchip-timer driver. Therefore adapt this driver to also
> be able to act as clocksource on rk3188.
> 
> In order to test clocksource you can run following commands and check
> how much time it take in real. On rk3188 it take about ~45 seconds.
> 
>       cpufreq-set -f 1.6GHZ
>       date; sleep 60; date
> 
> rk3288 (and probably anything newer) is irrelevant to this patch,
> as it has the arch timer interface. This patch may be usefull
> for Cortex-A9/A5 based parts.
> 
> Regards,
> Alexander.
> 
> Changes in v6:
> - Removed Reviewed-by: Heiko Stübner <heiko@sntech.de> tag
> - Merge 5/8, 6/8, 7/8, 8/9 into single file
> - split init paths into rk_clkevt_init() and rk_clksrc_init()
>  so the driver code could be adopted to CLOCKEVENT_OF_DECLARE()
> - clockevents implemented using clocksource_mmio_init()
> - fixed commit message for 4/8 (thanks a lot Daniel)
> 
> Changes in v5:
> - Add Acked-by: Rob Herring <robh at kernel.org> to 1/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2016-December/013308.html
> - Add Reviwed-by: Heiko Stübner <heiko@sntech.de> to series
> - change timer compatible property in the rk322x.dtsi 2/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013784.html
> - updated comment message for 4/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013786.html
> - updated comment message for 5/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013787.html
> - fixed build error for 8/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013789.html
> 
> Alexander Kochetkov (5):
>  dt-bindings: clarify compatible property for rockchip timers
>  ARM: dts: rockchip: update compatible property for rk322x timer
>  clocksource/drivers/rockchip_timer: implement clocksource timer
>  ARM: dts: rockchip: add timer entries to rk3188 SoC
>  ARM: dts: rockchip: disable arm-global-timer for rk3188
> 
> .../bindings/timer/rockchip,rk-timer.txt           |   12 +-
> arch/arm/boot/dts/rk3188.dtsi                      |   17 ++
> arch/arm/boot/dts/rk322x.dtsi                      |    2 +-
> drivers/clocksource/Kconfig                        |    1 +
> drivers/clocksource/rockchip_timer.c               |  218 ++++++++++++++------
> 5 files changed, 185 insertions(+), 65 deletions(-)
> 
> -- 
> 1.7.9.5
> 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer
@ 2017-03-20 13:18   ` Alexander Kochetkov
  0 siblings, 0 replies; 33+ messages in thread
From: Alexander Kochetkov @ 2017-03-20 13:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hello, Daniel.

Sorry for bothering you, but could you please take a look at v6[1] series and tell what do you think about it?
I see your commit[2] in the git, but I don?t understand well how to use it in rockchip driver.

[1] https://lkml.org/lkml/2017/1/31/401
[2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/clocksource?id=376bc27150f180d9f5eddec6a14117780177589d

Regards,
Alexander.

> 31 ???. 2017 ?., ? 15:43, Alexander Kochetkov <al.kochet@gmail.com> ???????(?):
> 
> From: Alexander Kochetkov <akochetkov@lintech.ru>
> 
> Hello, Daniel, Heiko.
> 
> Here is try 6 :) Thanks a lot for helping me to bring the code
> into kernel!
> 
> This patch series contain:
> - devicetree bindings clarification for rockchip timers
> - dts files fixes for rk3228-evb, rk3229-evb and rk3188
> - implementation of clocksource and sched clock for rockchip SoC
> 
> The clock supplying the arm-global-timer on the rk3188 is coming from the
> the cpu clock itself and thus changes its rate everytime cpufreq adjusts
> the cpu frequency making this timer unsuitable as a stable clocksource.
> 
> The rk3188, rk3288 and following socs share a separate timer block already
> handled by the rockchip-timer driver. Therefore adapt this driver to also
> be able to act as clocksource on rk3188.
> 
> In order to test clocksource you can run following commands and check
> how much time it take in real. On rk3188 it take about ~45 seconds.
> 
>       cpufreq-set -f 1.6GHZ
>       date; sleep 60; date
> 
> rk3288 (and probably anything newer) is irrelevant to this patch,
> as it has the arch timer interface. This patch may be usefull
> for Cortex-A9/A5 based parts.
> 
> Regards,
> Alexander.
> 
> Changes in v6:
> - Removed Reviewed-by: Heiko St?bner <heiko@sntech.de> tag
> - Merge 5/8, 6/8, 7/8, 8/9 into single file
> - split init paths into rk_clkevt_init() and rk_clksrc_init()
>  so the driver code could be adopted to CLOCKEVENT_OF_DECLARE()
> - clockevents implemented using clocksource_mmio_init()
> - fixed commit message for 4/8 (thanks a lot Daniel)
> 
> Changes in v5:
> - Add Acked-by: Rob Herring <robh@kernel.org> to 1/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2016-December/013308.html
> - Add Reviwed-by: Heiko St?bner <heiko@sntech.de> to series
> - change timer compatible property in the rk322x.dtsi 2/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013784.html
> - updated comment message for 4/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013786.html
> - updated comment message for 5/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013787.html
> - fixed build error for 8/8
>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013789.html
> 
> Alexander Kochetkov (5):
>  dt-bindings: clarify compatible property for rockchip timers
>  ARM: dts: rockchip: update compatible property for rk322x timer
>  clocksource/drivers/rockchip_timer: implement clocksource timer
>  ARM: dts: rockchip: add timer entries to rk3188 SoC
>  ARM: dts: rockchip: disable arm-global-timer for rk3188
> 
> .../bindings/timer/rockchip,rk-timer.txt           |   12 +-
> arch/arm/boot/dts/rk3188.dtsi                      |   17 ++
> arch/arm/boot/dts/rk322x.dtsi                      |    2 +-
> drivers/clocksource/Kconfig                        |    1 +
> drivers/clocksource/rockchip_timer.c               |  218 ++++++++++++++------
> 5 files changed, 185 insertions(+), 65 deletions(-)
> 
> -- 
> 1.7.9.5
> 

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

* Re: [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer
  2017-03-20 13:18   ` Alexander Kochetkov
@ 2017-03-21  8:02     ` Daniel Lezcano
  -1 siblings, 0 replies; 33+ messages in thread
From: Daniel Lezcano @ 2017-03-21  8:02 UTC (permalink / raw)
  To: Alexander Kochetkov, Heiko Stuebner, LKML, devicetree, LAK,
	linux-rockchip
  Cc: Thomas Gleixner, Mark Rutland, Rob Herring, Russell King,
	Caesar Wang, Huang Tao

On 20/03/2017 14:18, Alexander Kochetkov wrote:
> Hello, Daniel.
> 
> Sorry for bothering you, but could you please take a look at v6[1] series and tell what do you think about it?
> I see your commit[2] in the git, but I don’t understand well how to use it in rockchip driver.
> 
> [1] https://lkml.org/lkml/2017/1/31/401
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/clocksource?id=376bc27150f180d9f5eddec6a14117780177589d

Hi Alexander,

I have been through the patchset and it is ok except for the patch 3/5.
I wanted to investigate a bit on this one because of the patch [2] you
are mentioning.

I think there is small missing piece of devicetree binding to specify
'clocksource' or 'clockevent'. Rob Herring is ok with an attribute of
this kind.

That would help to clearly separate these drivers without ambiguity.

However, it results on some duplicated code I'm not very happy with, so
that is my major issue with this approach I would like to solve. That is
the status today.

I wanted to take the opportunity of your changes to investigate this area.


>> 31 янв. 2017 г., в 15:43, Alexander Kochetkov <al.kochet@gmail.com> написал(а):
>>
>> From: Alexander Kochetkov <akochetkov@lintech.ru>
>>
>> Hello, Daniel, Heiko.
>>
>> Here is try 6 :) Thanks a lot for helping me to bring the code
>> into kernel!
>>
>> This patch series contain:
>> - devicetree bindings clarification for rockchip timers
>> - dts files fixes for rk3228-evb, rk3229-evb and rk3188
>> - implementation of clocksource and sched clock for rockchip SoC
>>
>> The clock supplying the arm-global-timer on the rk3188 is coming from the
>> the cpu clock itself and thus changes its rate everytime cpufreq adjusts
>> the cpu frequency making this timer unsuitable as a stable clocksource.
>>
>> The rk3188, rk3288 and following socs share a separate timer block already
>> handled by the rockchip-timer driver. Therefore adapt this driver to also
>> be able to act as clocksource on rk3188.
>>
>> In order to test clocksource you can run following commands and check
>> how much time it take in real. On rk3188 it take about ~45 seconds.
>>
>>       cpufreq-set -f 1.6GHZ
>>       date; sleep 60; date
>>
>> rk3288 (and probably anything newer) is irrelevant to this patch,
>> as it has the arch timer interface. This patch may be usefull
>> for Cortex-A9/A5 based parts.
>>
>> Regards,
>> Alexander.
>>
>> Changes in v6:
>> - Removed Reviewed-by: Heiko Stübner <heiko@sntech.de> tag
>> - Merge 5/8, 6/8, 7/8, 8/9 into single file
>> - split init paths into rk_clkevt_init() and rk_clksrc_init()
>>  so the driver code could be adopted to CLOCKEVENT_OF_DECLARE()
>> - clockevents implemented using clocksource_mmio_init()
>> - fixed commit message for 4/8 (thanks a lot Daniel)
>>
>> Changes in v5:
>> - Add Acked-by: Rob Herring <robh at kernel.org> to 1/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2016-December/013308.html
>> - Add Reviwed-by: Heiko Stübner <heiko@sntech.de> to series
>> - change timer compatible property in the rk322x.dtsi 2/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013784.html
>> - updated comment message for 4/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013786.html
>> - updated comment message for 5/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013787.html
>> - fixed build error for 8/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013789.html
>>
>> Alexander Kochetkov (5):
>>  dt-bindings: clarify compatible property for rockchip timers
>>  ARM: dts: rockchip: update compatible property for rk322x timer
>>  clocksource/drivers/rockchip_timer: implement clocksource timer
>>  ARM: dts: rockchip: add timer entries to rk3188 SoC
>>  ARM: dts: rockchip: disable arm-global-timer for rk3188
>>
>> .../bindings/timer/rockchip,rk-timer.txt           |   12 +-
>> arch/arm/boot/dts/rk3188.dtsi                      |   17 ++
>> arch/arm/boot/dts/rk322x.dtsi                      |    2 +-
>> drivers/clocksource/Kconfig                        |    1 +
>> drivers/clocksource/rockchip_timer.c               |  218 ++++++++++++++------
>> 5 files changed, 185 insertions(+), 65 deletions(-)
>>
>> -- 
>> 1.7.9.5
>>
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

* [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer
@ 2017-03-21  8:02     ` Daniel Lezcano
  0 siblings, 0 replies; 33+ messages in thread
From: Daniel Lezcano @ 2017-03-21  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 20/03/2017 14:18, Alexander Kochetkov wrote:
> Hello, Daniel.
> 
> Sorry for bothering you, but could you please take a look at v6[1] series and tell what do you think about it?
> I see your commit[2] in the git, but I don?t understand well how to use it in rockchip driver.
> 
> [1] https://lkml.org/lkml/2017/1/31/401
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/clocksource?id=376bc27150f180d9f5eddec6a14117780177589d

Hi Alexander,

I have been through the patchset and it is ok except for the patch 3/5.
I wanted to investigate a bit on this one because of the patch [2] you
are mentioning.

I think there is small missing piece of devicetree binding to specify
'clocksource' or 'clockevent'. Rob Herring is ok with an attribute of
this kind.

That would help to clearly separate these drivers without ambiguity.

However, it results on some duplicated code I'm not very happy with, so
that is my major issue with this approach I would like to solve. That is
the status today.

I wanted to take the opportunity of your changes to investigate this area.


>> 31 ???. 2017 ?., ? 15:43, Alexander Kochetkov <al.kochet@gmail.com> ???????(?):
>>
>> From: Alexander Kochetkov <akochetkov@lintech.ru>
>>
>> Hello, Daniel, Heiko.
>>
>> Here is try 6 :) Thanks a lot for helping me to bring the code
>> into kernel!
>>
>> This patch series contain:
>> - devicetree bindings clarification for rockchip timers
>> - dts files fixes for rk3228-evb, rk3229-evb and rk3188
>> - implementation of clocksource and sched clock for rockchip SoC
>>
>> The clock supplying the arm-global-timer on the rk3188 is coming from the
>> the cpu clock itself and thus changes its rate everytime cpufreq adjusts
>> the cpu frequency making this timer unsuitable as a stable clocksource.
>>
>> The rk3188, rk3288 and following socs share a separate timer block already
>> handled by the rockchip-timer driver. Therefore adapt this driver to also
>> be able to act as clocksource on rk3188.
>>
>> In order to test clocksource you can run following commands and check
>> how much time it take in real. On rk3188 it take about ~45 seconds.
>>
>>       cpufreq-set -f 1.6GHZ
>>       date; sleep 60; date
>>
>> rk3288 (and probably anything newer) is irrelevant to this patch,
>> as it has the arch timer interface. This patch may be usefull
>> for Cortex-A9/A5 based parts.
>>
>> Regards,
>> Alexander.
>>
>> Changes in v6:
>> - Removed Reviewed-by: Heiko St?bner <heiko@sntech.de> tag
>> - Merge 5/8, 6/8, 7/8, 8/9 into single file
>> - split init paths into rk_clkevt_init() and rk_clksrc_init()
>>  so the driver code could be adopted to CLOCKEVENT_OF_DECLARE()
>> - clockevents implemented using clocksource_mmio_init()
>> - fixed commit message for 4/8 (thanks a lot Daniel)
>>
>> Changes in v5:
>> - Add Acked-by: Rob Herring <robh@kernel.org> to 1/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2016-December/013308.html
>> - Add Reviwed-by: Heiko St?bner <heiko@sntech.de> to series
>> - change timer compatible property in the rk322x.dtsi 2/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013784.html
>> - updated comment message for 4/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013786.html
>> - updated comment message for 5/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013787.html
>> - fixed build error for 8/8
>>  http://lists.infradead.org/pipermail/linux-rockchip/2017-January/013789.html
>>
>> Alexander Kochetkov (5):
>>  dt-bindings: clarify compatible property for rockchip timers
>>  ARM: dts: rockchip: update compatible property for rk322x timer
>>  clocksource/drivers/rockchip_timer: implement clocksource timer
>>  ARM: dts: rockchip: add timer entries to rk3188 SoC
>>  ARM: dts: rockchip: disable arm-global-timer for rk3188
>>
>> .../bindings/timer/rockchip,rk-timer.txt           |   12 +-
>> arch/arm/boot/dts/rk3188.dtsi                      |   17 ++
>> arch/arm/boot/dts/rk322x.dtsi                      |    2 +-
>> drivers/clocksource/Kconfig                        |    1 +
>> drivers/clocksource/rockchip_timer.c               |  218 ++++++++++++++------
>> 5 files changed, 185 insertions(+), 65 deletions(-)
>>
>> -- 
>> 1.7.9.5
>>
> 


-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

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

end of thread, other threads:[~2017-03-21  8:02 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-31 12:43 [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer Alexander Kochetkov
2017-01-31 12:43 ` Alexander Kochetkov
2017-01-31 12:43 ` Alexander Kochetkov
2017-01-31 12:43 ` [PATCH v6 1/5] dt-bindings: clarify compatible property for rockchip timers Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-02-01  9:33   ` Heiko Stuebner
2017-02-01  9:33     ` Heiko Stuebner
2017-02-01  9:33     ` Heiko Stuebner
2017-01-31 12:43 ` [PATCH v6 2/5] ARM: dts: rockchip: update compatible property for rk322x timer Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-02-01  9:34   ` Heiko Stuebner
2017-02-01  9:34     ` Heiko Stuebner
2017-02-01  9:34     ` Heiko Stuebner
2017-01-31 12:43 ` [PATCH v6 3/5] clocksource/drivers/rockchip_timer: implement clocksource timer Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-01-31 12:43 ` [PATCH v6 4/5] ARM: dts: rockchip: add timer entries to rk3188 SoC Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-02-01  9:43   ` Heiko Stuebner
2017-02-01  9:43     ` Heiko Stuebner
2017-01-31 12:43 ` [PATCH v6 5/5] ARM: dts: rockchip: disable arm-global-timer for rk3188 Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-01-31 12:43   ` Alexander Kochetkov
2017-02-01  9:48   ` Heiko Stuebner
2017-02-01  9:48     ` Heiko Stuebner
2017-02-01  9:48     ` Heiko Stuebner
2017-03-20 13:18 ` [PATCH v6 0/5] Implement clocksource for rockchip SoC using rockchip timer Alexander Kochetkov
2017-03-20 13:18   ` Alexander Kochetkov
2017-03-20 13:18   ` Alexander Kochetkov
2017-03-21  8:02   ` Daniel Lezcano
2017-03-21  8:02     ` Daniel Lezcano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.