1 // SPDX-License-Identifier: GPL-2.0-only
2 /* Copyright Altera Corporation (C) 2014. All rights reserved.
5 #include <linux/module.h>
8 #include <asm/processor.h>
11 void __delay(unsigned long cycles
)
13 cycles_t start
= get_cycles();
15 while ((get_cycles() - start
) < cycles
)
18 EXPORT_SYMBOL(__delay
);
20 void __const_udelay(unsigned long xloops
)
24 loops
= (u64
)xloops
* loops_per_jiffy
* HZ
;
28 EXPORT_SYMBOL(__const_udelay
);
30 void __udelay(unsigned long usecs
)
32 __const_udelay(usecs
* 0x10C7UL
); /* 2**32 / 1000000 (rounded up) */
34 EXPORT_SYMBOL(__udelay
);
36 void __ndelay(unsigned long nsecs
)
38 __const_udelay(nsecs
* 0x5UL
); /* 2**32 / 1000000000 (rounded up) */
40 EXPORT_SYMBOL(__ndelay
);