ARM: move timer-sp.c from versatile to common
Subsystems (4)
PATCH 1/3 ARM: move timer-sp.c from versatile to common
From: Rob Herring <[email protected]>
The timer-sp h/w used on versatile platforms can also be used for other platforms, so move it to a common location.
Rename timer names for clocksource and clockevent to generic name. Which timer instance is which is platform dependent.
--- arch/arm/common/Makefile | 1 + arch/arm/common/timer-sp.c | 154 ++++++++++++++++++++++ arch/arm/include/asm/hardware/timer-sp.h | 2 + arch/arm/mach-integrator/integrator_cp.c | 2 +- arch/arm/mach-realview/core.c | 2 +- arch/arm/mach-versatile/core.c | 2 +- arch/arm/mach-vexpress/ct-ca9x4.c | 2 +- arch/arm/mach-vexpress/v2m.c | 2 +- arch/arm/plat-versatile/Makefile | 1 - arch/arm/plat-versatile/include/plat/timer-sp.h | 2 - arch/arm/plat-versatile/timer-sp.c | 156 ----------------------- 11 files changed, 162 insertions(+), 164 deletions(-) create mode 100644 arch/arm/common/timer-sp.c create mode 100644 arch/arm/include/asm/hardware/timer-sp.h delete mode 100644 arch/arm/plat-versatile/include/plat/timer-sp.h delete mode 100644 arch/arm/plat-versatile/timer-sp.c
arch/arm/common/Makefile +1 -0
@@ -17,3 +17,4 @@ obj-$(CONFIG_ARCH_IXP2000) += uengine.o obj-$(CONFIG_ARCH_IXP23XX) += uengine.o obj-$(CONFIG_PCI_HOST_ITE8152) += it8152.o obj-$(CONFIG_COMMON_CLKDEV) += clkdev.o +obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
arch/arm/common/timer-sp.c new file +154 -0
154 lines not on this page · raw message
arch/arm/include/asm/hardware/timer-sp.h new file +2 -0
@@ -0,0 +1,2 @@ +void sp804_clocksource_init (void __iomem *); +void sp804_clockevents_init (void __iomem *,unsigned int );
arch/arm/mach-integrator/integrator_cp.c +1 -1
@@ -41,7 +41,7 @@#include <asm/mach/map.h> #include <asm/mach/time.h> -#include <plat/timer-sp.h> +#include <asm/hardware/timer-sp.h> #include "common.h"
arch/arm/mach-realview/core.c +1 -1
@@ -50,7 +50,7 @@#include <mach/clkdev.h> #include <mach/platform.h> #include <mach/irqs.h> -#include <plat/timer-sp.h> +#include <asm/hardware/timer-sp.h> #include "core.h"
arch/arm/mach-versatile/core.c +1 -1
@@ -49,7 +49,7 @@#include <mach/clkdev.h> #include <mach/hardware.h> #include <mach/platform.h> -#include <plat/timer-sp.h> +#include <asm/hardware/timer-sp.h> #include "core.h"
arch/arm/mach-vexpress/ct-ca9x4.c +1 -1
@@ -21,7 +21,7 @@#include <mach/clkdev.h> #include <mach/ct-ca9x4.h> -#include <plat/timer-sp.h> +#include <asm/hardware/timer-sp.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
arch/arm/mach-vexpress/v2m.c +1 -1
@@ -22,7 +22,7 @@#include <mach/clkdev.h> #include <mach/motherboard.h> -#include <plat/timer-sp.h> +#include <asm/hardware/timer-sp.h> #include "core.h"
arch/arm/plat-versatile/Makefile +0 -1
@@ -1,5 +1,4 @@ obj-y := clock.o -obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o obj-$(CONFIG_ARCH_REALVIEW) += sched-clock.o obj-$(CONFIG_ARCH_VERSATILE) += sched-clock.o ifeq ($(CONFIG_LEDS_CLASS),y)
arch/arm/plat-versatile/include/plat/timer-sp.h deleted +0 -2
@@ -1,2 +0,0 @@ -void sp804_clocksource_init (void __iomem *); -void sp804_clockevents_init (void __iomem *,unsigned int );
arch/arm/plat-versatile/timer-sp.c deleted +0 -156
156 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH 3/3 ARM: twd_smp: add clock api support
From: Rob Herring <[email protected]>
The private timer freq is currently dynamically detected using jiffies count to determine the rate. This method adds a delay to boot-up, so use the clock api instead to get the clock rate.
--- arch/arm/include/asm/smp_twd.h | 2 ++ arch/arm/kernel/smp_twd.c | 7 +++++++ 2 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/include/asm/smp_twd.h +2 -0
@@ -19,11 +19,13 @@#define TWD_TIMER_CONTROL_IT_ENABLE (1 << 2)struct clock_event_device ; +struct clk ;extern void __iomem *twd_base;void twd_timer_stop (void );int twd_timer_ack (void );void twd_timer_setup (struct clock_event_device *); +void twd_timer_init (void __iomem *base,struct clk *clk);#endif
arch/arm/kernel/smp_twd.c +7 -0
@@ -17,6 +17,7 @@#include <linux/clockchips.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/clk.h> #include <asm/smp_twd.h> #include <asm/hardware/gic.h>
@@ -151,6 +152,12 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)clockevents_register_device (clk); } +void __init twd_timer_init (void __iomem *base,struct clk *clk) +{ + twd_base = base; + twd_timer_rate =clk_get_rate (clk); +} +#ifdef CONFIG_HOTPLUG_CPU /* * take a local timer down
Signature · 1 line
1.7.0.4
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 53 lines · Rob Herring
From: Rob Herring <[email protected]>
The private timer freq is currently dynamically detected using jiffies count to determine the rate. This method adds a delay to boot-up, so use the clock api instead to get the clock rate.
Signed-off-by Rob Herring <[email protected]>---
?arch/arm/include/asm/smp_twd.h | ? ?2 ++
?arch/arm/kernel/smp_twd.c ? ? ?| ? ?7 +++++++
?2 files changed, 9 insertions(+), 0 deletions(-)arch/arm/include/asm/smp_twd.h +2
-0@@ -19,11 +19,13 @@ ?#define TWD_TIMER_CONTROL_IT_ENABLE ? ?(1 << 2) ?struct clock_event_device; +struct clk ; ?extern void __iomem *twd_base; ?void twd_timer_stop(void); ?int twd_timer_ack(void); ?void twd_timer_setup(struct clock_event_device *); +void twd_timer_init (void __iomem *base,struct clk *clk);?#endif
arch/arm/kernel/smp_twd.c +0
-0@@ -17,6 +17,7 @@?#include <
linux/clockchips.h>
?#include <linux/irq.h>
?#include <linux/io.h>
+#include <linux/clk.h>?#include <
asm/smp_twd.h>
?#include <asm/hardware/gic.h>arch/arm/kernel/smp_twd.c +6
-0@@ -151,6 +152,12 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk) ? ? ? ?clockevents_register_device(clk); ?} +void __init twd_timer_init (void __iomem *base,struct clk *clk) +{ + ? ? ? twd_base = base; + ? ? ? twd_timer_rate = clk_get_rate(clk); +} +
Quoted 3 lines
?#ifdef
CONFIG_HOTPLUG_CPU
?/*
?* take a local timer down
The local timers run off the PERIPHCLK in the CPU, which is specified as the CPU clock divided by an implementation defined integer >= 2. If you take the divider value as a parameter to twd_timer_init, the clock that is passed in can be the cpu's clock.
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 48 lines · Colin Cross
Quoted 47 lines · Rob Herring
From: Rob Herring<[email protected]>
The private timer freq is currently dynamically detected using jiffies count to determine the rate. This method adds a delay to boot-up, so use the clock api instead to get the clock rate.
Signed-off-by Rob Herring<[email protected]>--- arch/arm/include/asm/smp_twd.h | 2 ++ arch/arm/kernel/smp_twd.c | 7 +++++++ 2 files changed, 9 insertions(+), 0 deletions(-)arch/arm/include/asm/smp_twd.h +2
-0@@ -19,11 +19,13 @@#define TWD_TIMER_CONTROL_IT_ENABLE (1<< 2)struct clock_event_device ; +struct clk ;extern void __iomem *twd_base;void twd_timer_stop (void );int twd_timer_ack (void );void twd_timer_setup (struct clock_event_device *); +void twd_timer_init (void __iomem *base,struct clk *clk);#endif arch/arm/kernel/smp_twd.c +1
-0@@ -17,6 +17,7 @@#include <linux/clockchips.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/clk.h> #include <asm/smp_twd.h> #include <asm/hardware/gic.h> @@ -151,6 +152,12 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)clockevents_register_device (clk); }
Quoted 14 lines
arch/arm/kernel/smp_twd.c void __cpuinit twd_timer_setup(struct clock_event_device *clk) · line 163
Quoted 9 lines
arch/arm/kernel/smp_twd.c +6
-0+void __init twd_timer_init (void __iomem *base,struct clk *clk) +{ + twd_base = base; + twd_timer_rate =clk_get_rate (clk); +} +#ifdef CONFIG_HOTPLUG_CPU /* * take a local timer down The local timers run off the PERIPHCLK in the CPU, which is specified as the CPU clock divided by an implementation defined integer>= 2. If you take the divider value as a parameter to
twd_timer_init, the clock that is passed in can be the cpu's clock.
That is an implementation detail of the A9. Future designs could be completely asynchronous. Using the clock api works either way.
Rob
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 69 lines · Rob Herring
Quoted 53 lines · Colin Cross
Quoted 50 lines · On Thu, Sep 30, 2010 at 3:49 PM, Rob Herring<[email protected]> ?wrote:
From: Rob Herring<[email protected]>
The private timer freq is currently dynamically detected using jiffies count to determine the rate. This method adds a delay to boot-up, so use the clock api instead to get the clock rate.
Signed-off-by Rob Herring<[email protected]>---
?arch/arm/include/asm/smp_twd.h | ? ?2 ++
?arch/arm/kernel/smp_twd.c ? ? ?| ? ?7 +++++++
?2 files changed, 9 insertions(+), 0 deletions(-)arch/arm/include/asm/smp_twd.h +2
-0@@ -19,11 +19,13 @@ ?#define TWD_TIMER_CONTROL_IT_ENABLE ? ?(1<< ?2) ?struct clock_event_device; +struct clk ; ?extern void __iomem *twd_base; ?void twd_timer_stop(void); ?int twd_timer_ack(void); ?void twd_timer_setup(struct clock_event_device *); +void twd_timer_init (void __iomem *base,struct clk *clk);?#endif
arch/arm/kernel/smp_twd.c +0
-0@@ -17,6 +17,7 @@?#include<linux/clockchips.h>
?#include<linux/irq.h>
?#include<linux/io.h>
+#include<linux/clk.h>?#include<asm/smp_twd.h>
?#include<asm/hardware/gic.h>arch/arm/kernel/smp_twd.c +0
-0@@ -151,6 +152,12 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk) ? ? ? ?clockevents_register_device(clk); ?}Quoted 14 lines
Quoted 9 lines
arch/arm/kernel/smp_twd.c +6
-0+void __init twd_timer_init (void __iomem *base,struct clk *clk) +{ + ? ? ? twd_base = base; + ? ? ? twd_timer_rate = clk_get_rate(clk); +} +?#ifdef
CONFIG_HOTPLUG_CPU
?/*
?* take a local timer downThe local timers run off the PERIPHCLK in the CPU, which is specified as the CPU clock divided by an implementation defined integer>= 2. If you take the divider value as a parameter to
twd_timer_init, the clock that is passed in can be the cpu's clock.
Quoted 2 lines
That is an implementation detail of the A9. Future designs could be completely asynchronous. Using the clock api works either way.
True. That could still be handled by passing a divider of 1. For all current implementations, this api will be used with clock that is a constant divider of an existing clock. Taking a divider value would avoid having to create a new clock that may not be similar to any other clock in the device.
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 70 lines · Colin Cross
Quoted 69 lines · Rob Herring
Quoted 67 lines · Colin Cross
Quoted 58 lines · Rob Herring
From: Rob Herring<[email protected]>
The private timer freq is currently dynamically detected using jiffies count to determine the rate. This method adds a delay to boot-up, so use the clock api instead to get the clock rate.
Signed-off-by Rob Herring<[email protected]>--- arch/arm/include/asm/smp_twd.h | 2 ++ arch/arm/kernel/smp_twd.c | 7 +++++++ 2 files changed, 9 insertions(+), 0 deletions(-)arch/arm/include/asm/smp_twd.h +2
-0@@ -19,11 +19,13 @@#define TWD_TIMER_CONTROL_IT_ENABLE (1<< 2)struct clock_event_device ; +struct clk ;extern void __iomem *twd_base;void twd_timer_stop (void );int twd_timer_ack (void );void twd_timer_setup (struct clock_event_device *); +void twd_timer_init (void __iomem *base,struct clk *clk);#endif arch/arm/kernel/smp_twd.c +7
-0@@ -17,6 +17,7 @@#include <linux/clockchips.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/clk.h> #include <asm/smp_twd.h> #include <asm/hardware/gic.h> @@ -151,6 +152,12 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)clockevents_register_device (clk ); } +void __init twd_timer_init (void __iomem *base,struct clk *clk) +{ + twd_base = base; + twd_timer_rate =clk_get_rate (clk); +} +#ifdef CONFIG_HOTPLUG_CPU /* Quoted 1 line
* take a local timer down
The local timers run off the PERIPHCLK in the CPU, which is specified as the CPU clock divided by an implementation defined integer>= 2. If you take the divider value as a parameter to
twd_timer_init, the clock that is passed in can be the cpu's clock.
Quoted 8 lines
Quoted 2 lines
That is an implementation detail of the A9. Future designs could be completely asynchronous. Using the clock api works either way.
True. That could still be handled by passing a divider of 1. For all current implementations, this api will be used with clock that is a constant divider of an existing clock. Taking a divider value would avoid having to create a new clock that may not be similar to any other clock in the device.
If I pass in a divider, what clock rate do I divide with it? If I only have the divider, then I'm dependent on knowing CLK freq (the cpu freq in A9 case). Ultimately I have to know the timer clock rate to setup a clock_event device. I'm open to passing in the clock rate directly, but having the clk ptr is more flexible. Other examples of timer init like i.MX use the same arguments.
The point of this api is to avoid spending 5 jiffies on the primary cpu to calculate the rate. That is a significant chunk of the kernel boot time. Calling this function is entirely optional and the old way still works.
Rob
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 90 lines · Rob Herring
Quoted 73 lines · Colin Cross
Quoted 70 lines · On Thu, Sep 30, 2010 at 7:03 PM, Rob Herring<[email protected]> ?wrote:
Quoted 67 lines · Colin Cross
Quoted 56 lines · On Thu, Sep 30, 2010 at 3:49 PM, Rob Herring<[email protected]> ?wrote:
From: Rob Herring<[email protected]>
The private timer freq is currently dynamically detected using jiffies count to determine the rate. This method adds a delay to boot-up, so use the clock api instead to get the clock rate.
Signed-off-by Rob Herring<[email protected]>---
?arch/arm/include/asm/smp_twd.h | ? ?2 ++
?arch/arm/kernel/smp_twd.c ? ? ?| ? ?7 +++++++
?2 files changed, 9 insertions(+), 0 deletions(-)arch/arm/include/asm/smp_twd.h +2
-0@@ -19,11 +19,13 @@ ?#define TWD_TIMER_CONTROL_IT_ENABLE ? ?(1<< ? ?2) ?struct clock_event_device; +struct clk ; ?extern void __iomem *twd_base; ?void twd_timer_stop(void); ?int twd_timer_ack(void); ?void twd_timer_setup(struct clock_event_device *); +void twd_timer_init (void __iomem *base,struct clk *clk);?#endif
arch/arm/kernel/smp_twd.c +0
-0@@ -17,6 +17,7 @@?#include<linux/clockchips.h>
?#include<linux/irq.h>
?#include<linux/io.h>
+#include<linux/clk.h>?#include<asm/smp_twd.h>
?#include<asm/hardware/gic.h>arch/arm/kernel/smp_twd.c +6
-0@@ -151,6 +152,12 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk) ? ? ? ?clockevents_register_device(clk); ?} +void __init twd_timer_init (void __iomem *base,struct clk *clk) +{ + ? ? ? twd_base = base; + ? ? ? twd_timer_rate = clk_get_rate(clk); +} +Quoted 3 lines
?#ifdef
CONFIG_HOTPLUG_CPU
?/*
?* take a local timer downThe local timers run off the PERIPHCLK in the CPU, which is specified as the CPU clock divided by an implementation defined integer>= 2. If you take the divider value as a parameter to
twd_timer_init, the clock that is passed in can be the cpu's clock.Quoted 8 lines
Quoted 2 lines
That is an implementation detail of the A9. Future designs could be completely asynchronous. Using the clock api works either way.
True. ?That could still be handled by passing a divider of 1. ?For all current implementations, this api will be used with clock that is a constant divider of an existing clock. ?Taking a divider value would avoid having to create a new clock that may not be similar to any other clock in the device.
If I pass in a divider, what clock rate do I divide with it? If I only have the divider, then I'm dependent on knowing CLK freq (the cpu freq in A9 case). Ultimately I have to know the timer clock rate to setup a
clock_eventdevice. I'm open to passing in the clock rate directly, but having the clk ptr is more flexible. Other examples of timer init like i.MX use the same arguments.
Quoted 3 lines
The point of this api is to avoid spending 5 jiffies on the primary cpu to calculate the rate. That is a significant chunk of the kernel boot time. Calling this function is entirely optional and the old way still works.
I like the idea of passing in the clk pointer - it would simplify problems I've been having with rescaling the localtimer when the cpu frequency changes. However, it would reduce the amount of machine-specific code necessary if I could pass in the already-existing clock (cpu clock, for A9), as well as the value of the divider that is present inside cpu (4 for Tegra2).
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 95 lines · Colin Cross
Quoted 90 lines · Rob Herring
Quoted 73 lines · Colin Cross
Quoted 70 lines · Rob Herring
Quoted 67 lines · Colin Cross
Quoted 58 lines · Rob Herring
From: Rob Herring<[email protected]>
The private timer freq is currently dynamically detected using jiffies count to determine the rate. This method adds a delay to boot-up, so use the clock api instead to get the clock rate.
Signed-off-by Rob Herring<[email protected]>--- arch/arm/include/asm/smp_twd.h | 2 ++ arch/arm/kernel/smp_twd.c | 7 +++++++ 2 files changed, 9 insertions(+), 0 deletions(-)arch/arm/include/asm/smp_twd.h +2
-0@@ -19,11 +19,13 @@#define TWD_TIMER_CONTROL_IT_ENABLE (1<< 2)struct clock_event_device ; +struct clk ;extern void __iomem *twd_base;void twd_timer_stop (void );int twd_timer_ack (void );void twd_timer_setup (struct clock_event_device *); +void twd_timer_init (void __iomem *base,struct clk *clk);#endif arch/arm/kernel/smp_twd.c +7
-0@@ -17,6 +17,7 @@#include <linux/clockchips.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/clk.h> #include <asm/smp_twd.h> #include <asm/hardware/gic.h> @@ -151,6 +152,12 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)clockevents_register_device (clk ); } +void __init twd_timer_init (void __iomem *base,struct clk *clk) +{ + twd_base = base; + twd_timer_rate =clk_get_rate (clk); +} +#ifdef CONFIG_HOTPLUG_CPU /* Quoted 1 line
* take a local timer down
The local timers run off the PERIPHCLK in the CPU, which is specified as the CPU clock divided by an implementation defined integer>= 2. If you take the divider value as a parameter to
twd_timer_init, the clock that is passed in can be the cpu's clock.Quoted 8 lines
Quoted 2 lines
That is an implementation detail of the A9. Future designs could be completely asynchronous. Using the clock api works either way.
True. That could still be handled by passing a divider of 1. For all current implementations, this api will be used with clock that is a constant divider of an existing clock. Taking a divider value would avoid having to create a new clock that may not be similar to any other clock in the device.
If I pass in a divider, what clock rate do I divide with it? If I only have the divider, then I'm dependent on knowing CLK freq (the cpu freq in A9 case). Ultimately I have to know the timer clock rate to setup a
clock_eventdevice. I'm open to passing in the clock rate directly, but having the clk ptr is more flexible. Other examples of timer init like i.MX use the same arguments.Quoted 3 lines
The point of this api is to avoid spending 5 jiffies on the primary cpu to calculate the rate. That is a significant chunk of the kernel boot time. Calling this function is entirely optional and the old way still works.
Quoted 6 lines
I like the idea of passing in the clk pointer - it would simplify problems I've been having with rescaling the localtimer when the cpu frequency changes. However, it would reduce the amount of machine-specific code necessary if I could pass in the already-existing clock (cpu clock, for A9), as well as the value of the divider that is present inside cpu (4 for Tegra2).
You are assuming all hardware would have a fixed divider. There is no requirement that the CLK:PERIPHCLK ratio is fixed. Well designed clock controller h/w would support CLK changing while maintaining PERIPHCLK rate or at least support changing the ratio.
You will need to get the clock rate every set_next_event and somehow sync cpu freq changes to when no timers are active on all cores. Or just accept the timer inaccuracy for 1 time. Good luck with that... ;)
What is the problem of defining another clock in the platform? The watchdogs if implemented also need that clock.
Rob
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 11 lines · Rob Herring
Quoted 10 lines · Colin Cross
Quoted 7 lines · On Thu, Sep 30, 2010 at 8:14 PM, Rob Herring<[email protected]> ?wrote:
Quoted 5 lines · Colin Cross
Quoted 2 lines · On Thu, Sep 30, 2010 at 7:03 PM, Rob Herring<[email protected]> ?wrote:
On 09/30/2010 07:49 PM, Colin Cross wrote:
snip
Quoted 36 lines
Quoted 29 lines
Quoted 24 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
The local timers run off the PERIPHCLK in the CPU, which is specified as the CPU clock divided by an implementation defined integer>= 2. If you take the divider value as a parameter to
twd_timer_init, the clock that is passed in can be the cpu's clock.Quoted 8 lines
Quoted 2 lines
That is an implementation detail of the A9. Future designs could be completely asynchronous. Using the clock api works either way.
True. ?That could still be handled by passing a divider of 1. ?For all current implementations, this api will be used with clock that is a constant divider of an existing clock. ?Taking a divider value would avoid having to create a new clock that may not be similar to any other clock in the device.
If I pass in a divider, what clock rate do I divide with it? If I only have
the divider, then I'm dependent on knowing CLK freq (the cpu freq in A9 case). Ultimately I have to know the timer clock rate to setup aclock_event
device. I'm open to passing in the clock rate directly, but having the clk
ptr is more flexible. Other examples of timer init like i.MX use the same arguments.Quoted 4 lines
The point of this api is to avoid spending 5 jiffies on the primary cpu to
calculate the rate. That is a significant chunk of the kernel boot time. Calling this function is entirely optional and the old way still works.Quoted 6 lines
I like the idea of passing in the clk pointer - it would simplify problems I've been having with rescaling the localtimer when the cpu frequency changes. ?However, it would reduce the amount of machine-specific code necessary if I could pass in the already-existing clock (cpu clock, for A9), as well as the value of the divider that is present inside cpu (4 for Tegra2).
Quoted 4 lines
You are assuming all hardware would have a fixed divider. There is no requirement that the CLK:PERIPHCLK ratio is fixed. Well designed clock controller h/w would support CLK changing while maintaining PERIPHCLK rate or at least support changing the ratio.
The ARM specification for Cortex A9 requires a fixed CLK:PERIPHCLK ratio, which AFAICT covers at least 5 out of the 6 current users of the twd driver.
Quoted 3 lines
You will need to get the clock rate every
set_next_eventand somehow sync cpu freq changes to when no timers are active on all cores. Or just accept the timer inaccuracy for 1 time. Good luck with that... ;)
The timer APIs require that a timer take at least as long as requested to fire. If you change the TWD prescaler before the CPU frequency increases, or after the CPU frequency decreases, the timer interrupt will not fire until a small time after the requested time.
Quoted 2 lines
What is the problem of defining another clock in the platform? The watchdogs if implemented also need that clock.
It would be a convenient shortcut. On Tegra, we don't use the A9 watchdog, because it gets powered down in idle. Defining a new clock is not a trivial task - on Tegra we have no fixed dividers like this, so we would need a new clock type. An extra argument, which can be set to 1 if your local timer block has no divider, would save ~20 LoC on each existing platform, but either way would work.
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 4 lines · Colin Cross
The timer APIs require that a timer take at least as long as requested to fire. If you change the TWD prescaler before the CPU frequency increases, or after the CPU frequency decreases, the timer interrupt will not fire until a small time after the requested time.
That maybe - and for TWD which is used for local timer purposes only, that's fine. What wouldn't be fine is if your clocksource counter changes frequency...
In any case, I'm not sure that passing in a struct clk pointer is really the right way to go - the point of the clk API is to remove such passing of static structures.
How about instead using clk_get_sys() to obtain a clock for the TWD?
Do we need separate connection IDs for each TWD, or are all TWDs in a system always clocked together?
PATCH 3/3 ARM: twd_smp: add clock api support
Quoted 10 lines · Russell King - ARM Linux
Quoted 4 lines · Colin Cross
The timer APIs require that a timer take at least as long as requested to fire. If you change the TWD prescaler before the CPU frequency increases, or after the CPU frequency decreases, the timer interrupt will not fire until a small time after the requested time.
That maybe - and for TWD which is used for local timer purposes only, that's fine. What wouldn't be fine is if your clocksource counter changes frequency...
Quoted 5 lines
In any case, I'm not sure that passing in a struct clk pointer is really the right way to go - the point of the clk API is to remove such passing of static structures.
How about instead using
clk_get_sys()to obtain a clock for the TWD?
Okay. Opinions on the name: periphclk, arm_twd, twd?
Quoted 3 lines
Do we need separate connection IDs for each TWD, or are all TWDs in a system always clocked together?
A9 is 1 clock for all. Probably is likely that they will always be symmetric.
Rob
PATCH 1/3 ARM: move timer-sp.c from versatile to common
In reply to Rob HerringQuoted 8 lines · Rob Herring
From: Rob Herring <[email protected]>
The timer-sp h/w used on versatile platforms can also be used for other platforms, so move it to a common location.
Rename timer names for clocksource and clockevent to generic name. Which timer instance is which is platform dependent.
How about move it to drivers/clocksource ?
Best Regards,
J.
PATCH 1/3 ARM: move timer-sp.c from versatile to common
Quoted 6 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 5 lines · Rob Herring
From: Rob Herring<[email protected]>
The timer-sp h/w used on versatile platforms can also be used for other platforms, so move it to a common location.
Quoted 7 lines
Quoted 3 lines
Rename timer names for clocksource and clockevent to generic name. Which timer instance is which is platform dependent.
How about move it to
drivers/clocksource?Best Regards,
J.
I'll defer to Russell. It's not exactly common practice to put timer code there. The ones that are there don't appear to be the primary system timers as they are initialized by initcalls which is not early enough.
Rob
PATCH 1/3 ARM: move timer-sp.c from versatile to common
In reply to Rob HerringWhat happened to 2/3 ?