Blame view

arch/arm/mach-h720x/cpu-h7201.c 1.47 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  /*
   * linux/arch/arm/mach-h720x/cpu-h7201.c
   *
   * Copyright (C) 2003 Thomas Gleixner <tglx@linutronix.de>
   *               2003 Robert Schwebel <r.schwebel@pengutronix.de>
   *               2004 Sascha Hauer    <s.hauer@pengutronix.de>
   *
   * processor specific stuff for the Hynix h7201
   *
   * 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/interrupt.h>
  #include <linux/module.h>
  #include <asm/types.h>
a09e64fbc   Russell King   [ARM] Move includ...
20
  #include <mach/hardware.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
  #include <asm/irq.h>
a09e64fbc   Russell King   [ARM] Move includ...
22
  #include <mach/irqs.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
23
24
25
26
27
28
29
  #include <asm/mach/irq.h>
  #include <asm/mach/time.h>
  #include "common.h"
  /*
   * Timer interrupt handler
   */
  static irqreturn_t
0cd61b68c   Linus Torvalds   Initial blind fix...
30
  h7201_timer_interrupt(int irq, void *dev_id)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
  {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
  	CPU_REG (TIMER_VIRT, TIMER_TOPSTAT);
0cd61b68c   Linus Torvalds   Initial blind fix...
33
  	timer_tick();
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
36
37
38
39
  	return IRQ_HANDLED;
  }
  
  static struct irqaction h7201_timer_irq = {
  	.name		= "h7201 Timer Tick",
b30fabada   Bernhard Walle   Add IRQF_IRQPOLL ...
40
  	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
09b8b5f84   Russell King   [PATCH] ARM: Add ...
41
  	.handler	= h7201_timer_interrupt,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  };
  
  /*
   * Setup TIMER0 as system timer
   */
  void __init h7201_init_time(void)
  {
  	CPU_REG (TIMER_VIRT, TM0_PERIOD) = LATCH;
  	CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_RESET;
  	CPU_REG (TIMER_VIRT, TM0_CTRL) = TM_REPEAT | TM_START;
  	CPU_REG (TIMER_VIRT, TIMER_TOPCTRL) = ENABLE_TM0_INTR | TIMER_ENABLE_BIT;
  
  	setup_irq(IRQ_TIMER0, &h7201_timer_irq);
  }
  
  struct sys_timer h7201_timer = {
  	.init		= h7201_init_time,
  	.offset		= h720x_gettimeoffset,
  };