Skip to contentSkip to conversation

clocksource: tegra: enable arch_timer

PATCH New Joseph Lo 3 participants 6 messages Apr 3, 2013 – Apr 4, 2013

Subsystems (2)
lore
Share & tools
lore

Joseph Lo

author
#0 lore raw

PATCH 1/1 clocksource: tegra: enable arch_timer

Architected timer is the local timer for Cortex-A15. Adding the support for Tegra.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 drivers/clocksource/tegra20_timer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/clocksource/tegra20_timer.c +5 -2
index ae877b0..e443f44 100644
@@ -30,6 +30,7 @@
 #include <asm/mach/time.h>
 #include <asm/smp_twd.h>
 #include <asm/sched_clock.h>
+#include <asm/arch_timer.h>
 
 #define RTC_SECONDS            0x08
 #define RTC_SHADOW_SECONDS     0x0c
@@ -200,8 +201,6 @@ static void __init tegra20_init_timer(struct device_node *np)
 		WARN(1, "Unknown clock rate");
 	}
 
-	setup_sched_clock(tegra_read_sched_clock, 32, 1000000);
-
 	if (clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US,
 		"timer_us", 1000000, 300, 32, clocksource_mmio_readl_up)) {
 		pr_err("Failed to register clocksource\n");
@@ -218,6 +217,10 @@ static void __init tegra20_init_timer(struct device_node *np)
 	tegra_clockevent.irq = tegra_timer_irq.irq;
 	clockevents_config_and_register(&tegra_clockevent, 1000000,
 					0x1, 0x1fffffff);
+	if (arch_timer_of_register())
+		setup_sched_clock(tegra_read_sched_clock, 32, 1000000);
+	else
+		arch_timer_sched_clock_init();
 }
 CLOCKSOURCE_OF_DECLARE(tegra20_timer, "nvidia,tegra20-timer", tegra20_init_timer);
 
Signature · 1 line
1.8.2
#1 lore raw

PATCH 1/1 clocksource: tegra: enable arch_timer

Quoted 6 lines · Joseph Lo

Architected timer is the local timer for Cortex-A15. Adding the support for Tegra.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>

My patch series to add CLOCKSOURCE_OF_DECLARE support to arch timer and sched_clock enhancements will make this unnecessary:

http://www.spinics.net/lists/arm-kernel/msg234597.html

Testing would be appreciated.

Rob

Quoted 37 lines
---
 drivers/clocksource/tegra20_timer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/clocksource/tegra20_timer.c +5 -2
index ae877b0..e443f44 100644
@@ -30,6 +30,7 @@
 #include <asm/mach/time.h>
 #include <asm/smp_twd.h>
 #include <asm/sched_clock.h>
+#include <asm/arch_timer.h>
 
 #define RTC_SECONDS            0x08
 #define RTC_SHADOW_SECONDS     0x0c
@@ -200,8 +201,6 @@ static void __init tegra20_init_timer(struct device_node *np)
 		WARN(1, "Unknown clock rate");
 	}
 
-	setup_sched_clock(tegra_read_sched_clock, 32, 1000000);
-
 	if (clocksource_mmio_init(timer_reg_base + TIMERUS_CNTR_1US,
 		"timer_us", 1000000, 300, 32, clocksource_mmio_readl_up)) {
 		pr_err("Failed to register clocksource\n");
@@ -218,6 +217,10 @@ static void __init tegra20_init_timer(struct device_node *np)
 	tegra_clockevent.irq = tegra_timer_irq.irq;
 	clockevents_config_and_register(&tegra_clockevent, 1000000,
 					0x1, 0x1fffffff);
+	if (arch_timer_of_register())
+		setup_sched_clock(tegra_read_sched_clock, 32, 1000000);
+	else
+		arch_timer_sched_clock_init();
 }
 CLOCKSOURCE_OF_DECLARE(tegra20_timer, "nvidia,tegra20-timer", tegra20_init_timer);
 
#2 lore raw

PATCH 1/1 clocksource: tegra: enable arch_timer

Quoted 8 lines · Rob Herring
Quoted 6 lines · Joseph Lo

Architected timer is the local timer for Cortex-A15. Adding the support for Tegra.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>
Quoted 6 lines

My patch series to add CLOCKSOURCE_OF_DECLARE support to arch timer and sched_clock enhancements will make this unnecessary:

http://www.spinics.net/lists/arm-kernel/msg234597.html

Testing would be appreciated.

Joseph (or Rob), what's the benefit of this change; what works with it and/or what breaks without it?

Rob, if I did apply this change, and you also apply that series of yours, what is the result: compile-time breakage, run-time breakage, just some redundant code that needs to be removed again?

Thanks.

#3 lore raw

PATCH 1/1 clocksource: tegra: enable arch_timer

Quoted 12 lines · Stephen Warren
Quoted 11 lines · Rob Herring
Quoted 6 lines · Joseph Lo

Architected timer is the local timer for Cortex-A15. Adding the support for Tegra.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>

My patch series to add CLOCKSOURCE_OF_DECLARE support to arch timer and sched_clock enhancements will make this unnecessary:

Quoted 6 lines
Quoted 3 lines

http://www.spinics.net/lists/arm-kernel/msg234597.html

Testing would be appreciated.

Joseph (or Rob), what's the benefit of this change; what works with it and/or what breaks without it?

I assume you mean Joseph's change. Well, it enables local timers on A15. But mine will too for Tegra if you have the arch timer in the dtb.

Quoted 3 lines

Rob, if I did apply this change, and you also apply that series of yours, what is the result: compile-time breakage, run-time breakage, just some redundant code that needs to be removed again?

Compile-time breakage as the functions called here are being removed.

Rob

#4 lore raw

PATCH 1/1 clocksource: tegra: enable arch_timer

Quoted 13 lines · Rob Herring
Quoted 12 lines · Stephen Warren
Quoted 11 lines · Rob Herring
Quoted 6 lines · Joseph Lo

Architected timer is the local timer for Cortex-A15. Adding the support for Tegra.

Cc John Stultz <[email protected]>
Cc Thomas Gleixner <[email protected]>

My patch series to add CLOCKSOURCE_OF_DECLARE support to arch timer and sched_clock enhancements will make this unnecessary:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

http://www.spinics.net/lists/arm-kernel/msg234597.html

Testing would be appreciated.

Joseph (or Rob), what's the benefit of this change; what works with it and/or what breaks without it?

I assume you mean Joseph's change.

Yes.

Quoted 2 lines

Well, it enables local timers on A15.
But mine will too for Tegra if you have the arch timer in the dtb.

Well, I meant what benefit would I see from enabling them, rather than using the Tegra-specific timers as I believe is currently happening.

Quoted 5 lines
Quoted 3 lines

Rob, if I did apply this change, and you also apply that series of yours, what is the result: compile-time breakage, run-time breakage, just some redundant code that needs to be removed again?

Compile-time breakage as the functions called here are being removed.

OK, I definitely won't apply Joseph's patch then.

Aside from that, I took the git branch you mentioned in the patch you linked to above, merged it into my dev tree, updated my bootloader to actually initialize the TSC correctly, and I see the following during boot, so I guess that's enough for:

on your patches.

Quoted 5 lines
[    0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 4294967ms
[    0.000000] Architected local timer running at 12.00MHz (virt).
[    0.000000] Switching to timer-based delay loop
[  117.431229] Calibrating delay loop (skipped), value calculated using timer frequency.. 24.00 BogoMIPS (lpj=120000)
[  117.987221] Switching to clocksource arch_sys_counter
author
#5 lore raw

PATCH 1/1 clocksource: tegra: enable arch_timer

Quoted 11 lines · Stephen Warren
Quoted 8 lines · Rob Herring
Quoted 5 lines · Stephen Warren
Quoted 1 line · Rob Herring

On 04/03/2013 06:32 AM, Joseph Lo wrote:

Rob, if I did apply this change, and you also apply that series of yours, what is the result: compile-time breakage, run-time breakage, just some redundant code that needs to be removed again?

Compile-time breakage as the functions called here are being removed.

OK, I definitely won't apply Joseph's patch then.

Agree. This patch is redundant, once Rob's patches go into mainline.

Quoted 15 lines

Aside from that, I took the git branch you mentioned in the patch you linked to above, merged it into my dev tree, updated my bootloader to actually initialize the TSC correctly, and I see the following during boot, so I guess that's enough for:

on your patches.

Quoted 5 lines
[    0.000000] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 4294967ms
[    0.000000] Architected local timer running at 12.00MHz (virt).
[    0.000000] Switching to timer-based delay loop
[  117.431229] Calibrating delay loop (skipped), value calculated using timer frequency.. 24.00 BogoMIPS (lpj=120000)
[  117.987221] Switching to clocksource arch_sys_counter