Skip to contentSkip to conversation

timer changes for 3.16

GIT PULL Thomas Gleixner 1 participant 1 message Jun 4, 2014

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

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

This time you get nothing really exciting:
- A huge update to the sh* clocksource drivers
- Support for two more ARM SoCs
- Removal of the deprecated setup_sched_clock() API
- The usual pile of fixlets all over the place

Thanks,

tglx

------------------>
Fabian Frederick (1):
ntp: Convert simple_strtol to kstrtol

George Spelvin (1):
ntp: Make is_error_status() use its argument

Jingoo Han (4):
clocksource: em_sti: Remove unnecessary OOM messages
clocksource: sh_cmt: Remove unnecessary OOM messages
clocksource: sh_mtu2: Remove unnecessary OOM messages
clocksource: sh_tmu: Remove unnecessary OOM messages

Laurent Pinchart (53):
clocksource: sh_cmt: Use request_irq() instead of setup_irq()
clocksource: sh_cmt: Split channel fields from sh_cmt_priv
clocksource: sh_cmt: Rename struct sh_cmt_priv to sh_cmt_device
clocksource: sh_cmt: Split channel setup to separate function
clocksource: sh_cmt: Constify name argument to sh_cmt_register()
clocksource: sh_cmt: Rename mapbase/mapbase_str to mapbase_ch/mapbase
clocksource: sh_cmt: Add memory base to sh_cmt_channel structure
clocksource: sh_cmt: Add index to struct sh_cmt_channel
clocksource: sh_cmt: Replace kmalloc + memset with kzalloc
clocksource: sh_cmt: Allocate channels dynamically
clocksource: sh_cmt: Split static information from sh_cmt_device
clocksource: sh_cmt: Replace hardcoded register values with macros
clocksource: sh_cmt: Set cpumask to cpu_possible_mask
clocksource: sh_cmt: Hardcode CMT clock event rating to 125
clocksource: sh_cmt: Hardcode CMT clock source rating to 125
clocksource: sh_cmt: Add support for multiple channels per device
clocksource: sh_cmt: Rename clock to "fck" in the non-legacy case
clocksource: sh_cmt: Remove FSF mail address from GPL notice
clocksource: sh_cmt: Sort headers alphabetically
clocksource: sh_cmt: Request IRQ for clock event device only
clocksource: sh_tmu: Use request_irq() instead of setup_irq()
clocksource: sh_tmu: Split channel fields from sh_tmu_priv
clocksource: sh_tmu: Rename struct sh_tmu_priv to sh_tmu_device
clocksource: sh_tmu: Split channel setup to separate function
clocksource: sh_tmu: Constify name argument to sh_tmu_register()
clocksource: sh_tmu: Add memory base to sh_tmu_channel structure
clocksource: sh_tmu: Add index to struct sh_tmu_channel
clocksource: sh_tmu: Replace kmalloc + memset with kzalloc
clocksource: sh_tmu: Allocate channels dynamically
clocksource: sh_tmu: Replace hardcoded register values with macros
clocksource: sh_tmu: Hardcode TMU clock event and source ratings to 200
clocksource: sh_tmu: Add support for multiple channels per device
clocksource: sh_tmu: Rename clock to "fck" in the non-legacy case
clocksource: sh_tmu: Remove FSF mail address from GPL notice
clocksource: sh_tmu: Sort headers alphabetically
clocksource: sh_mtu2: Use request_irq() instead of setup_irq()
clocksource: sh_mtu2: Turn sh_mtu2_priv fields into local variables
clocksource: sh_mtu2: Split channel fields from sh_mtu2_priv
clocksource: sh_mtu2: Rename struct sh_mtu2_priv to sh_mtu2_device
clocksource: sh_mtu2: Split channel setup to separate function
clocksource: sh_mtu2: Constify name argument to sh_mtu2_register()
clocksource: sh_mtu2: Add memory base to sh_mtu2_channel structure
clocksource: sh_mtu2: Add index to struct sh_mtu2_channel
clocksource: sh_mtu2: Replace kmalloc + memset with kzalloc
clocksource: sh_mtu2: Allocate channels dynamically
clocksource: sh_mtu2: Replace hardcoded register values with macros
clocksource: sh_mtu2: Set cpumask to cpu_possible_mask
clocksource: sh_mtu2: Hardcode MTU2 clock event rating to 200
clocksource: sh_mtu2: Add support for multiple channels per device
clocksource: sh_mtu2: Rename clock to "fck" in the non-legacy case
clocksource: sh_mtu2: Remove FSF mail address from GPL notice
clocksource: sh_mtu2: Sort headers alphabetically
clocksource: sh_tmu: Fix channel IRQ retrieval in legacy case

