ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Subsystems (4)
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
The realtime counter called master counter, produces the count used by the private timer peripherals in the MPU_CLUSTER. The CNTFRQ per cpu register is used to denote the frequency of the counter. Currently the frequency value is passed from the
DT file, but this is not scalable when we have other non-DT guest OS. This register must be set to the right value by the secure rom code. Setting this register helps in propagating the right frequency value across OSes.
More discussions and the reason for adding this in a non-DT way can be seen from below.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg93832.html
So configuring this secure register for all the cpus here.
While here, removing the clock-frequency DT entry for omap5 as it is no more needed after this patch.
---
[V4] Updated commit log, removed the redundant entry in OMAP5.dtsi and
a unnecessary newline in timer.c
arch/arm/boot/dts/omap5.dtsi | 1 - arch/arm/mach-omap2/omap-secure.h | 2 ++ arch/arm/mach-omap2/omap-smp.c | 9 +++++++++ arch/arm/mach-omap2/timer.c | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-)
arch/arm/boot/dts/omap5.dtsi +0 -1
@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; }; gic: interrupt-controller at 48211000 {
arch/arm/mach-omap2/omap-secure.h +2 -0
@@ -42,6 +42,8 @@#define OMAP4_MON_L2X0_AUXCTRL_INDEX 0x109#define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113 +#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109 +/* Secure PPA(Primary Protected Application) APIs */ #define OMAP4_PPA_L2_POR_INDEX 0x23#define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25
arch/arm/mach-omap2/omap-smp.c +9 -0
@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;
@@ -66,6 +68,13 @@ static void omap4_secondary_init(unsigned int cpu) 4, 0, 0, 0, 0, 0);/* +* Configure the CNTFRQ register for the secondary cpu's which +* indicates the frequency of the cpu local timers. +*/ +if (soc_is_omap54xx () ||soc_is_dra7xx ()) +omap_smc1 (OMAP5_DRA7_MON_SET_CNTFRQ_INDEX , arch_timer_freq); + +/* * Synchronise with the boot thread. */ spin_lock (&boot_lock);
arch/arm/mach-omap2/timer.c +5 -0
@@ -55,6 +55,7 @@#include "soc.h" #include "common.h" #include "powerdomain.h" +#include "omap-secure.h" #define REALTIME_COUNTER_BASE 0x48243200#define INCREMENTER_NUMERATOR_OFFSET 0x10
@@ -65,6 +66,7 @@static struct omap_dm_timer clkev;static struct clock_event_device clockevent_gpt; +unsigned long arch_timer_freq;static irqreturn_t omap2_gp_timer_interrupt (int irq,void *dev_id) {
@@ -542,6 +544,9 @@ static void __init realtime_counter_init(void) reg |= den;__raw_writel (reg, base +INCREMENTER_DENUMERATOR_RELOAD_OFFSET ); + arch_timer_freq = (rate / den) * num; +omap_smc1 (OMAP5_DRA7_MON_SET_CNTFRQ_INDEX , arch_timer_freq); + iounmap(base); }#else
Signature · 1 line
1.7.9.5
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Hi Tony,
Quoted 109 lines · Sricharan R
The realtime counter called master counter, produces the count used by the private timer peripherals in the
MPU_CLUSTER. The CNTFRQ per cpu register is used to denote the frequency of the counter. Currently the frequency value is passed from the
DT file, but this is not scalable when we have other non-DT guest OS. This register must be set to the right value by the secure rom code. Setting this register helps in propagating the right frequency value across OSes.More discussions and the reason for adding this in a non-DT way can be seen from below.
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg93832.htmlSo configuring this secure register for all the cpus here.
While here, removing the clock-frequency DT entry for omap5 as it is no more needed after this patch.
Cc Santosh Shilimkar <[email protected]>Cc Nishanth Menon <[email protected]>Cc Rajendra Nayak <[email protected]>Cc Marc Zyngier <[email protected]>Cc Mark Rutland <[email protected]>Tested-by Nishanth Menon <[email protected]>Signed-off-by Sricharan R <[email protected]>---
[V4] Updated commit log, removed the redundant entry inOMAP5.dtsiand
a unnecessary newline intimer.carch/arm/boot/dts/omap5.dtsi | 1 - arch/arm/mach-omap2/omap-secure.h | 2 ++ arch/arm/mach-omap2/omap-smp.c | 9 +++++++++ arch/arm/mach-omap2/timer.c | 5 +++++ 4 files changed, 16 insertions(+), 1 deletion(-)arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; }; gic: interrupt-controller at 48211000 {arch/arm/mach-omap2/omap-secure.h +2
-0@@ -42,6 +42,8 @@#define OMAP4_MON_L2X0_AUXCTRL_INDEX 0x109#define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113 +#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109 +/* Secure PPA(Primary Protected Application) APIs */ #define OMAP4_PPA_L2_POR_INDEX 0x23#define OMAP4_PPA_CPU_ACTRL_SMP_INDEX 0x25arch/arm/mach-omap2/omap-smp.c +9
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;@@ -66,6 +68,13 @@ static void omap4_secondary_init(unsigned int cpu) 4, 0, 0, 0, 0, 0);/* +* Configure the CNTFRQ register for the secondary cpu's which +* indicates the frequency of the cpu local timers. +*/ +if (soc_is_omap54xx () ||soc_is_dra7xx ()) +omap_smc1 (OMAP5_DRA7_MON_SET_CNTFRQ_INDEX , arch_timer_freq); + +/* * Synchronise with the boot thread. */ spin_lock (&boot_lock);arch/arm/mach-omap2/timer.c +2
-0@@ -55,6 +55,7 @@#include "soc.h" #include "common.h" #include "powerdomain.h" +#include "omap-secure.h" #define REALTIME_COUNTER_BASE 0x48243200#define INCREMENTER_NUMERATOR_OFFSET 0x10@@ -65,6 +66,7 @@static struct omap_dm_timer clkev;static struct clock_event_device clockevent_gpt; +unsigned long arch_timer_freq;static irqreturn_t omap2_gp_timer_interrupt (int irq,void *dev_id) {
arch/arm/mach-omap2/timer.c static void __init realtime_counter_init(void) · line 552
Quoted 9 lines
arch/arm/mach-omap2/timer.c +3
-0@@ -542,6 +544,9 @@ static void __init realtime_counter_init(void) reg |= den;__raw_writel (reg, base +INCREMENTER_DENUMERATOR_RELOAD_OFFSET ); + arch_timer_freq = (rate / den) * num; +omap_smc1 (OMAP5_DRA7_MON_SET_CNTFRQ_INDEX , arch_timer_freq); + iounmap(base); }#else
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
ARM: DRA7: realtime_counter: Add ratio registers for 20MHZ sys-clk frequency
http://www.spinics.net/lists/linux-omap/msg97281.html
Regards,
Sricharan
Tony Lindgren
maintainerPATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Quoted 11 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi line 57
Quoted 10 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; }; gic: interrupt-controller at 48211000 {
Can the above be done later on in a separate clean-up patch? If so I can drop that part as that removes a dependency to the .dts patches queued by Benoit.
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c line 48
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c +2
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;
No externs in *.c files please, checkpatch.pl and sparse should warn about this.
Quoted 6 lines
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
ARM: DRA7:
realtime_counter: Add ratio registers for 20MHZ sys-clk frequency
The 20MHz patch I've applied, just noticed the above things when was about to apply this.
Regards,
Tony
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Sricharan R
Quoted 9 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; };
Quoted 6 lines
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi line 57
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi +0
-0gic: interrupt-controller at 48211000 {Can the above be done later on in a separate clean-up patch? If so I can drop that part as that removes a dependency to the .dts patches queued by Benoit.
This can be applied separately.
Quoted 18 lines
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c line 48
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c +2
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;No externs in *.c files please, checkpatch.pl and sparse should warn about this.
Quoted 3 lines
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
Quoted 7 lines
Quoted 3 lines
ARM: DRA7:
realtime_counter: Add ratio registers for 20MHZ sys-clk frequencyThe 20MHz patch I've applied, just noticed the above things when was about to apply this.
Now re-looking at the patch, I think this extern stuff can be and should be avoided. It needs order change though like below. Not tested but should work.
arch/arm/mach-omap2/timer.c +1 -2
@@ -631,10 +631,9 @@ void __init omap4_local_timer_init(void)#ifdef CONFIG_SOC_OMAP5 void __init omap5_realtime_timer_init (void ) { -omap4_sync32k_timer_init ();realtime_counter_init (); -clocksource_of_init (); +omap4_sync32k_timer_init (); }#endif /* CONFIG_SOC_OMAP5 */
Then, the CNTFREQ programming needs to be moved to realtime_counter_init(). It should be actually part of that first place instead of timer_init().
On secondary CPU then a simple asm accessor can
read the CNTFREQ and pass that to SMC.
Sricharan,
Can you try above and see if everything works as expected. If it does, please post an updated patch based on above.
Regards,
santosh
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Santosh,
Quoted 67 lines · Santosh Shilimkar
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Sricharan R
Quoted 9 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; };Quoted 5 lines
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi line 57
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi +0
-0gic: interrupt-controller at 48211000 {Can the above be done later on in a separate clean-up patch? If so I can drop that part as that removes a dependency to the .dts patches queued by Benoit.
This can be applied separately.
Quoted 14 lines
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c line 48
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c +2
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;No externs in *.c files please, checkpatch.pl and sparse should warn about this.
Quoted 9 lines
Quoted 6 lines
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
ARM: DRA7:
realtime_counter: Add ratio registers for 20MHZ sys-clk frequencyThe 20MHz patch I've applied, just noticed the above things when was about to apply this.
Now re-looking at the patch, I think this extern stuff can be and should be avoided. It needs order change though like below. Not tested but should work.
arch/arm/mach-omap2/timer.c +1
-2@@ -631,10 +631,9 @@ void __init omap4_local_timer_init(void)#ifdef CONFIG_SOC_OMAP5 void __init omap5_realtime_timer_init (void ) { -omap4_sync32k_timer_init ();realtime_counter_init (); -clocksource_of_init (); +omap4_sync32k_timer_init (); }#endif /* CONFIG_SOC_OMAP5 */ Then, the CNTFREQ programming needs to be moved to
realtime_counter_init(). It should be actually part of that first place instead oftimer_init().
Quoted 2 lines
On secondary CPU then a simple asm accessor can
read the CNTFREQ and pass that to SMC.
Sorry, I did not quite get you here. You mean an asm accessor to
the read the variable that is set in timer.c ?
Regards,
Sricharan
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Quoted 66 lines · Sricharan R
Santosh,
Quoted 63 lines · Santosh Shilimkar
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Sricharan R
Quoted 9 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; };Quoted 5 lines
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi line 57
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi +0
-0gic: interrupt-controller at 48211000 {Can the above be done later on in a separate clean-up patch? If so I can drop that part as that removes a dependency to the .dts patches queued by Benoit.
This can be applied separately.
Quoted 14 lines
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c line 48
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c +2
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;No externs in *.c files please, checkpatch.pl and sparse should warn about this.
Quoted 9 lines
Quoted 6 lines
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
ARM: DRA7:
realtime_counter: Add ratio registers for 20MHZ sys-clk frequencyThe 20MHz patch I've applied, just noticed the above things when was about to apply this.
Now re-looking at the patch, I think this extern stuff can be and should be avoided. It needs order change though like below. Not tested but should work.
arch/arm/mach-omap2/timer.c +1
-2@@ -631,10 +631,9 @@ void __init omap4_local_timer_init(void)#ifdef CONFIG_SOC_OMAP5 void __init omap5_realtime_timer_init (void ) { -omap4_sync32k_timer_init ();realtime_counter_init (); -clocksource_of_init (); +omap4_sync32k_timer_init (); }#endif /* CONFIG_SOC_OMAP5 */
Quoted 8 lines
Quoted 6 lines
Then, the CNTFREQ programming needs to be moved to
realtime_counter_init(). It should be actually part of that first place instead oftimer_init().On secondary CPU then a simple asm accessor can
read the CNTFREQ and pass that to SMC.Sorry, I did not quite get you here. You mean an asm accessor to
the read the variable that is set intimer.c?
Also, is it not ok to move the extern to a .h file instead ?
Regards,
Sricharan
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Quoted 71 lines · Sricharan R
Quoted 70 lines · Sricharan R
Santosh,
Quoted 67 lines · Santosh Shilimkar
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Sricharan R
Quoted 9 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; };Quoted 5 lines
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi line 57
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi +0
-0gic: interrupt-controller at 48211000 {Can the above be done later on in a separate clean-up patch? If so I can drop that part as that removes a dependency to the .dts patches queued by Benoit.
This can be applied separately.
Quoted 14 lines
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c line 48
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c +2
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;No externs in *.c files please, checkpatch.pl and sparse should warn about this.
Quoted 9 lines
Quoted 6 lines
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
ARM: DRA7:
realtime_counter: Add ratio registers for 20MHZ sys-clk frequencyThe 20MHz patch I've applied, just noticed the above things when was about to apply this.
Now re-looking at the patch, I think this extern stuff can be and should be avoided. It needs order change though like below. Not tested but should work.
arch/arm/mach-omap2/timer.c +1
-2@@ -631,10 +631,9 @@ void __init omap4_local_timer_init(void)#ifdef CONFIG_SOC_OMAP5 void __init omap5_realtime_timer_init (void ) { -omap4_sync32k_timer_init ();realtime_counter_init (); -clocksource_of_init (); +omap4_sync32k_timer_init (); }#endif /* CONFIG_SOC_OMAP5 */ Then, the CNTFREQ programming needs to be moved to
realtime_counter_init(). It should be actually part of that first place instead oftimer_init().
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
On secondary CPU then a simple asm accessor can
read the CNTFREQ and pass that to SMC.Sorry, I did not quite get you here. You mean an asm accessor to
the read the variable that is set intimer.c?Also, is it not ok to move the extern to a .h file instead ?
I think you can avoid that variable export with above suggestion
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
In reply to Sricharan RQuoted 66 lines · Sricharan R
Santosh,
Quoted 63 lines · Santosh Shilimkar
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Sricharan R
Quoted 9 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; };Quoted 5 lines
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi line 57
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi +0
-0gic: interrupt-controller at 48211000 {Can the above be done later on in a separate clean-up patch? If so I can drop that part as that removes a dependency to the .dts patches queued by Benoit.
This can be applied separately.
Quoted 14 lines
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c line 48
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c +2
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;No externs in *.c files please, checkpatch.pl and sparse should warn about this.
Quoted 9 lines
Quoted 6 lines
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
ARM: DRA7:
realtime_counter: Add ratio registers for 20MHZ sys-clk frequencyThe 20MHz patch I've applied, just noticed the above things when was about to apply this.
Now re-looking at the patch, I think this extern stuff can be and should be avoided. It needs order change though like below. Not tested but should work.
arch/arm/mach-omap2/timer.c +1
-2@@ -631,10 +631,9 @@ void __init omap4_local_timer_init(void)#ifdef CONFIG_SOC_OMAP5 void __init omap5_realtime_timer_init (void ) { -omap4_sync32k_timer_init ();realtime_counter_init (); -clocksource_of_init (); +omap4_sync32k_timer_init (); }#endif /* CONFIG_SOC_OMAP5 */
Quoted 9 lines
Quoted 6 lines
Then, the CNTFREQ programming needs to be moved to
realtime_counter_init(). It should be actually part of that first place instead oftimer_init().On secondary CPU then a simple asm accessor can
read the CNTFREQ and pass that to SMC.Sorry, I did not quite get you here. You mean an asm accessor to
the read the variable that is set intimer.c?
Reading CNTFREQ CP15 directly....
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Quoted 71 lines · Santosh Shilimkar
Quoted 70 lines · Sricharan R
Santosh,
Quoted 67 lines · Santosh Shilimkar
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Sricharan R
Quoted 9 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; };Quoted 5 lines
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi line 57
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi +0
-0gic: interrupt-controller at 48211000 {Can the above be done later on in a separate clean-up patch? If so I can drop that part as that removes a dependency to the .dts patches queued by Benoit.
This can be applied separately.
Quoted 14 lines
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c line 48
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c +2
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;No externs in *.c files please, checkpatch.pl and sparse should warn about this.
Quoted 9 lines
Quoted 6 lines
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
ARM: DRA7:
realtime_counter: Add ratio registers for 20MHZ sys-clk frequencyThe 20MHz patch I've applied, just noticed the above things when was about to apply this.
Now re-looking at the patch, I think this extern stuff can be and should be avoided. It needs order change though like below. Not tested but should work.
arch/arm/mach-omap2/timer.c +1
-2@@ -631,10 +631,9 @@ void __init omap4_local_timer_init(void)#ifdef CONFIG_SOC_OMAP5 void __init omap5_realtime_timer_init (void ) { -omap4_sync32k_timer_init ();realtime_counter_init (); -clocksource_of_init (); +omap4_sync32k_timer_init (); }#endif /* CONFIG_SOC_OMAP5 */ Then, the CNTFREQ programming needs to be moved to
realtime_counter_init(). It should be actually part of that first place instead oftimer_init().
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
On secondary CPU then a simple asm accessor can
read the CNTFREQ and pass that to SMC.Sorry, I did not quite get you here. You mean an asm accessor to
the read the variable that is set intimer.c?Reading CNTFREQ CP15 directly....
Sorry, Still not clear. CNTFREQ is per-cpu register. So when
the secondary cpu init happens on CPU1, then you mean we will have to read it from CPU0 register and pass it for secondary ?
Regards,
Sricharan
PATCH v4 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register
Quoted 77 lines · Sricharan R
Quoted 76 lines · Santosh Shilimkar
Quoted 75 lines · Sricharan R
Santosh,
Quoted 67 lines · Santosh Shilimkar
Quoted 11 lines · Tony Lindgren
Quoted 10 lines · Sricharan R
Quoted 9 lines · Sricharan R
arch/arm/boot/dts/omap5.dtsi +0
-1@@ -52,7 +52,6 @@ <GIC_PPI 14 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 11 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>, <GIC_PPI 10 (GIC_CPU_MASK_RAW(3) | IRQ_TYPE_LEVEL_LOW)>; - clock-frequency = <6144000>; };Quoted 5 lines
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi line 57
Quoted 1 line
arch/arm/boot/dts/omap5.dtsi +0
-0gic: interrupt-controller at 48211000 {Can the above be done later on in a separate clean-up patch? If so I can drop that part as that removes a dependency to the .dts patches queued by Benoit.
This can be applied separately.
Quoted 14 lines
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c line 48
Quoted 11 lines
arch/arm/mach-omap2/omap-smp.c +2
-0@@ -41,6 +41,8 @@u16 pm44xx_errata; +extern unsigned long arch_timer_freq; +/* SCU base address */ static void __iomem *scu_base;No externs in *.c files please, checkpatch.pl and sparse should warn about this.
Quoted 9 lines
Quoted 6 lines
Are you planning to pull this patch and the below $subject patch as well? They are acked and tested.
ARM: DRA7:
realtime_counter: Add ratio registers for 20MHZ sys-clk frequencyThe 20MHz patch I've applied, just noticed the above things when was about to apply this.
Now re-looking at the patch, I think this extern stuff can be and should be avoided. It needs order change though like below. Not tested but should work.
arch/arm/mach-omap2/timer.c +1
-2@@ -631,10 +631,9 @@ void __init omap4_local_timer_init(void)#ifdef CONFIG_SOC_OMAP5 void __init omap5_realtime_timer_init (void ) { -omap4_sync32k_timer_init ();realtime_counter_init (); -clocksource_of_init (); +omap4_sync32k_timer_init (); }#endif /* CONFIG_SOC_OMAP5 */ Then, the CNTFREQ programming needs to be moved to
realtime_counter_init(). It should be actually part of that first place instead oftimer_init().Quoted 2 lines
On secondary CPU then a simple asm accessor can
read the CNTFREQ and pass that to SMC.Sorry, I did not quite get you here. You mean an asm accessor to
the read the variable that is set intimer.c?
Quoted 6 lines
Quoted 2 lines
Reading CNTFREQ CP15 directly....
Sorry, Still not clear. CNTFREQ is per-cpu register. So when
the secondary cpu init happens on CPU1, then you mean we will have to read it from CPU0 register and pass it for secondary ?
Create a function within timer.c which sets the freq for a given CPU. On Boot CPU you figure out frequency and then just use that static variable.
Regards,
Santosh