Skip to contentSkip to conversation

ARM: OMAP: Make OMAP clocksource source selection runtime

PATCH Superseded Vaibhav Hiremath 6 participants 14 messages May 2, 2012 – May 7, 2012

Subsystems (5)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover ARM: OMAP: Make OMAP clocksource source selection runtime

Current OMAP code supports couple of clocksource options based on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz)

This patch series cleans up the existing 32k-sync timer implementation, movind SoC init code to respective files (mach-omap1/timer32k.c and mach-omap2/timer.c) and uses kernel parameter to override the default clocksource of "counter_32k", also in order to support some OMAP based derivative SoCs like AM33XX which doesn't have 32K sync-timer hardware IP, adds hwmod lookup for omap2+ devices, and if lookup fails then fall back to gp-timer.

if(use_gptimer_clksrc == true)

	gptimer clocksource init;
else if (counter_32 init == false)
	/* Fallback to gptimer */
	gptimer clocksource init(;

With this, we should be able to support multi-omap boot including devices with/without 32k-sync timer.

This patch-series has been boot tested on AM37xEVM platform, it would be helpful if somebody help me to validate it on OMAP1/2 platforms.

The patches are also available at (based on linux-omap/master) -
https://github.com/hvaibhav/am335x-linux 32ksync-timer-cleanup

History:
========
Changes from V5:
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg67163.html
- 2 of the original patch-series (1/3 and 2/3) has already been accepted and queued by Paul, so removing them.
Also, add 2 new patches,
- OMAP2 timer32k cleanup, check for return values.
- Changed name of system timers, "gp timer" => "gp_timer".
- Moved SoC specific init code to respective files (mach-omap1/timer32k.c and mach-omap2/timer.c)

Changes from V4:
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg67019.html
- Fix the possible bug, leftover the cnt addr argument to clocksource_mmio_init().

Changes from V3:
http://www.mail-archive.com/linux-omap at vger.kernel.org/msg66462.html
- Fixed all review comments from Kevin H
* Moved counter_32k CR register offset handling to counter_32k.c file, so now, calling funtion don't have to maintain or add offset to base addr.
* Added comment for function omap_init_clocksource_32k()
* Used resource_size() for calculate size
* Convert WARN_ON to pr_warn

Changes from V2:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/092037.html
- Added early_param support to read clocksource selection from user through kernel parameter ("clocksource=")
- Converted to ocp_if changes from Paul

Changes from V1:
http://lists.infradead.org/pipermail/linux-arm-kernel/2012-January/081037.html
- Based on Tony's comment, added pbase & size argument to omap_init_clocksource_32k(), to avoid cpu_is_xxx() check.
- Added commit description based on discussion on list (Thanks to Santosh here)
- Reorder patch sequence

Vaibhav Hiremath (3):
ARM: OMAP1: FIX: check possible error condition in timer_init
ARM: OMAP2+: Replace space=>underscore in the name field of system
timers
ARM: OMAP: Make OMAP clocksource source selection using kernel param

 arch/arm/mach-omap1/common.h             |   10 ++-
 arch/arm/mach-omap1/time.c               |   16 +----
 arch/arm/mach-omap1/timer32k.c           |   28 ++++++-
 arch/arm/mach-omap2/timer.c              |  118 +++++++++++++++++++++++------
 arch/arm/plat-omap/counter_32k.c         |   91 ++++++++++-------------
 arch/arm/plat-omap/include/plat/common.h |    2 +-
 6 files changed, 167 insertions(+), 98 deletions(-)
#1 lore raw

PATCH v6 1/3 ARM: OMAP1: FIX: check possible error condition in timer_init

OMAP1, omap_32k_timer_init() function always returns "true", irrespective of whether error occurred while initializing 32k sync counter as a kernel clocksource or not and execution will never fallback to mpu_timer clocksource init code.

This patch adds check for return value from function omap_init_clocksource_32k(), and fallback to omap_mpu_timer_init() in case of failure/error from omap_init_clocksource_32k().

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>

---
This is new patch addition compared to original series (<=V5).

Also, note that, this patch is only compile tested, since I do not have omap1 board with me to validate it. Kevin, can you help me to validate it.

 arch/arm/mach-omap1/common.h   |   10 +++++++++-
 arch/arm/mach-omap1/time.c     |   16 +---------------
 arch/arm/mach-omap1/timer32k.c |   13 +++++++++----
 3 files changed, 19 insertions(+), 20 deletions(-)
arch/arm/mach-omap1/common.h +9 -1
index 8cc616e..e8c9ad3 100644
@@ -63,7 +63,15 @@ extern void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
 			       unsigned int ctrl);
 
 extern struct sys_timer omap1_timer;
