Blackfin: add bfin_write_{or,and} helpers

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Mike Frysinger 2011-01-11 16:33:15 +00:00
parent 4c131c8c23
commit b5fc12df90

View File

@ -58,14 +58,26 @@
({ BUG(); 0; }); \ ({ BUG(); 0; }); \
}) })
#define bfin_write(addr, val) \ #define bfin_write(addr, val) \
({ \ do { \
switch (sizeof(*(addr))) { \ switch (sizeof(*(addr))) { \
case 1: bfin_write8(addr, val); break; \ case 1: bfin_write8(addr, val); break; \
case 2: bfin_write16(addr, val); break; \ case 2: bfin_write16(addr, val); break; \
case 4: bfin_write32(addr, val); break; \ case 4: bfin_write32(addr, val); break; \
default: BUG(); \ 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__ */ #endif /* __ASSEMBLY__ */