MIPS: sni: Migrate to new 'set-state' interface
Migrate sni 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. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: linux-mips@linux-mips.org Cc: linaro-kernel@lists.linaro.org Cc: Thomas Gleixner <tglx@linutronix.de> Patchwork: https://patchwork.linux-mips.org/patch/10612/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
0c16240ab0
commit
397d08b006
@ -14,11 +14,8 @@
|
|||||||
#define SNI_COUNTER2_DIV 64
|
#define SNI_COUNTER2_DIV 64
|
||||||
#define SNI_COUNTER0_DIV ((SNI_CLOCK_TICK_RATE / SNI_COUNTER2_DIV) / HZ)
|
#define SNI_COUNTER0_DIV ((SNI_CLOCK_TICK_RATE / SNI_COUNTER2_DIV) / HZ)
|
||||||
|
|
||||||
static void a20r_set_mode(enum clock_event_mode mode,
|
static int a20r_set_periodic(struct clock_event_device *evt)
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
{
|
||||||
switch (mode) {
|
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0x34;
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 12) = 0x34;
|
||||||
wmb();
|
wmb();
|
||||||
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV;
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 0) = SNI_COUNTER0_DIV;
|
||||||
@ -32,15 +29,7 @@ static void a20r_set_mode(enum clock_event_mode mode,
|
|||||||
wmb();
|
wmb();
|
||||||
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV >> 8;
|
*(volatile u8 *)(A20R_PT_CLOCK_BASE + 8) = SNI_COUNTER2_DIV >> 8;
|
||||||
wmb();
|
wmb();
|
||||||
|
return 0;
|
||||||
break;
|
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
break;
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct clock_event_device a20r_clockevent_device = {
|
static struct clock_event_device a20r_clockevent_device = {
|
||||||
@ -51,7 +40,7 @@ static struct clock_event_device a20r_clockevent_device = {
|
|||||||
|
|
||||||
.rating = 300,
|
.rating = 300,
|
||||||
.irq = SNI_A20R_IRQ_TIMER,
|
.irq = SNI_A20R_IRQ_TIMER,
|
||||||
.set_mode = a20r_set_mode,
|
.set_state_periodic = a20r_set_periodic,
|
||||||
};
|
};
|
||||||
|
|
||||||
static irqreturn_t a20r_interrupt(int irq, void *dev_id)
|
static irqreturn_t a20r_interrupt(int irq, void *dev_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user