-extern bool omap_32k_timer_init(void);
+
+#ifdef CONFIG_OMAP_32K_TIMER
+extern int omap_32k_timer_init(void);
+#else
+static int __init omap_32k_timer_init(void)
+{
+	return -ENODEV;
+}
+#endif
 
 extern u32 omap_irq_flags;
 
arch/arm/mach-omap1/time.c +1 -15
index 4d8dd9a..4062480 100644
@@ -232,20 +232,6 @@ static inline void omap_mpu_timer_init(void)
 }
 #endif	/* CONFIG_OMAP_MPU_TIMER */
 
-static inline int omap_32k_timer_usable(void)
-{
-	int res = false;
-
-	if (cpu_is_omap730() || cpu_is_omap15xx())
-		return res;
-
-#ifdef CONFIG_OMAP_32K_TIMER
-	res = omap_32k_timer_init();
-#endif
-
-	return res;
-}
-
 /*
  * ---------------------------------------------------------------------------
  * Timer initialization
@@ -253,7 +239,7 @@ static inline int omap_32k_timer_usable(void)
  */
 static void __init omap1_timer_init(void)
 {
-	if (!omap_32k_timer_usable())
+	if (omap_32k_timer_init() != 0)
 		omap_mpu_timer_init();
 }
 
arch/arm/mach-omap1/timer32k.c +9 -4
index 325b9a0..e3613a8 100644
@@ -182,10 +182,15 @@ static __init void omap_init_32k_timer(void)
  * Timer initialization
  * ---------------------------------------------------------------------------
  */
-bool __init omap_32k_timer_init(void)
+int __init omap_32k_timer_init(void)
 {
-	omap_init_clocksource_32k();
-	omap_init_32k_timer();
+	int ret = -ENODEV;
 
-	return true;
+	if (cpu_is_omap16xx())
+		ret = omap_init_clocksource_32k();
+
+	if (!ret)
+		omap_init_32k_timer();
+
+	return ret;
 }

--
1.7.0.4

#2 lore raw

PATCH v6 1/3 ARM: OMAP1: FIX: check possible error condition in timer_init

Quoted 14 lines · Vaibhav Hiremath

OMAP1, omap_32k_timer_init() function always returns "true", irrespective of whether error occurred while initializing 32k sync counter as a kernel clocksource or not and execution will never fallback to mpu_timer clocksource init code.

This patch adds check for return value from function omap_init_clocksource_32k(), and fallback to omap_mpu_timer_init() in case of failure/error from omap_init_clocksource_32k().

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
Quoted 6 lines

---
This is new patch addition compared to original series (<=V5).

Also, note that, this patch is only compile tested, since I do not have omap1 board with me to validate it. Kevin, can you help me to validate it.

I boot tested on OMAP1 (5912/OSK) with 32k timer and MPU timer Kconfigs. Works fine, but needs small change below for compile warnings.

Otherwise, looks good.

Quoted 10 lines
 arch/arm/mach-omap1/common.h   |   10 +++++++++-
 arch/arm/mach-omap1/time.c     |   16 +---------------
 arch/arm/mach-omap1/timer32k.c |   13 +++++++++----
 3 files changed, 19 insertions(+), 20 deletions(-)
arch/arm/mach-omap1/common.h +0 -0
index 8cc616e..e8c9ad3 100644

arch/arm/mach-omap1/common.h extern void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd, · line 70

Quoted 9 lines
arch/arm/mach-omap1/common.h +5 -1
@@ -63,7 +63,15 @@ extern void omap1_nand_cmd_ctl(struct mtd_info *mtd, int cmd,
 			       unsigned int ctrl);
 
 extern struct sys_timer omap1_timer;
-extern bool omap_32k_timer_init(void);
+
+#ifdef CONFIG_OMAP_32K_TIMER
+extern int omap_32k_timer_init(void);
+#else
+static int __init omap_32k_timer_init(void)

This needs to be inline. Compile test on OMAP1 with
CONFIG_OMAP_32K_TIMER=n to see why.

Quoted 72 lines
arch/arm/mach-omap1/common.h +4 -0
+{
+	return -ENODEV;
+}
+#endif
 
 extern u32 omap_irq_flags;
 
arch/arm/mach-omap1/time.c +1 -15
index 4d8dd9a..4062480 100644
@@ -232,20 +232,6 @@ static inline void omap_mpu_timer_init(void)
 }
 #endif	/* CONFIG_OMAP_MPU_TIMER */
 
-static inline int omap_32k_timer_usable(void)
-{
-	int res = false;
-
-	if (cpu_is_omap730() || cpu_is_omap15xx())
-		return res;
-
-#ifdef CONFIG_OMAP_32K_TIMER
-	res = omap_32k_timer_init();
-#endif
-
-	return res;
-}
-
 /*
  * ---------------------------------------------------------------------------
  * Timer initialization
@@ -253,7 +239,7 @@ static inline int omap_32k_timer_usable(void)
  */
 static void __init omap1_timer_init(void)
 {
-	if (!omap_32k_timer_usable())
+	if (omap_32k_timer_init() != 0)
 		omap_mpu_timer_init();
 }
 
arch/arm/mach-omap1/timer32k.c +9 -5
index 325b9a0..e3613a8 100644
@@ -182,10 +182,15 @@ static __init void omap_init_32k_timer(void)
  * Timer initialization
  * ---------------------------------------------------------------------------
  */
-bool __init omap_32k_timer_init(void)
+int __init omap_32k_timer_init(void)
 {
-	omap_init_clocksource_32k();
-	omap_init_32k_timer();
+	int ret = -ENODEV;
 
-	return true;
+	if (cpu_is_omap16xx())
+		ret = omap_init_clocksource_32k();
+
+	if (!ret)
+		omap_init_32k_timer();
+
+	return ret;
 }
--

1.7.0.4

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

maintainer
#3 lore raw

PATCH v6 1/3 ARM: OMAP1: FIX: check possible error condition in timer_init

Hi,

Quoted 19 lines · Kevin Hilman
Quoted 17 lines · Vaibhav Hiremath

OMAP1, omap_32k_timer_init() function always returns "true", irrespective of whether error occurred while initializing 32k sync counter as a kernel clocksource or not and execution will never fallback to mpu_timer clocksource init code.

This patch adds check for return value from function omap_init_clocksource_32k(), and fallback to omap_mpu_timer_init() in case of failure/error from omap_init_clocksource_32k().

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>

---
This is new patch addition compared to original series (<=V5).

Quoted 8 lines
Quoted 3 lines

Also, note that, this patch is only compile tested, since I do not have omap1 board with me to validate it. Kevin, can you help me to validate it.

I boot tested on OMAP1 (5912/OSK) with 32k timer and MPU timer Kconfigs. Works fine, but needs small change below for compile warnings.

Otherwise, looks good.

We need at least one tested-by on some 15xx platform for these changes. Janusz, can you please give this series a try on your board too?

Regards,

Tony

#4 lore raw

PATCH v6 1/3 ARM: OMAP1: FIX: check possible error condition in timer_init

Dnia pi?tek, 4 maja 2012 10:43:02 Tony Lindgren pisze:

Quoted 28 lines

Hi,

Quoted 25 lines · Kevin Hilman
Quoted 14 lines · Vaibhav Hiremath

OMAP1, omap_32k_timer_init() function always returns "true", irrespective of whether error occurred while initializing 32k sync counter as a kernel clocksource or not and execution will never fallback to mpu_timer clocksource init code.

This patch adds check for return value from function omap_init_clocksource_32k(), and fallback to omap_mpu_timer_init() in case of failure/error from omap_init_clocksource_32k().

Cc Tony Lindgren <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Benoit Cousson <[email protected]>
Quoted 6 lines

---
This is new patch addition compared to original series (<=V5).

Also, note that, this patch is only compile tested, since I do not have omap1 board with me to validate it. Kevin, can you help me to validate it.

I boot tested on OMAP1 (5912/OSK) with 32k timer and MPU timer Kconfigs. Works fine, but needs small change below for compile

warnings.

Quoted 4 lines
Quoted 2 lines

Otherwise, looks good.

We need at least one tested-by on some 15xx platform for these

changes.

Quoted 1 line

Janusz, can you please give this series a try on your board too?

Sure, but in a week or so.

I'm still trying to follow the l-o list, but please always Cc: me for testing any changes on Amstrad Delta whenever you see fit.

Regards,
Janusz

#5 lore raw

PATCH v6 2/3 ARM: OMAP2+: Replace space=>underscore in the name field of system timers

In reply to Vaibhav Hiremath

Depending on the bootloader, passing command-line arguments with spaces may have issues. Some bootloaders doesn't seem to pass along the quotes, passing only 'gp' part of the string, which leads to wrong clocksource override configuration.

So this patch changes "gp timer" => "gp_timer", for clockevent, clocksource and timer irq_handler.

Cc Santosh Shilimkar <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Kevin Hilman <[email protected]>

---
This is new patch addition compared to original series (<=V5).

 arch/arm/mach-omap2/timer.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/timer.c +3 -3
index ecec873..777f84b 100644
@@ -90,7 +90,7 @@ static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id)
 }
 
 static struct irqaction omap2_gp_timer_irq = {
-	.name		= "gp timer",
+	.name		= "gp_timer",
 	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
 	.handler	= omap2_gp_timer_interrupt,
 };
@@ -132,7 +132,7 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode,
 }
 
 static struct clock_event_device clockevent_gpt = {
-	.name		= "gp timer",
+	.name		= "gp_timer",
 	.features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
 	.shift		= 32,
 	.set_next_event	= omap2_gp_timer_set_next_event,
@@ -269,7 +269,7 @@ static cycle_t clocksource_read_cycles(struct clocksource *cs)
 }
 
 static struct clocksource clocksource_gpt = {
-	.name		= "gp timer",
+	.name		= "gp_timer",
 	.rating		= 300,
 	.read		= clocksource_read_cycles,
 	.mask		= CLOCKSOURCE_MASK(32),

--
1.7.0.4

#6 lore raw

PATCH v6 2/3 ARM: OMAP2+: Replace space=>underscore in the name field of system timers

Quoted 4 lines · Vaibhav Hiremath

Depending on the bootloader, passing command-line arguments with spaces may have issues. Some bootloaders doesn't seem to pass along the quotes, passing only 'gp' part of the string, which leads to wrong clocksource override configuration.

For clarity, it would help to specify which command-line options this affects

Quoted 9 lines

So this patch changes "gp timer" => "gp_timer", for clockevent, clocksource and timer irq_handler.

Cc Santosh Shilimkar <[email protected]>
Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Kevin Hilman <[email protected]>

With the change above,

#7 lore raw

PATCH v6 3/3 ARM: OMAP: Make OMAP clocksource source selection using kernel param

In reply to Vaibhav Hiremath

Current OMAP code supports couple of clocksource options based on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz). So there can be 3 options -

1. 32KHz sync-timer
2. Sys_clock based (e.g 13/19.2/26/38.4 MHz) gptimer
3. 32KHz based gptimer.

The optional gptimer based clocksource was added so that it can give the high precision than sync-timer, so expected usage was 2 and not 3.
Unfortunately option 2, clocksource doesn't meet the requirement of free-running clock as per clocksource need. It stops in low power states when sys_clock is cut. That makes gptimer based clocksource option useless for OMAP2/3/4 devices with sys_clock as a clock input. So, in order to use option 2, deeper idle state MUST be disabled.

Option 3 will still work but it is no better than 32K sync-timer based clocksource.

We must support both sync timer and gptimer based clocksource as some OMAP based derivative SoCs like AM33XX does not have the sync timer.

Considering above, make sync-timer and gptimer clocksource runtime selectable so that both OMAP and AMXXXX continue to use the same code.

And, in order to precisely configure/setup sched_clock for given clocksource, decision has to be made early enough in boot sequence.

So, the solution is,

Use standard kernel parameter ("clocksource=") to override default 32k_sync-timer, in addition to this, we also use hwmod database lookup mechanism, through which at run-time we can identify availability of 32k-sync timer on the device, else fall back to gptimer.

Also, moved low-level SoC specific init code to respective files, (mach-omap1/timer32k.c and mach-omap2/timer.c)

Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Tarun Kanti DebBarma <[email protected]>
Cc Ming Lei <[email protected]>

---
Two of the original patch-series (1/3 and 2/3) has already been accepted and queued by Paul, so removing them.
New 2 patches have been added to the series,
- OMAP2 timer32k cleanup, check for return values.
- Changed name of system timers, "gp timer" => "gp_timer".

 arch/arm/mach-omap1/timer32k.c           |   19 +++++-
 arch/arm/mach-omap2/timer.c              |  112 ++++++++++++++++++++++++------
 arch/arm/plat-omap/counter_32k.c         |   91 ++++++++++--------------
 arch/arm/plat-omap/include/plat/common.h |    2 +-
 4 files changed, 147 insertions(+), 77 deletions(-)
arch/arm/mach-omap1/timer32k.c +17 -2
index e3613a8..eae49c3 100644
@@ -71,6 +71,7 @@
 
 /* 16xx specific defines */
 #define OMAP1_32K_TIMER_BASE		0xfffb9000
+#define OMAP1_32KSYNC_TIMER_BASE	0xfffbc400
 #define OMAP1_32K_TIMER_CR		0x08
 #define OMAP1_32K_TIMER_TVR		0x00
 #define OMAP1_32K_TIMER_TCR		0x04
@@ -186,8 +187,22 @@ int __init omap_32k_timer_init(void)
 {
 	int ret = -ENODEV;
 
-	if (cpu_is_omap16xx())
-		ret = omap_init_clocksource_32k();
+	if (cpu_is_omap16xx()) {
+		void __iomem *base;
+		struct clk *sync32k_ick;
+
+		base = ioremap(OMAP1_32KSYNC_TIMER_BASE, SZ_1K);
+		if (!base) {
+			pr_err("32k_counter: failed to map base addr\n");
+			return -ENODEV;
+		}
+
+		sync32k_ick = clk_get(NULL, "omap_32ksync_ick");
+		if (!IS_ERR(sync32k_ick))
+			clk_enable(sync32k_ick);
+
+		ret = omap_init_clocksource_32k(base);
+	}
 
 	if (!ret)
 		omap_init_32k_timer();
arch/arm/mach-omap2/timer.c +90 -22

153 lines not on this page · raw message

arch/arm/plat-omap/counter_32k.c +39 -52

119 lines not on this page · raw message

arch/arm/plat-omap/include/plat/common.h +1 -1
index a557b84..d1cb6f5 100644
@@ -30,7 +30,7 @@
 #include <plat/i2c.h>
 #include <plat/omap_hwmod.h>
 
-extern int __init omap_init_clocksource_32k(void);
+extern int __init omap_init_clocksource_32k(void __iomem *vbase);
 
 extern void __init omap_check_revision(void);
 

--
1.7.0.4

#8 lore raw

PATCH v6 3/3 ARM: OMAP: Make OMAP clocksource source selection using kernel param

Quoted 41 lines · Vaibhav Hiremath

Current OMAP code supports couple of clocksource options based on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz). So there can be 3 options -

1. 32KHz sync-timer
2. Sys_clock based (e.g 13/19.2/26/38.4 MHz) gptimer
3. 32KHz based gptimer.

The optional gptimer based clocksource was added so that it can give the high precision than sync-timer, so expected usage was 2 and not 3.
Unfortunately option 2, clocksource doesn't meet the requirement of free-running clock as per clocksource need. It stops in low power states when sys_clock is cut. That makes gptimer based clocksource option useless for OMAP2/3/4 devices with sys_clock as a clock input. So, in order to use option 2, deeper idle state MUST be disabled.

Option 3 will still work but it is no better than 32K sync-timer based clocksource.

We must support both sync timer and gptimer based clocksource as some OMAP based derivative SoCs like AM33XX does not have the sync timer.

Considering above, make sync-timer and gptimer clocksource runtime selectable so that both OMAP and AMXXXX continue to use the same code.

And, in order to precisely configure/setup sched_clock for given clocksource, decision has to be made early enough in boot sequence.

So, the solution is,

Use standard kernel parameter ("clocksource=") to override default 32k_sync-timer, in addition to this, we also use hwmod database lookup mechanism, through which at run-time we can identify availability of 32k-sync timer on the device, else fall back to gptimer.

Also, moved low-level SoC specific init code to respective files, (mach-omap1/timer32k.c and mach-omap2/timer.c)

Quoted 9 lines
Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Tarun Kanti DebBarma <[email protected]>
Cc Ming Lei <[email protected]>

tested on OMAP3530/Overo with default 32k timer and cmdline override for GPtimer.

Kevin

#9 lore raw

PATCH v6 3/3 ARM: OMAP: Make OMAP clocksource source selection using kernel param

Quoted 13 lines · Kevin
Quoted 10 lines · Vaibhav Hiremath
Cc Benoit Cousson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Tarun Kanti DebBarma <[email protected]>
Cc Ming Lei <[email protected]>
Quoted 6 lines

tested on OMAP3530/Overo with default 32k timer and cmdline override for GPtimer.

Thanks Kevin, I have submitted V7 version of this series with your ack and tested-by.

Tony,
Can you queue it for v3.5?

Thanks,
Vaibhav

#10 lore raw

v6 cover ARM: OMAP: Make OMAP clocksource source selection runtime

In reply to Vaibhav Hiremath

Hi Vaibhav,

Quoted 21 lines · Vaibhav Hiremath

Current OMAP code supports couple of clocksource options based on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz)

This patch series cleans up the existing 32k-sync timer implementation, movind SoC init code to respective files (mach-omap1/timer32k.c and mach-omap2/timer.c) and uses kernel parameter to override the default clocksource of "counter_32k", also in order to support some OMAP based derivative SoCs like AM33XX which doesn't have 32K sync-timer hardware IP, adds hwmod lookup for omap2+ devices, and if lookup fails then fall back to gp-timer.

if(use_gptimer_clksrc == true)

	gptimer clocksource init;
else if (counter_32 init == false)
	/* Fallback to gptimer */
	gptimer clocksource init(;

With this, we should be able to support multi-omap boot including devices with/without 32k-sync timer.

Quoted 6 lines

This patch-series has been boot tested on AM37xEVM platform, it would be helpful if somebody help me to validate it on OMAP1/2 platforms.

The patches are also available at (based on linux-omap/master) -
https://github.com/hvaibhav/am335x-linux 32ksync-timer-cleanup

I was testing on OMAP4 and I found that the gptimer was always being set by default. I noticed that currently the HWMOD for counter_32k on OMAP4 is commented and hence was not being found. Please can you include the following with your series?

Cheers
Jon

Quoted 1 line

From 2a213a6d5f5894bc1c5262f2724508eaef21c7a5 Mon Sep 17 00:00:00 2001

From: Jon Hunter <[email protected]>
Date: Wed, 2 May 2012 14:45:03 -0500
Subject: [PATCH] ARM: OMAP4: Enable counter_32k HWMOD for OMAP4 devices

HWMOD is being used to determine if the 32k sync timer is present in order to use the timer as the clocksource for the kernel. Enable the counter_32k HWMOD for OMAP4 devices so that the 32k sync timer will be used by default.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
index 6abc757..f0455d0 100644
@@ -5561,7 +5561,7 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = {
 	&omap44xx_bandgap_hwmod,
 
 	/* counter class */
-/*	&omap44xx_counter_32k_hwmod, */
+	&omap44xx_counter_32k_hwmod,
 
 	/* dma class */
 	&omap44xx_dma_system_hwmod,
Signature · 1 line
1.7.5.4
#11 lore raw

v6 cover ARM: OMAP: Make OMAP clocksource source selection runtime

Quoted 24 lines · Jon

Hi Vaibhav,

Quoted 21 lines · Vaibhav Hiremath

Current OMAP code supports couple of clocksource options based on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz)

This patch series cleans up the existing 32k-sync timer implementation, movind SoC init code to respective files (mach-omap1/timer32k.c and mach-omap2/timer.c) and uses kernel parameter to override the default clocksource of "counter_32k", also in order to support some OMAP based derivative SoCs like AM33XX which doesn't have 32K sync-timer hardware IP, adds hwmod lookup for omap2+ devices, and if lookup fails then fall back to gp-timer.

if(use_gptimer_clksrc == true)

	gptimer clocksource init;
else if (counter_32 init == false)
	/* Fallback to gptimer */
	gptimer clocksource init(;

With this, we should be able to support multi-omap boot including devices with/without 32k-sync timer.

Quoted 9 lines
Quoted 6 lines

This patch-series has been boot tested on AM37xEVM platform, it would be helpful if somebody help me to validate it on OMAP1/2 platforms.

The patches are also available at (based on linux-omap/master) -
https://github.com/hvaibhav/am335x-linux 32ksync-timer-cleanup

I was testing on OMAP4 and I found that the gptimer was always being set by default. I noticed that currently the HWMOD for counter_32k on OMAP4 is commented and hence was not being found. Please can you include the following with your series?

The 32kcounter hwmod entry is already enabled in linux-omap/master branch.

Your baseline looks pretty old to me, are you not using linux-omap/master? The hwmod data registration has now changed to ocp_if, and your patch still use hwmod data entry.

Can you please use linux-omap/master and test it?

Thanks,
Vaibhav

#12 lore raw

v6 cover ARM: OMAP: Make OMAP clocksource source selection runtime

Hi Vaibhav,

Quoted 32 lines · Vaibhav
Quoted 31 lines · Jon

Hi Vaibhav,

Quoted 27 lines · Vaibhav Hiremath

Current OMAP code supports couple of clocksource options based on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz)

This patch series cleans up the existing 32k-sync timer implementation, movind SoC init code to respective files (mach-omap1/timer32k.c and mach-omap2/timer.c) and uses kernel parameter to override the default clocksource of "counter_32k", also in order to support some OMAP based derivative SoCs like AM33XX which doesn't have 32K sync-timer hardware IP, adds hwmod lookup for omap2+ devices, and if lookup fails then fall back to gp-timer.

if(use_gptimer_clksrc == true)

	gptimer clocksource init;
else if (counter_32 init == false)
	/* Fallback to gptimer */
	gptimer clocksource init(;

With this, we should be able to support multi-omap boot including devices with/without 32k-sync timer.

This patch-series has been boot tested on AM37xEVM platform, it would be helpful if somebody help me to validate it on OMAP1/2 platforms.

The patches are also available at (based on linux-omap/master) -
https://github.com/hvaibhav/am335x-linux 32ksync-timer-cleanup

Quoted 6 lines
Quoted 2 lines

I was testing on OMAP4 and I found that the gptimer was always being set by default. I noticed that currently the HWMOD for counter_32k on OMAP4 is commented and hence was not being found. Please can you include the following with your series?

The 32kcounter hwmod entry is already enabled in linux-omap/master branch.

Your baseline looks pretty old to me, are you not using linux-omap/master?

Ha! My "old" baseline is the latest mainline kernel ;-)

I guess this is a bit out-dated in terms of omap now. Sorry I missed that fact your patches were on top of the omap kernel in the changelog.

Cheers
Jon

#13 lore raw

v6 cover ARM: OMAP: Make OMAP clocksource source selection runtime

Quoted 38 lines · Jon Hunter

Hi Vaibhav,

Quoted 35 lines · Vaibhav
Quoted 33 lines · Jon

Hi Vaibhav,

Quoted 21 lines · Vaibhav Hiremath

Current OMAP code supports couple of clocksource options based on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz)

