Commit cb349152 authored by David S. Miller's avatar David S. Miller

[SPARC]: Add ndelay.

parent c98a2447
......@@ -1808,6 +1808,15 @@ C_LABEL(fpload):
retl
nop
.globl C_LABEL(ndelay)
C_LABEL(ndelay):
save %sp, -REGWIN_SZ, %sp
mov %i0, %o0
call .umul
mov 5, %o1
ba delay_continue
nop
.globl C_LABEL(udelay)
C_LABEL(udelay):
save %sp, -REGWIN_SZ, %sp
......@@ -1815,6 +1824,7 @@ C_LABEL(udelay):
sethi %hi(0x10c6), %o1
call .umul
or %o1, %lo(0x10c6), %o1
delay_continue:
#ifndef CONFIG_SMP
sethi %hi(C_LABEL(loops_per_jiffy)), %o3
call .umul
......
......@@ -151,6 +151,7 @@ EXPORT_SYMBOL(__cpu_logical_map);
#endif
EXPORT_SYMBOL(udelay);
EXPORT_SYMBOL(ndelay);
EXPORT_SYMBOL(mostek_lock);
EXPORT_SYMBOL(mstk48t02_regs);
#if CONFIG_SUN_AUXIO
......
......@@ -21,5 +21,6 @@ extern __inline__ void __delay(unsigned long loops)
/* This is too messy with inline asm on the Sparc. */
extern void udelay(unsigned long usecs);
extern void ndelay(unsigned long usecs);
#endif /* defined(__SPARC_DELAY_H) */
......@@ -45,6 +45,19 @@ static __inline__ void __udelay(unsigned long usecs, unsigned long lps)
__delay(usecs * HZ);
}
extern __inline__ void __ndelay(unsigned long usecs, unsigned long lps)
{
usecs *= 0x0000000000000005UL; /* 2**32 / 10000 */
__asm__ __volatile__(
" mulx %1, %2, %0\n"
" srlx %0, 32, %0\n"
: "=r" (usecs)
: "r" (usecs), "r" (lps));
__delay(usecs * HZ);
}
#ifdef CONFIG_SMP
#define __udelay_val cpu_data[smp_processor_id()].udelay_val
#else
......@@ -52,6 +65,7 @@ static __inline__ void __udelay(unsigned long usecs, unsigned long lps)
#endif
#define udelay(usecs) __udelay((usecs),__udelay_val)
#define ndelay(usecs) __ndelay((usecs),__udelay_val)
#endif /* !__ASSEMBLY__ */
......
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