Skip to contentSkip to conversation

sh: CMT early platform driver

PATCH New Magnus Damm 1 participant 1 message Dec 11, 2008

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

PATCH 2/3 sh: CMT early platform driver

From: Magnus Damm <[email protected]>

CMT driver for SuperH V5. Implemented as early platform driver.

Both 16-bit and 32-bit CMT versions are supported, but only 32-bit is tested. This driver contains support for both clockevents and clocksources, but no unregistration is supported at this point.

Works fine as clock source and/or event in periodic or oneshot mode. Tested on sh7722 and sh7723, but should work with any cpu/architecture.

---

Changes since V4 include:
- use read() instead of read2()
- use early platform driver instead of sh_timer code
- keep platform data in sh_cmt.h instead of sh_timer.h

Changes since V3 include:
- Removed dependency of timer_inc
- Removed unregistration code

Changes since V2 include:
- Rewrote driver to platform driver and early timer
- Only control clocks and hardware registers in disable()/enable()
- Removed exported struct from sh_timer.c/sh_timer.h
- sh_timer_early_probe() is used for early timer setup

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_cmt.c |  702 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/sh_cmt.h       |   13 
 4 files changed, 723 insertions(+)
arch/sh/Kconfig +7 -0
@@ -399,6 +399,13 @@ config SH_TIMER
 	def_bool n
 	select GENERIC_CLOCKEVENTS
 
+config SH_TIMER_CMT
+	def_bool y
+	prompt "CMT timer support"
+	depends on SH_TIMER
+	help
+	  This enables build of the CMT system timer driver.
+
 config SH_TMU
 	def_bool y
 	prompt "TMU timer support"
drivers/clocksource/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_ATMEL_TCB_CLKSRC)	+= tcb_cl
 obj-$(CONFIG_X86_CYCLONE_TIMER)	+= cyclone.o
 obj-$(CONFIG_X86_PM_TIMER)	+= acpi_pm.o
 obj-$(CONFIG_SCx200HR_TIMER)	+= scx200_hrt.o
+obj-$(CONFIG_SH_TIMER_CMT)	+= sh_cmt.o
drivers/clocksource/sh_cmt.c new file +702 -0

702 lines not on this page · raw message

include/linux/sh_cmt.h new file +13 -0
@@ -0,0 +1,13 @@
+#ifndef __SH_CMT_H__
+#define __SH_CMT_H__
+
+struct sh_cmt_config {
+	char *name;
+	unsigned long channel_offset;
+	int timer_bit;
+	char *clk;
+	unsigned long clockevent_rating;
+	unsigned long clocksource_rating;
+};
+
+#endif /* __SH_CMT_H__ */