diff options
Diffstat (limited to 'include/asm-powerpc/io.h')
-rw-r--r-- | include/asm-powerpc/io.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h index 4c0b55087dc7..6805efb2cb6d 100644 --- a/include/asm-powerpc/io.h +++ b/include/asm-powerpc/io.h | |||
@@ -737,6 +737,29 @@ static inline void * bus_to_virt(unsigned long address) | |||
737 | #define setbits8(_addr, _v) out_8((_addr), in_8(_addr) | (_v)) | 737 | #define setbits8(_addr, _v) out_8((_addr), in_8(_addr) | (_v)) |
738 | #define clrbits8(_addr, _v) out_8((_addr), in_8(_addr) & ~(_v)) | 738 | #define clrbits8(_addr, _v) out_8((_addr), in_8(_addr) & ~(_v)) |
739 | 739 | ||
740 | /* Clear and set bits in one shot. These macros can be used to clear and | ||
741 | * set multiple bits in a register using a single read-modify-write. These | ||
742 | * macros can also be used to set a multiple-bit bit pattern using a mask, | ||
743 | * by specifying the mask in the 'clear' parameter and the new bit pattern | ||
744 | * in the 'set' parameter. | ||
745 | */ | ||
746 | |||
747 | #define clrsetbits(type, addr, clear, set) \ | ||
748 | out_##type((addr), (in_##type(addr) & ~(clear)) | (set)) | ||
749 | |||
750 | #ifdef __powerpc64__ | ||
751 | #define clrsetbits_be64(addr, clear, set) clrsetbits(be64, addr, clear, set) | ||
752 | #define clrsetbits_le64(addr, clear, set) clrsetbits(le64, addr, clear, set) | ||
753 | #endif | ||
754 | |||
755 | #define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set) | ||
756 | #define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set) | ||
757 | |||
758 | #define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set) | ||
759 | #define clrsetbits_le16(addr, clear, set) clrsetbits(le32, addr, clear, set) | ||
760 | |||
761 | #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set) | ||
762 | |||
740 | #endif /* __KERNEL__ */ | 763 | #endif /* __KERNEL__ */ |
741 | 764 | ||
742 | #endif /* _ASM_POWERPC_IO_H */ | 765 | #endif /* _ASM_POWERPC_IO_H */ |