diff options
author | Valentine Barshak <vbarshak@ru.mvista.com> | 2008-03-05 13:38:04 -0500 |
---|---|---|
committer | Josh Boyer <jwboyer@linux.vnet.ibm.com> | 2008-03-26 08:20:38 -0400 |
commit | 266d028acb615e1766c3fb9530c9e86de8476a33 (patch) | |
tree | 5f8beaee529761b26ee858d91a8ee9262a80264d /include/asm-powerpc/dcr-native.h | |
parent | d0a48c9f4c4582a966ce6426c1bf8ef1e37e63ee (diff) |
[POWERPC] 4xx: Add dcri_clrset() for locked read/modify/write functionality
This adds dcri_clrset() macro which does read/modify/write
on indirect dcr registers while holding indirect dcr lock.
Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'include/asm-powerpc/dcr-native.h')
-rw-r--r-- | include/asm-powerpc/dcr-native.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/asm-powerpc/dcr-native.h b/include/asm-powerpc/dcr-native.h index be6c879e8760..f8398ce80372 100644 --- a/include/asm-powerpc/dcr-native.h +++ b/include/asm-powerpc/dcr-native.h | |||
@@ -82,6 +82,19 @@ static inline void __mtdcri(int base_addr, int base_data, int reg, | |||
82 | spin_unlock_irqrestore(&dcr_ind_lock, flags); | 82 | spin_unlock_irqrestore(&dcr_ind_lock, flags); |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline void __dcri_clrset(int base_addr, int base_data, int reg, | ||
86 | unsigned clr, unsigned set) | ||
87 | { | ||
88 | unsigned long flags; | ||
89 | unsigned int val; | ||
90 | |||
91 | spin_lock_irqsave(&dcr_ind_lock, flags); | ||
92 | __mtdcr(base_addr, reg); | ||
93 | val = (__mfdcr(base_data) & ~clr) | set; | ||
94 | __mtdcr(base_data, val); | ||
95 | spin_unlock_irqrestore(&dcr_ind_lock, flags); | ||
96 | } | ||
97 | |||
85 | #define mfdcri(base, reg) __mfdcri(DCRN_ ## base ## _CONFIG_ADDR, \ | 98 | #define mfdcri(base, reg) __mfdcri(DCRN_ ## base ## _CONFIG_ADDR, \ |
86 | DCRN_ ## base ## _CONFIG_DATA, \ | 99 | DCRN_ ## base ## _CONFIG_DATA, \ |
87 | reg) | 100 | reg) |
@@ -90,6 +103,10 @@ static inline void __mtdcri(int base_addr, int base_data, int reg, | |||
90 | DCRN_ ## base ## _CONFIG_DATA, \ | 103 | DCRN_ ## base ## _CONFIG_DATA, \ |
91 | reg, data) | 104 | reg, data) |
92 | 105 | ||
106 | #define dcri_clrset(base, reg, clr, set) __dcri_clrset(DCRN_ ## base ## _CONFIG_ADDR, \ | ||
107 | DCRN_ ## base ## _CONFIG_DATA, \ | ||
108 | reg, clr, set) | ||
109 | |||
93 | #endif /* __ASSEMBLY__ */ | 110 | #endif /* __ASSEMBLY__ */ |
94 | #endif /* __KERNEL__ */ | 111 | #endif /* __KERNEL__ */ |
95 | #endif /* _ASM_POWERPC_DCR_NATIVE_H */ | 112 | #endif /* _ASM_POWERPC_DCR_NATIVE_H */ |