diff options
| author | Arend van Spriel <arend@broadcom.com> | 2011-12-08 18:06:41 -0500 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2011-12-13 15:31:24 -0500 |
| commit | 9d08f10d355afd500310738ff09b4d921a447102 (patch) | |
| tree | 85748639950c04f299d81c784eb68a059ee7c449 /include/linux/bcma | |
| parent | ffb2756511a90091185e9be0652cc10eee0890d0 (diff) | |
bcma: add set/mask macros for 16-bit register access
The BCMA header only had definitions for 32-bit register access. Used
those as a template for the 16-bit flavour. Also changed them to inline
functions to be on the safe side. As offset parameter is used twice there
would be a problem when used like this: bcma_set32(core, offset++, val);
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Franky Lin <frankyl@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/linux/bcma')
| -rw-r--r-- | include/linux/bcma/bcma.h | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 4d4b59de9467..de6057f16987 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
| @@ -254,12 +254,32 @@ void bcma_awrite32(struct bcma_device *core, u16 offset, u32 value) | |||
| 254 | core->bus->ops->awrite32(core, offset, value); | 254 | core->bus->ops->awrite32(core, offset, value); |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | #define bcma_mask32(cc, offset, mask) \ | 257 | static inline void bcma_mask32(struct bcma_device *cc, u16 offset, u32 mask) |
| 258 | bcma_write32(cc, offset, bcma_read32(cc, offset) & (mask)) | 258 | { |
| 259 | #define bcma_set32(cc, offset, set) \ | 259 | bcma_write32(cc, offset, bcma_read32(cc, offset) & mask); |
| 260 | bcma_write32(cc, offset, bcma_read32(cc, offset) | (set)) | 260 | } |
| 261 | #define bcma_maskset32(cc, offset, mask, set) \ | 261 | static inline void bcma_set32(struct bcma_device *cc, u16 offset, u32 set) |
| 262 | bcma_write32(cc, offset, (bcma_read32(cc, offset) & (mask)) | (set)) | 262 | { |
| 263 | bcma_write32(cc, offset, bcma_read32(cc, offset) | set); | ||
| 264 | } | ||
| 265 | static inline void bcma_maskset32(struct bcma_device *cc, | ||
| 266 | u16 offset, u32 mask, u32 set) | ||
| 267 | { | ||
| 268 | bcma_write32(cc, offset, (bcma_read32(cc, offset) & mask) | set); | ||
| 269 | } | ||
| 270 | static inline void bcma_mask16(struct bcma_device *cc, u16 offset, u16 mask) | ||
| 271 | { | ||
| 272 | bcma_write16(cc, offset, bcma_read16(cc, offset) & mask); | ||
| 273 | } | ||
| 274 | static inline void bcma_set16(struct bcma_device *cc, u16 offset, u16 set) | ||
| 275 | { | ||
| 276 | bcma_write16(cc, offset, bcma_read16(cc, offset) | set); | ||
| 277 | } | ||
| 278 | static inline void bcma_maskset16(struct bcma_device *cc, | ||
| 279 | u16 offset, u16 mask, u16 set) | ||
| 280 | { | ||
| 281 | bcma_write16(cc, offset, (bcma_read16(cc, offset) & mask) | set); | ||
| 282 | } | ||
| 263 | 283 | ||
| 264 | extern bool bcma_core_is_enabled(struct bcma_device *core); | 284 | extern bool bcma_core_is_enabled(struct bcma_device *core); |
| 265 | extern void bcma_core_disable(struct bcma_device *core, u32 flags); | 285 | extern void bcma_core_disable(struct bcma_device *core, u32 flags); |
