revert changes to io access functions done in madwifi trunk (they seem wrong to me...
[openwrt/openwrt.git] / package / madwifi / patches / 128-revert_ioaccess.patch
1 Index: madwifi-ng-r2756-20071018/ath_hal/ah_os.h
2 ===================================================================
3 --- madwifi-ng-r2756-20071018.orig/ath_hal/ah_os.h 2007-10-24 19:56:29.632449329 +0200
4 +++ madwifi-ng-r2756-20071018/ath_hal/ah_os.h 2007-10-24 19:56:39.192994154 +0200
5 @@ -172,44 +172,25 @@
6 * never byte-swapped by PCI chipsets or bridges, but always
7 * written directly (i.e. the format defined by the manufacturer).
8 */
9 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
10 -# if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
11 +#if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
12 #define _OS_REG_WRITE(_ah, _reg, _val) do { \
13 (0x4000 <= (_reg) && (_reg) < 0x5000) ? \
14 - iowrite32((_val), (_ah)->ah_sh + (_reg)) : \
15 - iowrite32be((_val), (_ah)->ah_sh + (_reg)); \
16 - } while (0)
17 -#define _OS_REG_READ(_ah, _reg) \
18 - ((0x4000 <= (_reg) && (_reg) < 0x5000) ? \
19 - ioread32((_ah)->ah_sh + (_reg)) : \
20 - ioread32be((_ah)->ah_sh + (_reg)));
21 -# else /* AH_LITTLE_ENDIAN */
22 -#define _OS_REG_WRITE(_ah, _reg, _val) do { \
23 - iowrite32(_val, (_ah)->ah_sh + (_reg)); \
24 - } while (0)
25 -#define _OS_REG_READ(_ah, _reg) \
26 - ioread32((_ah)->ah_sh + (_reg))
27 -
28 -# endif /* AH_BYTE_ORDER */
29 -#else
30 -# if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
31 -#define _OS_REG_WRITE(_ah, _reg, _val) do { \
32 - writel((0x4000 <= (_reg) && (_reg) < 0x5000) ? \
33 - (_val) : cpu_to_le32(_val), \
34 - (_ah)->ah_sh + (_reg)); \
35 - } while (0)
36 + writel((_val), (_ah)->ah_sh + (_reg)) : \
37 + ({__raw_writel((_val), (_ah)->ah_sh + (_reg)); \
38 + mb(); }); \
39 +} while (0)
40 #define _OS_REG_READ(_ah, _reg) \
41 ((0x4000 <= (_reg) && (_reg) < 0x5000) ? \
42 readl((_ah)->ah_sh + (_reg)) : \
43 - cpu_to_le32(readl((_ah)->ah_sh + (_reg))))
44 -# else /* AH_LITTLE_ENDIAN */
45 + ({unsigned long __v = __raw_readl((_ah)->ah_sh + \
46 + (_reg)); mb(); __v; }))
47 +#else /* AH_LITTLE_ENDIAN */
48 #define _OS_REG_WRITE(_ah, _reg, _val) do { \
49 writel(_val, (_ah)->ah_sh + (_reg)); \
50 - } while (0)
51 +} while (0)
52 #define _OS_REG_READ(_ah, _reg) \
53 readl((_ah)->ah_sh + (_reg))
54 -# endif /* AH_BYTE_ORDER */
55 -#endif /* KERNEL_VERSON(2,6,12) */
56 +#endif /* AH_BYTE_ORDER */
57
58 /*
59 The functions in this section are not intended to be invoked by MadWifi driver