Blame view

arch/sh/kernel/localtimer.c 1.48 KB
8c24594de   Paul Mundt   sh: generic clock...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  /*
   * Dummy local timer
   *
   * Copyright (C) 2008  Paul Mundt
   *
   * cloned from:
   *
   *  linux/arch/arm/mach-realview/localtimer.c
   *
   *  Copyright (C) 2002 ARM Ltd.
   *  All Rights Reserved
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
  #include <linux/init.h>
  #include <linux/kernel.h>
  #include <linux/delay.h>
  #include <linux/device.h>
  #include <linux/smp.h>
  #include <linux/jiffies.h>
  #include <linux/percpu.h>
  #include <linux/clockchips.h>
fc6191dd3   Paul Mundt   sh: Fix up clocke...
25
  #include <linux/hardirq.h>
8c24594de   Paul Mundt   sh: generic clock...
26
27
28
29
30
31
32
33
34
  #include <linux/irq.h>
  
  static DEFINE_PER_CPU(struct clock_event_device, local_clockevent);
  
  /*
   * Used on SMP for either the local timer or SMP_MSG_TIMER
   */
  void local_timer_interrupt(void)
  {
c473b2c6f   Christoph Lameter   sh: Replace __get...
35
  	struct clock_event_device *clk = this_cpu_ptr(&local_clockevent);
8c24594de   Paul Mundt   sh: generic clock...
36

fc6191dd3   Paul Mundt   sh: Fix up clocke...
37
  	irq_enter();
8c24594de   Paul Mundt   sh: generic clock...
38
  	clk->event_handler(clk);
fc6191dd3   Paul Mundt   sh: Fix up clocke...
39
  	irq_exit();
8c24594de   Paul Mundt   sh: generic clock...
40
41
42
43
44
45
  }
  
  static void dummy_timer_set_mode(enum clock_event_mode mode,
  				 struct clock_event_device *clk)
  {
  }
3366e3585   Paul Mundt   sh: Move platform...
46
  void local_timer_setup(unsigned int cpu)
8c24594de   Paul Mundt   sh: generic clock...
47
48
49
50
  {
  	struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
  
  	clk->name		= "dummy_timer";
fc6191dd3   Paul Mundt   sh: Fix up clocke...
51
52
53
54
  	clk->features		= CLOCK_EVT_FEAT_ONESHOT |
  				  CLOCK_EVT_FEAT_PERIODIC |
  				  CLOCK_EVT_FEAT_DUMMY;
  	clk->rating		= 400;
8c24594de   Paul Mundt   sh: generic clock...
55
56
57
  	clk->mult		= 1;
  	clk->set_mode		= dummy_timer_set_mode;
  	clk->broadcast		= smp_timer_broadcast;
320ab2b0b   Rusty Russell   cpumask: convert ...
58
  	clk->cpumask		= cpumask_of(cpu);
8c24594de   Paul Mundt   sh: generic clock...
59
60
61
  
  	clockevents_register_device(clk);
  }
763142d1e   Paul Mundt   sh: CPU hotplug s...
62
63
64
65
  
  void local_timer_stop(unsigned int cpu)
  {
  }