diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-01-11 11:33:15 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-03-18 03:49:24 -0400 |
commit | b5fc12df9039a9e6a2c5ae1fc0cee244b6aca8e2 (patch) | |
tree | 037e73020be971370ce2103c4500f6deef4fc297 /arch/blackfin/include | |
parent | 4c131c8c23eeb90d0fe93bd490ffd63ff0f97d10 (diff) |
Blackfin: add bfin_write_{or,and} helpers
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/include')
-rw-r--r-- | arch/blackfin/include/asm/def_LPBlackfin.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/arch/blackfin/include/asm/def_LPBlackfin.h b/arch/blackfin/include/asm/def_LPBlackfin.h index e3f0f4c49819..7600fe0696af 100644 --- a/arch/blackfin/include/asm/def_LPBlackfin.h +++ b/arch/blackfin/include/asm/def_LPBlackfin.h | |||
@@ -58,14 +58,26 @@ | |||
58 | ({ BUG(); 0; }); \ | 58 | ({ BUG(); 0; }); \ |
59 | }) | 59 | }) |
60 | #define bfin_write(addr, val) \ | 60 | #define bfin_write(addr, val) \ |
61 | ({ \ | 61 | do { \ |
62 | switch (sizeof(*(addr))) { \ | 62 | switch (sizeof(*(addr))) { \ |
63 | case 1: bfin_write8(addr, val); break; \ | 63 | case 1: bfin_write8(addr, val); break; \ |
64 | case 2: bfin_write16(addr, val); break; \ | 64 | case 2: bfin_write16(addr, val); break; \ |
65 | case 4: bfin_write32(addr, val); break; \ | 65 | case 4: bfin_write32(addr, val); break; \ |
66 | default: BUG(); \ | 66 | default: BUG(); \ |
67 | } \ | 67 | } \ |
68 | }) | 68 | } while (0) |
69 | |||
70 | #define bfin_write_or(addr, bits) \ | ||
71 | do { \ | ||
72 | void *__addr = (void *)(addr); \ | ||
73 | bfin_write(__addr, bfin_read(__addr) | (bits)); \ | ||
74 | } while (0) | ||
75 | |||
76 | #define bfin_write_and(addr, bits) \ | ||
77 | do { \ | ||
78 | void *__addr = (void *)(addr); \ | ||
79 | bfin_write(__addr, bfin_read(__addr) & (bits)); \ | ||
80 | } while (0) | ||
69 | 81 | ||
70 | #endif /* __ASSEMBLY__ */ | 82 | #endif /* __ASSEMBLY__ */ |
71 | 83 | ||