Skip to contentSkip to conversation

clocksource: SuperH MTU2 Timer driver

PATCH New Magnus Damm 1 participant 1 message Apr 30, 2009

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

PATCH 1/1 clocksource: SuperH MTU2 Timer driver

From: Magnus Damm <[email protected]>

This patch adds a MTU2 driver for the SuperH architecture.

The MTU2 driver is a platform driver with early platform support to allow using a MTU2 channel as only clockevent during system bootup.

Clocksource on sh2a is currently unsupported due to code generation issues with 64-bit math, so at this point only periodic clockevent support is in place.

---

Tested on a rsk7203 board with a sh7203 processor.

 arch/sh/Kconfig               |   11 +
 drivers/clocksource/Makefile  |    1 
 drivers/clocksource/sh_mtu2.c |  357 +++++++++++++++++++++++++++++++++++++++++
 include/linux/sh_mtu2.h       |   12 +
 4 files changed, 381 insertions(+)
arch/sh/Kconfig +11 -0
@@ -113,6 +113,9 @@ config SYS_SUPPORTS_PCI
 config SYS_SUPPORTS_CMT
 	bool
 
+config SYS_SUPPORTS_MTU2
+	bool
+
 config STACKTRACE_SUPPORT
 	def_bool y
 
@@ -478,6 +481,14 @@ config SH_MTU2
 	help
 	  This enables the use of the MTU2 as the system timer.
 
+config SH_TIMER_MTU2
+	bool "MTU2 timer driver"
+	depends on SYS_SUPPORTS_MTU2 && !SH_MTU2
+	default y
+	select GENERIC_CLOCKEVENTS
+	help
+	  This enables build of the MTU2 timer driver.
+
 config SH_TIMER_IRQ
 	int
 	default "28" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785 || \
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_CMT)	+= sh_cmt.o
+obj-$(CONFIG_SH_TIMER_MTU2)	+= sh_mtu2.o
drivers/clocksource/sh_mtu2.c new file +357 -0

357 lines not on this page · raw message

include/linux/sh_mtu2.h new file +12 -0
@@ -0,0 +1,12 @@
+#ifndef __SH_MTU2_H__
+#define __SH_MTU2_H__
+
+struct sh_mtu2_config {
+	char *name;
+	int channel_offset;
+	int timer_bit;
+	char *clk;
+	unsigned long clockevent_rating;
+};
+
+#endif /* __SH_MTU2_H__ */