J-Core timer support
Subsystems (4)
Rich Felker
maintainerv6 cover J-Core timer support
Updated to include changes requested by Thomas Gleixner. Aside from minor style improvements, the main changes are moving from the old cpu notifier framework for cpu starting to the cpuhotplug framework. Since the new framework does not easily facilitate multiple driver instances without significant additional code, and since there is presently no need for multiple instances, the (now-only-nominal) support for multiple instances was removed; this simplifies some of the code. Use of the full 64-bit clocksource was also replaced by 32-bit to avoid expensive (non-native, software) 64-bit arithmetic in hot paths.
I've also removed a comment about Linux implementation details from the DT binding document since it's not actually part of the bindings.
Finally, driver was made conditional in Kconfig to avoid it showing up in configurations where it's not relevant.
Rich
Rich Felker (2):
of: add J-Core timer bindings
clocksource: add J-Core timer/clocksource driver
.../devicetree/bindings/timer/jcore,pit.txt | 24 ++ drivers/clocksource/Kconfig | 9 + drivers/clocksource/Makefile | 1 + drivers/clocksource/jcore-pit.c | 242 +++++++++++++++++++++ include/linux/cpuhotplug.h | 1 + 5 files changed, 277 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt create mode 100644 drivers/clocksource/jcore-pit.c
Signature · 1 line
2.8.1
Rich Felker
maintainerPATCH v6 1/2 of: add J-Core timer bindings
--- .../devicetree/bindings/timer/jcore,pit.txt | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/jcore,pit.txt
Documentation/devicetree/bindings/timer/jcore,pit.txt new file +24 -0
@@ -0,0 +1,24 @@ +J-Core Programmable Interval Timer and Clocksource + +Required properties: + +- compatible: Must be "jcore,pit". + +- reg: Memory region(s) for timer/clocksource registers. For SMP, + there should be one region per cpu, indexed by the sequential, + zero-based hardware cpu number. + +- interrupts: An interrupt to assign for the timer. The actual pit + core is integrated with the aic and allows the timer interrupt + assignment to be programmed by software, but this property is + required in order to reserve an interrupt number that doesn't + conflict with other devices. + + +Example: + +timer@200 { + compatible = "jcore,pit"; + reg = < 0x200 0x30 0x500 0x30 >; + interrupts = < 0x48 >; +};
Signature · 1 line
2.8.1
Rich Felker
maintainerPATCH v6 2/2 clocksource: add J-Core timer/clocksource driver
In reply to Rich FelkerAt the hardware level, the J-Core PIT is integrated with the interrupt controller, but it is represented as its own device and has an independent programming interface. It provides a 12-bit countdown timer, which is not presently used, and a periodic timer. The interval length for the latter is programmable via a 32-bit throttle register whose units are determined by a bus-period register. The periodic timer is used to implement both periodic and oneshot clock event modes; in oneshot mode the interrupt handler simply disables the timer as soon as it fires.
Despite its device tree node representing an interrupt for the PIT, the actual irq generated is programmable, not hard-wired. The driver is responsible for programming the PIT to generate the hardware irq number that the DT assigns to it.
On SMP configurations, J-Core provides cpu-local instances of the PIT; no broadcast timer is needed. This driver supports the creation of the necessary per-cpu clock_event_device instances. The code has been tested and works on SMP, but will not be usable without additional J-Core SMP-support patches and appropriate hardware capable of running SMP.
A nanosecond-resolution clocksource is provided using the J-Core "RTC" registers, which give a 64-bit seconds count and 32-bit nanoseconds. The driver converts these to a 64-bit nanoseconds count.
--- drivers/clocksource/Kconfig | 9 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/jcore-pit.c | 242 ++++++++++++++++++++++++++++++++++++++++ include/linux/cpuhotplug.h | 1 + 4 files changed, 253 insertions(+) create mode 100644 drivers/clocksource/jcore-pit.c
drivers/clocksource/Kconfig +9 -0
@@ -407,6 +407,15 @@ config SYS_SUPPORTS_SH_TMU config SYS_SUPPORTS_EM_STI bool +config CLKSRC_JCORE_PIT + bool "J-Core PIT timer driver" + depends on OF && (SUPERH || COMPILE_TEST) + depends on GENERIC_CLOCKEVENTS + depends on HAS_IOMEM + help + This enables build of clocksource and clockevent driver for + the integrated PIT in the J-Core synthesizable, open source SoC. + config SH_TIMER_CMT bool "Renesas CMT timer driver" if COMPILE_TEST depends on GENERIC_CLOCKEVENTS
drivers/clocksource/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_ATMEL_TCB_CLKSRC) += tcb_clksrc.o obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o obj-$(CONFIG_SCx200HR_TIMER) += scx200_hrt.o obj-$(CONFIG_CS5535_CLOCK_EVENT_SRC) += cs5535-clockevt.o +obj-$(CONFIG_CLKSRC_JCORE_PIT) += jcore-pit.o obj-$(CONFIG_SH_TIMER_CMT) += sh_cmt.o obj-$(CONFIG_SH_TIMER_MTU2) += sh_mtu2.o obj-$(CONFIG_SH_TIMER_TMU) += sh_tmu.o
drivers/clocksource/jcore-pit.c new file +242 -0
242 lines not on this page · raw message
include/linux/cpuhotplug.h +1 -0
@@ -50,6 +50,7 @@ enum cpuhp_state {CPUHP_AP_ARM_ARCH_TIMER_STARTING ,CPUHP_AP_ARM_GLOBAL_TIMER_STARTING ,CPUHP_AP_DUMMY_TIMER_STARTING , +CPUHP_AP_JCORE_TIMER_STARTING ,CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING ,CPUHP_AP_ARM_TWD_STARTING , CPUHP_AP_METAG_TIMER_STARTING,
Signature · 6 lines
2.8.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html