Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1203974
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 55/74] clockevents/drivers/timer-sp804: Migrate to new 'set-state' interface |
| Date | 2015-08-10 12:00 +0200 |
| Message-ID | <pVS29-2wD-77@gated-at.bofh.it> (permalink) |
| References | <pVRSs-2iN-29@gated-at.bofh.it> <pVS25-2wD-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Viresh Kumar <viresh.kumar@linaro.org>
Migrate timer-sp driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.
This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.
There are few more changes worth noticing:
- The clockevent device was disabled by writing: 'TIMER_CTRL_32BIT |
TIMER_CTRL_IE' to ctrl register earlier. i.e. by un-setting the
TIMER_CTRL_ENABLE bit. Its done by writing zero now and should have
the same effect.
- For shutdown and resume we were writing the same value twice to the
register (to disable the timer), which is fixed now.
- Switching to oneshot mode was divided into two parts earlier:
- Firstly set_mode() was writing:
'TIMER_CTRL_32BIT | TIMER_CTRL_IE | TIMER_CTRL_ONESHOT'
to ctrl register (device not enabled yet)
- Then sp804_set_next_event() was enabling the device by writing
'readl(ctrl) | TIMER_CTRL_ENABLE' to the ctrl register. This was
unnecessarily complicated.
- Change this to: Stop device on set_state_oneshot and configure it in
sp804_set_next_event().
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Olof Johansson <olof@lixom.net>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/timer-sp804.c | 54 +++++++++++++++++++--------------------
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/drivers/clocksource/timer-sp804.c b/drivers/clocksource/timer-sp804.c
index ca02503..5f45b9a 100644
--- a/drivers/clocksource/timer-sp804.c
+++ b/drivers/clocksource/timer-sp804.c
@@ -133,50 +133,50 @@ static irqreturn_t sp804_timer_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static void sp804_set_mode(enum clock_event_mode mode,
- struct clock_event_device *evt)
+static inline void timer_shutdown(struct clock_event_device *evt)
{
- unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE;
+ writel(0, clkevt_base + TIMER_CTRL);
+}
- writel(ctrl, clkevt_base + TIMER_CTRL);
+static int sp804_shutdown(struct clock_event_device *evt)
+{
+ timer_shutdown(evt);
+ return 0;
+}
- switch (mode) {
- case CLOCK_EVT_MODE_PERIODIC:
- writel(clkevt_reload, clkevt_base + TIMER_LOAD);
- ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
- break;
-
- case CLOCK_EVT_MODE_ONESHOT:
- /* period set, and timer enabled in 'next_event' hook */
- ctrl |= TIMER_CTRL_ONESHOT;
- break;
-
- case CLOCK_EVT_MODE_UNUSED:
- case CLOCK_EVT_MODE_SHUTDOWN:
- default:
- break;
- }
+static int sp804_set_periodic(struct clock_event_device *evt)
+{
+ unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE |
+ TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
+ timer_shutdown(evt);
+ writel(clkevt_reload, clkevt_base + TIMER_LOAD);
writel(ctrl, clkevt_base + TIMER_CTRL);
+ return 0;
}
static int sp804_set_next_event(unsigned long next,
struct clock_event_device *evt)
{
- unsigned long ctrl = readl(clkevt_base + TIMER_CTRL);
+ unsigned long ctrl = TIMER_CTRL_32BIT | TIMER_CTRL_IE |
+ TIMER_CTRL_ONESHOT | TIMER_CTRL_ENABLE;
writel(next, clkevt_base + TIMER_LOAD);
- writel(ctrl | TIMER_CTRL_ENABLE, clkevt_base + TIMER_CTRL);
+ writel(ctrl, clkevt_base + TIMER_CTRL);
return 0;
}
static struct clock_event_device sp804_clockevent = {
- .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
- CLOCK_EVT_FEAT_DYNIRQ,
- .set_mode = sp804_set_mode,
- .set_next_event = sp804_set_next_event,
- .rating = 300,
+ .features = CLOCK_EVT_FEAT_PERIODIC |
+ CLOCK_EVT_FEAT_ONESHOT |
+ CLOCK_EVT_FEAT_DYNIRQ,
+ .set_state_shutdown = sp804_shutdown,
+ .set_state_periodic = sp804_set_periodic,
+ .set_state_oneshot = sp804_shutdown,
+ .tick_resume = sp804_shutdown,
+ .set_next_event = sp804_set_next_event,
+ .rating = 300,
};
static struct irqaction sp804_timer_irq = {
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PULL] clockevents changes for 4.3 Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 11:50 +0200
[PATCH 66/74] s390/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 43/74] clockevents/drivers/prima2: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 41/74] clockevents/drivers/integrator: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 74/74] cris/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 67/74] score/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
Re: [PATCH 67/74] score/time: Migrate to new 'set-state' interface Lennox Wu <lennox.wu@gmail.com> - 2015-08-16 19:10 +0200
[PATCH 61/74] c6x/timer64: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 31/74] clockevents/drivers/sh_tmu: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 69/74] sparc/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 72/74] xtensa/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 08/74] clockevents/drivers/exynos_mct: Remove unneeded container_of() Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 42/74] clockevents/drivers/keystone: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
Re: [PATCH 42/74] clockevents/drivers/keystone: Migrate to new 'set-state' interface "santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com> - 2015-08-10 19:00 +0200
[PATCH 52/74] clockevents/drivers/dw_apb_timer: Add dynamic irq flag to the timer Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 11/74] clockevents/drivers/asm9260: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 23/74] clockevents/drivers/mxs: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 01/74] clockevents/drivers/arm_arch_timer: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 51/74] clockevents/drivers/exynos_mct: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 70/74] um/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 12/74] clockevents/drivers/cadence_ttc: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 71/74] unicore/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 27/74] clockevents/drivers/rockchip: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 68/74] sh/localtimer: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 62/74] microblaze/timer: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 55/74] clockevents/drivers/timer-sp804: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 65/74] powerpc/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 73/74] kernel: broadcast-hrtimer: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 24/74] clockevents/drivers/nomadik-mtu: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 60/74] blackfin/time-ts: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 05/74] clockevents/drivers/cs5535: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 63/74] mn10300/cevt-mn10300: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 02/74] clockevents/drivers/arm_global_timer: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 64/74] openrisc/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 10/74] clockevents/drivers/sh_cmt: Remove obsolete sh-cmt-48-gen2 platform_device_id entry Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 47/74] clockevents/drivers/vf_pit: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:00 +0200
[PATCH 32/74] clockevents/drivers/sun4i: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 25/74] clockevents/drivers/pxa: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 17/74] clockevents/drivers/i8253: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 49/74] clockevents/drivers/zevio: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 34/74] clockevents/drivers/time-armada-370-xp: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 44/74] clockevents/drivers/stm32: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 33/74] clockevents/drivers/tegra20: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 56/74] clockevents/drivers/timer-atmel-pit: Fix typo in structure initialization Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 30/74] clockevents/drivers/sh_mtu2: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 28/74] clockevents/drivers/samsung_pwm: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 38/74] clockevents/drivers/atmel: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 29/74] clockevents/drivers/sh_cmt: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 57/74] clocksource/drivers/sh_tmu: Fix traceback spotted in -next Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 22/74] clockevents/drivers/mtk: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 36/74] clockevents/drivers/orion: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 39/74] clockevents/drivers/atmel-st: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 37/74] clockevents/drivers/atlas7: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 53/74] clockevents/drivers/sh_cmt: Remove obsolete sh-cmt-48 platform_device_id entry Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 58/74] clockevents/drivers/h8300_timer8: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 45/74] clockevents/drivers/sun5i: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 54/74] clockevents/drivers/timer-imx-gpt: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 35/74] clockevents/drivers/efm32: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 46/74] clockevents/drivers/u300: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 20/74] clockevents/drivers/mips-gic: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 26/74] clockevents/drivers/qcom: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 40/74] clockevents/drivers/digicolor: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 48/74] clockevents/drivers/vt8500: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 50/74] clockevents/drivers/tcb_clksrc: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 21/74] clockevents/drivers/moxart: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 59/74] alpha/time: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 19/74] clockevents/drivers/metag_generic: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:10 +0200
[PATCH 09/74] clockevents/drivers/sh_cmt: Remove obsolete sh-cmt-32-fast platform_device_id entry Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
[PATCH 13/74] clockevents/drivers/clps711x: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
[PATCH 14/74] clockevents/drivers/dummy_timer: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
[PATCH 07/74] clockevents/drivers/Kconfig: Replace USE_OF with OF Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
[PATCH 15/74] clockevents/drivers/dw_apb: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
[PATCH 18/74] clockevents/drivers/meson6: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
[PATCH 06/74] clockevents/drivers/em_sti: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
[PATCH 16/74] clockevents/drivers/fsl_ftm: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
[PATCH 04/74] clockevents/drivers/bcm_kona: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
Re: [PATCH 04/74] clockevents/drivers/bcm_kona: Migrate to new 'set-state' interface Scott Branden <sbranden@broadcom.com> - 2015-08-12 21:40 +0200
[PATCH 03/74] clockevents/drivers/bcm2835: Migrate to new 'set-state' interface Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-08-10 12:20 +0200
Re: [PATCH 03/74] clockevents/drivers/bcm2835: Migrate to new 'set-state' interface Lee Jones <lee@kernel.org> - 2015-08-11 17:40 +0200
csiph-web