diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-12-25 16:06:06 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-03-09 00:30:47 -0500 |
commit | 69e1d8a61d5aa9e03676dc21fdfb750c5a97bb34 (patch) | |
tree | 2a36fd12ff45c0ccde2d620476fdad1dcbaadf56 /arch | |
parent | f05ede3a9416b6eff6c997c12fd749044fb4fdac (diff) |
Blackfin: unify MMR helpers
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/blackfin/include/asm/def_LPBlackfin.h | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h index e521f8eb260a..f342ff0319df 100644 --- a/arch/blackfin/include/asm/def_LPBlackfin.h +++ b/arch/blackfin/include/asm/def_LPBlackfin.h | |||
@@ -25,62 +25,30 @@ | |||
25 | # define NOP_PAD_ANOMALY_05000198 | 25 | # define NOP_PAD_ANOMALY_05000198 |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #define bfin_read8(addr) ({ \ | 28 | #define _bfin_readX(addr, size, asm_size, asm_ext) ({ \ |
29 | uint32_t __v; \ | 29 | u32 __v; \ |
30 | __asm__ __volatile__( \ | 30 | __asm__ __volatile__( \ |
31 | NOP_PAD_ANOMALY_05000198 \ | 31 | NOP_PAD_ANOMALY_05000198 \ |
32 | "%0 = b[%1] (z);" \ | 32 | "%0 = " #asm_size "[%1]" #asm_ext ";" \ |
33 | : "=d" (__v) \ | 33 | : "=d" (__v) \ |
34 | : "a" (addr) \ | 34 | : "a" (addr) \ |
35 | ); \ | 35 | ); \ |
36 | __v; }) | 36 | __v; }) |
37 | 37 | #define _bfin_writeX(addr, val, size, asm_size) \ | |
38 | #define bfin_read16(addr) ({ \ | ||
39 | uint32_t __v; \ | ||
40 | __asm__ __volatile__( \ | ||
41 | NOP_PAD_ANOMALY_05000198 \ | ||
42 | "%0 = w[%1] (z);" \ | ||
43 | : "=d" (__v) \ | ||
44 | : "a" (addr) \ | ||
45 | ); \ | ||
46 | __v; }) | ||
47 | |||
48 | #define bfin_read32(addr) ({ \ | ||
49 | uint32_t __v; \ | ||
50 | __asm__ __volatile__( \ | ||
51 | NOP_PAD_ANOMALY_05000198 \ | ||
52 | "%0 = [%1];" \ | ||
53 | : "=d" (__v) \ | ||
54 | : "a" (addr) \ | ||
55 | ); \ | ||
56 | __v; }) | ||
57 | |||
58 | #define bfin_write8(addr, val) \ | ||
59 | __asm__ __volatile__( \ | 38 | __asm__ __volatile__( \ |
60 | NOP_PAD_ANOMALY_05000198 \ | 39 | NOP_PAD_ANOMALY_05000198 \ |
61 | "b[%0] = %1;" \ | 40 | #asm_size "[%0] = %1;" \ |
62 | : \ | 41 | : \ |
63 | : "a" (addr), "d" ((uint8_t)(val)) \ | 42 | : "a" (addr), "d" ((u##size)(val)) \ |
64 | : "memory" \ | 43 | : "memory" \ |
65 | ) | 44 | ) |
66 | 45 | ||
67 | #define bfin_write16(addr, val) \ | 46 | #define bfin_read8(addr) _bfin_readX(addr, 8, b, (z)) |
68 | __asm__ __volatile__( \ | 47 | #define bfin_read16(addr) _bfin_readX(addr, 16, w, (z)) |
69 | NOP_PAD_ANOMALY_05000198 \ | 48 | #define bfin_read32(addr) _bfin_readX(addr, 32, , ) |
70 | "w[%0] = %1;" \ | 49 | #define bfin_write8(addr, val) _bfin_writeX(addr, val, 8, b) |
71 | : \ | 50 | #define bfin_write16(addr, val) _bfin_writeX(addr, val, 16, w) |
72 | : "a" (addr), "d" ((uint16_t)(val)) \ | 51 | #define bfin_write32(addr, val) _bfin_writeX(addr, val, 32, ) |
73 | : "memory" \ | ||
74 | ) | ||
75 | |||
76 | #define bfin_write32(addr, val) \ | ||
77 | __asm__ __volatile__( \ | ||
78 | NOP_PAD_ANOMALY_05000198 \ | ||
79 | "[%0] = %1;" \ | ||
80 | : \ | ||
81 | : "a" (addr), "d" (val) \ | ||
82 | : "memory" \ | ||
83 | ) | ||
84 | 52 | ||
85 | #endif /* __ASSEMBLY__ */ | 53 | #endif /* __ASSEMBLY__ */ |
86 | 54 | ||