diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-01-11 17:33:15 +0100 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-03-18 08:49:24 +0100 |
commit | b5fc12df9039a9e6a2c5ae1fc0cee244b6aca8e2 (patch) | |
tree | 037e73020be971370ce2103c4500f6deef4fc297 /arch/blackfin | |
parent | Blackfin: bf548-ezkit: add CAN1 support (diff) | |
download | linux-b5fc12df9039a9e6a2c5ae1fc0cee244b6aca8e2.tar.xz linux-b5fc12df9039a9e6a2c5ae1fc0cee244b6aca8e2.zip |
Blackfin: add bfin_write_{or,and} helpers
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-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 @@ ({ BUG(); 0; }); \ }) #define bfin_write(addr, val) \ -({ \ +do { \ switch (sizeof(*(addr))) { \ case 1: bfin_write8(addr, val); break; \ case 2: bfin_write16(addr, val); break; \ case 4: bfin_write32(addr, val); break; \ default: BUG(); \ } \ -}) +} while (0) + +#define bfin_write_or(addr, bits) \ +do { \ + void *__addr = (void *)(addr); \ + bfin_write(__addr, bfin_read(__addr) | (bits)); \ +} while (0) + +#define bfin_write_and(addr, bits) \ +do { \ + void *__addr = (void *)(addr); \ + bfin_write(__addr, bfin_read(__addr) & (bits)); \ +} while (0) #endif /* __ASSEMBLY__ */ |