timer changes for v3.12
Subsystems (6)
Linus,
Please pull the latest timers-core-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-core-for-linus
HEAD: cfb6d656d569510ac9239583ce09e4c92ad54719 Merge branch 'timers/clockevents-next' of git://git.linaro.org/people/dlezcano/clockevents into timers/core
Various clocksource driver updates: extend the core with memory mapped hardware (mmio) support and add new (ARM) Moxart SoC and sun4i hardware support.
Thanks,
Ingo
------------------>
John Stultz (1):
MAINTAINERS: Add Daniel as maintainer for CLOCKSOURCE and CLOCKEVENT Drivers
Jonas Jensen (4):
ARM: clocksource: Add support for MOXA ART SoCs
ARM: clocksource: moxart: documentation: Fix device tree bindings document
ARM: clocksource: moxart: Add bitops.h include
ARM: clocksource: moxart: documentation: Update device tree bindings document
Maxime Ripard (10):
clocksource: sun4i: Use the BIT macros where possible
clocksource: sun4i: Wrap macros arguments in parenthesis
clocksource: sun4i: rename AUTORELOAD define to RELOAD
clocksource: sun4i: Add clocksource and sched clock drivers
clocksource: sun4i: Don't forget to enable the clock we use
clocksource: sun4i: Fix the next event code
clocksource: sun4i: Factor out some timer code
clocksource: sun4i: Remove TIMER_SCAL variable
clocksource: sun4i: Cleanup parent clock setup
clocksource: sun4i: Fix bug when switching from periodic to oneshot modes
Soren Brinkmann (2):
clocksource: cadence_ttc: Remove unused header
clocksource: cadence_ttc: Reuse clocksource as sched_clock
Stephen Boyd (6):
clocksource: orion: Use linux/sched_clock.h
clocksource: arch_timer: Make register accessors less error-prone
clocksource: arch_timer: Pass clock event to set_mode callback
Documentation: Add memory mapped ARM architected timer binding
clocksource: arch_timer: Push the read/write wrappers deeper
clocksource: arch_timer: Add support for memory mapped timers
.../devicetree/bindings/arm/arch_timer.txt | 59 ++- .../bindings/timer/moxa,moxart-timer.txt | 17 + MAINTAINERS | 10 +- arch/arm/include/asm/arch_timer.h | 14 +- arch/arm64/include/asm/arch_timer.h | 23 +- drivers/clocksource/Makefile | 1 + drivers/clocksource/arm_arch_timer.c | 447 +++++++++++++++++---- drivers/clocksource/cadence_ttc_timer.c | 13 +- drivers/clocksource/moxart_timer.c | 165 ++++++++ drivers/clocksource/sun4i_timer.c | 110 +++-- drivers/clocksource/time-orion.c | 2 +- include/clocksource/arm_arch_timer.h | 10 +- 12 files changed, 738 insertions(+), 133 deletions(-) create mode 100644 Documentation/devicetree/bindings/timer/moxa,moxart-timer.txt create mode 100644 drivers/clocksource/moxart_timer.c
Documentation/devicetree/bindings/arm/arch_timer.txt +56 -3
@@ -1,10 +1,14 @@ * ARM architected timer -ARM cores may have a per-core architected timer, which provides per-cpu timers. +ARM cores may have a per-core architected timer, which provides per-cpu timers, +or a memory mapped architected timer, which provides up to 8 frames with a +physical and optional virtual timer per frame. -The timer is attached to a GIC to deliver its per-processor interrupts. +The per-core architected timer is attached to a GIC to deliver its +per-processor interrupts via PPIs. The memory mapped timer is attached to a GIC +to deliver its interrupts via SPIs. -** Timer node properties: +** CP15 Timer node properties: - compatible : Should at least contain one of "arm,armv7-timer"
@@ -26,3 +30,52 @@ Example: <1 10 0xf08>; clock-frequency = <100000000>; }; + +** Memory mapped timer node properties: + +- compatible : Should at least contain "arm,armv7-timer-mem". + +- clock-frequency : The frequency of the main counter, in Hz. Optional. + +- reg : The control frame base address. + +Note that #address-cells, #size-cells, and ranges shall be present to ensure +the CPU can address a frame's registers. + +A timer node has up to 8 frame sub-nodes, each with the following properties: + +- frame-number: 0 to 7. + +- interrupts : Interrupt list for physical and virtual timers in that order. + The virtual timer interrupt is optional. + +- reg : The first and second view base addresses in that order. The second view + base address is optional. + +- status : "disabled" indicates the frame is not available for use. Optional. + +Example: + + timer@f0000000 { + compatible = "arm,armv7-timer-mem"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + reg = <0xf0000000 0x1000>; + clock-frequency = <50000000>; + + frame@f0001000 { + frame-number = <0> + interrupts = <0 13 0x8>, + <0 14 0x8>; + reg = <0xf0001000 0x1000>, + <0xf0002000 0x1000>; + }; + + frame@f0003000 { + frame-number = <1> + interrupts = <0 15 0x8>; + reg = <0xf0003000 0x1000>; + status = "disabled"; + }; + };
Documentation/devicetree/bindings/timer/moxa,moxart-timer.txt new file +17 -0
@@ -0,0 +1,17 @@ +MOXA ART timer + +Required properties: + +- compatible : Must be "moxa,moxart-timer" +- reg : Should contain registers location and length +- interrupts : Should contain the timer interrupt number +- clocks : Should contain phandle for the clock that drives the counter + +Example: + + timer: timer@98400000 { + compatible = "moxa,moxart-timer"; + reg = <0x98400000 0x42>; + interrupts = <19 1>; + clocks = <&coreclk>; + };
MAINTAINERS +8 -2
@@ -2112,6 +2112,13 @@ M: Russell King <[email protected]> S: Maintained F: include/linux/clk.h +CLOCKSOURCE, CLOCKEVENT DRIVERS +M: Daniel Lezcano <[email protected]> +M: Thomas Gleixner <[email protected]> +T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core +S: Supported +F: drivers/clocksource + CISCO FCOE HBA DRIVER M: Hiral Patel <[email protected]> M: Suma Ramars <[email protected]>
@@ -7143,7 +7150,7 @@ S: Maintained F: include/linux/mmc/dw_mmc.h F: drivers/mmc/host/dw_mmc* -TIMEKEEPING, NTP +TIMEKEEPING, CLOCKSOURCE CORE, NTP M: John Stultz <[email protected]> M: Thomas Gleixner <[email protected]> T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers/core
@@ -7156,7 +7163,6 @@ F: include/uapi/linux/timex.h F: kernel/time/clocksource.c F: kernel/time/time*.c F: kernel/time/ntp.c -F: drivers/clocksource TLG2300 VIDEO4LINUX-2 DRIVER M: Huang Shijie <[email protected]>
arch/arm/include/asm/arch_timer.h +6 -8
@@ -17,7 +17,8 @@ int arch_timer_arch_init(void);* nicely work out which register we want, and chuck away the rest of * the code. At least it does so with a recent GCC (4.6.3). */ -static inline void arch_timer_reg_write (const int access,const int reg,u32 val) +static __always_inline +void arch_timer_reg_write_cp15(int access, enum arch_timer_reg reg, u32 val) {if (access ==ARCH_TIMER_PHYS_ACCESS ) {switch (reg) {
@@ -28,9 +29,7 @@ static inline void arch_timer_reg_write(const int access, const int reg, u32 val asmvolatile ("mcr p15, 0, %0, c14, c2, 0" : :"r" (val));break ; } - } - -if (access ==ARCH_TIMER_VIRT_ACCESS ) { + }else if (access ==ARCH_TIMER_VIRT_ACCESS ) {switch (reg) {case ARCH_TIMER_REG_CTRL : asmvolatile ("mcr p15, 0, %0, c14, c3, 1" : :"r" (val));
@@ -44,7 +43,8 @@ static inline void arch_timer_reg_write(const int access, const int reg, u32 valisb (); } -static inline u32 arch_timer_reg_read (const int access,const int reg) +static __always_inline +u32 arch_timer_reg_read_cp15(int access, enum arch_timer_reg reg) {u32 val =0 ;
@@ -57,9 +57,7 @@ static inline u32 arch_timer_reg_read(const int access, const int reg) asmvolatile ("mrc p15, 0, %0, c14, c2, 0" :"=r" (val));break ; } - } - -if (access ==ARCH_TIMER_VIRT_ACCESS ) { + }else if (access ==ARCH_TIMER_VIRT_ACCESS ) {switch (reg) {case ARCH_TIMER_REG_CTRL : asmvolatile ("mrc p15, 0, %0, c14, c3, 1" :"=r" (val));
arch/arm64/include/asm/arch_timer.h +9 -14
@@ -26,7 +26,13 @@#include <clocksource/arm_arch_timer.h> -static inline void arch_timer_reg_write (int access,int reg,u32 val) +/* +* These register accessors are marked inline so the compiler can +* nicely work out which register we want, and chuck away the rest of +* the code. +*/ +static __always_inline +void arch_timer_reg_write_cp15(int access, enum arch_timer_reg reg, u32 val) {if (access ==ARCH_TIMER_PHYS_ACCESS ) {switch (reg) {
@@ -36,8 +42,6 @@ static inline void arch_timer_reg_write(int access, int reg, u32 val)case ARCH_TIMER_REG_TVAL : asmvolatile ("msr cntp_tval_el0, %0" : :"r" (val));break ; -default : -BUILD_BUG (); } }else if (access ==ARCH_TIMER_VIRT_ACCESS ) {switch (reg) {
@@ -47,17 +51,14 @@ static inline void arch_timer_reg_write(int access, int reg, u32 val)case ARCH_TIMER_REG_TVAL : asmvolatile ("msr cntv_tval_el0, %0" : :"r" (val));break ; -default : -BUILD_BUG (); } - }else { -BUILD_BUG (); }isb (); } -static inline u32 arch_timer_reg_read (int access,int reg) +static __always_inline +u32 arch_timer_reg_read_cp15(int access, enum arch_timer_reg reg) {u32 val;
@@ -69,8 +70,6 @@ static inline u32 arch_timer_reg_read(int access, int reg)case ARCH_TIMER_REG_TVAL : asmvolatile ("mrs %0, cntp_tval_el0" :"=r" (val));break ; -default : -BUILD_BUG (); } }else if (access ==ARCH_TIMER_VIRT_ACCESS ) {switch (reg) {
@@ -80,11 +79,7 @@ static inline u32 arch_timer_reg_read(int access, int reg)case ARCH_TIMER_REG_TVAL : asmvolatile ("mrs %0, cntv_tval_el0" :"=r" (val));break ; -default : -BUILD_BUG (); } - }else { -BUILD_BUG (); }return val;
drivers/clocksource/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_ARMADA_370_XP_TIMER) += time-armada-370-xp.o obj-$(CONFIG_ORION_TIMER) += time-orion.o obj-$(CONFIG_ARCH_BCM2835) += bcm2835_timer.o obj-$(CONFIG_ARCH_MARCO) += timer-marco.o +obj-$(CONFIG_ARCH_MOXART) += moxart_timer.o obj-$(CONFIG_ARCH_MXS) += mxs_timer.o obj-$(CONFIG_ARCH_PRIMA2) += timer-prima2.o obj-$(CONFIG_SUN4I_TIMER) += sun4i_timer.o
drivers/clocksource/arm_arch_timer.c +378 -69
590 lines not on this page · raw message
drivers/clocksource/cadence_ttc_timer.c +12 -1
@@ -21,7 +21,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/slab.h> -#include <linux/clk-provider.h> +#include <linux/sched_clock.h> /* * This driver configures the 2 16-bit count-up timers as follows:
@@ -95,6 +95,8 @@ struct ttc_timer_clockevent {#define to_ttc_timer_clkevent (x) \ container_of(x, struct ttc_timer_clockevent, ce) +static void __iomem *ttc_sched_clock_val_reg; +/** * ttc_set_interval - Set the timer interval value *
@@ -156,6 +158,11 @@ static cycle_t __ttc_clocksource_read(struct clocksource *cs) TTC_COUNT_VAL_OFFSET); } +static u32 notrace ttc_sched_clock_read(void) +{ +return __raw_readl (ttc_sched_clock_val_reg); +} +/** * ttc_set_next_event - Sets the time interval for next event *
@@ -297,6 +304,10 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base)kfree (ttccs);return ; } + + ttc_sched_clock_val_reg = base +TTC_COUNT_VAL_OFFSET ; +setup_sched_clock (ttc_sched_clock_read,16 , +clk_get_rate (ttccs->ttc.clk) /PRESCALE ); } static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
drivers/clocksource/moxart_timer.c new file +165 -0
165 lines not on this page · raw message
drivers/clocksource/sun4i_timer.c +78 -32
166 lines not on this page · raw message
drivers/clocksource/time-orion.c +1 -1
@@ -19,7 +19,7 @@#include <linux/of_address.h> #include <linux/of_irq.h> #include <linux/spinlock.h> -#include <asm/sched_clock.h> +#include <linux/sched_clock.h> #define TIMER_CTRL 0x00#define TIMER0_EN BIT(0)
include/clocksource/arm_arch_timer.h +7 -3
@@ -23,16 +23,20 @@#define ARCH_TIMER_CTRL_IT_MASK (1 << 1)#define ARCH_TIMER_CTRL_IT_STAT (1 << 2) -#define ARCH_TIMER_REG_CTRL 0 -#define ARCH_TIMER_REG_TVAL 1 +enum arch_timer_reg { +ARCH_TIMER_REG_CTRL , +ARCH_TIMER_REG_TVAL , +};#define ARCH_TIMER_PHYS_ACCESS 0#define ARCH_TIMER_VIRT_ACCESS 1 +#define ARCH_TIMER_MEM_PHYS_ACCESS 2 +#define ARCH_TIMER_MEM_VIRT_ACCESS 3#ifdef CONFIG_ARM_ARCH_TIMER extern u32 arch_timer_get_rate (void ); -extern u64 arch_timer_read_counter (void ); +extern u64 (*arch_timer_read_counter)(void );extern struct timecounter *arch_timer_get_timecounter (void );#else