This patch series cleans up the existing 32k-sync timer implementation, movind SoC init code to respective files (mach-omap1/timer32k.c and mach-omap2/timer.c) and uses kernel parameter to override the default clocksource of "counter_32k", also in order to support some OMAP based derivative SoCs like AM33XX which doesn't have 32K sync-timer hardware IP, adds hwmod lookup for omap2+ devices, and if lookup fails then fall back to gp-timer.

if(use_gptimer_clksrc == true)

	gptimer clocksource init;
else if (counter_32 init == false)
	/* Fallback to gptimer */
	gptimer clocksource init(;

With this, we should be able to support multi-omap boot including devices with/without 32k-sync timer.

Quoted 6 lines

This patch-series has been boot tested on AM37xEVM platform, it would be helpful if somebody help me to validate it on OMAP1/2 platforms.

The patches are also available at (based on linux-omap/master) -
https://github.com/hvaibhav/am335x-linux 32ksync-timer-cleanup

I was testing on OMAP4 and I found that the gptimer was always being set by default. I noticed that currently the HWMOD for counter_32k on OMAP4 is commented and hence was not being found. Please can you include the following with your series?

Quoted 8 lines
Quoted 3 lines

The 32kcounter hwmod entry is already enabled in linux-omap/master branch.

Your baseline looks pretty old to me, are you not using linux-omap/master?

Ha! My "old" baseline is the latest mainline kernel ;-)

I guess this is a bit out-dated in terms of omap now. Sorry I missed that fact your patches were on top of the omap kernel in the changelog.

Yeah, in fact Paul submitted a big series to clean / re-organize and add missing hwmod for 3.5. So any change on hwmod should be done on top of Paul's branch.

Regards,
Benoit