spi-topcliff-pch: add recovery processing in case wait-event timeout
[zen-stable.git] / arch / cris / arch-v32 / lib / spinlock.S
blobfe610b9d775f512a22ad4eb86f3e1724232b135f
1 ;; Core of the spinlock implementation
2 ;;
3 ;; Copyright (C) 2004 Axis Communications AB.
4 ;;
5 ;; Author: Mikael Starvik
8         .global cris_spin_lock
9         .type   cris_spin_lock,@function
10         .global cris_spin_trylock
11         .type   cris_spin_trylock,@function
13         .text
15 cris_spin_lock:
16         clearf  p
17 1:      test.b  [$r10]
18         beq     1b
19         clearf  p
20         ax
21         clear.b [$r10]
22         bcs     1b
23         clearf  p
24         ret
25         nop
27         .size   cris_spin_lock, . - cris_spin_lock
29 cris_spin_trylock:
30         clearf  p
31 1:      move.b  [$r10], $r11
32         ax
33         clear.b [$r10]
34         bcs     1b
35         clearf  p
36         ret
37         movu.b  $r11,$r10
39         .size   cris_spin_trylock, . - cris_spin_trylock