diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-io.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-io.h | 256 |
1 files changed, 128 insertions, 128 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h index 74a51798c232..75e20d0a20d1 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945-io.h | |||
@@ -26,8 +26,8 @@ | |||
26 | * | 26 | * |
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
29 | #ifndef __iwl_io_h__ | 29 | #ifndef __iwl3945_io_h__ |
30 | #define __iwl_io_h__ | 30 | #define __iwl3945_io_h__ |
31 | 31 | ||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | 33 | ||
@@ -49,8 +49,8 @@ | |||
49 | * | 49 | * |
50 | * If you wish to call the function without any debug or state checking, | 50 | * If you wish to call the function without any debug or state checking, |
51 | * you should use the single _ prefix version (as is used by dependent IO | 51 | * you should use the single _ prefix version (as is used by dependent IO |
52 | * routines, for example _iwl_read_direct32 calls the non-check version of | 52 | * routines, for example _iwl3945_read_direct32 calls the non-check version of |
53 | * _iwl_read32.) | 53 | * _iwl3945_read32.) |
54 | * | 54 | * |
55 | * These declarations are *extremely* useful in quickly isolating code deltas | 55 | * These declarations are *extremely* useful in quickly isolating code deltas |
56 | * which result in misconfiguring of the hardware I/O. In combination with | 56 | * which result in misconfiguring of the hardware I/O. In combination with |
@@ -59,39 +59,39 @@ | |||
59 | * | 59 | * |
60 | */ | 60 | */ |
61 | 61 | ||
62 | #define _iwl_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) | 62 | #define _iwl3945_write32(iwl, ofs, val) writel((val), (iwl)->hw_base + (ofs)) |
63 | #ifdef CONFIG_IWL3945_DEBUG | 63 | #ifdef CONFIG_IWL3945_DEBUG |
64 | static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *iwl, | 64 | static inline void __iwl3945_write32(const char *f, u32 l, struct iwl3945_priv *iwl, |
65 | u32 ofs, u32 val) | 65 | u32 ofs, u32 val) |
66 | { | 66 | { |
67 | IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); | 67 | IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l); |
68 | _iwl_write32(iwl, ofs, val); | 68 | _iwl3945_write32(iwl, ofs, val); |
69 | } | 69 | } |
70 | #define iwl_write32(iwl, ofs, val) \ | 70 | #define iwl3945_write32(iwl, ofs, val) \ |
71 | __iwl_write32(__FILE__, __LINE__, iwl, ofs, val) | 71 | __iwl3945_write32(__FILE__, __LINE__, iwl, ofs, val) |
72 | #else | 72 | #else |
73 | #define iwl_write32(iwl, ofs, val) _iwl_write32(iwl, ofs, val) | 73 | #define iwl3945_write32(iwl, ofs, val) _iwl3945_write32(iwl, ofs, val) |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | #define _iwl_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) | 76 | #define _iwl3945_read32(iwl, ofs) readl((iwl)->hw_base + (ofs)) |
77 | #ifdef CONFIG_IWL3945_DEBUG | 77 | #ifdef CONFIG_IWL3945_DEBUG |
78 | static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *iwl, u32 ofs) | 78 | static inline u32 __iwl3945_read32(char *f, u32 l, struct iwl3945_priv *iwl, u32 ofs) |
79 | { | 79 | { |
80 | IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); | 80 | IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l); |
81 | return _iwl_read32(iwl, ofs); | 81 | return _iwl3945_read32(iwl, ofs); |
82 | } | 82 | } |
83 | #define iwl_read32(iwl, ofs) __iwl_read32(__FILE__, __LINE__, iwl, ofs) | 83 | #define iwl3945_read32(iwl, ofs) __iwl3945_read32(__FILE__, __LINE__, iwl, ofs) |
84 | #else | 84 | #else |
85 | #define iwl_read32(p, o) _iwl_read32(p, o) | 85 | #define iwl3945_read32(p, o) _iwl3945_read32(p, o) |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, | 88 | static inline int _iwl3945_poll_bit(struct iwl3945_priv *priv, u32 addr, |
89 | u32 bits, u32 mask, int timeout) | 89 | u32 bits, u32 mask, int timeout) |
90 | { | 90 | { |
91 | int i = 0; | 91 | int i = 0; |
92 | 92 | ||
93 | do { | 93 | do { |
94 | if ((_iwl_read32(priv, addr) & mask) == (bits & mask)) | 94 | if ((_iwl3945_read32(priv, addr) & mask) == (bits & mask)) |
95 | return i; | 95 | return i; |
96 | mdelay(10); | 96 | mdelay(10); |
97 | i += 10; | 97 | i += 10; |
@@ -100,11 +100,11 @@ static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr, | |||
100 | return -ETIMEDOUT; | 100 | return -ETIMEDOUT; |
101 | } | 101 | } |
102 | #ifdef CONFIG_IWL3945_DEBUG | 102 | #ifdef CONFIG_IWL3945_DEBUG |
103 | static inline int __iwl_poll_bit(const char *f, u32 l, | 103 | static inline int __iwl3945_poll_bit(const char *f, u32 l, |
104 | struct iwl_priv *priv, u32 addr, | 104 | struct iwl3945_priv *priv, u32 addr, |
105 | u32 bits, u32 mask, int timeout) | 105 | u32 bits, u32 mask, int timeout) |
106 | { | 106 | { |
107 | int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout); | 107 | int ret = _iwl3945_poll_bit(priv, addr, bits, mask, timeout); |
108 | if (unlikely(ret == -ETIMEDOUT)) | 108 | if (unlikely(ret == -ETIMEDOUT)) |
109 | IWL_DEBUG_IO | 109 | IWL_DEBUG_IO |
110 | ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", | 110 | ("poll_bit(0x%08X, 0x%08X, 0x%08X) - timedout - %s %d\n", |
@@ -115,47 +115,47 @@ static inline int __iwl_poll_bit(const char *f, u32 l, | |||
115 | addr, bits, mask, ret, f, l); | 115 | addr, bits, mask, ret, f, l); |
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | #define iwl_poll_bit(iwl, addr, bits, mask, timeout) \ | 118 | #define iwl3945_poll_bit(iwl, addr, bits, mask, timeout) \ |
119 | __iwl_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) | 119 | __iwl3945_poll_bit(__FILE__, __LINE__, iwl, addr, bits, mask, timeout) |
120 | #else | 120 | #else |
121 | #define iwl_poll_bit(p, a, b, m, t) _iwl_poll_bit(p, a, b, m, t) | 121 | #define iwl3945_poll_bit(p, a, b, m, t) _iwl3945_poll_bit(p, a, b, m, t) |
122 | #endif | 122 | #endif |
123 | 123 | ||
124 | static inline void _iwl_set_bit(struct iwl_priv *priv, u32 reg, u32 mask) | 124 | static inline void _iwl3945_set_bit(struct iwl3945_priv *priv, u32 reg, u32 mask) |
125 | { | 125 | { |
126 | _iwl_write32(priv, reg, _iwl_read32(priv, reg) | mask); | 126 | _iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) | mask); |
127 | } | 127 | } |
128 | #ifdef CONFIG_IWL3945_DEBUG | 128 | #ifdef CONFIG_IWL3945_DEBUG |
129 | static inline void __iwl_set_bit(const char *f, u32 l, | 129 | static inline void __iwl3945_set_bit(const char *f, u32 l, |
130 | struct iwl_priv *priv, u32 reg, u32 mask) | 130 | struct iwl3945_priv *priv, u32 reg, u32 mask) |
131 | { | 131 | { |
132 | u32 val = _iwl_read32(priv, reg) | mask; | 132 | u32 val = _iwl3945_read32(priv, reg) | mask; |
133 | IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); | 133 | IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); |
134 | _iwl_write32(priv, reg, val); | 134 | _iwl3945_write32(priv, reg, val); |
135 | } | 135 | } |
136 | #define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m) | 136 | #define iwl3945_set_bit(p, r, m) __iwl3945_set_bit(__FILE__, __LINE__, p, r, m) |
137 | #else | 137 | #else |
138 | #define iwl_set_bit(p, r, m) _iwl_set_bit(p, r, m) | 138 | #define iwl3945_set_bit(p, r, m) _iwl3945_set_bit(p, r, m) |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | static inline void _iwl_clear_bit(struct iwl_priv *priv, u32 reg, u32 mask) | 141 | static inline void _iwl3945_clear_bit(struct iwl3945_priv *priv, u32 reg, u32 mask) |
142 | { | 142 | { |
143 | _iwl_write32(priv, reg, _iwl_read32(priv, reg) & ~mask); | 143 | _iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) & ~mask); |
144 | } | 144 | } |
145 | #ifdef CONFIG_IWL3945_DEBUG | 145 | #ifdef CONFIG_IWL3945_DEBUG |
146 | static inline void __iwl_clear_bit(const char *f, u32 l, | 146 | static inline void __iwl3945_clear_bit(const char *f, u32 l, |
147 | struct iwl_priv *priv, u32 reg, u32 mask) | 147 | struct iwl3945_priv *priv, u32 reg, u32 mask) |
148 | { | 148 | { |
149 | u32 val = _iwl_read32(priv, reg) & ~mask; | 149 | u32 val = _iwl3945_read32(priv, reg) & ~mask; |
150 | IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); | 150 | IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val); |
151 | _iwl_write32(priv, reg, val); | 151 | _iwl3945_write32(priv, reg, val); |
152 | } | 152 | } |
153 | #define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m) | 153 | #define iwl3945_clear_bit(p, r, m) __iwl3945_clear_bit(__FILE__, __LINE__, p, r, m) |
154 | #else | 154 | #else |
155 | #define iwl_clear_bit(p, r, m) _iwl_clear_bit(p, r, m) | 155 | #define iwl3945_clear_bit(p, r, m) _iwl3945_clear_bit(p, r, m) |
156 | #endif | 156 | #endif |
157 | 157 | ||
158 | static inline int _iwl_grab_nic_access(struct iwl_priv *priv) | 158 | static inline int _iwl3945_grab_nic_access(struct iwl3945_priv *priv) |
159 | { | 159 | { |
160 | int ret; | 160 | int ret; |
161 | u32 gp_ctl; | 161 | u32 gp_ctl; |
@@ -170,7 +170,7 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) | |||
170 | "wakes up NIC\n"); | 170 | "wakes up NIC\n"); |
171 | 171 | ||
172 | /* 10 msec allows time for NIC to complete its data save */ | 172 | /* 10 msec allows time for NIC to complete its data save */ |
173 | gp_ctl = _iwl_read32(priv, CSR_GP_CNTRL); | 173 | gp_ctl = _iwl3945_read32(priv, CSR_GP_CNTRL); |
174 | if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { | 174 | if (gp_ctl & CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY) { |
175 | IWL_DEBUG_RF_KILL("Wait for complete power-down, " | 175 | IWL_DEBUG_RF_KILL("Wait for complete power-down, " |
176 | "gpctl = 0x%08x\n", gp_ctl); | 176 | "gpctl = 0x%08x\n", gp_ctl); |
@@ -181,8 +181,8 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) | |||
181 | } | 181 | } |
182 | 182 | ||
183 | /* this bit wakes up the NIC */ | 183 | /* this bit wakes up the NIC */ |
184 | _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 184 | _iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
185 | ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, | 185 | ret = _iwl3945_poll_bit(priv, CSR_GP_CNTRL, |
186 | CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, | 186 | CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, |
187 | (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | | 187 | (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | |
188 | CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); | 188 | CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50); |
@@ -198,106 +198,106 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) | |||
198 | } | 198 | } |
199 | 199 | ||
200 | #ifdef CONFIG_IWL3945_DEBUG | 200 | #ifdef CONFIG_IWL3945_DEBUG |
201 | static inline int __iwl_grab_nic_access(const char *f, u32 l, | 201 | static inline int __iwl3945_grab_nic_access(const char *f, u32 l, |
202 | struct iwl_priv *priv) | 202 | struct iwl3945_priv *priv) |
203 | { | 203 | { |
204 | if (atomic_read(&priv->restrict_refcnt)) | 204 | if (atomic_read(&priv->restrict_refcnt)) |
205 | IWL_DEBUG_INFO("Grabbing access while already held at " | 205 | IWL_DEBUG_INFO("Grabbing access while already held at " |
206 | "line %d.\n", l); | 206 | "line %d.\n", l); |
207 | 207 | ||
208 | IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); | 208 | IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l); |
209 | return _iwl_grab_nic_access(priv); | 209 | return _iwl3945_grab_nic_access(priv); |
210 | } | 210 | } |
211 | #define iwl_grab_nic_access(priv) \ | 211 | #define iwl3945_grab_nic_access(priv) \ |
212 | __iwl_grab_nic_access(__FILE__, __LINE__, priv) | 212 | __iwl3945_grab_nic_access(__FILE__, __LINE__, priv) |
213 | #else | 213 | #else |
214 | #define iwl_grab_nic_access(priv) \ | 214 | #define iwl3945_grab_nic_access(priv) \ |
215 | _iwl_grab_nic_access(priv) | 215 | _iwl3945_grab_nic_access(priv) |
216 | #endif | 216 | #endif |
217 | 217 | ||
218 | static inline void _iwl_release_nic_access(struct iwl_priv *priv) | 218 | static inline void _iwl3945_release_nic_access(struct iwl3945_priv *priv) |
219 | { | 219 | { |
220 | #ifdef CONFIG_IWL3945_DEBUG | 220 | #ifdef CONFIG_IWL3945_DEBUG |
221 | if (atomic_dec_and_test(&priv->restrict_refcnt)) | 221 | if (atomic_dec_and_test(&priv->restrict_refcnt)) |
222 | #endif | 222 | #endif |
223 | _iwl_clear_bit(priv, CSR_GP_CNTRL, | 223 | _iwl3945_clear_bit(priv, CSR_GP_CNTRL, |
224 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 224 | CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
225 | } | 225 | } |
226 | #ifdef CONFIG_IWL3945_DEBUG | 226 | #ifdef CONFIG_IWL3945_DEBUG |
227 | static inline void __iwl_release_nic_access(const char *f, u32 l, | 227 | static inline void __iwl3945_release_nic_access(const char *f, u32 l, |
228 | struct iwl_priv *priv) | 228 | struct iwl3945_priv *priv) |
229 | { | 229 | { |
230 | if (atomic_read(&priv->restrict_refcnt) <= 0) | 230 | if (atomic_read(&priv->restrict_refcnt) <= 0) |
231 | IWL_ERROR("Release unheld nic access at line %d.\n", l); | 231 | IWL_ERROR("Release unheld nic access at line %d.\n", l); |
232 | 232 | ||
233 | IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); | 233 | IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l); |
234 | _iwl_release_nic_access(priv); | 234 | _iwl3945_release_nic_access(priv); |
235 | } | 235 | } |
236 | #define iwl_release_nic_access(priv) \ | 236 | #define iwl3945_release_nic_access(priv) \ |
237 | __iwl_release_nic_access(__FILE__, __LINE__, priv) | 237 | __iwl3945_release_nic_access(__FILE__, __LINE__, priv) |
238 | #else | 238 | #else |
239 | #define iwl_release_nic_access(priv) \ | 239 | #define iwl3945_release_nic_access(priv) \ |
240 | _iwl_release_nic_access(priv) | 240 | _iwl3945_release_nic_access(priv) |
241 | #endif | 241 | #endif |
242 | 242 | ||
243 | static inline u32 _iwl_read_direct32(struct iwl_priv *priv, u32 reg) | 243 | static inline u32 _iwl3945_read_direct32(struct iwl3945_priv *priv, u32 reg) |
244 | { | 244 | { |
245 | return _iwl_read32(priv, reg); | 245 | return _iwl3945_read32(priv, reg); |
246 | } | 246 | } |
247 | #ifdef CONFIG_IWL3945_DEBUG | 247 | #ifdef CONFIG_IWL3945_DEBUG |
248 | static inline u32 __iwl_read_direct32(const char *f, u32 l, | 248 | static inline u32 __iwl3945_read_direct32(const char *f, u32 l, |
249 | struct iwl_priv *priv, u32 reg) | 249 | struct iwl3945_priv *priv, u32 reg) |
250 | { | 250 | { |
251 | u32 value = _iwl_read_direct32(priv, reg); | 251 | u32 value = _iwl3945_read_direct32(priv, reg); |
252 | if (!atomic_read(&priv->restrict_refcnt)) | 252 | if (!atomic_read(&priv->restrict_refcnt)) |
253 | IWL_ERROR("Nic access not held from %s %d\n", f, l); | 253 | IWL_ERROR("Nic access not held from %s %d\n", f, l); |
254 | IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, | 254 | IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value, |
255 | f, l); | 255 | f, l); |
256 | return value; | 256 | return value; |
257 | } | 257 | } |
258 | #define iwl_read_direct32(priv, reg) \ | 258 | #define iwl3945_read_direct32(priv, reg) \ |
259 | __iwl_read_direct32(__FILE__, __LINE__, priv, reg) | 259 | __iwl3945_read_direct32(__FILE__, __LINE__, priv, reg) |
260 | #else | 260 | #else |
261 | #define iwl_read_direct32 _iwl_read_direct32 | 261 | #define iwl3945_read_direct32 _iwl3945_read_direct32 |
262 | #endif | 262 | #endif |
263 | 263 | ||
264 | static inline void _iwl_write_direct32(struct iwl_priv *priv, | 264 | static inline void _iwl3945_write_direct32(struct iwl3945_priv *priv, |
265 | u32 reg, u32 value) | 265 | u32 reg, u32 value) |
266 | { | 266 | { |
267 | _iwl_write32(priv, reg, value); | 267 | _iwl3945_write32(priv, reg, value); |
268 | } | 268 | } |
269 | #ifdef CONFIG_IWL3945_DEBUG | 269 | #ifdef CONFIG_IWL3945_DEBUG |
270 | static void __iwl_write_direct32(u32 line, | 270 | static void __iwl3945_write_direct32(u32 line, |
271 | struct iwl_priv *priv, u32 reg, u32 value) | 271 | struct iwl3945_priv *priv, u32 reg, u32 value) |
272 | { | 272 | { |
273 | if (!atomic_read(&priv->restrict_refcnt)) | 273 | if (!atomic_read(&priv->restrict_refcnt)) |
274 | IWL_ERROR("Nic access not held from line %d\n", line); | 274 | IWL_ERROR("Nic access not held from line %d\n", line); |
275 | _iwl_write_direct32(priv, reg, value); | 275 | _iwl3945_write_direct32(priv, reg, value); |
276 | } | 276 | } |
277 | #define iwl_write_direct32(priv, reg, value) \ | 277 | #define iwl3945_write_direct32(priv, reg, value) \ |
278 | __iwl_write_direct32(__LINE__, priv, reg, value) | 278 | __iwl3945_write_direct32(__LINE__, priv, reg, value) |
279 | #else | 279 | #else |
280 | #define iwl_write_direct32 _iwl_write_direct32 | 280 | #define iwl3945_write_direct32 _iwl3945_write_direct32 |
281 | #endif | 281 | #endif |
282 | 282 | ||
283 | static inline void iwl_write_reg_buf(struct iwl_priv *priv, | 283 | static inline void iwl3945_write_reg_buf(struct iwl3945_priv *priv, |
284 | u32 reg, u32 len, u32 *values) | 284 | u32 reg, u32 len, u32 *values) |
285 | { | 285 | { |
286 | u32 count = sizeof(u32); | 286 | u32 count = sizeof(u32); |
287 | 287 | ||
288 | if ((priv != NULL) && (values != NULL)) { | 288 | if ((priv != NULL) && (values != NULL)) { |
289 | for (; 0 < len; len -= count, reg += count, values++) | 289 | for (; 0 < len; len -= count, reg += count, values++) |
290 | _iwl_write_direct32(priv, reg, *values); | 290 | _iwl3945_write_direct32(priv, reg, *values); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, | 294 | static inline int _iwl3945_poll_direct_bit(struct iwl3945_priv *priv, |
295 | u32 addr, u32 mask, int timeout) | 295 | u32 addr, u32 mask, int timeout) |
296 | { | 296 | { |
297 | int i = 0; | 297 | int i = 0; |
298 | 298 | ||
299 | do { | 299 | do { |
300 | if ((_iwl_read_direct32(priv, addr) & mask) == mask) | 300 | if ((_iwl3945_read_direct32(priv, addr) & mask) == mask) |
301 | return i; | 301 | return i; |
302 | mdelay(10); | 302 | mdelay(10); |
303 | i += 10; | 303 | i += 10; |
@@ -307,11 +307,11 @@ static inline int _iwl_poll_direct_bit(struct iwl_priv *priv, | |||
307 | } | 307 | } |
308 | 308 | ||
309 | #ifdef CONFIG_IWL3945_DEBUG | 309 | #ifdef CONFIG_IWL3945_DEBUG |
310 | static inline int __iwl_poll_direct_bit(const char *f, u32 l, | 310 | static inline int __iwl3945_poll_direct_bit(const char *f, u32 l, |
311 | struct iwl_priv *priv, | 311 | struct iwl3945_priv *priv, |
312 | u32 addr, u32 mask, int timeout) | 312 | u32 addr, u32 mask, int timeout) |
313 | { | 313 | { |
314 | int ret = _iwl_poll_direct_bit(priv, addr, mask, timeout); | 314 | int ret = _iwl3945_poll_direct_bit(priv, addr, mask, timeout); |
315 | 315 | ||
316 | if (unlikely(ret == -ETIMEDOUT)) | 316 | if (unlikely(ret == -ETIMEDOUT)) |
317 | IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " | 317 | IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - " |
@@ -321,111 +321,111 @@ static inline int __iwl_poll_direct_bit(const char *f, u32 l, | |||
321 | "- %s %d\n", addr, mask, ret, f, l); | 321 | "- %s %d\n", addr, mask, ret, f, l); |
322 | return ret; | 322 | return ret; |
323 | } | 323 | } |
324 | #define iwl_poll_direct_bit(iwl, addr, mask, timeout) \ | 324 | #define iwl3945_poll_direct_bit(iwl, addr, mask, timeout) \ |
325 | __iwl_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) | 325 | __iwl3945_poll_direct_bit(__FILE__, __LINE__, iwl, addr, mask, timeout) |
326 | #else | 326 | #else |
327 | #define iwl_poll_direct_bit _iwl_poll_direct_bit | 327 | #define iwl3945_poll_direct_bit _iwl3945_poll_direct_bit |
328 | #endif | 328 | #endif |
329 | 329 | ||
330 | static inline u32 _iwl_read_prph(struct iwl_priv *priv, u32 reg) | 330 | static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg) |
331 | { | 331 | { |
332 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); | 332 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); |
333 | return _iwl_read_direct32(priv, HBUS_TARG_PRPH_RDAT); | 333 | return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT); |
334 | } | 334 | } |
335 | #ifdef CONFIG_IWL3945_DEBUG | 335 | #ifdef CONFIG_IWL3945_DEBUG |
336 | static inline u32 __iwl_read_prph(u32 line, struct iwl_priv *priv, u32 reg) | 336 | static inline u32 __iwl3945_read_prph(u32 line, struct iwl3945_priv *priv, u32 reg) |
337 | { | 337 | { |
338 | if (!atomic_read(&priv->restrict_refcnt)) | 338 | if (!atomic_read(&priv->restrict_refcnt)) |
339 | IWL_ERROR("Nic access not held from line %d\n", line); | 339 | IWL_ERROR("Nic access not held from line %d\n", line); |
340 | return _iwl_read_prph(priv, reg); | 340 | return _iwl3945_read_prph(priv, reg); |
341 | } | 341 | } |
342 | 342 | ||
343 | #define iwl_read_prph(priv, reg) \ | 343 | #define iwl3945_read_prph(priv, reg) \ |
344 | __iwl_read_prph(__LINE__, priv, reg) | 344 | __iwl3945_read_prph(__LINE__, priv, reg) |
345 | #else | 345 | #else |
346 | #define iwl_read_prph _iwl_read_prph | 346 | #define iwl3945_read_prph _iwl3945_read_prph |
347 | #endif | 347 | #endif |
348 | 348 | ||
349 | static inline void _iwl_write_prph(struct iwl_priv *priv, | 349 | static inline void _iwl3945_write_prph(struct iwl3945_priv *priv, |
350 | u32 addr, u32 val) | 350 | u32 addr, u32 val) |
351 | { | 351 | { |
352 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_WADDR, | 352 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR, |
353 | ((addr & 0x0000FFFF) | (3 << 24))); | 353 | ((addr & 0x0000FFFF) | (3 << 24))); |
354 | _iwl_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); | 354 | _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val); |
355 | } | 355 | } |
356 | #ifdef CONFIG_IWL3945_DEBUG | 356 | #ifdef CONFIG_IWL3945_DEBUG |
357 | static inline void __iwl_write_prph(u32 line, struct iwl_priv *priv, | 357 | static inline void __iwl3945_write_prph(u32 line, struct iwl3945_priv *priv, |
358 | u32 addr, u32 val) | 358 | u32 addr, u32 val) |
359 | { | 359 | { |
360 | if (!atomic_read(&priv->restrict_refcnt)) | 360 | if (!atomic_read(&priv->restrict_refcnt)) |
361 | IWL_ERROR("Nic access from line %d\n", line); | 361 | IWL_ERROR("Nic access from line %d\n", line); |
362 | _iwl_write_prph(priv, addr, val); | 362 | _iwl3945_write_prph(priv, addr, val); |
363 | } | 363 | } |
364 | 364 | ||
365 | #define iwl_write_prph(priv, addr, val) \ | 365 | #define iwl3945_write_prph(priv, addr, val) \ |
366 | __iwl_write_prph(__LINE__, priv, addr, val); | 366 | __iwl3945_write_prph(__LINE__, priv, addr, val); |
367 | #else | 367 | #else |
368 | #define iwl_write_prph _iwl_write_prph | 368 | #define iwl3945_write_prph _iwl3945_write_prph |
369 | #endif | 369 | #endif |
370 | 370 | ||
371 | #define _iwl_set_bits_prph(priv, reg, mask) \ | 371 | #define _iwl3945_set_bits_prph(priv, reg, mask) \ |
372 | _iwl_write_prph(priv, reg, (_iwl_read_prph(priv, reg) | mask)) | 372 | _iwl3945_write_prph(priv, reg, (_iwl3945_read_prph(priv, reg) | mask)) |
373 | #ifdef CONFIG_IWL3945_DEBUG | 373 | #ifdef CONFIG_IWL3945_DEBUG |
374 | static inline void __iwl_set_bits_prph(u32 line, struct iwl_priv *priv, | 374 | static inline void __iwl3945_set_bits_prph(u32 line, struct iwl3945_priv *priv, |
375 | u32 reg, u32 mask) | 375 | u32 reg, u32 mask) |
376 | { | 376 | { |
377 | if (!atomic_read(&priv->restrict_refcnt)) | 377 | if (!atomic_read(&priv->restrict_refcnt)) |
378 | IWL_ERROR("Nic access not held from line %d\n", line); | 378 | IWL_ERROR("Nic access not held from line %d\n", line); |
379 | 379 | ||
380 | _iwl_set_bits_prph(priv, reg, mask); | 380 | _iwl3945_set_bits_prph(priv, reg, mask); |
381 | } | 381 | } |
382 | #define iwl_set_bits_prph(priv, reg, mask) \ | 382 | #define iwl3945_set_bits_prph(priv, reg, mask) \ |
383 | __iwl_set_bits_prph(__LINE__, priv, reg, mask) | 383 | __iwl3945_set_bits_prph(__LINE__, priv, reg, mask) |
384 | #else | 384 | #else |
385 | #define iwl_set_bits_prph _iwl_set_bits_prph | 385 | #define iwl3945_set_bits_prph _iwl3945_set_bits_prph |
386 | #endif | 386 | #endif |
387 | 387 | ||
388 | #define _iwl_set_bits_mask_prph(priv, reg, bits, mask) \ | 388 | #define _iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \ |
389 | _iwl_write_prph(priv, reg, ((_iwl_read_prph(priv, reg) & mask) | bits)) | 389 | _iwl3945_write_prph(priv, reg, ((_iwl3945_read_prph(priv, reg) & mask) | bits)) |
390 | 390 | ||
391 | #ifdef CONFIG_IWL3945_DEBUG | 391 | #ifdef CONFIG_IWL3945_DEBUG |
392 | static inline void __iwl_set_bits_mask_prph(u32 line, | 392 | static inline void __iwl3945_set_bits_mask_prph(u32 line, |
393 | struct iwl_priv *priv, u32 reg, u32 bits, u32 mask) | 393 | struct iwl3945_priv *priv, u32 reg, u32 bits, u32 mask) |
394 | { | 394 | { |
395 | if (!atomic_read(&priv->restrict_refcnt)) | 395 | if (!atomic_read(&priv->restrict_refcnt)) |
396 | IWL_ERROR("Nic access not held from line %d\n", line); | 396 | IWL_ERROR("Nic access not held from line %d\n", line); |
397 | _iwl_set_bits_mask_prph(priv, reg, bits, mask); | 397 | _iwl3945_set_bits_mask_prph(priv, reg, bits, mask); |
398 | } | 398 | } |
399 | #define iwl_set_bits_mask_prph(priv, reg, bits, mask) \ | 399 | #define iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \ |
400 | __iwl_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) | 400 | __iwl3945_set_bits_mask_prph(__LINE__, priv, reg, bits, mask) |
401 | #else | 401 | #else |
402 | #define iwl_set_bits_mask_prph _iwl_set_bits_mask_prph | 402 | #define iwl3945_set_bits_mask_prph _iwl3945_set_bits_mask_prph |
403 | #endif | 403 | #endif |
404 | 404 | ||
405 | static inline void iwl_clear_bits_prph(struct iwl_priv | 405 | static inline void iwl3945_clear_bits_prph(struct iwl3945_priv |
406 | *priv, u32 reg, u32 mask) | 406 | *priv, u32 reg, u32 mask) |
407 | { | 407 | { |
408 | u32 val = _iwl_read_prph(priv, reg); | 408 | u32 val = _iwl3945_read_prph(priv, reg); |
409 | _iwl_write_prph(priv, reg, (val & ~mask)); | 409 | _iwl3945_write_prph(priv, reg, (val & ~mask)); |
410 | } | 410 | } |
411 | 411 | ||
412 | static inline u32 iwl_read_targ_mem(struct iwl_priv *priv, u32 addr) | 412 | static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr) |
413 | { | 413 | { |
414 | iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); | 414 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr); |
415 | return iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT); | 415 | return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT); |
416 | } | 416 | } |
417 | 417 | ||
418 | static inline void iwl_write_targ_mem(struct iwl_priv *priv, u32 addr, u32 val) | 418 | static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val) |
419 | { | 419 | { |
420 | iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); | 420 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); |
421 | iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); | 421 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val); |
422 | } | 422 | } |
423 | 423 | ||
424 | static inline void iwl_write_targ_mem_buf(struct iwl_priv *priv, u32 addr, | 424 | static inline void iwl3945_write_targ_mem_buf(struct iwl3945_priv *priv, u32 addr, |
425 | u32 len, u32 *values) | 425 | u32 len, u32 *values) |
426 | { | 426 | { |
427 | iwl_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); | 427 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr); |
428 | for (; 0 < len; len -= sizeof(u32), values++) | 428 | for (; 0 < len; len -= sizeof(u32), values++) |
429 | iwl_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); | 429 | iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values); |
430 | } | 430 | } |
431 | #endif | 431 | #endif |