patch-2.4.5 linux/include/asm-ppc/time.h

Next file: linux/include/asm-ppc/timex.h
Previous file: linux/include/asm-ppc/termios.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/include/asm-ppc/time.h linux/include/asm-ppc/time.h
@@ -1,5 +1,7 @@
 /*
- * $Id: time.h,v 1.12 1999/08/27 04:21:23 cort Exp $
+ * BK Id: SCCS/s.time.h 1.10 05/17/01 18:14:26 cort
+ */
+/*
  * Common time prototypes and such for all ppc machines.
  *
  * Written by Cort Dougan (cort@fsmlabs.com) to merge
@@ -9,6 +11,7 @@
 #ifdef __KERNEL__
 #include <linux/config.h>
 #include <linux/mc146818rtc.h>
+#include <linux/threads.h>
 
 #include <asm/processor.h>
 
@@ -23,7 +26,12 @@
 
 int via_calibrate_decr(void);
 
-/* Accessor functions for the decrementer register. */
+/* Accessor functions for the decrementer register.
+ * The 4xx doesn't even have a decrementer.  I tried to use the
+ * generic timer interrupt code, which seems OK, with the 4xx PIT
+ * in auto-reload mode.  The problem is PIT stops counting when it
+ * hits zero.  If it would wrap, we could use it just like a decrementer.
+ */
 static __inline__ unsigned int get_dec(void)
 {
 #if defined(CONFIG_4xx)
@@ -36,14 +44,12 @@
 static __inline__ void set_dec(unsigned int val)
 {
 #if defined(CONFIG_4xx)
-	mtspr(SPRN_PIT, val);
-#else
-#ifdef CONFIG_8xx_CPU6
+	return;		/* Have to let it auto-reload */
+#elif defined(CONFIG_8xx_CPU6)
 	set_dec_cpu6(val);
 #else
 	mtspr(SPRN_DEC, val);
 #endif
-#endif
 }
 
 /* Accessor functions for the timebase (RTC on 601) registers. */
@@ -59,6 +65,12 @@
 extern __inline__ unsigned long get_tbl(void) {
 	unsigned long tbl;
 	asm volatile("mftb %0" : "=r" (tbl));
+	return tbl;
+}
+
+extern __inline__ unsigned long get_tbu(void) {
+	unsigned long tbl;
+	asm volatile("mftbu %0" : "=r" (tbl));
 	return tbl;
 }
 

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