Commit 59113d93 authored by Viresh Kumar's avatar Viresh Kumar Committed by Ralf Baechle

MIPS: rt3352: Migrate to new 'set-state' interface

Migrate ralink 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: default avatarViresh 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/10610/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 1fed884d
...@@ -36,8 +36,8 @@ struct systick_device { ...@@ -36,8 +36,8 @@ struct systick_device {
int freq_scale; int freq_scale;
}; };
static void systick_set_clock_mode(enum clock_event_mode mode, static int systick_set_oneshot(struct clock_event_device *evt);
struct clock_event_device *evt); static int systick_shutdown(struct clock_event_device *evt);
static int systick_next_event(unsigned long delta, static int systick_next_event(unsigned long delta,
struct clock_event_device *evt) struct clock_event_device *evt)
...@@ -73,11 +73,12 @@ static struct systick_device systick = { ...@@ -73,11 +73,12 @@ static struct systick_device systick = {
* cevt-r4k uses 300, make sure systick * cevt-r4k uses 300, make sure systick
* gets used if available * gets used if available
*/ */
.rating = 310, .rating = 310,
.features = CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_ONESHOT,
.set_next_event = systick_next_event, .set_next_event = systick_next_event,
.set_mode = systick_set_clock_mode, .set_state_shutdown = systick_shutdown,
.event_handler = systick_event_handler, .set_state_oneshot = systick_set_oneshot,
.event_handler = systick_event_handler,
}, },
}; };
...@@ -87,33 +88,33 @@ static struct irqaction systick_irqaction = { ...@@ -87,33 +88,33 @@ static struct irqaction systick_irqaction = {
.dev_id = &systick.dev, .dev_id = &systick.dev,
}; };
static void systick_set_clock_mode(enum clock_event_mode mode, static int systick_shutdown(struct clock_event_device *evt)
struct clock_event_device *evt)
{ {
struct systick_device *sdev; struct systick_device *sdev;
sdev = container_of(evt, struct systick_device, dev); sdev = container_of(evt, struct systick_device, dev);
switch (mode) { if (sdev->irq_requested)
case CLOCK_EVT_MODE_ONESHOT: free_irq(systick.dev.irq, &systick_irqaction);
if (!sdev->irq_requested) sdev->irq_requested = 0;
setup_irq(systick.dev.irq, &systick_irqaction); iowrite32(0, systick.membase + SYSTICK_CONFIG);
sdev->irq_requested = 1;
iowrite32(CFG_EXT_STK_EN | CFG_CNT_EN, return 0;
systick.membase + SYSTICK_CONFIG); }
break;
static int systick_set_oneshot(struct clock_event_device *evt)
case CLOCK_EVT_MODE_SHUTDOWN: {
if (sdev->irq_requested) struct systick_device *sdev;
free_irq(systick.dev.irq, &systick_irqaction);
sdev->irq_requested = 0; sdev = container_of(evt, struct systick_device, dev);
iowrite32(0, systick.membase + SYSTICK_CONFIG);
break; if (!sdev->irq_requested)
setup_irq(systick.dev.irq, &systick_irqaction);
default: sdev->irq_requested = 1;
pr_err("%s: Unhandeled mips clock_mode\n", systick.dev.name); iowrite32(CFG_EXT_STK_EN | CFG_CNT_EN,
break; systick.membase + SYSTICK_CONFIG);
}
return 0;
} }
static void __init ralink_systick_init(struct device_node *np) static void __init ralink_systick_init(struct device_node *np)
......
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