delay_32.h 907 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * delay.h: Linux delay routines on the Sparc.
  4. *
  5. * Copyright (C) 1994 David S. Miller ([email protected]).
  6. */
  7. #ifndef __SPARC_DELAY_H
  8. #define __SPARC_DELAY_H
  9. #include <asm/cpudata.h>
  10. static inline void __delay(unsigned long loops)
  11. {
  12. __asm__ __volatile__("cmp %0, 0\n\t"
  13. "1: bne 1b\n\t"
  14. "subcc %0, 1, %0\n" :
  15. "=&r" (loops) :
  16. "0" (loops) :
  17. "cc");
  18. }
  19. /* This is too messy with inline asm on the Sparc. */
  20. void __udelay(unsigned long usecs, unsigned long lpj);
  21. void __ndelay(unsigned long nsecs, unsigned long lpj);
  22. #ifdef CONFIG_SMP
  23. #define __udelay_val cpu_data(smp_processor_id()).udelay_val
  24. #else /* SMP */
  25. #define __udelay_val loops_per_jiffy
  26. #endif /* SMP */
  27. #define udelay(__usecs) __udelay(__usecs, __udelay_val)
  28. #define ndelay(__nsecs) __ndelay(__nsecs, __udelay_val)
  29. #endif /* defined(__SPARC_DELAY_H) */