Skip to contentSkip to conversation

clockevents for 4.7

GIT PULL New Daniel Lezcano 1 participant 6 messages Apr 28, 2016

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

Hi Thomas, Ingo,

this pull request contains the following changes:

- Implement the set_state_oneshot_stopped() for dw_apb timer (Jisheng Zhang)

- Add a missing __init attribute for the Mediatek timer (Julia Lawall)

- Remove the suspend/resume code as it is never used (Thierry Reding)

- Add a new driver MPS2 with the DT bindings documenation (Vladimir Murzin)

The following changes since commit 86d3473224b004f920c107206d181d37db735145:

time: Introduce do_sys_settimeofday64() (2016-04-22 11:49:04 -0700)

are available in the git repository at:

http://git.linaro.org/people/daniel.lezcano/linux.git clockevents/4.7

for you to fetch changes up to 9999c5fc014adcc4278adddb73888c301be7b9f7:

clocksource/drivers/tegra: Remove unused suspend/resume code (2016-04-28
15:09:08 +0200)

----------------------------------------------------------------
Jisheng Zhang (1):
clockevents/drivers/dw_apb_timer: Implement
->set_state_oneshot_stopped()

Julia Lawall (1):
clocksource/drivers/mtk_timer: Add __init attribute

Thierry Reding (1):
clocksource/drivers/tegra: Remove unused suspend/resume code

Vladimir Murzin (2):
dt-bindings: document the MPS2 timer bindings clockevents/driversi/mps2: add MPS2 Timer driver

 Documentation/devicetree/bindings/timer/arm,mps2-timer.txt |  28 
+++++++++++++
 drivers/clocksource/Kconfig                                |   6 +++
 drivers/clocksource/Makefile                               |   1 +
 drivers/clocksource/dw_apb_timer.c                         |   1 +
 drivers/clocksource/mps2-timer.c                           | 275 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/clocksource/mtk_timer.c                            |   2 +-
 drivers/clocksource/tegra20_timer.c                        |  14 -------
 7 files changed, 312 insertions(+), 15 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/timer/arm,mps2-timer.txt
 create mode 100644 drivers/clocksource/mps2-timer.c
#1 lore raw

PATCH 1/5 clockevents/drivers/dw_apb_timer: Implement ->set_state_oneshot_stopped()

From: Jisheng Zhang <[email protected]>

