mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 07:04:24 +00:00
sparc/time: Migrate to new 'set-state' interface
Migrate sparc drivers 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 which switching to few clockevent modes and so their callbacks aren't implemented. Cc: "David S. Miller" <davem@davemloft.net> Cc: sparclinux@vger.kernel.org Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
This commit is contained in:
parent
d5ed65d83c
commit
ff4aea45c7
3 changed files with 37 additions and 53 deletions
|
@ -247,7 +247,7 @@ void smp4m_percpu_timer_interrupt(struct pt_regs *regs)
|
||||||
|
|
||||||
ce = &per_cpu(sparc32_clockevent, cpu);
|
ce = &per_cpu(sparc32_clockevent, cpu);
|
||||||
|
|
||||||
if (ce->mode & CLOCK_EVT_MODE_PERIODIC)
|
if (clockevent_state_periodic(ce))
|
||||||
sun4m_clear_profile_irq(cpu);
|
sun4m_clear_profile_irq(cpu);
|
||||||
else
|
else
|
||||||
sparc_config.load_profile_irq(cpu, 0); /* Is this needless? */
|
sparc_config.load_profile_irq(cpu, 0); /* Is this needless? */
|
||||||
|
|
|
@ -101,21 +101,18 @@ irqreturn_t notrace timer_interrupt(int dummy, void *dev_id)
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timer_ce_set_mode(enum clock_event_mode mode,
|
static int timer_ce_shutdown(struct clock_event_device *evt)
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
{
|
||||||
switch (mode) {
|
timer_ce_enabled = 0;
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
timer_ce_enabled = 1;
|
|
||||||
break;
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
timer_ce_enabled = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
smp_mb();
|
smp_mb();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int timer_ce_set_periodic(struct clock_event_device *evt)
|
||||||
|
{
|
||||||
|
timer_ce_enabled = 1;
|
||||||
|
smp_mb();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __init void setup_timer_ce(void)
|
static __init void setup_timer_ce(void)
|
||||||
|
@ -127,7 +124,9 @@ static __init void setup_timer_ce(void)
|
||||||
ce->name = "timer_ce";
|
ce->name = "timer_ce";
|
||||||
ce->rating = 100;
|
ce->rating = 100;
|
||||||
ce->features = CLOCK_EVT_FEAT_PERIODIC;
|
ce->features = CLOCK_EVT_FEAT_PERIODIC;
|
||||||
ce->set_mode = timer_ce_set_mode;
|
ce->set_state_shutdown = timer_ce_shutdown;
|
||||||
|
ce->set_state_periodic = timer_ce_set_periodic;
|
||||||
|
ce->tick_resume = timer_ce_set_periodic;
|
||||||
ce->cpumask = cpu_possible_mask;
|
ce->cpumask = cpu_possible_mask;
|
||||||
ce->shift = 32;
|
ce->shift = 32;
|
||||||
ce->mult = div_sc(sparc_config.clock_rate, NSEC_PER_SEC,
|
ce->mult = div_sc(sparc_config.clock_rate, NSEC_PER_SEC,
|
||||||
|
@ -183,24 +182,20 @@ static __init int setup_timer_cs(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
static void percpu_ce_setup(enum clock_event_mode mode,
|
static int percpu_ce_shutdown(struct clock_event_device *evt)
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
{
|
||||||
int cpu = cpumask_first(evt->cpumask);
|
int cpu = cpumask_first(evt->cpumask);
|
||||||
|
|
||||||
switch (mode) {
|
sparc_config.load_profile_irq(cpu, 0);
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
return 0;
|
||||||
sparc_config.load_profile_irq(cpu,
|
}
|
||||||
SBUS_CLOCK_RATE / HZ);
|
|
||||||
break;
|
static int percpu_ce_set_periodic(struct clock_event_device *evt)
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
{
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
int cpu = cpumask_first(evt->cpumask);
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
sparc_config.load_profile_irq(cpu, 0);
|
sparc_config.load_profile_irq(cpu, SBUS_CLOCK_RATE / HZ);
|
||||||
break;
|
return 0;
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int percpu_ce_set_next_event(unsigned long delta,
|
static int percpu_ce_set_next_event(unsigned long delta,
|
||||||
|
@ -224,7 +219,9 @@ void register_percpu_ce(int cpu)
|
||||||
ce->name = "percpu_ce";
|
ce->name = "percpu_ce";
|
||||||
ce->rating = 200;
|
ce->rating = 200;
|
||||||
ce->features = features;
|
ce->features = features;
|
||||||
ce->set_mode = percpu_ce_setup;
|
ce->set_state_shutdown = percpu_ce_shutdown;
|
||||||
|
ce->set_state_periodic = percpu_ce_set_periodic;
|
||||||
|
ce->set_state_oneshot = percpu_ce_shutdown;
|
||||||
ce->set_next_event = percpu_ce_set_next_event;
|
ce->set_next_event = percpu_ce_set_next_event;
|
||||||
ce->cpumask = cpumask_of(cpu);
|
ce->cpumask = cpumask_of(cpu);
|
||||||
ce->shift = 32;
|
ce->shift = 32;
|
||||||
|
|
|
@ -674,32 +674,19 @@ static int sparc64_next_event(unsigned long delta,
|
||||||
return tick_ops->add_compare(delta) ? -ETIME : 0;
|
return tick_ops->add_compare(delta) ? -ETIME : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sparc64_timer_setup(enum clock_event_mode mode,
|
static int sparc64_timer_shutdown(struct clock_event_device *evt)
|
||||||
struct clock_event_device *evt)
|
|
||||||
{
|
{
|
||||||
switch (mode) {
|
tick_ops->disable_irq();
|
||||||
case CLOCK_EVT_MODE_ONESHOT:
|
return 0;
|
||||||
case CLOCK_EVT_MODE_RESUME:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_SHUTDOWN:
|
|
||||||
tick_ops->disable_irq();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLOCK_EVT_MODE_PERIODIC:
|
|
||||||
case CLOCK_EVT_MODE_UNUSED:
|
|
||||||
WARN_ON(1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct clock_event_device sparc64_clockevent = {
|
static struct clock_event_device sparc64_clockevent = {
|
||||||
.features = CLOCK_EVT_FEAT_ONESHOT,
|
.features = CLOCK_EVT_FEAT_ONESHOT,
|
||||||
.set_mode = sparc64_timer_setup,
|
.set_state_shutdown = sparc64_timer_shutdown,
|
||||||
.set_next_event = sparc64_next_event,
|
.set_next_event = sparc64_next_event,
|
||||||
.rating = 100,
|
.rating = 100,
|
||||||
.shift = 30,
|
.shift = 30,
|
||||||
.irq = -1,
|
.irq = -1,
|
||||||
};
|
};
|
||||||
static DEFINE_PER_CPU(struct clock_event_device, sparc64_events);
|
static DEFINE_PER_CPU(struct clock_event_device, sparc64_events);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue