[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / arch / sh64 / lib / udelay.c
blobdad2f254efeec811ca13da849c65bd4a5e2df964
1 /*
2 * arch/sh64/lib/udelay.c
4 * Delay routines, using a pre-computed "loops_per_jiffy" value.
6 * Copyright (C) 2000, 2001 Paolo Alberelli
7 * Copyright (C) 2003, 2004 Paul Mundt
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
13 #include <linux/config.h>
14 #include <linux/sched.h>
15 #include <asm/param.h>
17 extern unsigned long loops_per_jiffy;
20 * Use only for very small delays (< 1 msec).
22 * The active part of our cycle counter is only 32-bits wide, and
23 * we're treating the difference between two marks as signed. On
24 * a 1GHz box, that's about 2 seconds.
27 void __delay(int loops)
29 long long dummy;
30 __asm__ __volatile__("gettr tr0, %1\n\t"
31 "pta $+4, tr0\n\t"
32 "addi %0, -1, %0\n\t"
33 "bne %0, r63, tr0\n\t"
34 "ptabs %1, tr0\n\t":"=r"(loops),
35 "=r"(dummy)
36 :"0"(loops));
39 void __udelay(unsigned long long usecs, unsigned long lpj)
41 usecs *= (((unsigned long long) HZ << 32) / 1000000) * lpj;
42 __delay((long long) usecs >> 32);
45 void __ndelay(unsigned long long nsecs, unsigned long lpj)
47 nsecs *= (((unsigned long long) HZ << 32) / 1000000000) * lpj;
48 __delay((long long) nsecs >> 32);
51 void udelay(unsigned long usecs)
53 __udelay(usecs, loops_per_jiffy);
56 void ndelay(unsigned long nsecs)
58 __ndelay(nsecs, loops_per_jiffy);