Skip to contentSkip to conversation

sh: timer rewrite, tmu driver

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

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

PATCH 2/8 sh: timer rewrite, tmu driver

From: Magnus Damm <[email protected]>

TMU driver for the new SuperH timer base code implementation. 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.

---

 arch/sh/Kconfig                |    7 +
 drivers/clocksource/Makefile   |    1 
 drivers/clocksource/sh_timer.c |    3 
 drivers/clocksource/sh_tmu.c   |  275 ++++++++++++++++++++++++++++++++++++++++
 include/linux/sh_timer.h       |   17 ++
 5 files changed, 302 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
@@ -26,6 +26,9 @@ struct sysdev_class sh_timer_class = {
 };
 
 struct sysdev_driver *sh_timer_drivers[] = {
+#ifdef CONFIG_SH_TIMER_TMU
+	&sh_tmu,
+#endif
 };
 
 int sh_timer_register(struct sh_timer_config *timers, int nr_timers)
drivers/clocksource/sh_tmu.c new file +275 -0

275 lines not on this page · raw message

include/linux/sh_timer.h +16 -1
@@ -17,8 +17,12 @@
 #include <linux/io.h>
 #include <linux/clk.h>
 #include <linux/sysdev.h>
+#include <linux/clockchips.h>
 
-enum sh_timer_type { SH_TIMER_TYPE_INVALID = 0 };
+enum sh_timer_type { SH_TIMER_TYPE_INVALID = 0,
+		     SH_TIMER_TYPE_TMU };
+
+extern struct sysdev_driver sh_tmu;
 
 struct sh_timer_config {
 	enum sh_timer_type type;
@@ -31,6 +35,17 @@ struct sh_timer_config {
 	char *clk;
 	int irq;
 
+	union {
+		struct {
+			void __iomem *mapbase;
+			struct clk *clk;
+			unsigned long periodic_interval;
+#ifdef CONFIG_GENERIC_CLOCKEVENTS
+			struct clock_event_device ced;
+#endif
+		} tmu;
+	} priv;
+
 	struct sys_device sysdev;
 };