| 148 | | #define _OS_REG_WRITE(_ah, _reg, _val) do { \ |
|---|
| 149 | | (0x4000 <= (_reg) && (_reg) < 0x5000) ? \ |
|---|
| 150 | | writel((_val), (_ah)->ah_sh + (_reg)) : \ |
|---|
| 151 | | __raw_writel((_val), (_ah)->ah_sh + (_reg)); \ |
|---|
| 152 | | } while (0) |
|---|
| 153 | | #define _OS_REG_READ(_ah, _reg) \ |
|---|
| 154 | | ((0x4000 <= (_reg) && (_reg) < 0x5000) ? \ |
|---|
| 155 | | readl((_ah)->ah_sh + (_reg)) : \ |
|---|
| 156 | | __raw_readl((_ah)->ah_sh + (_reg))) |
|---|
| | 148 | |
|---|
| | 149 | #if defined (AH_XSCALE_BE_SWAP) |
|---|
| | 150 | /* |
|---|
| | 151 | * Somehow there is no byte swap in the arm-xscale arch |
|---|
| | 152 | * so let's byteswap the atheros registers here... |
|---|
| | 153 | */ |
|---|
| | 154 | static __inline__ u_int32_t |
|---|
| | 155 | __bswap32(u_int32_t _x) |
|---|
| | 156 | { |
|---|
| | 157 | return ((u_int32_t)( |
|---|
| | 158 | (((const u_int8_t *)(&_x))[0] ) | |
|---|
| | 159 | (((const u_int8_t *)(&_x))[1]<< 8) | |
|---|
| | 160 | (((const u_int8_t *)(&_x))[2]<<16) | |
|---|
| | 161 | (((const u_int8_t *)(&_x))[3]<<24)) |
|---|
| | 162 | ); |
|---|
| | 163 | } |
|---|
| | 164 | #define _OS_REG_WRITE(_ah, _reg, _val) do { \ |
|---|
| | 165 | if ( (_reg) >= 0x4000 && (_reg) < 0x5000) \ |
|---|
| | 166 | *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = \ |
|---|
| | 167 | __bswap32((_val)); \ |
|---|
| | 168 | else \ |
|---|
| | 169 | *((volatile u_int32_t *)((_ah)->ah_sh + (_reg))) = (_val); \ |
|---|
| | 170 | } while (0) |
|---|
| | 171 | #define _OS_REG_READ(_ah, _reg) \ |
|---|
| | 172 | (((_reg) >= 0x4000 && (_reg) < 0x5000) ? \ |
|---|
| | 173 | __bswap32(*((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) : \ |
|---|
| | 174 | *((volatile u_int32_t *)((_ah)->ah_sh + (_reg)))) |
|---|
| | 175 | #else |
|---|
| | 176 | #define _OS_REG_WRITE(_ah, _reg, _val) do { \ |
|---|
| | 177 | (0x4000 <= (_reg) && (_reg) < 0x5000) ? \ |
|---|
| | 178 | writel((_val), (_ah)->ah_sh + (_reg)) : \ |
|---|
| | 179 | __raw_writel((_val), (_ah)->ah_sh + (_reg)); \ |
|---|
| | 180 | } while (0) |
|---|
| | 181 | #define _OS_REG_READ(_ah, _reg) \ |
|---|
| | 182 | ((0x4000 <= (_reg) && (_reg) < 0x5000) ? \ |
|---|
| | 183 | readl((_ah)->ah_sh + (_reg)) : \ |
|---|
| | 184 | __raw_readl((_ah)->ah_sh + (_reg))) |
|---|
| | 185 | #endif /* if defined AH_XSCALE_BE_SWAP */ |
|---|
| | 186 | |
|---|