Matthew Leach (4):
clocksource: arm_global_timer: Only check for unusable timer on A9
documentaion: DT: allow a A5 compatible string in global timer
dts: ca5: add the global timer for the A5
KConfig: Vexpress: build the ARM_GLOBAL_TIMER with vexpress platform

Maxime Ripard (2):
clocksource: sun5i: Add support for reset controller
ARM: sun6i: a31: Add support for the High Speed Timers

Michael Kerrisk (1):
timer_stats/doc: Fix /proc/timer_stats documentation

Stephen Boyd (2):
sched_clock: Remove deprecated setup_sched_clock() API
clocksource: qcom: Implement read_current_timer for udelay

Uwe Kleine-König (1):
clocksource: efm32: use $vendor,$device scheme for compatible string

Xiubo Li (5):
clocksource: Fix type confusion for clocksource_mmio_readX_Y
clocksource: Fix clocksource_mmio_readX_down
clocksource: ftm: Add FlexTimer Module (FTM) Timer devicetree Documentation
ARM: dts: vf610: Add Freescale FlexTimer Module timer node.
clocksource: Add Freescale FlexTimer Module (FTM) timer support

Yang Wei (1):
clocksource: dw_apb_timer_of: Do not trace read_sched_clock

 .../devicetree/bindings/arm/global_timer.txt       |   7 +-
 .../bindings/timer/allwinner,sun5i-a13-hstimer.txt |   4 +
 ...efm32,timer.txt => energymicro,efm32-timer.txt} |   4 +-
 .../devicetree/bindings/timer/fsl,ftm-timer.txt    |  31 +
 Documentation/timers/timer_stats.txt               |   6 +-
 arch/arm/boot/dts/sun6i-a31.dtsi                   |  11 +
 arch/arm/boot/dts/vexpress-v2p-ca5s.dts            |  10 +-
 arch/arm/boot/dts/vf610.dtsi                       |  13 +
 arch/arm/mach-vexpress/Kconfig                     |   1 +
 drivers/clocksource/Kconfig                        |   5 +
 drivers/clocksource/Makefile                       |   1 +
 drivers/clocksource/arm_global_timer.c             |   5 +-
 drivers/clocksource/dw_apb_timer_of.c              |   2 +-
 drivers/clocksource/em_sti.c                       |   4 +-
 drivers/clocksource/fsl_ftm_timer.c                | 367 ++++++++
 drivers/clocksource/mmio.c                         |   8 +-
 drivers/clocksource/qcom-timer.c                   |  13 +
 drivers/clocksource/sh_cmt.c                       | 958 ++++++++++++++-------
 drivers/clocksource/sh_mtu2.c                      | 490 +++++++----
 drivers/clocksource/sh_tmu.c                       | 543 +++++++-----
 drivers/clocksource/time-efm32.c                   |   3 +-
 drivers/clocksource/timer-sun5i.c                  |   6 +
 include/linux/sched_clock.h                        |   1 -
 include/linux/sh_timer.h                           |   1 +
 kernel/time/ntp.c                                  |  17 +-
 kernel/time/sched_clock.c                          |  13 -
 26 files changed, 1798 insertions(+), 726 deletions(-)
 rename Documentation/devicetree/bindings/timer/{efm32,timer.txt => energymicro,efm32-timer.txt} (87%)
 create mode 100644 Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt
 create mode 100644 drivers/clocksource/fsl_ftm_timer.c
Documentation/devicetree/bindings/arm/global_timer.txt +5 -2
index 1e54898..bdae3a8 100644
@@ -4,8 +4,11 @@
 
 ** Timer node required properties:
 
-- compatible : Should be "arm,cortex-a9-global-timer"
-		Driver supports versions r2p0 and above.
+- compatible : should contain
+	     * "arm,cortex-a5-global-timer" for Cortex-A5 global timers.
+	     * "arm,cortex-a9-global-timer" for Cortex-A9 global
+	         timers or any compatible implementation. Note: driver
+	         supports versions r2p0 and above.
 
 - interrupts : One interrupt to each core
 
Documentation/devicetree/bindings/timer/allwinner,sun5i-a13-hstimer.txt +4 -0
index 7c26154..27cfc7d 100644
@@ -9,6 +9,9 @@ Required properties:
 		one)
 - clocks: phandle to the source clock (usually the AHB clock)
 
