summaryrefslogtreecommitdiffstats
path: root/include/asm-ppc/delay.h
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@nuclecu.unam.mx>1997-08-06 19:14:48 +0000
committerMiguel de Icaza <miguel@nuclecu.unam.mx>1997-08-06 19:14:48 +0000
commite2819e52a162873ff5061de81bb749831bdb5de9 (patch)
tree6067ea700202750ba335a423696f2972700e5f76 /include/asm-ppc/delay.h
parent17a005074429bbf143e40401f405ae4363e56828 (diff)
Merge to 2.1.38.
IMPORTANT NOTE: I could not figure out what information is the one that should be used for the following files (ie, those that were in our tree, or those that came from Linus' patch), please, check these: include/asm-mips/jazz.h include/asm-mips/jazzdma.h include/asm-mips/ioctls.h
Diffstat (limited to 'include/asm-ppc/delay.h')
-rw-r--r--include/asm-ppc/delay.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/include/asm-ppc/delay.h b/include/asm-ppc/delay.h
index 68f1a4da7..9da227167 100644
--- a/include/asm-ppc/delay.h
+++ b/include/asm-ppc/delay.h
@@ -1,14 +1,31 @@
#ifndef _PPC_DELAY_H
#define _PPC_DELAY_H
+/*
+ * Copyright 1996, Paul Mackerras.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
-extern __inline__ void __delay(unsigned long );
-extern __inline__ void __udelay(unsigned long );
-
+extern __inline__ void __delay(unsigned int loops)
+{
+ if (loops != 0)
+ __asm__ __volatile__("mtctr %0; 1: bdnz 1b" : :
+ "r" (loops) : "ctr");
+}
-extern __inline__ unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
+extern __inline__ void udelay(unsigned long usecs)
{
- return (a*b)/c;
+ unsigned long loops;
+
+ /* compute (usecs * 2^32 / 10^6) * loops_per_sec / 2^32 */
+ usecs *= 0x10c6; /* 2^32 / 10^6 */
+ __asm__("mulhwu %0,%1,%2" : "=r" (loops) :
+ "r" (usecs), "r" (loops_per_sec));
+ __delay(loops);
}
#endif /* defined(_PPC_DELAY_H) */