diff options
Diffstat (limited to 'arch/blackfin/include/asm/delay.h')
| -rw-r--r-- | arch/blackfin/include/asm/delay.h | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/arch/blackfin/include/asm/delay.h b/arch/blackfin/include/asm/delay.h index 0889c3abb593..c31f91cc1d5d 100644 --- a/arch/blackfin/include/asm/delay.h +++ b/arch/blackfin/include/asm/delay.h | |||
| @@ -13,29 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | static inline void __delay(unsigned long loops) | 14 | static inline void __delay(unsigned long loops) |
| 15 | { | 15 | { |
| 16 | if (ANOMALY_05000312) { | 16 | __asm__ __volatile__ ( |
| 17 | /* Interrupted loads to loop registers -> bad */ | ||
| 18 | unsigned long tmp; | ||
| 19 | __asm__ __volatile__( | ||
| 20 | "[--SP] = LC0;" | ||
| 21 | "[--SP] = LT0;" | ||
| 22 | "[--SP] = LB0;" | ||
| 23 | "LSETUP (1f,1f) LC0 = %1;" | ||
| 24 | "1: NOP;" | ||
| 25 | /* We take advantage of the fact that LC0 is 0 at | ||
| 26 | * the end of the loop. Otherwise we'd need some | ||
| 27 | * NOPs after the CLI here. | ||
| 28 | */ | ||
| 29 | "CLI %0;" | ||
| 30 | "LB0 = [SP++];" | ||
| 31 | "LT0 = [SP++];" | ||
| 32 | "LC0 = [SP++];" | ||
| 33 | "STI %0;" | ||
| 34 | : "=d" (tmp) | ||
| 35 | : "a" (loops) | ||
| 36 | ); | ||
| 37 | } else | ||
| 38 | __asm__ __volatile__ ( | ||
| 39 | "LSETUP(1f, 1f) LC0 = %0;" | 17 | "LSETUP(1f, 1f) LC0 = %0;" |
| 40 | "1: NOP;" | 18 | "1: NOP;" |
| 41 | : | 19 | : |
| @@ -47,16 +25,15 @@ static inline void __delay(unsigned long loops) | |||
| 47 | #include <linux/param.h> /* needed for HZ */ | 25 | #include <linux/param.h> /* needed for HZ */ |
| 48 | 26 | ||
| 49 | /* | 27 | /* |
| 50 | * Use only for very small delays ( < 1 msec). Should probably use a | 28 | * close approximation borrowed from m68knommu to avoid 64-bit math |
| 51 | * lookup table, really, as the multiplications take much too long with | ||
| 52 | * short delays. This is a "reasonable" implementation, though (and the | ||
| 53 | * first constant multiplications gets optimized away if the delay is | ||
| 54 | * a constant) | ||
| 55 | */ | 29 | */ |
| 30 | |||
| 31 | #define HZSCALE (268435456 / (1000000/HZ)) | ||
| 32 | |||
| 56 | static inline void udelay(unsigned long usecs) | 33 | static inline void udelay(unsigned long usecs) |
| 57 | { | 34 | { |
| 58 | extern unsigned long loops_per_jiffy; | 35 | extern unsigned long loops_per_jiffy; |
| 59 | __delay(usecs * loops_per_jiffy / (1000000 / HZ)); | 36 | __delay((((usecs * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6); |
| 60 | } | 37 | } |
| 61 | 38 | ||
| 62 | #endif | 39 | #endif |
