diff options
| author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-20 20:52:36 -0400 | 
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-20 20:52:36 -0400 | 
| commit | 050335db2a777ffaa859d77beb05fffe9e8c5ae9 (patch) | |
| tree | 6f1fb3e3477de613b4adac8c46bd6e86301ed8ae /arch/arm/mach-netx/time.c | |
| parent | a4cfae13cef6a700a04b13ba1d819c0641b1b26f (diff) | |
| parent | 905f14672e6d0552bfde954d5f7adb5f2c7a7960 (diff) | |
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (42 commits)
  [ARM] Fix tosa build error
  [ARM] 3610/1: Make reboot work on Versatile
  [ARM] 3609/1: S3C24XX: defconfig update for s3c2410_defconfig
  [ARM] 3591/1: Anubis: IDE device definitions
  [ARM] Include asm/hardware.h not asm/arch/hardware.h
  [ARM] 3594/1: Poodle: Add touchscreen support + other updates
  [ARM] 3564/1: sharpsl_pm: Abstract some machine specific parameters
  [ARM] 3561/1: Poodle: Correct the MMC/SD power control
  [ARM] 3593/1: Add reboot and shutdown handlers for Zaurus handhelds
  [ARM] 3599/1: AT91RM9200 remove global variables
  [ARM] 3607/1: AT91RM9200 misc fixes
  [ARM] 3605/1: AT91RM9200 Power Management
  [ARM] 3604/1: AT91RM9200 New boards
  [ARM] 3603/1: AT91RM9200 remove old files
  [ARM] 3592/1: AT91RM9200 Serial driver update
  [ARM] 3590/1: AT91RM9200 Platform devices support
  [ARM] 3589/1: AT91RM9200 DK/EK board update
  [ARM] 3588/1: AT91RM9200 CSB337/637 board update
  [ARM] 3587/1: AT91RM9200 hardware headers
  [ARM] 3586/1: AT91RM9200 header update
  ...
Diffstat (limited to 'arch/arm/mach-netx/time.c')
| -rw-r--r-- | arch/arm/mach-netx/time.c | 88 | 
1 files changed, 88 insertions, 0 deletions
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c new file mode 100644 index 000000000000..edfbdf40c600 --- /dev/null +++ b/arch/arm/mach-netx/time.c  | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | /* | ||
| 2 | * arch/arm/mach-netx/time.c | ||
| 3 | * | ||
| 4 | * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 | ||
| 8 | * as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #include <linux/init.h> | ||
| 21 | #include <linux/interrupt.h> | ||
| 22 | |||
| 23 | #include <asm/hardware.h> | ||
| 24 | #include <asm/io.h> | ||
| 25 | #include <asm/mach/time.h> | ||
| 26 | #include <asm/arch/netx-regs.h> | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Returns number of us since last clock interrupt. Note that interrupts | ||
| 30 | * will have been disabled by do_gettimeoffset() | ||
| 31 | */ | ||
| 32 | static unsigned long netx_gettimeoffset(void) | ||
| 33 | { | ||
| 34 | return readl(NETX_GPIO_COUNTER_CURRENT(0)) / 100; | ||
| 35 | } | ||
| 36 | |||
| 37 | /* | ||
| 38 | * IRQ handler for the timer | ||
| 39 | */ | ||
| 40 | static irqreturn_t | ||
| 41 | netx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) | ||
| 42 | { | ||
| 43 | write_seqlock(&xtime_lock); | ||
| 44 | |||
| 45 | timer_tick(regs); | ||
| 46 | write_sequnlock(&xtime_lock); | ||
| 47 | |||
| 48 | /* acknowledge interrupt */ | ||
| 49 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ); | ||
| 50 | |||
| 51 | return IRQ_HANDLED; | ||
| 52 | } | ||
| 53 | |||
| 54 | |||
| 55 | static struct irqaction netx_timer_irq = { | ||
| 56 | .name = "NetX Timer Tick", | ||
| 57 | .flags = SA_INTERRUPT | SA_TIMER, | ||
| 58 | .handler = netx_timer_interrupt, | ||
| 59 | }; | ||
| 60 | |||
| 61 | /* | ||
| 62 | * Set up timer interrupt | ||
| 63 | */ | ||
| 64 | static void __init netx_timer_init(void) | ||
| 65 | { | ||
| 66 | /* disable timer initially */ | ||
| 67 | writel(0, NETX_GPIO_COUNTER_CTRL(0)); | ||
| 68 | |||
| 69 | /* Reset the timer value to zero */ | ||
| 70 | writel(0, NETX_GPIO_COUNTER_CURRENT(0)); | ||
| 71 | |||
| 72 | writel(LATCH, NETX_GPIO_COUNTER_MAX(0)); | ||
| 73 | |||
| 74 | /* acknowledge interrupt */ | ||
| 75 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ); | ||
| 76 | |||
| 77 | /* Enable the interrupt in the specific timer register and start timer */ | ||
| 78 | writel(COUNTER_BIT(0), NETX_GPIO_IRQ_ENABLE); | ||
| 79 | writel(NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN, | ||
| 80 | NETX_GPIO_COUNTER_CTRL(0)); | ||
| 81 | |||
| 82 | setup_irq(NETX_IRQ_TIMER0, &netx_timer_irq); | ||
| 83 | } | ||
| 84 | |||
| 85 | struct sys_timer netx_timer = { | ||
| 86 | .init = netx_timer_init, | ||
| 87 | .offset = netx_gettimeoffset, | ||
| 88 | }; | ||
