Skip to contentSkip to conversation

sh: timer rewrite V2, tmu driver

PATCH New Magnus Damm 1 participant 1 message Nov 25, 2008

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

PATCH 2/8 sh: timer rewrite V2, tmu driver

From: Magnus Damm <[email protected]>

TMU driver for the SuperH timer base code implementation V2. Based on the old in-tree driver, but rewritten to become reentrant and fit the new timer base code. Hardware configuration is received from the processor code.

Tickless behaviour is similar to old in-tree code which means the interrupt count seems too high, at least compared to the CMT driver. This driver is useful for testing but needs further work.

---

Changes since V1 include:
- Reworked private data handling - no more union in sh_timer.h
- Made spinlock static
- Use setup_irq() to request early interrupt
- Removed request_mem_region()/free_mem_region()
- Removed sysdev code

 arch/sh/Kconfig                |    7 +
 drivers/clocksource/Makefile   |    1 
 drivers/clocksource/sh_timer.c |    3 
 drivers/clocksource/sh_tmu.c   |  278 ++++++++++++++++++++++++++++++++++++++++
 include/linux/sh_timer.h       |    4 
 5 files changed, 292 insertions(+), 1 deletion(-)
arch/sh/Kconfig +7 -0
@@ -389,6 +389,13 @@ config SH_TIMER
 	select GENERIC_TIME
 	select GENERIC_CLOCKEVENTS
 
+config SH_TIMER_TMU
+	def_bool y
+	prompt "TMU timer support"
+	depends on SH_TIMER && GENERIC_CLOCKEVENTS
+	help
+	  This enables build of the TMU system timer driver.
+
 config SH_TMU
 	def_bool y
 	prompt "TMU timer support"
drivers/clocksource/Makefile +1 -0
@@ -3,3 +3,4 @@ obj-$(CONFIG_X86_CYCLONE_TIMER)	+= cyclo
 obj-$(CONFIG_X86_PM_TIMER)	+= acpi_pm.o
 obj-$(CONFIG_SCx200HR_TIMER)	+= scx200_hrt.o
 obj-$(CONFIG_SH_TIMER)		+= sh_timer.o
+obj-$(CONFIG_SH_TIMER_TMU)	+= sh_tmu.o
drivers/clocksource/sh_timer.c +3 -0
@@ -22,6 +22,9 @@
 #include <linux/sh_timer.h>
 
 struct early_timer *sh_timers_early[] = {
+#ifdef CONFIG_SH_TIMER_TMU
+	[SH_TIMER_TYPE_TMU] = &sh_tmu,
+#endif
 };
 
 static struct sh_timer_config *sh_timer_timers;
drivers/clocksource/sh_tmu.c new file +278 -0

278 lines not on this page · raw message

include/linux/sh_timer.h +3 -1
@@ -14,7 +14,9 @@ struct early_timer {
 	int (*setup)(void *priv, void *config);
 };
 
-enum sh_timer_type { SH_TIMER_TYPE_NR };
+enum sh_timer_type { SH_TIMER_TYPE_TMU, SH_TIMER_TYPE_NR };
+
+extern struct early_timer sh_tmu;
 
 struct sh_timer_config {
 	enum sh_timer_type type;