2 * arch/s390/kernel/delay.c
3 * Precise Delay Loops for S390
6 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
9 * Derived from "arch/i386/lib/delay.c"
10 * Copyright (C) 1993 Linus Torvalds
11 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
14 #include <linux/sched.h>
15 #include <linux/delay.h>
21 void __delay(unsigned long loops)
24 * To end the bloody studid and useless discussion about the
25 * BogoMips number I took the liberty to define the __delay
26 * function in a way that that resulting BogoMips number will
27 * yield the megahertz number of the cpu. The important function
28 * is udelay and that is done using the tod clock. -- martin.
30 asm volatile("0: brct %0,0b" : : "d" ((loops/2) + 1));
34 * Waits for 'usecs' microseconds using the tod clock, giving up the time slice
35 * of the virtual PU inbetween to avoid congestion.
37 void __udelay(unsigned long usecs)
43 start_cc = get_clock();
46 } while (((get_clock() - start_cc)/4096) < usecs);