The dw_apb_timer only "supports PERIODIC mode and their drivers emulate ONESHOT over that" as described in commit 8fff52fd5093 ("clockevents:
Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state").

Inspired by Viresh, I think the dw_apb_timer also needs to implement the set_state_oneshot_stopped() which is called by the clkevt core, when the next event is required at an expiry time of 'KTIME_MAX'. This normally happens with NO_HZ_{IDLE|FULL} in both LOWRES/HIGHRES modes.

This patch makes the clockevent device to stop on such an event, to avoid spurious interrupts, as explained by the above commit.

---
 drivers/clocksource/dw_apb_timer.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clocksource/dw_apb_timer.c +1 -0
index 6334526..797505a 100644
@@ -264,6 +264,7 @@ dw_apb_clockevent_init(int cpu, const char *name, unsigned rating,
 	dw_ced->ced.set_state_shutdown = apbt_shutdown;
 	dw_ced->ced.set_state_periodic = apbt_set_periodic;
 	dw_ced->ced.set_state_oneshot = apbt_set_oneshot;
+	dw_ced->ced.set_state_oneshot_stopped = apbt_shutdown;
 	dw_ced->ced.tick_resume = apbt_resume;
 	dw_ced->ced.set_next_event = apbt_next_event;
 	dw_ced->ced.irq = dw_ced->timer.irq;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/5 clocksource/drivers/mtk_timer: Add __init attribute

From: Julia Lawall <[email protected]>

Add __init attribute on a function that is only called from other __init functions and that is not inlined, at least with gcc version 4.8.4 on an x86 machine with allyesconfig. Currently, the function is put in the .text.unlikely segment. Declaring it as __init will cause it to be put in the .init.text and to disappear after initialization.

The result of objdump -x on the function before the change is as follows:

0000000000000000 l F .text.unlikely 000000000000006f mtk_timer_setup.isra.4

And after the change it is as follows:

0000000000000000 l F .init.text 000000000000006a mtk_timer_setup.isra.4

Done with the help of Coccinelle. The semantic patch checks for local static non-init functions that are called from an __init function and are not called from any other function.

---
 drivers/clocksource/mtk_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/mtk_timer.c +1 -1
index d67bc35..7e583f8 100644
@@ -152,7 +152,7 @@ static irqreturn_t mtk_timer_interrupt(int irq, void *dev_id)
 }
 
 static void
-mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
+__init mtk_timer_setup(struct mtk_clock_event_device *evt, u8 timer, u8 option)
 {
 	writel(TIMER_CTRL_CLEAR | TIMER_CTRL_DISABLE,
 		evt->gpt_base + TIMER_CTRL_REG(timer));
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/5 dt-bindings: document the MPS2 timer bindings

In reply to Daniel Lezcano

From: Vladimir Murzin <[email protected]>

This adds documentation of device tree bindings for the timers found on ARM MPS2 platform.

---
 .../devicetree/bindings/timer/arm,mps2-timer.txt   | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/timer/arm,mps2-timer.txt
Documentation/devicetree/bindings/timer/arm,mps2-timer.txt new file +28 -0
new file mode 100644
index 0000000..48f84d7
@@ -0,0 +1,28 @@
+ARM MPS2 timer
+
+The MPS2 platform has simple general-purpose 32 bits timers.
+
+Required properties:
+- compatible	: Should be "arm,mps2-timer"
+- reg		: Address and length of the register set
+- interrupts	: Reference to the timer interrupt
+
+Required clocking property, have to be one of:
+- clocks	  : The input clock of the timer
+- clock-frequency : The rate in HZ in input of the ARM MPS2 timer
+
+Examples:
+
+timer1: mps2-timer@40000000 {
+	compatible = "arm,mps2-timer";
+	reg = <0x40000000 0x1000>;
+	interrupts = <8>;
+	clocks = <&sysclk>;
+};
+
+timer2: mps2-timer@40001000 {
+	compatible = "arm,mps2-timer";
+	reg = <0x40001000 0x1000>;
+	interrupts = <9>;
+	clock-frequency = <25000000>;
+};
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/5 clockevents/driversi/mps2: add MPS2 Timer driver

In reply to Daniel Lezcano

From: Vladimir Murzin <[email protected]>

MPS2 platform has simple 32 bits general purpose countdown timers.

The driver uses the first detected timer as a clocksource and the rest of the timers as a clockevent

---
 drivers/clocksource/Kconfig      |   6 +
 drivers/clocksource/Makefile     |   1 +
 drivers/clocksource/mps2-timer.c | 275 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 282 insertions(+)
 create mode 100644 drivers/clocksource/mps2-timer.c
drivers/clocksource/Kconfig +6 -0
index c346be6..6ff327a 100644
@@ -186,6 +186,12 @@ config CLKSRC_STM32
 	depends on OF && ARM && (ARCH_STM32 || COMPILE_TEST)
 	select CLKSRC_MMIO
 
+config CLKSRC_MPS2
+	bool "Clocksource for MPS2 SoCs" if COMPILE_TEST
+	depends on GENERIC_SCHED_CLOCK
+	select CLKSRC_MMIO
+	select CLKSRC_OF
+
 config ARM_ARCH_TIMER
 	bool
 	select CLKSRC_OF if OF
drivers/clocksource/Makefile +1 -0
index dc2b899..b0a3c96 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_CLKSRC_EFM32)	+= time-efm32.o
 obj-$(CONFIG_CLKSRC_STM32)	+= timer-stm32.o
 obj-$(CONFIG_CLKSRC_EXYNOS_MCT)	+= exynos_mct.o
 obj-$(CONFIG_CLKSRC_LPC32XX)	+= time-lpc32xx.o
+obj-$(CONFIG_CLKSRC_MPS2)	+= mps2-timer.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
drivers/clocksource/mps2-timer.c new file +275 -0

275 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/5 clocksource/drivers/tegra: Remove unused suspend/resume code

In reply to Daniel Lezcano

From: Thierry Reding <[email protected]>

The tegra_timer_suspend() and tegra_timer_resume() functions are never used, so they can be removed.

---
 drivers/clocksource/tegra20_timer.c | 14 --------------
 1 file changed, 14 deletions(-)
drivers/clocksource/tegra20_timer.c +0 -14
index 38333ab..7b94ad2 100644
@@ -258,17 +258,3 @@ static void __init tegra20_init_rtc(struct device_node *np)
 	register_persistent_clock(NULL, tegra_read_persistent_clock64);
 }
 CLOCKSOURCE_OF_DECLARE(tegra20_rtc, "nvidia,tegra20-rtc", tegra20_init_rtc);
-
-#ifdef CONFIG_PM
-static u32 usec_config;
-
-void tegra_timer_suspend(void)
-{
-	usec_config = timer_readl(TIMERUS_USEC_CFG);
-}
-
-void tegra_timer_resume(void)
-{
-	timer_writel(usec_config, TIMERUS_USEC_CFG);
-}
-#endif
Signature · 1 line
1.9.1