]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-powerpc/dcr-native.h
Fix timerfd breakage on avr32
[linux-2.6-omap-h63xx.git] / include / asm-powerpc / dcr-native.h
index 8dbb1ab0aa04d2fce6a0e4c858ee0357875e2cc1..af5fb31af559d6dbf5a0ecb95f1705d952419fa5 100644 (file)
@@ -22,6 +22,8 @@
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
+#include <linux/spinlock.h>
+
 typedef struct {
        unsigned int base;
 } dcr_host_t;
@@ -55,20 +57,28 @@ do {                                                                \
 } while (0)
 
 /* R/W of indirect DCRs make use of standard naming conventions for DCRs */
-#define mfdcri(base, reg)                      \
-({                                             \
-       mtdcr(base ## _CFGADDR, base ## _ ## reg);      \
-       mfdcr(base ## _CFGDATA);                        \
+extern spinlock_t dcr_ind_lock;
+
+#define mfdcri(base, reg)                              \
+({                                                     \
+       unsigned long flags;                            \
+       unsigned int val;                               \
+       spin_lock_irqsave(&dcr_ind_lock, flags);        \
+       mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg);      \
+       val = mfdcr(DCRN_ ## base ## _CONFIG_DATA);     \
+       spin_unlock_irqrestore(&dcr_ind_lock, flags);   \
+       val;                                            \
 })
 
-#define mtdcri(base, reg, data)                        \
-do {                                           \
-       mtdcr(base ## _CFGADDR, base ## _ ## reg);      \
-       mtdcr(base ## _CFGDATA, data);          \
+#define mtdcri(base, reg, data)                                \
+do {                                                   \
+       unsigned long flags;                            \
+       spin_lock_irqsave(&dcr_ind_lock, flags);        \
+       mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg);      \
+       mtdcr(DCRN_ ## base ## _CONFIG_DATA, data);     \
+       spin_unlock_irqrestore(&dcr_ind_lock, flags);   \
 } while (0)
 
 #endif /* __ASSEMBLY__ */
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_DCR_NATIVE_H */
-
-