Commit c0630ba1 authored by Alan Cox's avatar Alan Cox Committed by Andy Grover

[PATCH] ndelay() for x86

The implementation is not ideal.  Thats something to tidy up.
parent 8b18caf4
...@@ -104,6 +104,7 @@ EXPORT_SYMBOL_NOVERS(__up_wakeup); ...@@ -104,6 +104,7 @@ EXPORT_SYMBOL_NOVERS(__up_wakeup);
/* Networking helper routines. */ /* Networking helper routines. */
EXPORT_SYMBOL(csum_partial_copy_generic); EXPORT_SYMBOL(csum_partial_copy_generic);
/* Delay loops */ /* Delay loops */
EXPORT_SYMBOL(__ndelay);
EXPORT_SYMBOL(__udelay); EXPORT_SYMBOL(__udelay);
EXPORT_SYMBOL(__delay); EXPORT_SYMBOL(__delay);
EXPORT_SYMBOL(__const_udelay); EXPORT_SYMBOL(__const_udelay);
......
...@@ -41,3 +41,8 @@ void __udelay(unsigned long usecs) ...@@ -41,3 +41,8 @@ void __udelay(unsigned long usecs)
{ {
__const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */ __const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */
} }
void __ndelay(unsigned long nsecs)
{
__const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */
}
...@@ -8,8 +8,10 @@ ...@@ -8,8 +8,10 @@
*/ */
extern void __bad_udelay(void); extern void __bad_udelay(void);
extern void __bad_ndelay(void);
extern void __udelay(unsigned long usecs); extern void __udelay(unsigned long usecs);
extern void __ndelay(unsigned long nsecs);
extern void __const_udelay(unsigned long usecs); extern void __const_udelay(unsigned long usecs);
extern void __delay(unsigned long loops); extern void __delay(unsigned long loops);
...@@ -17,4 +19,8 @@ extern void __delay(unsigned long loops); ...@@ -17,4 +19,8 @@ extern void __delay(unsigned long loops);
((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \ ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
__udelay(n)) __udelay(n))
#define ndelay(n) (__builtin_constant_p(n) ? \
((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
__ndelay(n))
#endif /* defined(_I386_DELAY_H) */ #endif /* defined(_I386_DELAY_H) */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment