Commit b5fc12df authored by Mike Frysinger's avatar Mike Frysinger

Blackfin: add bfin_write_{or,and} helpers

Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent 4c131c8c
...@@ -58,14 +58,26 @@ ...@@ -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__ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment