Skip to contentSkip to conversation

ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register

PATCH New Sricharan R 4 participants 12 messages Sep 18, 2013 – Oct 8, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 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
host OS, as this will be propagated to the guests as well.

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.

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]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/omap-secure.h |    2 ++
 arch/arm/mach-omap2/omap-smp.c    |    9 +++++++++
 arch/arm/mach-omap2/timer.c       |    6 ++++++
 3 files changed, 17 insertions(+)
arch/arm/mach-omap2/omap-secure.h +2 -0
index a171a5a..4de9a00 100644
@@ -51,6 +51,8 @@
 
 #define OMAP5_MON_AMBA_IF_INDEX		0x108
 
+#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
index 98a1146..00873b4 100644
@@ -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 __cpuinit 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 +6 -0
index fd9238d..2c499f3 100644
@@ -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)
 {
@@ -546,7 +548,11 @@ static void __init realtime_counter_init(void)
 	reg |= den;
 	__raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
 
+	arch_timer_freq = (rate / den) * num;
+
 	iounmap(base);
+
+	omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq);
 }
 #else
 static inline void __init realtime_counter_init(void)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register

Quoted 14 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
host OS, as this will be propagated to the guests as well.

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.

Quoted 7 lines
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]>
Cc Tony Lindgren <[email protected]>

thanks for a better alternative.

[...]

Signature · 2 lines
Regards,
Nishanth Menon
#2 lore raw

PATCH 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register

In reply to Sricharan R
Quoted 8 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
host OS, as this will be propagated to the guests as well.

Its not host OS but ROM code/secure code. Host OS is not ideal place to set it up.

Quoted 24 lines

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.

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]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/omap-secure.h |    2 ++
 arch/arm/mach-omap2/omap-smp.c    |    9 +++++++++
 arch/arm/mach-omap2/timer.c       |    6 ++++++
 3 files changed, 17 insertions(+)
arch/arm/mach-omap2/omap-secure.h +0 -0
index a171a5a..4de9a00 100644

arch/arm/mach-omap2/omap-secure.h line 55

Quoted 5 lines
arch/arm/mach-omap2/omap-secure.h +2 -0
@@ -51,6 +51,8 @@
 
 #define OMAP5_MON_AMBA_IF_INDEX		0x108
 
+#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX	0x109
+

Nice. Looks like OMAP5 ES2.0 addition which I missed.

Quoted 17 lines
arch/arm/mach-omap2/omap-secure.h +0 -0
 /* 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 +2 -0
index 98a1146..00873b4 100644
@@ -41,6 +41,8 @@
 
 u16 pm44xx_errata;
 
+extern unsigned long arch_timer_freq;
+
 /* SCU base address */
 static void __iomem *scu_base;
 

arch/arm/mach-omap2/omap-smp.c static void __cpuinit omap4_secondary_init(unsigned int cpu) · line 74

Quoted 7 lines
arch/arm/mach-omap2/omap-smp.c +4 -0
@@ -66,6 +68,13 @@ static void __cpuinit 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())

CNTFREQ programming was not supported on OMAP5 ES1.0 and that was one of the reason this parameter came into picture. So you need to skip the ES1.0 here.

Quoted 27 lines
arch/arm/mach-omap2/omap-smp.c +3 -0
+		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
index fd9238d..2c499f3 100644
@@ -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 555

Quoted 8 lines
arch/arm/mach-omap2/timer.c +4 -0
@@ -546,7 +548,11 @@ static void __init realtime_counter_init(void)
 	reg |= den;
 	__raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
 
+	arch_timer_freq = (rate / den) * num;
+
 	iounmap(base);
+
+	omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq);

Few problems with this approach..

1. CNTFREQ needs to be programmed on all CPUs. Even though arch-timer code uses boot-cpu now thats not safe for guest which can start on secondary CPUs. So please update this in secondary boot path as well.

2. When you power cycle CPU, you will loose the value of this register so you need to reprogram them on every CPU power up. Both DRA and OMAP5 doesn't support that part yet but do remember to patch that when such support gets added.

Can you please fix above comments and repost. I will ack that then.

Regards,
Santosh

#3 lore raw

PATCH 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register

Quoted 11 lines · Santosh Shilimkar
Quoted 8 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
host OS, as this will be propagated to the guests as well.

Its not host OS but ROM code/secure code. Host OS is not ideal place to set it up.

ok, so you are suggesting to re word this right ?

Quoted 50 lines
Quoted 24 lines

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.

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]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/omap-secure.h |    2 ++
 arch/arm/mach-omap2/omap-smp.c    |    9 +++++++++
 arch/arm/mach-omap2/timer.c       |    6 ++++++
 3 files changed, 17 insertions(+)
