Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * delay.h: Linux delay routines on the Sparc.
0004  *
0005  * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu).
0006  */
0007 
0008 #ifndef __SPARC_DELAY_H
0009 #define __SPARC_DELAY_H
0010 
0011 #include <asm/cpudata.h>
0012 
0013 static inline void __delay(unsigned long loops)
0014 {
0015     __asm__ __volatile__("cmp %0, 0\n\t"
0016                  "1: bne 1b\n\t"
0017                  "subcc %0, 1, %0\n" :
0018                  "=&r" (loops) :
0019                  "0" (loops) :
0020                  "cc");
0021 }
0022 
0023 /* This is too messy with inline asm on the Sparc. */
0024 void __udelay(unsigned long usecs, unsigned long lpj);
0025 void __ndelay(unsigned long nsecs, unsigned long lpj);
0026 
0027 #ifdef CONFIG_SMP
0028 #define __udelay_val    cpu_data(smp_processor_id()).udelay_val
0029 #else /* SMP */
0030 #define __udelay_val    loops_per_jiffy
0031 #endif /* SMP */
0032 #define udelay(__usecs) __udelay(__usecs, __udelay_val)
0033 #define ndelay(__nsecs) __ndelay(__nsecs, __udelay_val)
0034 
0035 #endif /* defined(__SPARC_DELAY_H) */