Commit 5bbc08fb authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Ungerer

m68k/coldfire/pit: Migrate to new 'set-state' interface

Migrate m68k 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.

We weren't doing anything in ->set_mode(RESUME) and so tick_resume()
isn't implemented.

Cc: Greg Ungerer <gerg@uclinux.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.org>
parent c13dcf9f
...@@ -42,37 +42,28 @@ static u32 pit_cnt; ...@@ -42,37 +42,28 @@ static u32 pit_cnt;
* This is also called after resume to bring the PIT into operation again. * This is also called after resume to bring the PIT into operation again.
*/ */
static void init_cf_pit_timer(enum clock_event_mode mode, static int cf_pit_set_periodic(struct clock_event_device *evt)
struct clock_event_device *evt)
{ {
switch (mode) { __raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
case CLOCK_EVT_MODE_PERIODIC: __raw_writew(PIT_CYCLES_PER_JIFFY, TA(MCFPIT_PMR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE |
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR)); MCFPIT_PCSR_OVW | MCFPIT_PCSR_RLD |
__raw_writew(PIT_CYCLES_PER_JIFFY, TA(MCFPIT_PMR)); MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | \ return 0;
MCFPIT_PCSR_OVW | MCFPIT_PCSR_RLD | \ }
MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
break; static int cf_pit_set_oneshot(struct clock_event_device *evt)
{
case CLOCK_EVT_MODE_SHUTDOWN: __raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
case CLOCK_EVT_MODE_UNUSED: __raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE |
MCFPIT_PCSR_OVW | MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR)); return 0;
break; }
case CLOCK_EVT_MODE_ONESHOT: static int cf_pit_shutdown(struct clock_event_device *evt)
{
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR)); __raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | \ return 0;
MCFPIT_PCSR_OVW | MCFPIT_PCSR_CLK64, \
TA(MCFPIT_PCSR));
break;
case CLOCK_EVT_MODE_RESUME:
/* Nothing to do here */
break;
}
} }
/* /*
...@@ -88,12 +79,15 @@ static int cf_pit_next_event(unsigned long delta, ...@@ -88,12 +79,15 @@ static int cf_pit_next_event(unsigned long delta,
} }
struct clock_event_device cf_pit_clockevent = { struct clock_event_device cf_pit_clockevent = {
.name = "pit", .name = "pit",
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_PERIODIC |
.set_mode = init_cf_pit_timer, CLOCK_EVT_FEAT_ONESHOT,
.set_next_event = cf_pit_next_event, .set_state_shutdown = cf_pit_shutdown,
.shift = 32, .set_state_periodic = cf_pit_set_periodic,
.irq = MCF_IRQ_PIT1, .set_state_oneshot = cf_pit_set_oneshot,
.set_next_event = cf_pit_next_event,
.shift = 32,
.irq = MCF_IRQ_PIT1,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment