blob: dee5be66da8229d73853ab55776a626503aebb1a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright 2003 PathScale, Inc.
3 * Copied from arch/x86_64
4 *
5 * Licensed under the GPL
6 */
7
Jeff Dike060e3522005-05-20 13:59:08 -07008#include <linux/module.h>
9#include <linux/delay.h>
10#include <asm/processor.h>
11#include <asm/param.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13void __delay(unsigned long loops)
14{
15 unsigned long i;
16
Jeff Dike060e3522005-05-20 13:59:08 -070017 for(i = 0; i < loops; i++)
18 cpu_relax();
Linus Torvalds1da177e2005-04-16 15:20:36 -070019}
20
Bodo Stroesser5fd861b2005-05-05 16:15:37 -070021void __udelay(unsigned long usecs)
22{
Jeff Dike060e3522005-05-20 13:59:08 -070023 unsigned long i, n;
Bodo Stroesser5fd861b2005-05-05 16:15:37 -070024
25 n = (loops_per_jiffy * HZ * usecs) / MILLION;
Jeff Dike060e3522005-05-20 13:59:08 -070026 for(i=0;i<n;i++)
27 cpu_relax();
Bodo Stroesser5fd861b2005-05-05 16:15:37 -070028}
29
Jeff Dike060e3522005-05-20 13:59:08 -070030EXPORT_SYMBOL(__udelay);