patch-2.3.49 linux/include/asm-arm/arch-nexuspci/time.h

Next file: linux/include/asm-arm/arch-nexuspci/uncompress.h
Previous file: linux/include/asm-arm/arch-nexuspci/system.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.48/linux/include/asm-arm/arch-nexuspci/time.h linux/include/asm-arm/arch-nexuspci/time.h
@@ -1,34 +1,37 @@
 /*
  * linux/include/asm-arm/arch-nexuspci/time.h
  *
- * Copyright (c) 1997 Phil Blundell.
+ * Copyright (c) 1997, 1998, 1999, 2000 FutureTV Labs Ltd.
  *
- * Nexus PCI card has no real-time clock.  We get timer ticks from the
+ * The FTV PCI card has no real-time clock.  We get timer ticks from the
  * SCC chip.
  */
 
-#define UART_BASE		0xfff00000
-#define INTCONT			0xffe00000
-
 static void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
-	static int count = 50;
+	static int count = 25;
+	unsigned char stat = __raw_readb(DUART_BASE + 0x14);
+	if (!(stat & 0x10))
+		return;		/* Not for us */
 
-	writeb(0x90, UART_BASE + 8);
+	/* Reset counter */
+	__raw_writeb(0x90, DUART_BASE + 8);
 
 	if (--count == 0) {
 		static int state = 1;
 		state ^= 1;
-		writeb(0x1a + state, INTCONT);
+		__raw_writeb(0x1a + state, INTCONT_BASE);
+		__raw_writeb(0x18 + state, INTCONT_BASE);
 		count = 50;
 	}
 
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
-	readb(UART_BASE + 0x14);
+	/* Wait for slow rise time */
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
+	__raw_readb(DUART_BASE + 0x14);
 
 	do_timer(regs);	
 }
@@ -37,10 +40,10 @@
 {
 	int tick = 3686400 / 16 / 2 / 100;
 
-	writeb(tick & 0xff, UART_BASE + 0x1c);
-	writeb(tick >> 8, UART_BASE + 0x18);
-	writeb(0x80, UART_BASE + 8);
-	writeb(0x10, UART_BASE + 0x14);
+	__raw_writeb(tick & 0xff, DUART_BASE + 0x1c);
+	__raw_writeb(tick >> 8, DUART_BASE + 0x18);
+	__raw_writeb(0x80, DUART_BASE + 8);
+	__raw_writeb(0x10, DUART_BASE + 0x14);
 
 	timer_irq.handler = timer_interrupt;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)