aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-iop3xx/iop331-time.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-28 17:40:39 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-28 17:40:39 -0400
commitebdea46fecae40c4d7effcd33f40918a37a1df4b (patch)
treee4312bf7f1f3d184738963a0ec300aa9fdfd55c1 /arch/arm/mach-iop3xx/iop331-time.c
parentfecf3404f4aba6d0edeba31eeb018cbb6326dff2 (diff)
parent250d375d1da45a5e08ab8baf5eaa7eb258afd82b (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: (130 commits) [ARM] 3856/1: Add clocksource for Intel IXP4xx platforms [ARM] 3855/1: Add generic time support [ARM] 3873/1: S3C24XX: Add irq_chip names [ARM] 3872/1: S3C24XX: Apply consistant tabbing to irq_chips [ARM] 3871/1: S3C24XX: Fix ordering of EINT4..23 [ARM] nommu: confirms the CR_V bit in nommu mode [ARM] nommu: abort handler fixup for !CPU_CP15_MMU cores. [ARM] 3870/1: AT91: Start removing static memory mappings [ARM] 3869/1: AT91: NAND support for DK and KB9202 boards [ARM] 3868/1: AT91 hardware header update [ARM] 3867/1: AT91 GPIO update [ARM] 3866/1: AT91 clock update [ARM] 3865/1: AT91RM9200 header updates [ARM] 3862/2: S3C2410 - add basic power management support for AML M5900 series [ARM] kthread: switch arch/arm/kernel/apm.c [ARM] Off-by-one in arch/arm/common/icst* [ARM] 3864/1: Refactore sharpsl_pm [ARM] 3863/1: Add Locomo SPI Device [ARM] 3847/2: Convert LOMOMO to use struct device for GPIOs [ARM] Use CPU_CACHE_* where possible in asm/cacheflush.h ...
Diffstat (limited to 'arch/arm/mach-iop3xx/iop331-time.c')
-rw-r--r--arch/arm/mach-iop3xx/iop331-time.c106
1 files changed, 0 insertions, 106 deletions
diff --git a/arch/arm/mach-iop3xx/iop331-time.c b/arch/arm/mach-iop3xx/iop331-time.c
deleted file mode 100644
index 0c09e74c5740..000000000000
--- a/arch/arm/mach-iop3xx/iop331-time.c
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * arch/arm/mach-iop3xx/iop331-time.c
3 *
4 * Timer code for IOP331 based systems
5 *
6 * Author: Dave Jiang <dave.jiang@intel.com>
7 *
8 * Copyright 2003 Intel Corp.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/kernel.h>
17#include <linux/interrupt.h>
18#include <linux/time.h>
19#include <linux/init.h>
20#include <linux/timex.h>
21
22#include <asm/hardware.h>
23#include <asm/io.h>
24#include <asm/irq.h>
25#include <asm/uaccess.h>
26#include <asm/mach/irq.h>
27#include <asm/mach/time.h>
28
29static inline unsigned long get_elapsed(void)
30{
31 return LATCH - *IOP331_TU_TCR0;
32}
33
34static unsigned long iop331_gettimeoffset(void)
35{
36 unsigned long elapsed, usec;
37 u32 tisr1, tisr2;
38
39 /*
40 * If an interrupt was pending before we read the timer,
41 * we've already wrapped. Factor this into the time.
42 * If an interrupt was pending after we read the timer,
43 * it may have wrapped between checking the interrupt
44 * status and reading the timer. Re-read the timer to
45 * be sure its value is after the wrap.
46 */
47
48 asm volatile("mrc p6, 0, %0, c6, c1, 0" : "=r" (tisr1));
49 elapsed = get_elapsed();
50 asm volatile("mrc p6, 0, %0, c6, c1, 0" : "=r" (tisr2));
51
52 if(tisr1 & 1)
53 elapsed += LATCH;
54 else if (tisr2 & 1)
55 elapsed = LATCH + get_elapsed();
56
57 /*
58 * Now convert them to usec.
59 */
60 usec = (unsigned long)(elapsed / (CLOCK_TICK_RATE/1000000));
61
62 return usec;
63}
64
65static irqreturn_t
66iop331_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
67{
68 u32 tisr;
69
70 write_seqlock(&xtime_lock);
71
72 asm volatile("mrc p6, 0, %0, c6, c1, 0" : "=r" (tisr));
73 tisr |= 1;
74 asm volatile("mcr p6, 0, %0, c6, c1, 0" : : "r" (tisr));
75
76 timer_tick(regs);
77
78 write_sequnlock(&xtime_lock);
79 return IRQ_HANDLED;
80}
81
82static struct irqaction iop331_timer_irq = {
83 .name = "IOP331 Timer Tick",
84 .handler = iop331_timer_interrupt,
85 .flags = IRQF_DISABLED | IRQF_TIMER,
86};
87
88static void __init iop331_timer_init(void)
89{
90 u32 timer_ctl;
91
92 setup_irq(IRQ_IOP331_TIMER0, &iop331_timer_irq);
93
94 timer_ctl = IOP331_TMR_EN | IOP331_TMR_PRIVILEGED | IOP331_TMR_RELOAD |
95 IOP331_TMR_RATIO_1_1;
96
97 asm volatile("mcr p6, 0, %0, c4, c1, 0" : : "r" (LATCH));
98
99 asm volatile("mcr p6, 0, %0, c0, c1, 0" : : "r" (timer_ctl));
100
101}
102
103struct sys_timer iop331_timer = {
104 .init = iop331_timer_init,
105 .offset = iop331_gettimeoffset,
106};