arch/arm/mach-omap2/omap-secure.h +0 -0
index a171a5a..4de9a00 100644

arch/arm/mach-omap2/omap-secure.h line 55

Quoted 5 lines
arch/arm/mach-omap2/omap-secure.h +2 -0
@@ -51,6 +51,8 @@
 
 #define OMAP5_MON_AMBA_IF_INDEX		0x108
 
+#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX	0x109
+

Nice. Looks like OMAP5 ES2.0 addition which I missed.

Quoted 19 lines
arch/arm/mach-omap2/omap-secure.h +0 -0
 /* 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 +2 -0
index 98a1146..00873b4 100644
@@ -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 __cpuinit omap4_secondary_init(unsigned int cpu)
 							4, 0, 0, 0, 0, 0);
 
Quoted 8 lines

arch/arm/mach-omap2/omap-smp.c static void __cpuinit omap4_secondary_init(unsigned int cpu) · line 74

Quoted 5 lines
arch/arm/mach-omap2/omap-smp.c +4 -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())

CNTFREQ programming was not supported on OMAP5 ES1.0 and that was one of the reason this parameter came into picture. So you need to skip the ES1.0 here.

We do not intend to support ES1.0 right ? . ok then id.c needs to be cleaned up to remove ES1.0 traces.

Quoted 37 lines
Quoted 27 lines
arch/arm/mach-omap2/omap-smp.c +3 -0
+		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
index fd9238d..2c499f3 100644
@@ -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 555

Quoted 8 lines
arch/arm/mach-omap2/timer.c +4 -0
@@ -546,7 +548,11 @@ static void __init realtime_counter_init(void)
 	reg |= den;
 	__raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
 
+	arch_timer_freq = (rate / den) * num;
+
 	iounmap(base);
+
+	omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq);

Few problems with this approach..

Quoted 3 lines

1. CNTFREQ needs to be programmed on all CPUs. Even though arch-timer code uses boot-cpu now thats not safe for guest which can start on secondary CPUs. So please update this in secondary boot path as well.

The patch is doing this for secondary cpu's as well in the call back omap4_secondary_init.

Quoted 4 lines

2. When you power cycle CPU, you will loose the value of this register so you need to reprogram them on every CPU power up. Both DRA and OMAP5 doesn't support that part yet but do remember to patch that when such support gets added.

oh ok. did not realize this. Will add the change for this then.

Quoted 5 lines

Can you please fix above comments and repost. I will ack that then.

Regards,
Santosh

Regards,
Sricharan

#4 lore raw

PATCH 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register

Quoted 71 lines · Sricharan R
Quoted 11 lines · Santosh Shilimkar
Quoted 8 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
host OS, as this will be propagated to the guests as well.

Its not host OS but ROM code/secure code. Host OS is not ideal place to set it up.

ok, so you are suggesting to re word this right ?

Quoted 50 lines
Quoted 24 lines

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.

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]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/omap-secure.h |    2 ++
 arch/arm/mach-omap2/omap-smp.c    |    9 +++++++++
 arch/arm/mach-omap2/timer.c       |    6 ++++++
 3 files changed, 17 insertions(+)
arch/arm/mach-omap2/omap-secure.h +0 -0
index a171a5a..4de9a00 100644

arch/arm/mach-omap2/omap-secure.h line 55

Quoted 5 lines
arch/arm/mach-omap2/omap-secure.h +2 -0
@@ -51,6 +51,8 @@
 
 #define OMAP5_MON_AMBA_IF_INDEX		0x108
 
+#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX	0x109
+

Nice. Looks like OMAP5 ES2.0 addition which I missed.

Quoted 19 lines
arch/arm/mach-omap2/omap-secure.h +0 -0
 /* 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 +2 -0
index 98a1146..00873b4 100644
@@ -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 __cpuinit omap4_secondary_init(unsigned int cpu)
 							4, 0, 0, 0, 0, 0);
 
Quoted 8 lines

arch/arm/mach-omap2/omap-smp.c static void __cpuinit omap4_secondary_init(unsigned int cpu) · line 74

Quoted 5 lines
arch/arm/mach-omap2/omap-smp.c +4 -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())

CNTFREQ programming was not supported on OMAP5 ES1.0 and that was one of the reason this parameter came into picture. So you need to skip the ES1.0 here.

Quoted 2 lines

We do not intend to support ES1.0 right ? . ok then id.c needs to be cleaned up to remove ES1.0 traces.

yes. With clean-up ES1.0, this can stay as is.

Quoted 37 lines
Quoted 37 lines
Quoted 27 lines
arch/arm/mach-omap2/omap-smp.c +3 -0
+		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
index fd9238d..2c499f3 100644
@@ -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 555

Quoted 8 lines
arch/arm/mach-omap2/timer.c +4 -0
@@ -546,7 +548,11 @@ static void __init realtime_counter_init(void)
 	reg |= den;
 	__raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
 
+	arch_timer_freq = (rate / den) * num;
+
 	iounmap(base);
+
+	omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq);

Few problems with this approach..

Quoted 6 lines
Quoted 3 lines

1. CNTFREQ needs to be programmed on all CPUs. Even though arch-timer code uses boot-cpu now thats not safe for guest which can start on secondary CPUs. So please update this in secondary boot path as well.

The patch is doing this for secondary cpu's as well in the call back omap4_secondary_init.

NM just pointed out this off-list.

Quoted 5 lines
Quoted 4 lines

2. When you power cycle CPU, you will loose the value of this register so you need to reprogram them on every CPU power up. Both DRA and OMAP5 doesn't support that part yet but do remember to patch that when such support gets added.

oh ok. did not realize this. Will add the change for this then.

Since PM isn't supported for now, the patch looks alright with ES1.0 support gets dropped. Just fix the change-log.

Feel free to add my ack on updated version.

Regards,
Santosh

#5 lore raw

PATCH 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register

Quoted 126 lines · Santosh Shilimkar
Quoted 71 lines · Sricharan R
Quoted 11 lines · Santosh Shilimkar
Quoted 8 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
host OS, as this will be propagated to the guests as well.

Its not host OS but ROM code/secure code. Host OS is not ideal place to set it up.

ok, so you are suggesting to re word this right ?

Quoted 50 lines
Quoted 24 lines

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.

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]>
Cc Tony Lindgren <[email protected]>
---
 arch/arm/mach-omap2/omap-secure.h |    2 ++
 arch/arm/mach-omap2/omap-smp.c    |    9 +++++++++
 arch/arm/mach-omap2/timer.c       |    6 ++++++
 3 files changed, 17 insertions(+)
arch/arm/mach-omap2/omap-secure.h +0 -0
index a171a5a..4de9a00 100644

arch/arm/mach-omap2/omap-secure.h line 55

Quoted 5 lines
arch/arm/mach-omap2/omap-secure.h +2 -0
@@ -51,6 +51,8 @@
 
 #define OMAP5_MON_AMBA_IF_INDEX		0x108
 
+#define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX	0x109
+

Nice. Looks like OMAP5 ES2.0 addition which I missed.

Quoted 19 lines
arch/arm/mach-omap2/omap-secure.h +0 -0
 /* 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 +2 -0
index 98a1146..00873b4 100644
@@ -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 __cpuinit omap4_secondary_init(unsigned int cpu)
 							4, 0, 0, 0, 0, 0);
 
Quoted 8 lines

arch/arm/mach-omap2/omap-smp.c static void __cpuinit omap4_secondary_init(unsigned int cpu) · line 74

Quoted 5 lines
arch/arm/mach-omap2/omap-smp.c +4 -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())

CNTFREQ programming was not supported on OMAP5 ES1.0 and that was one of the reason this parameter came into picture. So you need to skip the ES1.0 here.

Quoted 2 lines

We do not intend to support ES1.0 right ? . ok then id.c needs to be cleaned up to remove ES1.0 traces.

yes. With clean-up ES1.0, this can stay as is.

Quoted 37 lines
Quoted 37 lines
Quoted 27 lines
arch/arm/mach-omap2/omap-smp.c +3 -0
+		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
index fd9238d..2c499f3 100644
@@ -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 555

Quoted 8 lines
arch/arm/mach-omap2/timer.c +4 -0
@@ -546,7 +548,11 @@ static void __init realtime_counter_init(void)
 	reg |= den;
 	__raw_writel(reg, base + INCREMENTER_DENUMERATOR_RELOAD_OFFSET);
 
+	arch_timer_freq = (rate / den) * num;
+
 	iounmap(base);
+
+	omap_smc1(OMAP5_DRA7_MON_SET_CNTFRQ_INDEX, arch_timer_freq);

Few problems with this approach..

Quoted 6 lines
Quoted 3 lines

1. CNTFREQ needs to be programmed on all CPUs. Even though arch-timer code uses boot-cpu now thats not safe for guest which can start on secondary CPUs. So please update this in secondary boot path as well.

The patch is doing this for secondary cpu's as well in the call back omap4_secondary_init.

NM just pointed out this off-list.

Quoted 4 lines
Quoted 4 lines

2. When you power cycle CPU, you will loose the value of this register so you need to reprogram them on every CPU power up. Both DRA and OMAP5 doesn't support that part yet but do remember to patch that when such support gets added.

Quoted 5 lines
Quoted 1 line

oh ok. did not realize this. Will add the change for this then.

Since PM isn't supported for now, the patch looks alright with ES1.0 support gets dropped. Just fix the change-log.

Feel free to add my ack on updated version.

Thanks. Will repost with the updated log and ack.

Regards,
Sricharan

#6 lore raw

PATCH 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register

In reply to Santosh Shilimkar
Quoted 1 line · Santosh Shilimkar

On Wednesday 18 September 2013 07:23 AM, Sricharan R wrote:

[...]

						4, 0, 0, 0, 0, 0);
Quoted 10 lines

arch/arm/mach-omap2/omap-smp.c static void __cpuinit omap4_secondary_init(unsigned int cpu) · line 74

Quoted 6 lines
arch/arm/mach-omap2/omap-smp.c +4 -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())

CNTFREQ programming was not supported on OMAP5 ES1.0 and that was one of the reason this parameter came into picture. So you need to skip the ES1.0 here.

Even though ES1.0 is present in id.c, we have 0 support for ES1.0.

ES1.0 was more or less a test chip, no production devices were manufactured with it, no public boards (including uevms) are available to purchase with ES1.0. Further, inside TI, all ES1.0 samples and boards have been scrapped and replaced with ES2.0 platforms.

In short, no users and dead code in kernel tree. I dont see why we cant just cleanup OMAP5 ES1.0 entirely from kernel tree?

Signature · 2 lines
Regards,
Nishanth Menon
#7 lore raw

PATCH 1/1 ARM: OMAP5/DRA7: realtime_counter: Configure CNTFRQ register

Quoted 16 lines · Nishanth Menon
Quoted 1 line · Santosh Shilimkar

On Wednesday 18 September 2013 07:23 AM, Sricharan R wrote:

[...]

						4, 0, 0, 0, 0, 0);
Quoted 10 lines

arch/arm/mach-omap2/omap-smp.c static void __cpuinit omap4_secondary_init(unsigned int cpu) · line 74

Quoted 6 lines
arch/arm/mach-omap2/omap-smp.c +4 -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())

CNTFREQ programming was not supported on OMAP5 ES1.0 and that was one of the reason this parameter came into picture. So you need to skip the ES1.0 here.

Even though ES1.0 is present in id.c, we have 0 support for ES1.0.

Quoted 8 lines

ES1.0 was more or less a test chip, no production devices were manufactured with it, no public boards (including uevms) are available to purchase with ES1.0. Further, inside TI, all ES1.0 samples and boards have been scrapped and replaced with ES2.0 platforms.

In short, no users and dead code in kernel tree. I dont see why we cant just cleanup OMAP5 ES1.0 entirely from kernel tree?

Yes...There is no reason to keep broken ES1.0 support. Patch please ;-)

Regards,
Santosh

#8 lore raw

PATCH 1/1 ARM: OMAP5: id: Remove ES1.0 support

In reply to Nishanth Menon

OMAP5 ES1.0 was intended as a test chip and has major register level differences w.r.t ES2.0 revision of the chip. All register defines, dts support has been solely added for ES2.0 version of the chip. Further, all ES1.0 chips and platforms are supposed to have been removed from circulation. Hence, there is no need to further retain any resemblence of ES1.0 support in id detection code.

Remove the omap_revision handling and BUG() instead to prevent folks who mistakenly try an older unsupported chip and report bogus errors.

Cc Santosh Shilimkar <[email protected]>

---
ref: http://marc.info/?l=linux-omap&m=137951198232339&w=2
based on 3.12-rc1 tag

 arch/arm/mach-omap2/id.c  |    8 ++++----
 arch/arm/mach-omap2/soc.h |    2 --
 2 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/id.c +4 -4
index 0289adc..4f8f1cb 100644
@@ -576,8 +576,8 @@ void __init omap5xxx_check_revision(void)
 	case 0xb942:
 		switch (rev) {
 		case 0:
-			omap_revision = OMAP5430_REV_ES1_0;
-			break;
+			/* No support for ES1.0 Test chip */
+			BUG();
 		case 1:
 		default:
 			omap_revision = OMAP5430_REV_ES2_0;
@@ -587,8 +587,8 @@ void __init omap5xxx_check_revision(void)
 	case 0xb998:
 		switch (rev) {
 		case 0:
-			omap_revision = OMAP5432_REV_ES1_0;
-			break;
+			/* No support for ES1.0 Test chip */
+			BUG();
 		case 1:
 		default:
 			omap_revision = OMAP5432_REV_ES2_0;
arch/arm/mach-omap2/soc.h +0 -2
index 4588df1..076bd90 100644
@@ -455,9 +455,7 @@ IS_OMAP_TYPE(3430, 0x3430)
 #define OMAP4470_REV_ES1_0	(OMAP447X_CLASS | (0x10 << 8))
 
 #define OMAP54XX_CLASS		0x54000054
-#define OMAP5430_REV_ES1_0	(OMAP54XX_CLASS | (0x30 << 16) | (0x10 << 8))
 #define OMAP5430_REV_ES2_0	(OMAP54XX_CLASS | (0x30 << 16) | (0x20 << 8))
-#define OMAP5432_REV_ES1_0	(OMAP54XX_CLASS | (0x32 << 16) | (0x10 << 8))
 #define OMAP5432_REV_ES2_0	(OMAP54XX_CLASS | (0x32 << 16) | (0x20 << 8))
 
 void omap2xxx_check_revision(void);
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH 1/1 ARM: OMAP5: id: Remove ES1.0 support

Quoted 7 lines · Nishanth Menon

OMAP5 ES1.0 was intended as a test chip and has major register level differences w.r.t ES2.0 revision of the chip. All register defines, dts support has been solely added for ES2.0 version of the chip. Further, all ES1.0 chips and platforms are supposed to have been removed from circulation. Hence, there is no need to further retain any resemblence of ES1.0 support in id detection code.

Quoted 9 lines

Remove the omap_revision handling and BUG() instead to prevent folks who mistakenly try an older unsupported chip and report bogus errors.

Cc Santosh Shilimkar <[email protected]>

---
ref: http://marc.info/?l=linux-omap&m=137951198232339&w=2
based on 3.12-rc1 tag

That was quick ...

maintainer
#10 lore raw

PATCH 1/1 ARM: OMAP5: id: Remove ES1.0 support

Quoted 11 lines · Santosh Shilimkar
Quoted 10 lines · Nishanth Menon

OMAP5 ES1.0 was intended as a test chip and has major register level differences w.r.t ES2.0 revision of the chip. All register defines, dts support has been solely added for ES2.0 version of the chip. Further, all ES1.0 chips and platforms are supposed to have been removed from circulation. Hence, there is no need to further retain any resemblence of ES1.0 support in id detection code.

Remove the omap_revision handling and BUG() instead to prevent folks who mistakenly try an older unsupported chip and report bogus errors.

Quoted 8 lines
Quoted 6 lines
Cc Santosh Shilimkar <[email protected]>

---
ref: http://marc.info/?l=linux-omap&m=137951198232339&w=2
based on 3.12-rc1 tag

That was quick ...

Heh, it was made, but not supposed to be used, and still merged to mainline kernel..

I guess this is the way to deal with this issue as we don't have really any omap5 es1 support in place. So applying into omap-for-v3.13/soc branch.

Tony

#11 lore raw

PATCH 1/1 ARM: OMAP5: id: Remove ES1.0 support

Quoted 18 lines · Tony Lindgren
Quoted 17 lines · Santosh Shilimkar
Quoted 16 lines · Nishanth Menon

OMAP5 ES1.0 was intended as a test chip and has major register level differences w.r.t ES2.0 revision of the chip. All register defines, dts support has been solely added for ES2.0 version of the chip. Further, all ES1.0 chips and platforms are supposed to have been removed from circulation. Hence, there is no need to further retain any resemblence of ES1.0 support in id detection code.

Remove the omap_revision handling and BUG() instead to prevent folks who mistakenly try an older unsupported chip and report bogus errors.

Cc Santosh Shilimkar <[email protected]>

---
ref: http://marc.info/?l=linux-omap&m=137951198232339&w=2
based on 3.12-rc1 tag

Quoted 6 lines
Quoted 2 lines

That was quick ...

Heh, it was made, but not supposed to be used, and still merged to mainline kernel..

You know the history. At least for this silicon we avoided tons of datafiles merges for ES1.0 which changed completely for ES2.0. At least during that period people had choice to merge the data-files based on the board they have to test out ;-)

Quoted 4 lines

I guess this is the way to deal with this issue as we don't have really any omap5 es1 support in place. So applying into omap-for-v3.13/soc branch.

Thanks !!

Regards,
Santosh