+Optionnal properties:
+- resets: phandle to a reset controller asserting the timer
+
 Example:
 
 timer@01c60000 {
@@ -19,4 +22,5 @@ timer@01c60000 {
 		     <0 53 1>,
 		     <0 54 1>;
 	clocks = <&ahb1_gates 19>;
+	resets = <&ahb1rst 19>;
 };
Documentation/devicetree/bindings/timer/energymicro,efm32-timer.txt renamed from Documentation/devicetree/bindings/timer/efm32,timer.txt +2 -2
similarity index 87%
rename from Documentation/devicetree/bindings/timer/efm32,timer.txt
rename to Documentation/devicetree/bindings/timer/energymicro,efm32-timer.txt
index 97a568f..e502c11 100644
@@ -6,7 +6,7 @@ channels and can be used as PWM or Quadrature Decoder. Available clock sources
 are the cpu's HFPERCLK (with a 10-bit prescaler) or an external pin.
 
 Required properties:
-- compatible : Should be efm32,timer
+- compatible : Should be "energymicro,efm32-timer"
 - reg : Address and length of the register set
 - clocks : Should contain a reference to the HFPERCLK
 
@@ -16,7 +16,7 @@ Optional properties:
 Example:
 
 timer@40010c00 {
-	compatible = "efm32,timer";
+	compatible = "energymicro,efm32-timer";
 	reg = <0x40010c00 0x400>;
 	interrupts = <14>;
 	clocks = <&cmu clk_HFPERCLKTIMER3>;
Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt new file +31 -0
new file mode 100644
index 0000000..aa8c402
@@ -0,0 +1,31 @@
+Freescale FlexTimer Module (FTM) Timer
+
+Required properties:
+
+- compatible : should be "fsl,ftm-timer"
+- reg : Specifies base physical address and size of the register sets for the
+  clock event device and clock source device.
+- interrupts : Should be the clock event device interrupt.
+- clocks : The clocks provided by the SoC to drive the timer, must contain an
+  entry for each entry in clock-names.
+- clock-names : Must include the following entries:
+  o "ftm-evt"
+  o "ftm-src"
+  o "ftm-evt-counter-en"
+  o "ftm-src-counter-en"
+- big-endian: One boolean property, the big endian mode will be in use if it is
+  present, or the little endian mode will be in use for all the device registers.
+
+Example:
+ftm: ftm@400b8000 {
+	compatible = "fsl,ftm-timer";
+	reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
+	interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>;
+	clock-names = "ftm-evt", "ftm-src",
+		"ftm-evt-counter-en", "ftm-src-counter-en";
+	clocks = <&clks VF610_CLK_FTM2>,
+		<&clks VF610_CLK_FTM3>,
+		<&clks VF610_CLK_FTM2_EXT_FIX_EN>,
+		<&clks VF610_CLK_FTM3_EXT_FIX_EN>;
+	big-endian;
+};
Documentation/timers/timer_stats.txt +3 -3
index 8abd40b..de835ee 100644
@@ -39,9 +39,9 @@ To stop a sample period issue:
 The statistics can be retrieved by:
 # cat /proc/timer_stats
 
-The readout of /proc/timer_stats automatically disables sampling. The sampled
-information is kept until a new sample period is started. This allows multiple
-readouts.
+While sampling is enabled, each readout from /proc/timer_stats will see
+newly updated statistics. Once sampling is disabled, the sampled information
+is kept until a new sample period is started. This allows multiple readouts.
 
 Sample output of /proc/timer_stats:
 
arch/arm/boot/dts/sun6i-a31.dtsi +11 -0
index d45efa7..8cee8a1 100644
@@ -428,6 +428,17 @@
 			status = "disabled";
 		};
 
+		timer@01c60000 {
+			compatible = "allwinner,sun6i-a31-hstimer", "allwinner,sun7i-a20-hstimer";
+			reg = <0x01c60000 0x1000>;
+			interrupts = <0 51 4>,
+				     <0 52 4>,
+				     <0 53 4>,
+				     <0 54 4>;
+			clocks = <&ahb1_gates 19>;
+			resets = <&ahb1_rst 19>;
+		};
+
 		spi0: spi@01c68000 {
 			compatible = "allwinner,sun6i-a31-spi";
 			reg = <0x01c68000 0x1000>;
arch/arm/boot/dts/vexpress-v2p-ca5s.dts +9 -1
index c544a55..d2709b7 100644
@@ -88,6 +88,14 @@
 		interrupts = <1 13 0x304>;
 	};
 
+	timer@2c000200 {
+		compatible = "arm,cortex-a5-global-timer",
+		             "arm,cortex-a9-global-timer";
+		reg = <0x2c000200 0x20>;
+		interrupts = <1 11 0x304>;
+		clocks = <&oscclk0>;
+	};
+
 	watchdog@2c000620 {
 		compatible = "arm,cortex-a5-twd-wdt";
 		reg = <0x2c000620 0x20>;
@@ -120,7 +128,7 @@
 		compatible = "arm,vexpress,config-bus";
 		arm,vexpress,config-bridge = <&v2m_sysreg>;
 
-		osc@0 {
+		oscclk0: osc@0 {
 			/* CPU and internal AXI reference clock */
 			compatible = "arm,vexpress-osc";
 			arm,vexpress-sysreg,func = <1 0>;
arch/arm/boot/dts/vf610.dtsi +13 -0
index b8ce0aa7..3c91b84 100644
@@ -347,6 +347,19 @@
 				status = "disabled";
 			};
 
+			ftm: ftm@400b8000 {
+				compatible = "fsl,ftm-timer";
+				reg = <0x400b8000 0x1000 0x400b9000 0x1000>;
+				interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>;
+				clock-names = "ftm-evt", "ftm-src",
+					"ftm-evt-counter-en", "ftm-src-counter-en";
+				clocks = <&clks VF610_CLK_FTM2>,
+					<&clks VF610_CLK_FTM3>,
+					<&clks VF610_CLK_FTM2_EXT_FIX_EN>,
+					<&clks VF610_CLK_FTM3_EXT_FIX_EN>;
+				status = "disabled";
+			};
+
 			fec0: ethernet@400d0000 {
 				compatible = "fsl,mvf600-fec";
 				reg = <0x400d0000 0x1000>;
arch/arm/mach-vexpress/Kconfig +1 -0
index 657d52d..e9811a0 100644
@@ -4,6 +4,7 @@ config ARCH_VEXPRESS
 	select ARCH_SUPPORTS_BIG_ENDIAN
 	select ARM_AMBA
 	select ARM_GIC
+	select ARM_GLOBAL_TIMER
 	select ARM_TIMER_SP804
 	select COMMON_CLK_VERSATILE
 	select HAVE_ARM_SCU if SMP
drivers/clocksource/Kconfig +5 -0
index 96918e1..0437767 100644
@@ -136,6 +136,11 @@ config CLKSRC_SAMSUNG_PWM
 	  for all devicetree enabled platforms. This driver will be
 	  needed only on systems that do not have the Exynos MCT available.
 
+config FSL_FTM_TIMER
+	bool
+	help
+	  Support for Freescale FlexTimer Module (FTM) timer.
+
 config VF_PIT_TIMER
 	bool
 	help
drivers/clocksource/Makefile +1 -0
index 98cb6c5..0770916 100644
@@ -31,6 +31,7 @@ obj-$(CONFIG_CADENCE_TTC_TIMER)	+= cadence_ttc_timer.o
 obj-$(CONFIG_CLKSRC_EFM32)	+= time-efm32.o
 obj-$(CONFIG_CLKSRC_EXYNOS_MCT)	+= exynos_mct.o
 obj-$(CONFIG_CLKSRC_SAMSUNG_PWM)	+= samsung_pwm_timer.o
+obj-$(CONFIG_FSL_FTM_TIMER)	+= fsl_ftm_timer.o
 obj-$(CONFIG_VF_PIT_TIMER)	+= vf_pit_timer.o
 obj-$(CONFIG_CLKSRC_QCOM)	+= qcom-timer.o
 
drivers/clocksource/arm_global_timer.c +3 -2
index 0fc31d0..60e5a170 100644
@@ -246,11 +246,12 @@ static void __init global_timer_of_register(struct device_node *np)
 	int err = 0;
 
 	/*
-	 * In r2p0 the comparators for each processor with the global timer
+	 * In A9 r2p0 the comparators for each processor with the global timer
 	 * fire when the timer value is greater than or equal to. In previous
 	 * revisions the comparators fired when the timer value was equal to.
 	 */
-	if ((read_cpuid_id() & 0xf0000f) < 0x200000) {
+	if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9
+	    && (read_cpuid_id() & 0xf0000f) < 0x200000) {
 		pr_warn("global-timer: non support for this cpu version.\n");
 		return;
 	}
drivers/clocksource/dw_apb_timer_of.c +1 -1
index 2a2ea27..d305fb0 100644
@@ -106,7 +106,7 @@ static void __init add_clocksource(struct device_node *source_timer)
 	sched_rate = rate;
 }
 
-static u64 read_sched_clock(void)
+static u64 notrace read_sched_clock(void)
 {
 	return ~__raw_readl(sched_io_base);
 }
drivers/clocksource/em_sti.c +1 -3
index 9d17083..d0a7bd6 100644
@@ -318,10 +318,8 @@ static int em_sti_probe(struct platform_device *pdev)
 	int irq;
 
 	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
-	if (p == NULL) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+	if (p == NULL)
 		return -ENOMEM;
-	}
 
 	p->pdev = pdev;
 	platform_set_drvdata(pdev, p);
drivers/clocksource/fsl_ftm_timer.c new file +367 -0

367 lines not on this page · raw message

drivers/clocksource/mmio.c +4 -4
index c0e2512..1593ade 100644
@@ -22,22 +22,22 @@ static inline struct clocksource_mmio *to_mmio_clksrc(struct clocksource *c)
 
 cycle_t clocksource_mmio_readl_up(struct clocksource *c)
 {
-	return readl_relaxed(to_mmio_clksrc(c)->reg);
+	return (cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg);
 }
 
 cycle_t clocksource_mmio_readl_down(struct clocksource *c)
 {
-	return ~readl_relaxed(to_mmio_clksrc(c)->reg);
+	return ~(cycle_t)readl_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
 }
 
 cycle_t clocksource_mmio_readw_up(struct clocksource *c)
 {
-	return readw_relaxed(to_mmio_clksrc(c)->reg);
+	return (cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg);
 }
 
 cycle_t clocksource_mmio_readw_down(struct clocksource *c)
 {
-	return ~(unsigned)readw_relaxed(to_mmio_clksrc(c)->reg);
+	return ~(cycle_t)readw_relaxed(to_mmio_clksrc(c)->reg) & c->mask;
 }
 
 /**
drivers/clocksource/qcom-timer.c +13 -0
index e807acf..8d115db 100644
@@ -26,6 +26,8 @@
 #include <linux/of_irq.h>
 #include <linux/sched_clock.h>
 
+#include <asm/delay.h>
+
 #define TIMER_MATCH_VAL			0x0000
 #define TIMER_COUNT_VAL			0x0004
 #define TIMER_ENABLE			0x0008
@@ -179,6 +181,15 @@ static u64 notrace msm_sched_clock_read(void)
 	return msm_clocksource.read(&msm_clocksource);
 }
 
+static unsigned long msm_read_current_timer(void)
+{
+	return msm_clocksource.read(&msm_clocksource);
+}
+
+static struct delay_timer msm_delay_timer = {
+	.read_current_timer = msm_read_current_timer,
+};
+
 static void __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq,
 				  bool percpu)
 {
@@ -217,6 +228,8 @@ err:
 	if (res)
 		pr_err("clocksource_register failed\n");
 	sched_clock_register(msm_sched_clock_read, sched_bits, dgt_hz);
+	msm_delay_timer.freq = dgt_hz;
+	register_current_timer_delay(&msm_delay_timer);
 }
 
 #ifdef CONFIG_ARCH_QCOM
drivers/clocksource/sh_cmt.c +625 -333

1,407 lines not on this page · raw message

drivers/clocksource/sh_mtu2.c +340 -150

694 lines not on this page · raw message

drivers/clocksource/sh_tmu.c +340 -203

273 lines not on this page · raw message

drivers/clocksource/time-efm32.c +2 -1
index 1a6205b..bba62f9 100644

Lines of this file are not shown. View the raw message.

drivers/clocksource/timer-sun5i.c +6 -0
index deebcd6..0226844 100644

Lines of this file are not shown. View the raw message.

include/linux/sched_clock.h +0 -1
index cddf0c2..efa931c 100644

Lines of this file are not shown. View the raw message.

include/linux/sh_timer.h +1 -0
index 4d9dcd1..8e1e036 100644

Lines of this file are not shown. View the raw message.

kernel/time/ntp.c +10 -7
index 419a52c..c8780cd 100644

Lines of this file are not shown. View the raw message.

kernel/time/sched_clock.c +0 -13
index 4d23dc4..445106d 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.