linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: davinci: time.c: group related header files together
@ 2011-12-23 17:57 Sekhar Nori
  2011-12-23 17:57 ` [PATCH 2/2] ARM: davinci: convert sched_clock() to use common infrastructure Sekhar Nori
  0 siblings, 1 reply; 5+ messages in thread
From: Sekhar Nori @ 2011-12-23 17:57 UTC (permalink / raw)
  To: linux-arm-kernel

Rearrange header files to keep related header files
together.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 arch/arm/mach-davinci/time.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index e1969ce..f2afb2d 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -19,11 +19,13 @@
 #include <linux/err.h>
 #include <linux/platform_device.h>
 
-#include <mach/hardware.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
+
 #include <mach/cputype.h>
+#include <mach/hardware.h>
 #include <mach/time.h>
+
 #include "clock.h"
 
 static struct clock_event_device clockevent_davinci;
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ARM: davinci: convert sched_clock() to use common infrastructure
  2011-12-23 17:57 [PATCH 1/2] ARM: davinci: time.c: group related header files together Sekhar Nori
@ 2011-12-23 17:57 ` Sekhar Nori
  2012-01-03  9:07   ` Russell King - ARM Linux
  2012-01-03  9:26   ` Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Sekhar Nori @ 2011-12-23 17:57 UTC (permalink / raw)
  To: linux-arm-kernel

Convert davinci to use the common sched_clock() infrastructure
for extending 32bit counters to full 64-bit nanoseconds.

Eventually clocksource timer should be initialized from init_early
so there would be no need to use a dummy clocksource read at start.

Tested-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
 arch/arm/Kconfig             |    1 +
 arch/arm/mach-davinci/time.c |   15 ++++++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 776d76b..3304316 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -925,6 +925,7 @@ config ARCH_DAVINCI
 	select ARCH_REQUIRE_GPIOLIB
 	select ZONE_DMA
 	select HAVE_IDE
+	select HAVE_SCHED_CLOCK
 	select CLKDEV_LOOKUP
 	select GENERIC_ALLOCATOR
 	select GENERIC_IRQ_CHIP
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index f2afb2d..e7d8b52 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -19,6 +19,7 @@
 #include <linux/err.h>
 #include <linux/platform_device.h>
 
+#include <asm/sched_clock.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
 
@@ -291,15 +292,21 @@ static struct clocksource clocksource_davinci = {
 	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+static DEFINE_CLOCK_DATA(cd);
+
 /*
  * Overwrite weak default sched_clock with something more precise
  */
 unsigned long long notrace sched_clock(void)
 {
-	const cycle_t cyc = clocksource_davinci.read(&clocksource_davinci);
+	u32 cyc = clocksource_davinci.read(&clocksource_davinci);
+	return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+}
 
-	return clocksource_cyc2ns(cyc, clocksource_davinci.mult,
-				clocksource_davinci.shift);
+static void notrace davinci_update_sched_clock(void)
+{
+	u32 cyc = timer32_read(&timers[TID_CLOCKSOURCE]);
+	update_sched_clock(&cd, cyc, (u32)~0);
 }
 
 /*
@@ -401,6 +408,8 @@ static void __init davinci_timer_init(void)
 	/* setup clocksource */
 	clocksource_davinci.read = read_cycles;
 	clocksource_davinci.name = id_to_name[clocksource_id];
+	init_sched_clock(&cd, davinci_update_sched_clock, 32,
+			 davinci_clock_tick_rate);
 	if (clocksource_register_hz(&clocksource_davinci,
 				    davinci_clock_tick_rate))
 		printk(err, clocksource_davinci.name);
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ARM: davinci: convert sched_clock() to use common infrastructure
  2011-12-23 17:57 ` [PATCH 2/2] ARM: davinci: convert sched_clock() to use common infrastructure Sekhar Nori
@ 2012-01-03  9:07   ` Russell King - ARM Linux
  2012-01-06  6:53     ` Nori, Sekhar
  2012-01-03  9:26   ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2012-01-03  9:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 23, 2011 at 11:27:20PM +0530, Sekhar Nori wrote:
> Convert davinci to use the common sched_clock() infrastructure
> for extending 32bit counters to full 64-bit nanoseconds.
> 
> Eventually clocksource timer should be initialized from init_early
> so there would be no need to use a dummy clocksource read at start.

Please see patch 7205/2.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ARM: davinci: convert sched_clock() to use common infrastructure
  2011-12-23 17:57 ` [PATCH 2/2] ARM: davinci: convert sched_clock() to use common infrastructure Sekhar Nori
  2012-01-03  9:07   ` Russell King - ARM Linux
@ 2012-01-03  9:26   ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2012-01-03  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Dec 23, 2011 at 6:57 PM, Sekhar Nori <nsekhar@ti.com> wrote:

> Convert davinci to use the common sched_clock() infrastructure
> for extending 32bit counters to full 64-bit nanoseconds.
>
> Eventually clocksource timer should be initialized from init_early
> so there would be no need to use a dummy clocksource read at start.
>
> Tested-by: Murali Karicheri <m-karicheri2@ti.com>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>

This will collide with Marc Zyngiers runtime-selectable
sched_clock() patches merged to linux-next recently,
it probably won't even compile.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ARM: davinci: convert sched_clock() to use common infrastructure
  2012-01-03  9:07   ` Russell King - ARM Linux
@ 2012-01-06  6:53     ` Nori, Sekhar
  0 siblings, 0 replies; 5+ messages in thread
From: Nori, Sekhar @ 2012-01-06  6:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell, Linus, 

On Tue, Jan 03, 2012 at 14:37:11, Russell King - ARM Linux wrote:
> On Fri, Dec 23, 2011 at 11:27:20PM +0530, Sekhar Nori wrote:
> > Convert davinci to use the common sched_clock() infrastructure
> > for extending 32bit counters to full 64-bit nanoseconds.
> > 
> > Eventually clocksource timer should be initialized from init_early
> > so there would be no need to use a dummy clocksource read at start.
> 
> Please see patch 7205/2.

Thanks for the pointers. I rebased this series on latest linux-next
and got things working again.

I will post updated patches soon.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-01-06  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-23 17:57 [PATCH 1/2] ARM: davinci: time.c: group related header files together Sekhar Nori
2011-12-23 17:57 ` [PATCH 2/2] ARM: davinci: convert sched_clock() to use common infrastructure Sekhar Nori
2012-01-03  9:07   ` Russell King - ARM Linux
2012-01-06  6:53     ` Nori, Sekhar
2012-01-03  9:26   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).