diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-io.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-io.c | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.c b/drivers/net/wireless/iwlwifi/iwl-io.c index 081dd34d2387..66c873399aba 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.c +++ b/drivers/net/wireless/iwlwifi/iwl-io.c | |||
@@ -27,6 +27,7 @@ | |||
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/device.h> | 29 | #include <linux/device.h> |
30 | #include <linux/export.h> | ||
30 | 31 | ||
31 | #include "iwl-io.h" | 32 | #include "iwl-io.h" |
32 | #include"iwl-csr.h" | 33 | #include"iwl-csr.h" |
@@ -52,6 +53,7 @@ void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask) | |||
52 | __iwl_set_bit(trans, reg, mask); | 53 | __iwl_set_bit(trans, reg, mask); |
53 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 54 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
54 | } | 55 | } |
56 | EXPORT_SYMBOL_GPL(iwl_set_bit); | ||
55 | 57 | ||
56 | void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask) | 58 | void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask) |
57 | { | 59 | { |
@@ -61,6 +63,25 @@ void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask) | |||
61 | __iwl_clear_bit(trans, reg, mask); | 63 | __iwl_clear_bit(trans, reg, mask); |
62 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 64 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
63 | } | 65 | } |
66 | EXPORT_SYMBOL_GPL(iwl_clear_bit); | ||
67 | |||
68 | void iwl_set_bits_mask(struct iwl_trans *trans, u32 reg, u32 mask, u32 value) | ||
69 | { | ||
70 | unsigned long flags; | ||
71 | u32 v; | ||
72 | |||
73 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
74 | WARN_ON_ONCE(value & ~mask); | ||
75 | #endif | ||
76 | |||
77 | spin_lock_irqsave(&trans->reg_lock, flags); | ||
78 | v = iwl_read32(trans, reg); | ||
79 | v &= ~mask; | ||
80 | v |= value; | ||
81 | iwl_write32(trans, reg, v); | ||
82 | spin_unlock_irqrestore(&trans->reg_lock, flags); | ||
83 | } | ||
84 | EXPORT_SYMBOL_GPL(iwl_set_bits_mask); | ||
64 | 85 | ||
65 | int iwl_poll_bit(struct iwl_trans *trans, u32 addr, | 86 | int iwl_poll_bit(struct iwl_trans *trans, u32 addr, |
66 | u32 bits, u32 mask, int timeout) | 87 | u32 bits, u32 mask, int timeout) |
@@ -76,6 +97,7 @@ int iwl_poll_bit(struct iwl_trans *trans, u32 addr, | |||
76 | 97 | ||
77 | return -ETIMEDOUT; | 98 | return -ETIMEDOUT; |
78 | } | 99 | } |
100 | EXPORT_SYMBOL_GPL(iwl_poll_bit); | ||
79 | 101 | ||
80 | int iwl_grab_nic_access_silent(struct iwl_trans *trans) | 102 | int iwl_grab_nic_access_silent(struct iwl_trans *trans) |
81 | { | 103 | { |
@@ -117,6 +139,7 @@ int iwl_grab_nic_access_silent(struct iwl_trans *trans) | |||
117 | 139 | ||
118 | return 0; | 140 | return 0; |
119 | } | 141 | } |
142 | EXPORT_SYMBOL_GPL(iwl_grab_nic_access_silent); | ||
120 | 143 | ||
121 | bool iwl_grab_nic_access(struct iwl_trans *trans) | 144 | bool iwl_grab_nic_access(struct iwl_trans *trans) |
122 | { | 145 | { |
@@ -130,6 +153,7 @@ bool iwl_grab_nic_access(struct iwl_trans *trans) | |||
130 | 153 | ||
131 | return true; | 154 | return true; |
132 | } | 155 | } |
156 | EXPORT_SYMBOL_GPL(iwl_grab_nic_access); | ||
133 | 157 | ||
134 | void iwl_release_nic_access(struct iwl_trans *trans) | 158 | void iwl_release_nic_access(struct iwl_trans *trans) |
135 | { | 159 | { |
@@ -144,6 +168,7 @@ void iwl_release_nic_access(struct iwl_trans *trans) | |||
144 | */ | 168 | */ |
145 | mmiowb(); | 169 | mmiowb(); |
146 | } | 170 | } |
171 | EXPORT_SYMBOL_GPL(iwl_release_nic_access); | ||
147 | 172 | ||
148 | u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg) | 173 | u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg) |
149 | { | 174 | { |
@@ -158,6 +183,7 @@ u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg) | |||
158 | 183 | ||
159 | return value; | 184 | return value; |
160 | } | 185 | } |
186 | EXPORT_SYMBOL_GPL(iwl_read_direct32); | ||
161 | 187 | ||
162 | void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value) | 188 | void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value) |
163 | { | 189 | { |
@@ -170,6 +196,7 @@ void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value) | |||
170 | } | 196 | } |
171 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 197 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
172 | } | 198 | } |
199 | EXPORT_SYMBOL_GPL(iwl_write_direct32); | ||
173 | 200 | ||
174 | int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, | 201 | int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, |
175 | int timeout) | 202 | int timeout) |
@@ -185,6 +212,7 @@ int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, | |||
185 | 212 | ||
186 | return -ETIMEDOUT; | 213 | return -ETIMEDOUT; |
187 | } | 214 | } |
215 | EXPORT_SYMBOL_GPL(iwl_poll_direct_bit); | ||
188 | 216 | ||
189 | static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 reg) | 217 | static inline u32 __iwl_read_prph(struct iwl_trans *trans, u32 reg) |
190 | { | 218 | { |
@@ -211,6 +239,7 @@ u32 iwl_read_prph(struct iwl_trans *trans, u32 reg) | |||
211 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 239 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
212 | return val; | 240 | return val; |
213 | } | 241 | } |
242 | EXPORT_SYMBOL_GPL(iwl_read_prph); | ||
214 | 243 | ||
215 | void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val) | 244 | void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val) |
216 | { | 245 | { |
@@ -223,6 +252,7 @@ void iwl_write_prph(struct iwl_trans *trans, u32 addr, u32 val) | |||
223 | } | 252 | } |
224 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 253 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
225 | } | 254 | } |
255 | EXPORT_SYMBOL_GPL(iwl_write_prph); | ||
226 | 256 | ||
227 | void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) | 257 | void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) |
228 | { | 258 | { |
@@ -236,6 +266,7 @@ void iwl_set_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) | |||
236 | } | 266 | } |
237 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 267 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
238 | } | 268 | } |
269 | EXPORT_SYMBOL_GPL(iwl_set_bits_prph); | ||
239 | 270 | ||
240 | void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg, | 271 | void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg, |
241 | u32 bits, u32 mask) | 272 | u32 bits, u32 mask) |
@@ -250,6 +281,7 @@ void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 reg, | |||
250 | } | 281 | } |
251 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 282 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
252 | } | 283 | } |
284 | EXPORT_SYMBOL_GPL(iwl_set_bits_mask_prph); | ||
253 | 285 | ||
254 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) | 286 | void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) |
255 | { | 287 | { |
@@ -264,9 +296,10 @@ void iwl_clear_bits_prph(struct iwl_trans *trans, u32 reg, u32 mask) | |||
264 | } | 296 | } |
265 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 297 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
266 | } | 298 | } |
299 | EXPORT_SYMBOL_GPL(iwl_clear_bits_prph); | ||
267 | 300 | ||
268 | void _iwl_read_targ_mem_words(struct iwl_trans *trans, u32 addr, | 301 | void _iwl_read_targ_mem_dwords(struct iwl_trans *trans, u32 addr, |
269 | void *buf, int words) | 302 | void *buf, int dwords) |
270 | { | 303 | { |
271 | unsigned long flags; | 304 | unsigned long flags; |
272 | int offs; | 305 | int offs; |
@@ -275,24 +308,26 @@ void _iwl_read_targ_mem_words(struct iwl_trans *trans, u32 addr, | |||
275 | spin_lock_irqsave(&trans->reg_lock, flags); | 308 | spin_lock_irqsave(&trans->reg_lock, flags); |
276 | if (likely(iwl_grab_nic_access(trans))) { | 309 | if (likely(iwl_grab_nic_access(trans))) { |
277 | iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr); | 310 | iwl_write32(trans, HBUS_TARG_MEM_RADDR, addr); |
278 | for (offs = 0; offs < words; offs++) | 311 | for (offs = 0; offs < dwords; offs++) |
279 | vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT); | 312 | vals[offs] = iwl_read32(trans, HBUS_TARG_MEM_RDAT); |
280 | iwl_release_nic_access(trans); | 313 | iwl_release_nic_access(trans); |
281 | } | 314 | } |
282 | spin_unlock_irqrestore(&trans->reg_lock, flags); | 315 | spin_unlock_irqrestore(&trans->reg_lock, flags); |
283 | } | 316 | } |
317 | EXPORT_SYMBOL_GPL(_iwl_read_targ_mem_dwords); | ||
284 | 318 | ||
285 | u32 iwl_read_targ_mem(struct iwl_trans *trans, u32 addr) | 319 | u32 iwl_read_targ_mem(struct iwl_trans *trans, u32 addr) |
286 | { | 320 | { |
287 | u32 value; | 321 | u32 value; |
288 | 322 | ||
289 | _iwl_read_targ_mem_words(trans, addr, &value, 1); | 323 | _iwl_read_targ_mem_dwords(trans, addr, &value, 1); |
290 | 324 | ||
291 | return value; | 325 | return value; |
292 | } | 326 | } |
327 | EXPORT_SYMBOL_GPL(iwl_read_targ_mem); | ||
293 | 328 | ||
294 | int _iwl_write_targ_mem_words(struct iwl_trans *trans, u32 addr, | 329 | int _iwl_write_targ_mem_dwords(struct iwl_trans *trans, u32 addr, |
295 | void *buf, int words) | 330 | void *buf, int dwords) |
296 | { | 331 | { |
297 | unsigned long flags; | 332 | unsigned long flags; |
298 | int offs, result = 0; | 333 | int offs, result = 0; |
@@ -301,7 +336,7 @@ int _iwl_write_targ_mem_words(struct iwl_trans *trans, u32 addr, | |||
301 | spin_lock_irqsave(&trans->reg_lock, flags); | 336 | spin_lock_irqsave(&trans->reg_lock, flags); |
302 | if (likely(iwl_grab_nic_access(trans))) { | 337 | if (likely(iwl_grab_nic_access(trans))) { |
303 | iwl_write32(trans, HBUS_TARG_MEM_WADDR, addr); | 338 | iwl_write32(trans, HBUS_TARG_MEM_WADDR, addr); |
304 | for (offs = 0; offs < words; offs++) | 339 | for (offs = 0; offs < dwords; offs++) |
305 | iwl_write32(trans, HBUS_TARG_MEM_WDAT, vals[offs]); | 340 | iwl_write32(trans, HBUS_TARG_MEM_WDAT, vals[offs]); |
306 | iwl_release_nic_access(trans); | 341 | iwl_release_nic_access(trans); |
307 | } else | 342 | } else |
@@ -310,8 +345,10 @@ int _iwl_write_targ_mem_words(struct iwl_trans *trans, u32 addr, | |||
310 | 345 | ||
311 | return result; | 346 | return result; |
312 | } | 347 | } |
348 | EXPORT_SYMBOL_GPL(_iwl_write_targ_mem_dwords); | ||
313 | 349 | ||
314 | int iwl_write_targ_mem(struct iwl_trans *trans, u32 addr, u32 val) | 350 | int iwl_write_targ_mem(struct iwl_trans *trans, u32 addr, u32 val) |
315 | { | 351 | { |
316 | return _iwl_write_targ_mem_words(trans, addr, &val, 1); | 352 | return _iwl_write_targ_mem_dwords(trans, addr, &val, 1); |
317 | } | 353 | } |
354 | EXPORT_SYMBOL_GPL(iwl_write_targ_mem); | ||