diff options
Diffstat (limited to 'arch/blackfin/include/asm/def_LPBlackfin.h')
-rw-r--r-- | arch/blackfin/include/asm/def_LPBlackfin.h | 58 |
1 files changed, 14 insertions, 44 deletions
diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h index 25906468622f..f342ff0319df 100644 --- a/arch/blackfin/include/asm/def_LPBlackfin.h +++ b/arch/blackfin/include/asm/def_LPBlackfin.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #include <mach/anomaly.h> | 12 | #include <mach/anomaly.h> |
13 | 13 | ||
14 | #define MK_BMSK_(x) (1<<x) | 14 | #define MK_BMSK_(x) (1<<x) |
15 | #define BFIN_DEPOSIT(mask, x) (((x) << __ffs(mask)) & (mask)) | ||
16 | #define BFIN_EXTRACT(mask, x) (((x) & (mask)) >> __ffs(mask)) | ||
15 | 17 | ||
16 | #ifndef __ASSEMBLY__ | 18 | #ifndef __ASSEMBLY__ |
17 | 19 | ||
@@ -23,62 +25,30 @@ | |||
23 | # define NOP_PAD_ANOMALY_05000198 | 25 | # define NOP_PAD_ANOMALY_05000198 |
24 | #endif | 26 | #endif |
25 | 27 | ||
26 | #define bfin_read8(addr) ({ \ | 28 | #define _bfin_readX(addr, size, asm_size, asm_ext) ({ \ |
27 | uint32_t __v; \ | 29 | u32 __v; \ |
28 | __asm__ __volatile__( \ | 30 | __asm__ __volatile__( \ |
29 | NOP_PAD_ANOMALY_05000198 \ | 31 | NOP_PAD_ANOMALY_05000198 \ |
30 | "%0 = b[%1] (z);" \ | 32 | "%0 = " #asm_size "[%1]" #asm_ext ";" \ |
31 | : "=d" (__v) \ | 33 | : "=d" (__v) \ |
32 | : "a" (addr) \ | 34 | : "a" (addr) \ |
33 | ); \ | 35 | ); \ |
34 | __v; }) | 36 | __v; }) |
35 | 37 | #define _bfin_writeX(addr, val, size, asm_size) \ | |
36 | #define bfin_read16(addr) ({ \ | ||
37 | uint32_t __v; \ | ||
38 | __asm__ __volatile__( \ | ||
39 | NOP_PAD_ANOMALY_05000198 \ | ||
40 | "%0 = w[%1] (z);" \ | ||
41 | : "=d" (__v) \ | ||
42 | : "a" (addr) \ | ||
43 | ); \ | ||
44 | __v; }) | ||
45 | |||
46 | #define bfin_read32(addr) ({ \ | ||
47 | uint32_t __v; \ | ||
48 | __asm__ __volatile__( \ | ||
49 | NOP_PAD_ANOMALY_05000198 \ | ||
50 | "%0 = [%1];" \ | ||
51 | : "=d" (__v) \ | ||
52 | : "a" (addr) \ | ||
53 | ); \ | ||
54 | __v; }) | ||
55 | |||
56 | #define bfin_write8(addr, val) \ | ||
57 | __asm__ __volatile__( \ | 38 | __asm__ __volatile__( \ |
58 | NOP_PAD_ANOMALY_05000198 \ | 39 | NOP_PAD_ANOMALY_05000198 \ |
59 | "b[%0] = %1;" \ | 40 | #asm_size "[%0] = %1;" \ |
60 | : \ | 41 | : \ |
61 | : "a" (addr), "d" ((uint8_t)(val)) \ | 42 | : "a" (addr), "d" ((u##size)(val)) \ |
62 | : "memory" \ | 43 | : "memory" \ |
63 | ) | 44 | ) |
64 | 45 | ||
65 | #define bfin_write16(addr, val) \ | 46 | #define bfin_read8(addr) _bfin_readX(addr, 8, b, (z)) |
66 | __asm__ __volatile__( \ | 47 | #define bfin_read16(addr) _bfin_readX(addr, 16, w, (z)) |
67 | NOP_PAD_ANOMALY_05000198 \ | 48 | #define bfin_read32(addr) _bfin_readX(addr, 32, , ) |
68 | "w[%0] = %1;" \ | 49 | #define bfin_write8(addr, val) _bfin_writeX(addr, val, 8, b) |
69 | : \ | 50 | #define bfin_write16(addr, val) _bfin_writeX(addr, val, 16, w) |
70 | : "a" (addr), "d" ((uint16_t)(val)) \ | 51 | #define bfin_write32(addr, val) _bfin_writeX(addr, val, 32, ) |
71 | : "memory" \ | ||
72 | ) | ||
73 | |||
74 | #define bfin_write32(addr, val) \ | ||
75 | __asm__ __volatile__( \ | ||
76 | NOP_PAD_ANOMALY_05000198 \ | ||
77 | "[%0] = %1;" \ | ||
78 | : \ | ||
79 | : "a" (addr), "d" (val) \ | ||
80 | : "memory" \ | ||
81 | ) | ||
82 | 52 | ||
83 | #endif /* __ASSEMBLY__ */ | 53 | #endif /* __ASSEMBLY__ */ |
84 | 54 | ||