- pre3:
[davej-history.git] / include / asm-arm / arch-nexuspci / time.h
blob54872be9ff2b28243572599e81844c8a30c0f088
1 /*
2 * linux/include/asm-arm/arch-nexuspci/time.h
4 * Copyright (c) 1997, 1998, 1999, 2000 FutureTV Labs Ltd.
6 * The FTV PCI card has no real-time clock. We get timer ticks from the
7 * SCC chip.
8 */
10 static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
12 static int count = 25;
13 unsigned char stat = __raw_readb(DUART_BASE + 0x14);
14 if (!(stat & 0x10))
15 return; /* Not for us */
17 /* Reset counter */
18 __raw_writeb(0x90, DUART_BASE + 8);
20 if (--count == 0) {
21 static int state = 1;
22 state ^= 1;
23 __raw_writeb(0x1a + state, INTCONT_BASE);
24 __raw_writeb(0x18 + state, INTCONT_BASE);
25 count = 50;
28 /* Wait for slow rise time */
29 __raw_readb(DUART_BASE + 0x14);
30 __raw_readb(DUART_BASE + 0x14);
31 __raw_readb(DUART_BASE + 0x14);
32 __raw_readb(DUART_BASE + 0x14);
33 __raw_readb(DUART_BASE + 0x14);
34 __raw_readb(DUART_BASE + 0x14);
36 do_timer(regs);
39 extern __inline__ void setup_timer(void)
41 int tick = 3686400 / 16 / 2 / 100;
43 __raw_writeb(tick & 0xff, DUART_BASE + 0x1c);
44 __raw_writeb(tick >> 8, DUART_BASE + 0x18);
45 __raw_writeb(0x80, DUART_BASE + 8);
46 __raw_writeb(0x10, DUART_BASE + 0x14);
48 timer_irq.handler = timer_interrupt;
49 timer_irq.flags = SA_SHIRQ;
51 setup_arm_irq(IRQ_TIMER, &timer_irq);