delay.S 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * linux/arch/arm26/lib/delay.S
  3. *
  4. * Copyright (C) 1995, 1996 Russell King
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/linkage.h>
  11. #include <asm/assembler.h>
  12. .text
  13. LC0: .word loops_per_jiffy
  14. /*
  15. * 0 <= r0 <= 2000
  16. */
  17. ENTRY(udelay)
  18. mov r2, #0x6800
  19. orr r2, r2, #0x00db
  20. mul r1, r0, r2
  21. ldr r2, LC0
  22. ldr r2, [r2]
  23. mov r1, r1, lsr #11
  24. mov r2, r2, lsr #11
  25. mul r0, r1, r2
  26. movs r0, r0, lsr #6
  27. RETINSTR(moveq,pc,lr)
  28. /*
  29. * loops = (r0 * 0x10c6 * 100 * loops_per_jiffy) / 2^32
  30. *
  31. * Oh, if only we had a cycle counter...
  32. */
  33. @ Delay routine
  34. ENTRY(__delay)
  35. subs r0, r0, #1
  36. #if 0
  37. RETINSTR(movls,pc,lr)
  38. subs r0, r0, #1
  39. RETINSTR(movls,pc,lr)
  40. subs r0, r0, #1
  41. RETINSTR(movls,pc,lr)
  42. subs r0, r0, #1
  43. RETINSTR(movls,pc,lr)
  44. subs r0, r0, #1
  45. RETINSTR(movls,pc,lr)
  46. subs r0, r0, #1
  47. RETINSTR(movls,pc,lr)
  48. subs r0, r0, #1
  49. RETINSTR(movls,pc,lr)
  50. subs r0, r0, #1
  51. #endif
  52. bhi __delay
  53. RETINSTR(mov,pc,lr)