ARM: vf610: Fix/add clocksource
Subsystems (5)
v2 cover ARM: vf610: Fix/add clocksource
This patchset came out of need for a clocksource which supports shutdown. In the first version I proposed to just replace the current clocksource with the ARM Global Timer and even proposed to remove the PIT clocksource driver. But Bill Pringlemeir brought up a reasonable point why we should keep the PIT clocksource.
Since we need shutdown support for suspend/resume, I added another patch which fixes shutdown functionality for the PIT driver. Now it's possible to use suspend/resume functionality with each of the two clocksources.
Changes in v2:
- Added shutdown support for PIT clocksource (and hence clocksource maintainers as receipient).
- Create Kconfig entries which allow to choose between the two clocksources
- Clarified commit message
- Renamed device tree node to "timer"
Stefan Agner (3):
clocksource: vf_pit_timer: Support shutdown mode
ARM: dts: vf610: Add ARM Global Timer
ARM: vf610: Add ARM Global Timer clocksource option
arch/arm/boot/dts/vf610.dtsi | 8 ++++++++ arch/arm/mach-imx/Kconfig | 19 ++++++++++++++++++- drivers/clocksource/vf_pit_timer.c | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-)
Signature · 1 line
2.1.0
PATCH v2 1/3 clocksource: vf_pit_timer: Support shutdown mode
In order to avoid waking up the system in a low power mode, the clocksource should not generate interrupts anymore. Disable the PIT timer interrupt when changing into the CLOCK_EVT_MODE_SHUTDOWN mode.
--- drivers/clocksource/vf_pit_timer.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/clocksource/vf_pit_timer.c +5 -0
@@ -89,10 +89,15 @@ static int pit_set_next_event(unsigned long delta,static void pit_set_mode (enum clock_event_mode mode,struct clock_event_device *evt) { +switch (mode) {case CLOCK_EVT_MODE_PERIODIC :pit_set_next_event (cycle_per_jiffy, evt);break ; +case CLOCK_EVT_MODE_SHUTDOWN : +case CLOCK_EVT_MODE_UNUSED : +pit_timer_disable (); +break ;default :break ; }
Signature · 1 line
2.1.0
Re: [PATCH v2 1/3] clocksource: vf_pit_timer: Support shutdown mode
Hello.
Quoted 14 lines · Stefan Agner
In order to avoid waking up the system in a low power mode, the clocksource should not generate interrupts anymore. Disable the PIT timer interrupt when changing into the
CLOCK_EVT_MODE_SHUTDOWNmode.Signed-off-by Stefan Agner <[email protected]>--- drivers/clocksource/vf_pit_timer.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/clocksource/vf_pit_timer.c +0
-0
drivers/clocksource/vf_pit_timer.c static int pit_set_next_event(unsigned long delta, · line 92
Quoted 4 lines
drivers/clocksource/vf_pit_timer.c +1
-0@@ -89,10 +89,15 @@ static int pit_set_next_event(unsigned long delta,static void pit_set_mode (enum clock_event_mode mode,struct clock_event_device *evt) { +
scripts/checkpatch.pl should protest about this empty line, it's not
needed at all.
WBR, Sergei
PATCH v2 2/3 ARM: dts: vf610: Add ARM Global Timer
In reply to Stefan AgnerAdd Global Timer support which is part of the private peripherals of the Cortex-A5 processor. This Global Timer is compatible with the Cortex-A9 implementation. It's a 64-bit timer and is clocked by the peripheral clock, which is typically 133 or 166MHz on Vybrid.
--- arch/arm/boot/dts/vf610.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/vf610.dtsi +8 -0
@@ -11,6 +11,7 @@ #include "vf610-pinfunc.h" #include <dt-bindings/clock/vf610-clock.h> #include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/interrupt-controller/arm-gic.h> / { aliases {
@@ -83,6 +84,13 @@ <0x40002100 0x100>; }; + timer: global-timer at 40002200 { + compatible = "arm,cortex-a9-global-timer"; + reg = <0x40002200 0x20>; + interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clks VF610_CLK_PLATFORM_BUS>; + }; + L2: l2-cache at 40006000 { compatible = "arm,pl310-cache"; reg = <0x40006000 0x1000>;
Signature · 1 line
2.1.0
Re: [PATCH v2 2/3] ARM: dts: vf610: Add ARM Global Timer
Quoted 23 lines · Stefan Agner
Add Global Timer support which is part of the private peripherals of the Cortex-A5 processor. This Global Timer is compatible with the Cortex-A9 implementation. It's a 64-bit timer and is clocked by the peripheral clock, which is typically 133 or 166MHz on Vybrid.
Signed-off-by Stefan Agner <[email protected]>--- arch/arm/boot/dts/vf610.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)arch/arm/boot/dts/vf610.dtsi +1
-0@@ -11,6 +11,7 @@ #include "vf610-pinfunc.h" #include <dt-bindings/clock/vf610-clock.h> #include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/interrupt-controller/arm-gic.h> / { aliases {
arch/arm/boot/dts/vf610.dtsi line 87
Quoted 4 lines
arch/arm/boot/dts/vf610.dtsi +1
-0@@ -83,6 +84,13 @@ <0x40002100 0x100>; }; + timer: global-timer at 40002200 {
The renaming to "timer" should be applied on node name, not the label name. I change it as below and applied the patch.
global_timer: timer at 40002200
Shawn
Quoted 12 lines
arch/arm/boot/dts/vf610.dtsi +6
-0+ compatible = "arm,cortex-a9-global-timer"; + reg = <0x40002200 0x20>; + interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clks VF610_CLK_PLATFORM_BUS>; + }; + L2: l2-cache at 40006000 { compatible = "arm,pl310-cache"; reg = <0x40006000 0x1000>;Signature · 1 line
2.1.0
PATCH v2 3/3 ARM: vf610: Add ARM Global Timer clocksource option
In reply to Stefan AgnerAdd the ARM Global Timer as clocksource/scheduler clock option and use it as default scheduler clock. This leaves the PIT timer for other users e.g. the secondary Cortex-M4 core. Also, the Global Timer has double the precission (running at pheripheral clock compared to IPG clock) and a 64-bit incrementing counter register. We still keep the PIT timer as an secondary option in case the ARM Global Timer is not available.
--- arch/arm/mach-imx/Kconfig | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
arch/arm/mach-imx/Kconfig +18 -1
@@ -633,12 +633,29 @@ config SOC_VF610 bool "Vybrid Family VF610 support" select ARM_GIC select PINCTRL_VF610 - select VF_PIT_TIMER select PL310_ERRATA_769419 if CACHE_L2X0 help This enable support for Freescale Vybrid VF610 processor. +choice + prompt "Clocksource for scheduler clock" + depends on SOC_VF610 + default ARM_GLOBAL_TIMER + + config ARM_GLOBAL_TIMER + bool "Use ARM Global Timer" + select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK + help + Use the ARM Global Timer as clocksource + + config VF_PIT_TIMER + bool "Use PIT timer" + help + Use SoC Periodic Interrupt Timer (PIT) as clocksource + +endchoice + endif source "arch/arm/mach-imx/devices/Kconfig"
Signature · 1 line
2.1.0
Shawn Guo
AppliedRe: [PATCH v2 3/3] ARM: vf610: Add ARM Global Timer clocksource option
Quoted 9 lines · Stefan Agner
Add the ARM Global Timer as clocksource/scheduler clock option and use it as default scheduler clock. This leaves the PIT timer for other users e.g. the secondary Cortex-M4 core. Also, the Global Timer has double the precission (running at pheripheral clock compared to IPG clock) and a 64-bit incrementing counter register. We still keep the PIT timer as an secondary option in case the ARM Global Timer is not available.
Signed-off-by Stefan Agner <[email protected]>
Applied, thanks.
Re: [PATCH v2 3/3] ARM: vf610: Add ARM Global Timer clocksource option
In reply to Stefan AgnerQuoted 35 lines · Stefan Agner
Add the ARM Global Timer as clocksource/scheduler clock option and use it as default scheduler clock. This leaves the PIT timer for other users e.g. the secondary Cortex-M4 core. Also, the Global Timer has double the precission (running at pheripheral clock compared to IPG clock) and a 64-bit incrementing counter register. We still keep the PIT timer as an secondary option in case the ARM Global Timer is not available.
Signed-off-by Stefan Agner <[email protected]>--- arch/arm/mach-imx/Kconfig | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)arch/arm/mach-imx/Kconfig +8
-1@@ -633,12 +633,29 @@ config SOC_VF610 bool "Vybrid Family VF610 support" select ARM_GIC select PINCTRL_VF610 - select VF_PIT_TIMER select PL310_ERRATA_769419 if CACHE_L2X0 help This enable support for Freescale Vybrid VF610 processor. +choice + prompt "Clocksource for scheduler clock" + depends on SOC_VF610 + default ARM_GLOBAL_TIMER + + config ARM_GLOBAL_TIMER + bool "Use ARM Global Timer" + select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
arch/arm/mach-imx/Kconfig config SOC_VF610 · line 658
Quoted 10 lines
arch/arm/mach-imx/Kconfig +10
-0+ help + Use the ARM Global Timer as clocksource + + config VF_PIT_TIMER + bool "Use PIT timer" + help + Use SoC Periodic Interrupt Timer (PIT) as clocksource + +endchoice +
As per the report from 0-DAY kernel build test (thanks), the change causes the following warning on a particular config.
warning: (ARCH_ROCKCHIP && ARCH_BCM_5301X) selects CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK which has unmet direct dependencies (ARM_GLOBAL_TIMER)
It looks the redefinition of ARM_GLOBAL_TIMER is the cause for that warning. I think it's more safer to use new config symbols for choosing the clocksource device for VF610. I propose the following change to fix the warning. If there is no objection, I will squash it into the original commit soon.
arch/arm/mach-imx/Kconfig +5 -3
@@ -641,16 +641,18 @@ config SOC_VF610 choice prompt "Clocksource for scheduler clock" depends on SOC_VF610 - default ARM_GLOBAL_TIMER + default VF_USE_ARM_GLOBAL_TIMER - config ARM_GLOBAL_TIMER + config VF_USE_ARM_GLOBAL_TIMER bool "Use ARM Global Timer" + select ARM_GLOBAL_TIMER select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK help Use the ARM Global Timer as clocksource - config VF_PIT_TIMER + config VF_USE_PIT_TIMER bool "Use PIT timer" + select VF_PIT_TIMER help Use SoC Periodic Interrupt Timer (PIT) as clocksource
Stefan Agner
Acked-byRe: [PATCH v2 3/3] ARM: vf610: Add ARM Global Timer clocksource option
Am 2014-09-29 13:51, schrieb Shawn Guo:
Quoted 75 lines · Stefan Agner
Quoted 35 lines
Add the ARM Global Timer as clocksource/scheduler clock option and use it as default scheduler clock. This leaves the PIT timer for other users e.g. the secondary Cortex-M4 core. Also, the Global Timer has double the precission (running at pheripheral clock compared to IPG clock) and a 64-bit incrementing counter register. We still keep the PIT timer as an secondary option in case the ARM Global Timer is not available.
Signed-off-by Stefan Agner <[email protected]>--- arch/arm/mach-imx/Kconfig | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)arch/arm/mach-imx/Kconfig +8
-1@@ -633,12 +633,29 @@ config SOC_VF610 bool "Vybrid Family VF610 support" select ARM_GIC select PINCTRL_VF610 - select VF_PIT_TIMER select PL310_ERRATA_769419 if CACHE_L2X0 help This enable support for Freescale Vybrid VF610 processor. +choice + prompt "Clocksource for scheduler clock" + depends on SOC_VF610 + default ARM_GLOBAL_TIMER + + config ARM_GLOBAL_TIMER + bool "Use ARM Global Timer" + select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCKarch/arm/mach-imx/Kconfig config SOC_VF610 · line 658
Quoted 10 lines
arch/arm/mach-imx/Kconfig +10
-0+ help + Use the ARM Global Timer as clocksource + + config VF_PIT_TIMER + bool "Use PIT timer" + help + Use SoC Periodic Interrupt Timer (PIT) as clocksource + +endchoice +As per the report from 0-DAY kernel build test (thanks), the change causes the following warning on a particular config.
warning: (
ARCH_ROCKCHIP&&ARCH_BCM_5301X) selectsCLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCKwhich has unmet direct dependencies (ARM_GLOBAL_TIMER)It looks the redefinition of
ARM_GLOBAL_TIMERis the cause for that warning. I think it's more safer to use new config symbols for choosing the clocksource device for VF610. I propose the following change to fix the warning. If there is no objection, I will squash it into the original commit soon.arch/arm/mach-imx/Kconfig +3
-2@@ -641,16 +641,18 @@ config SOC_VF610 choice prompt "Clocksource for scheduler clock" depends on SOC_VF610 - default ARM_GLOBAL_TIMER + default VF_USE_ARM_GLOBAL_TIMER - config ARM_GLOBAL_TIMER + config VF_USE_ARM_GLOBAL_TIMER bool "Use ARM Global Timer" + select ARM_GLOBAL_TIMER
arch/arm/mach-imx/Kconfig config SOC_VF610 · line 657
Quoted 10 lines
arch/arm/mach-imx/Kconfig +2
-1select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK help Use the ARM Global Timer as clocksource - config VF_PIT_TIMER + config VF_USE_PIT_TIMER bool "Use PIT timer" + select VF_PIT_TIMER help Use SoC Periodic Interrupt Timer (PIT) as clocksource
I thought that Kconfig actually allowed to define a config symbol twice. But maybe this is not a good idea with dependencies (depends on SOC_VF610 on the choice level...?).
Thx Shawn, sorry about that.
Quoted 24 lines · stefan at agner.ch
This patchset came out of need for a clocksource which supports shutdown. In the first version I proposed to just replace the current clocksource with the ARM Global Timer and even proposed to remove the PIT clocksource driver. But Bill Pringlemeir brought up a reasonable point why we should keep the PIT clocksource.
Since we need shutdown support for suspend/resume, I added another patch which fixes shutdown functionality for the PIT driver. Now it's possible to use suspend/resume functionality with each of the two clocksources.
Changes in v2:
- Added shutdown support for PIT clocksource (and hence clocksource maintainers as receipient).
- CreateKconfigentries which allow to choose between the two clocksources
- Clarified commit message
- Renamed device tree node to "timer"Stefan Agner (3):
clocksource:vf_pit_timer: Support shutdown mode
ARM: dts: vf610: Add ARM Global Timer
ARM: vf610: Add ARM Global Timer clocksource option
Quoted 4 lines
arch/arm/boot/dts/vf610.dtsi | 8 ++++++++ arch/arm/mach-imx/Kconfig | 19 ++++++++++++++++++- drivers/clocksource/vf_pit_timer.c | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-)
Quoted 10 lines · Stefan Agner
This patchset came out of need for a clocksource which supports shutdown. In the first version I proposed to just replace the current clocksource with the ARM Global Timer and even proposed to remove the PIT clocksource driver. But Bill Pringlemeir brought up a reasonable point why we should keep the PIT clocksource.
Since we need shutdown support for suspend/resume, I added another patch which fixes shutdown functionality for the PIT driver. Now it's possible to use suspend/resume functionality with each of the two clocksources.
Quoted 8 lines
Changes in v2:
- Added shutdown support for PIT clocksource (and hence clocksource maintainers as receipient).
- CreateKconfigentries which allow to choose between the two clocksources
- Clarified commit message
- Renamed device tree node to "timer"
Hi Stefan,
I will take the patch 1/3 and let the other patches to be acked-by or picked in another tree.
Thanks
-- Daniel
Quoted 10 lines
Stefan Agner (3):
clocksource:vf_pit_timer: Support shutdown mode
ARM: dts: vf610: Add ARM Global Timer
ARM: vf610: Add ARM Global Timer clocksource optionarch/arm/boot/dts/vf610.dtsi | 8 ++++++++ arch/arm/mach-imx/Kconfig | 19 ++++++++++++++++++- drivers/clocksource/vf_pit_timer.c | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-)
Signature · 5 lines
<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
Am 2014-09-26 09:01, schrieb Daniel Lezcano:
Quoted 20 lines · Stefan Agner
Quoted 10 lines
This patchset came out of need for a clocksource which supports shutdown. In the first version I proposed to just replace the current clocksource with the ARM Global Timer and even proposed to remove the PIT clocksource driver. But Bill Pringlemeir brought up a reasonable point why we should keep the PIT clocksource.
Since we need shutdown support for suspend/resume, I added another patch which fixes shutdown functionality for the PIT driver. Now it's possible to use suspend/resume functionality with each of the two clocksources.
Quoted 8 lines
Changes in v2:
- Added shutdown support for PIT clocksource (and hence clocksource maintainers as receipient).
- CreateKconfigentries which allow to choose between the two clocksources
- Clarified commit message
- Renamed device tree node to "timer"
Quoted 7 lines
Hi Stefan,
I will take the patch 1/3 and let the other patches to be acked-by or picked in another tree.
Thanks
-- Daniel
Hi Daniel,
Great thx. If not already to late, can you drop that superfluous empty line mentioned by Sergei?
--
Stefan
Quoted 11 lines
Quoted 11 lines
Stefan Agner (3):
clocksource:vf_pit_timer: Support shutdown mode
ARM: dts: vf610: Add ARM Global Timer
ARM: vf610: Add ARM Global Timer clocksource optionarch/arm/boot/dts/vf610.dtsi | 8 ++++++++ arch/arm/mach-imx/Kconfig | 19 ++++++++++++++++++- drivers/clocksource/vf_pit_timer.c | 5 +++++ 3 files changed, 31 insertions(+), 1 deletion(-)