diff options
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r-- | drivers/net/wireless/b43/b43.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/b43/debugfs.c | 359 | ||||
-rw-r--r-- | drivers/net/wireless/b43/debugfs.h | 23 | ||||
-rw-r--r-- | drivers/net/wireless/b43/dma.c | 65 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 86 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pio.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/b43/rfkill.c | 7 | ||||
-rw-r--r-- | drivers/net/wireless/b43/xmit.c | 17 |
9 files changed, 465 insertions, 100 deletions
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 532365f5ecef..edcdfa366452 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -441,6 +441,8 @@ enum { | |||
441 | #define B43_FWPANIC_DIE 0 /* Firmware died. Don't auto-restart it. */ | 441 | #define B43_FWPANIC_DIE 0 /* Firmware died. Don't auto-restart it. */ |
442 | #define B43_FWPANIC_RESTART 1 /* Firmware died. Schedule a controller reset. */ | 442 | #define B43_FWPANIC_RESTART 1 /* Firmware died. Schedule a controller reset. */ |
443 | 443 | ||
444 | /* The firmware register that contains the watchdog counter. */ | ||
445 | #define B43_WATCHDOG_REG 1 | ||
444 | 446 | ||
445 | /* Device specific rate values. | 447 | /* Device specific rate values. |
446 | * The actual values defined here are (rate_in_mbps * 2). | 448 | * The actual values defined here are (rate_in_mbps * 2). |
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index 210e2789c1c3..29851bc1101f 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -74,70 +74,327 @@ struct b43_dfs_file * fops_to_dfs_file(struct b43_wldev *dev, | |||
74 | } while (0) | 74 | } while (0) |
75 | 75 | ||
76 | 76 | ||
77 | /* wl->irq_lock is locked */ | 77 | /* The biggest address values for SHM access from the debugfs files. */ |
78 | static ssize_t tsf_read_file(struct b43_wldev *dev, | 78 | #define B43_MAX_SHM_ROUTING 4 |
79 | char *buf, size_t bufsize) | 79 | #define B43_MAX_SHM_ADDR 0xFFFF |
80 | |||
81 | static ssize_t shm16read__read_file(struct b43_wldev *dev, | ||
82 | char *buf, size_t bufsize) | ||
80 | { | 83 | { |
81 | ssize_t count = 0; | 84 | ssize_t count = 0; |
82 | u64 tsf; | 85 | unsigned int routing, addr; |
86 | u16 val; | ||
83 | 87 | ||
84 | b43_tsf_read(dev, &tsf); | 88 | routing = dev->dfsentry->shm16read_routing_next; |
85 | fappend("0x%08x%08x\n", | 89 | addr = dev->dfsentry->shm16read_addr_next; |
86 | (unsigned int)((tsf & 0xFFFFFFFF00000000ULL) >> 32), | 90 | if ((routing > B43_MAX_SHM_ROUTING) || |
87 | (unsigned int)(tsf & 0xFFFFFFFFULL)); | 91 | (addr > B43_MAX_SHM_ADDR)) |
92 | return -EDESTADDRREQ; | ||
93 | |||
94 | val = b43_shm_read16(dev, routing, addr); | ||
95 | fappend("0x%04X\n", val); | ||
88 | 96 | ||
89 | return count; | 97 | return count; |
90 | } | 98 | } |
91 | 99 | ||
92 | /* wl->irq_lock is locked */ | 100 | static int shm16read__write_file(struct b43_wldev *dev, |
93 | static int tsf_write_file(struct b43_wldev *dev, | 101 | const char *buf, size_t count) |
94 | const char *buf, size_t count) | ||
95 | { | 102 | { |
96 | u64 tsf; | 103 | unsigned int routing, addr; |
104 | int res; | ||
97 | 105 | ||
98 | if (sscanf(buf, "%llu", (unsigned long long *)(&tsf)) != 1) | 106 | res = sscanf(buf, "0x%X 0x%X", &routing, &addr); |
107 | if (res != 2) | ||
99 | return -EINVAL; | 108 | return -EINVAL; |
100 | b43_tsf_write(dev, tsf); | 109 | if (routing > B43_MAX_SHM_ROUTING) |
110 | return -EADDRNOTAVAIL; | ||
111 | if (addr > B43_MAX_SHM_ADDR) | ||
112 | return -EADDRNOTAVAIL; | ||
113 | if (routing == B43_SHM_SHARED) { | ||
114 | if ((addr % 2) != 0) | ||
115 | return -EADDRNOTAVAIL; | ||
116 | } | ||
117 | |||
118 | dev->dfsentry->shm16read_routing_next = routing; | ||
119 | dev->dfsentry->shm16read_addr_next = addr; | ||
101 | 120 | ||
102 | return 0; | 121 | return 0; |
103 | } | 122 | } |
104 | 123 | ||
105 | /* wl->irq_lock is locked */ | 124 | static int shm16write__write_file(struct b43_wldev *dev, |
106 | static ssize_t ucode_regs_read_file(struct b43_wldev *dev, | 125 | const char *buf, size_t count) |
126 | { | ||
127 | unsigned int routing, addr, mask, set; | ||
128 | u16 val; | ||
129 | int res; | ||
130 | unsigned long flags; | ||
131 | |||
132 | res = sscanf(buf, "0x%X 0x%X 0x%X 0x%X", | ||
133 | &routing, &addr, &mask, &set); | ||
134 | if (res != 4) | ||
135 | return -EINVAL; | ||
136 | if (routing > B43_MAX_SHM_ROUTING) | ||
137 | return -EADDRNOTAVAIL; | ||
138 | if (addr > B43_MAX_SHM_ADDR) | ||
139 | return -EADDRNOTAVAIL; | ||
140 | if (routing == B43_SHM_SHARED) { | ||
141 | if ((addr % 2) != 0) | ||
142 | return -EADDRNOTAVAIL; | ||
143 | } | ||
144 | if ((mask > 0xFFFF) || (set > 0xFFFF)) | ||
145 | return -E2BIG; | ||
146 | |||
147 | spin_lock_irqsave(&dev->wl->shm_lock, flags); | ||
148 | if (mask == 0) | ||
149 | val = 0; | ||
150 | else | ||
151 | val = __b43_shm_read16(dev, routing, addr); | ||
152 | val &= mask; | ||
153 | val |= set; | ||
154 | __b43_shm_write16(dev, routing, addr, val); | ||
155 | spin_unlock_irqrestore(&dev->wl->shm_lock, flags); | ||
156 | |||
157 | return 0; | ||
158 | } | ||
159 | |||
160 | static ssize_t shm32read__read_file(struct b43_wldev *dev, | ||
107 | char *buf, size_t bufsize) | 161 | char *buf, size_t bufsize) |
108 | { | 162 | { |
109 | ssize_t count = 0; | 163 | ssize_t count = 0; |
110 | int i; | 164 | unsigned int routing, addr; |
165 | u32 val; | ||
166 | |||
167 | routing = dev->dfsentry->shm32read_routing_next; | ||
168 | addr = dev->dfsentry->shm32read_addr_next; | ||
169 | if ((routing > B43_MAX_SHM_ROUTING) || | ||
170 | (addr > B43_MAX_SHM_ADDR)) | ||
171 | return -EDESTADDRREQ; | ||
111 | 172 | ||
112 | for (i = 0; i < 64; i++) { | 173 | val = b43_shm_read32(dev, routing, addr); |
113 | fappend("r%d = 0x%04x\n", i, | 174 | fappend("0x%08X\n", val); |
114 | b43_shm_read16(dev, B43_SHM_SCRATCH, i)); | 175 | |
176 | return count; | ||
177 | } | ||
178 | |||
179 | static int shm32read__write_file(struct b43_wldev *dev, | ||
180 | const char *buf, size_t count) | ||
181 | { | ||
182 | unsigned int routing, addr; | ||
183 | int res; | ||
184 | |||
185 | res = sscanf(buf, "0x%X 0x%X", &routing, &addr); | ||
186 | if (res != 2) | ||
187 | return -EINVAL; | ||
188 | if (routing > B43_MAX_SHM_ROUTING) | ||
189 | return -EADDRNOTAVAIL; | ||
190 | if (addr > B43_MAX_SHM_ADDR) | ||
191 | return -EADDRNOTAVAIL; | ||
192 | if (routing == B43_SHM_SHARED) { | ||
193 | if ((addr % 2) != 0) | ||
194 | return -EADDRNOTAVAIL; | ||
195 | } | ||
196 | |||
197 | dev->dfsentry->shm32read_routing_next = routing; | ||
198 | dev->dfsentry->shm32read_addr_next = addr; | ||
199 | |||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static int shm32write__write_file(struct b43_wldev *dev, | ||
204 | const char *buf, size_t count) | ||
205 | { | ||
206 | unsigned int routing, addr, mask, set; | ||
207 | u32 val; | ||
208 | int res; | ||
209 | unsigned long flags; | ||
210 | |||
211 | res = sscanf(buf, "0x%X 0x%X 0x%X 0x%X", | ||
212 | &routing, &addr, &mask, &set); | ||
213 | if (res != 4) | ||
214 | return -EINVAL; | ||
215 | if (routing > B43_MAX_SHM_ROUTING) | ||
216 | return -EADDRNOTAVAIL; | ||
217 | if (addr > B43_MAX_SHM_ADDR) | ||
218 | return -EADDRNOTAVAIL; | ||
219 | if (routing == B43_SHM_SHARED) { | ||
220 | if ((addr % 2) != 0) | ||
221 | return -EADDRNOTAVAIL; | ||
115 | } | 222 | } |
223 | if ((mask > 0xFFFFFFFF) || (set > 0xFFFFFFFF)) | ||
224 | return -E2BIG; | ||
225 | |||
226 | spin_lock_irqsave(&dev->wl->shm_lock, flags); | ||
227 | if (mask == 0) | ||
228 | val = 0; | ||
229 | else | ||
230 | val = __b43_shm_read32(dev, routing, addr); | ||
231 | val &= mask; | ||
232 | val |= set; | ||
233 | __b43_shm_write32(dev, routing, addr, val); | ||
234 | spin_unlock_irqrestore(&dev->wl->shm_lock, flags); | ||
235 | |||
236 | return 0; | ||
237 | } | ||
238 | |||
239 | /* The biggest MMIO address that we allow access to from the debugfs files. */ | ||
240 | #define B43_MAX_MMIO_ACCESS (0xF00 - 1) | ||
241 | |||
242 | static ssize_t mmio16read__read_file(struct b43_wldev *dev, | ||
243 | char *buf, size_t bufsize) | ||
244 | { | ||
245 | ssize_t count = 0; | ||
246 | unsigned int addr; | ||
247 | u16 val; | ||
248 | |||
249 | addr = dev->dfsentry->mmio16read_next; | ||
250 | if (addr > B43_MAX_MMIO_ACCESS) | ||
251 | return -EDESTADDRREQ; | ||
252 | |||
253 | val = b43_read16(dev, addr); | ||
254 | fappend("0x%04X\n", val); | ||
255 | |||
256 | return count; | ||
257 | } | ||
258 | |||
259 | static int mmio16read__write_file(struct b43_wldev *dev, | ||
260 | const char *buf, size_t count) | ||
261 | { | ||
262 | unsigned int addr; | ||
263 | int res; | ||
264 | |||
265 | res = sscanf(buf, "0x%X", &addr); | ||
266 | if (res != 1) | ||
267 | return -EINVAL; | ||
268 | if (addr > B43_MAX_MMIO_ACCESS) | ||
269 | return -EADDRNOTAVAIL; | ||
270 | if ((addr % 2) != 0) | ||
271 | return -EINVAL; | ||
272 | |||
273 | dev->dfsentry->mmio16read_next = addr; | ||
274 | |||
275 | return 0; | ||
276 | } | ||
277 | |||
278 | static int mmio16write__write_file(struct b43_wldev *dev, | ||
279 | const char *buf, size_t count) | ||
280 | { | ||
281 | unsigned int addr, mask, set; | ||
282 | int res; | ||
283 | u16 val; | ||
284 | |||
285 | res = sscanf(buf, "0x%X 0x%X 0x%X", &addr, &mask, &set); | ||
286 | if (res != 3) | ||
287 | return -EINVAL; | ||
288 | if (addr > B43_MAX_MMIO_ACCESS) | ||
289 | return -EADDRNOTAVAIL; | ||
290 | if ((mask > 0xFFFF) || (set > 0xFFFF)) | ||
291 | return -E2BIG; | ||
292 | if ((addr % 2) != 0) | ||
293 | return -EINVAL; | ||
294 | |||
295 | if (mask == 0) | ||
296 | val = 0; | ||
297 | else | ||
298 | val = b43_read16(dev, addr); | ||
299 | val &= mask; | ||
300 | val |= set; | ||
301 | b43_write16(dev, addr, val); | ||
302 | |||
303 | return 0; | ||
304 | } | ||
305 | |||
306 | static ssize_t mmio32read__read_file(struct b43_wldev *dev, | ||
307 | char *buf, size_t bufsize) | ||
308 | { | ||
309 | ssize_t count = 0; | ||
310 | unsigned int addr; | ||
311 | u32 val; | ||
312 | |||
313 | addr = dev->dfsentry->mmio32read_next; | ||
314 | if (addr > B43_MAX_MMIO_ACCESS) | ||
315 | return -EDESTADDRREQ; | ||
316 | |||
317 | val = b43_read32(dev, addr); | ||
318 | fappend("0x%08X\n", val); | ||
116 | 319 | ||
117 | return count; | 320 | return count; |
118 | } | 321 | } |
119 | 322 | ||
323 | static int mmio32read__write_file(struct b43_wldev *dev, | ||
324 | const char *buf, size_t count) | ||
325 | { | ||
326 | unsigned int addr; | ||
327 | int res; | ||
328 | |||
329 | res = sscanf(buf, "0x%X", &addr); | ||
330 | if (res != 1) | ||
331 | return -EINVAL; | ||
332 | if (addr > B43_MAX_MMIO_ACCESS) | ||
333 | return -EADDRNOTAVAIL; | ||
334 | if ((addr % 4) != 0) | ||
335 | return -EINVAL; | ||
336 | |||
337 | dev->dfsentry->mmio32read_next = addr; | ||
338 | |||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | static int mmio32write__write_file(struct b43_wldev *dev, | ||
343 | const char *buf, size_t count) | ||
344 | { | ||
345 | unsigned int addr, mask, set; | ||
346 | int res; | ||
347 | u32 val; | ||
348 | |||
349 | res = sscanf(buf, "0x%X 0x%X 0x%X", &addr, &mask, &set); | ||
350 | if (res != 3) | ||
351 | return -EINVAL; | ||
352 | if (addr > B43_MAX_MMIO_ACCESS) | ||
353 | return -EADDRNOTAVAIL; | ||
354 | if ((mask > 0xFFFFFFFF) || (set > 0xFFFFFFFF)) | ||
355 | return -E2BIG; | ||
356 | if ((addr % 4) != 0) | ||
357 | return -EINVAL; | ||
358 | |||
359 | if (mask == 0) | ||
360 | val = 0; | ||
361 | else | ||
362 | val = b43_read32(dev, addr); | ||
363 | val &= mask; | ||
364 | val |= set; | ||
365 | b43_write32(dev, addr, val); | ||
366 | |||
367 | return 0; | ||
368 | } | ||
369 | |||
120 | /* wl->irq_lock is locked */ | 370 | /* wl->irq_lock is locked */ |
121 | static ssize_t shm_read_file(struct b43_wldev *dev, | 371 | static ssize_t tsf_read_file(struct b43_wldev *dev, |
122 | char *buf, size_t bufsize) | 372 | char *buf, size_t bufsize) |
123 | { | 373 | { |
124 | ssize_t count = 0; | 374 | ssize_t count = 0; |
125 | int i; | 375 | u64 tsf; |
126 | u16 tmp; | ||
127 | __le16 *le16buf = (__le16 *)buf; | ||
128 | 376 | ||
129 | for (i = 0; i < 0x1000; i++) { | 377 | b43_tsf_read(dev, &tsf); |
130 | if (bufsize < sizeof(tmp)) | 378 | fappend("0x%08x%08x\n", |
131 | break; | 379 | (unsigned int)((tsf & 0xFFFFFFFF00000000ULL) >> 32), |
132 | tmp = b43_shm_read16(dev, B43_SHM_SHARED, 2 * i); | 380 | (unsigned int)(tsf & 0xFFFFFFFFULL)); |
133 | le16buf[i] = cpu_to_le16(tmp); | ||
134 | count += sizeof(tmp); | ||
135 | bufsize -= sizeof(tmp); | ||
136 | } | ||
137 | 381 | ||
138 | return count; | 382 | return count; |
139 | } | 383 | } |
140 | 384 | ||
385 | /* wl->irq_lock is locked */ | ||
386 | static int tsf_write_file(struct b43_wldev *dev, | ||
387 | const char *buf, size_t count) | ||
388 | { | ||
389 | u64 tsf; | ||
390 | |||
391 | if (sscanf(buf, "%llu", (unsigned long long *)(&tsf)) != 1) | ||
392 | return -EINVAL; | ||
393 | b43_tsf_write(dev, tsf); | ||
394 | |||
395 | return 0; | ||
396 | } | ||
397 | |||
141 | static ssize_t txstat_read_file(struct b43_wldev *dev, | 398 | static ssize_t txstat_read_file(struct b43_wldev *dev, |
142 | char *buf, size_t bufsize) | 399 | char *buf, size_t bufsize) |
143 | { | 400 | { |
@@ -496,9 +753,15 @@ out_unlock: | |||
496 | .take_irqlock = _take_irqlock, \ | 753 | .take_irqlock = _take_irqlock, \ |
497 | } | 754 | } |
498 | 755 | ||
756 | B43_DEBUGFS_FOPS(shm16read, shm16read__read_file, shm16read__write_file, 1); | ||
757 | B43_DEBUGFS_FOPS(shm16write, NULL, shm16write__write_file, 1); | ||
758 | B43_DEBUGFS_FOPS(shm32read, shm32read__read_file, shm32read__write_file, 1); | ||
759 | B43_DEBUGFS_FOPS(shm32write, NULL, shm32write__write_file, 1); | ||
760 | B43_DEBUGFS_FOPS(mmio16read, mmio16read__read_file, mmio16read__write_file, 1); | ||
761 | B43_DEBUGFS_FOPS(mmio16write, NULL, mmio16write__write_file, 1); | ||
762 | B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file, 1); | ||
763 | B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file, 1); | ||
499 | B43_DEBUGFS_FOPS(tsf, tsf_read_file, tsf_write_file, 1); | 764 | B43_DEBUGFS_FOPS(tsf, tsf_read_file, tsf_write_file, 1); |
500 | B43_DEBUGFS_FOPS(ucode_regs, ucode_regs_read_file, NULL, 1); | ||
501 | B43_DEBUGFS_FOPS(shm, shm_read_file, NULL, 1); | ||
502 | B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0); | 765 | B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0); |
503 | B43_DEBUGFS_FOPS(txpower_g, txpower_g_read_file, txpower_g_write_file, 0); | 766 | B43_DEBUGFS_FOPS(txpower_g, txpower_g_read_file, txpower_g_write_file, 0); |
504 | B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1); | 767 | B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1); |
@@ -538,6 +801,7 @@ static void b43_add_dynamic_debug(struct b43_wldev *dev) | |||
538 | add_dyn_dbg("debug_pwork_fast", B43_DBG_PWORK_FAST, 0); | 801 | add_dyn_dbg("debug_pwork_fast", B43_DBG_PWORK_FAST, 0); |
539 | add_dyn_dbg("debug_pwork_stop", B43_DBG_PWORK_STOP, 0); | 802 | add_dyn_dbg("debug_pwork_stop", B43_DBG_PWORK_STOP, 0); |
540 | add_dyn_dbg("debug_lo", B43_DBG_LO, 0); | 803 | add_dyn_dbg("debug_lo", B43_DBG_LO, 0); |
804 | add_dyn_dbg("debug_firmware", B43_DBG_FIRMWARE, 0); | ||
541 | 805 | ||
542 | #undef add_dyn_dbg | 806 | #undef add_dyn_dbg |
543 | } | 807 | } |
@@ -584,6 +848,13 @@ void b43_debugfs_add_device(struct b43_wldev *dev) | |||
584 | return; | 848 | return; |
585 | } | 849 | } |
586 | 850 | ||
851 | e->mmio16read_next = 0xFFFF; /* invalid address */ | ||
852 | e->mmio32read_next = 0xFFFF; /* invalid address */ | ||
853 | e->shm16read_routing_next = 0xFFFFFFFF; /* invalid routing */ | ||
854 | e->shm16read_addr_next = 0xFFFFFFFF; /* invalid address */ | ||
855 | e->shm32read_routing_next = 0xFFFFFFFF; /* invalid routing */ | ||
856 | e->shm32read_addr_next = 0xFFFFFFFF; /* invalid address */ | ||
857 | |||
587 | #define ADD_FILE(name, mode) \ | 858 | #define ADD_FILE(name, mode) \ |
588 | do { \ | 859 | do { \ |
589 | struct dentry *d; \ | 860 | struct dentry *d; \ |
@@ -596,9 +867,15 @@ void b43_debugfs_add_device(struct b43_wldev *dev) | |||
596 | } while (0) | 867 | } while (0) |
597 | 868 | ||
598 | 869 | ||
870 | ADD_FILE(shm16read, 0600); | ||
871 | ADD_FILE(shm16write, 0200); | ||
872 | ADD_FILE(shm32read, 0600); | ||
873 | ADD_FILE(shm32write, 0200); | ||
874 | ADD_FILE(mmio16read, 0600); | ||
875 | ADD_FILE(mmio16write, 0200); | ||
876 | ADD_FILE(mmio32read, 0600); | ||
877 | ADD_FILE(mmio32write, 0200); | ||
599 | ADD_FILE(tsf, 0600); | 878 | ADD_FILE(tsf, 0600); |
600 | ADD_FILE(ucode_regs, 0400); | ||
601 | ADD_FILE(shm, 0400); | ||
602 | ADD_FILE(txstat, 0400); | 879 | ADD_FILE(txstat, 0400); |
603 | ADD_FILE(txpower_g, 0600); | 880 | ADD_FILE(txpower_g, 0600); |
604 | ADD_FILE(restart, 0200); | 881 | ADD_FILE(restart, 0200); |
@@ -620,9 +897,15 @@ void b43_debugfs_remove_device(struct b43_wldev *dev) | |||
620 | return; | 897 | return; |
621 | b43_remove_dynamic_debug(dev); | 898 | b43_remove_dynamic_debug(dev); |
622 | 899 | ||
900 | debugfs_remove(e->file_shm16read.dentry); | ||
901 | debugfs_remove(e->file_shm16write.dentry); | ||
902 | debugfs_remove(e->file_shm32read.dentry); | ||
903 | debugfs_remove(e->file_shm32write.dentry); | ||
904 | debugfs_remove(e->file_mmio16read.dentry); | ||
905 | debugfs_remove(e->file_mmio16write.dentry); | ||
906 | debugfs_remove(e->file_mmio32read.dentry); | ||
907 | debugfs_remove(e->file_mmio32write.dentry); | ||
623 | debugfs_remove(e->file_tsf.dentry); | 908 | debugfs_remove(e->file_tsf.dentry); |
624 | debugfs_remove(e->file_ucode_regs.dentry); | ||
625 | debugfs_remove(e->file_shm.dentry); | ||
626 | debugfs_remove(e->file_txstat.dentry); | 909 | debugfs_remove(e->file_txstat.dentry); |
627 | debugfs_remove(e->file_txpower_g.dentry); | 910 | debugfs_remove(e->file_txpower_g.dentry); |
628 | debugfs_remove(e->file_restart.dentry); | 911 | debugfs_remove(e->file_restart.dentry); |
diff --git a/drivers/net/wireless/b43/debugfs.h b/drivers/net/wireless/b43/debugfs.h index c75cff4151d9..22ffd02ba554 100644 --- a/drivers/net/wireless/b43/debugfs.h +++ b/drivers/net/wireless/b43/debugfs.h | |||
@@ -11,6 +11,7 @@ enum b43_dyndbg { /* Dynamic debugging features */ | |||
11 | B43_DBG_PWORK_FAST, | 11 | B43_DBG_PWORK_FAST, |
12 | B43_DBG_PWORK_STOP, | 12 | B43_DBG_PWORK_STOP, |
13 | B43_DBG_LO, | 13 | B43_DBG_LO, |
14 | B43_DBG_FIRMWARE, | ||
14 | __B43_NR_DYNDBG, | 15 | __B43_NR_DYNDBG, |
15 | }; | 16 | }; |
16 | 17 | ||
@@ -36,9 +37,15 @@ struct b43_dfsentry { | |||
36 | struct b43_wldev *dev; | 37 | struct b43_wldev *dev; |
37 | struct dentry *subdir; | 38 | struct dentry *subdir; |
38 | 39 | ||
40 | struct b43_dfs_file file_shm16read; | ||
41 | struct b43_dfs_file file_shm16write; | ||
42 | struct b43_dfs_file file_shm32read; | ||
43 | struct b43_dfs_file file_shm32write; | ||
44 | struct b43_dfs_file file_mmio16read; | ||
45 | struct b43_dfs_file file_mmio16write; | ||
46 | struct b43_dfs_file file_mmio32read; | ||
47 | struct b43_dfs_file file_mmio32write; | ||
39 | struct b43_dfs_file file_tsf; | 48 | struct b43_dfs_file file_tsf; |
40 | struct b43_dfs_file file_ucode_regs; | ||
41 | struct b43_dfs_file file_shm; | ||
42 | struct b43_dfs_file file_txstat; | 49 | struct b43_dfs_file file_txstat; |
43 | struct b43_dfs_file file_txpower_g; | 50 | struct b43_dfs_file file_txpower_g; |
44 | struct b43_dfs_file file_restart; | 51 | struct b43_dfs_file file_restart; |
@@ -46,6 +53,18 @@ struct b43_dfsentry { | |||
46 | 53 | ||
47 | struct b43_txstatus_log txstatlog; | 54 | struct b43_txstatus_log txstatlog; |
48 | 55 | ||
56 | /* The cached address for the next mmio16read file read */ | ||
57 | u16 mmio16read_next; | ||
58 | /* The cached address for the next mmio32read file read */ | ||
59 | u16 mmio32read_next; | ||
60 | |||
61 | /* The cached address for the next shm16read file read */ | ||
62 | u32 shm16read_routing_next; | ||
63 | u32 shm16read_addr_next; | ||
64 | /* The cached address for the next shm32read file read */ | ||
65 | u32 shm32read_routing_next; | ||
66 | u32 shm32read_addr_next; | ||
67 | |||
49 | /* Enabled/Disabled list for the dynamic debugging features. */ | 68 | /* Enabled/Disabled list for the dynamic debugging features. */ |
50 | u32 dyn_debug[__B43_NR_DYNDBG]; | 69 | u32 dyn_debug[__B43_NR_DYNDBG]; |
51 | /* Dentries for the dynamic debugging entries. */ | 70 | /* Dentries for the dynamic debugging entries. */ |
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c index 8a09a1db08db..098f886976f6 100644 --- a/drivers/net/wireless/b43/dma.c +++ b/drivers/net/wireless/b43/dma.c | |||
@@ -328,11 +328,11 @@ static inline | |||
328 | dma_addr_t dmaaddr; | 328 | dma_addr_t dmaaddr; |
329 | 329 | ||
330 | if (tx) { | 330 | if (tx) { |
331 | dmaaddr = dma_map_single(ring->dev->dev->dma_dev, | 331 | dmaaddr = ssb_dma_map_single(ring->dev->dev, |
332 | buf, len, DMA_TO_DEVICE); | 332 | buf, len, DMA_TO_DEVICE); |
333 | } else { | 333 | } else { |
334 | dmaaddr = dma_map_single(ring->dev->dev->dma_dev, | 334 | dmaaddr = ssb_dma_map_single(ring->dev->dev, |
335 | buf, len, DMA_FROM_DEVICE); | 335 | buf, len, DMA_FROM_DEVICE); |
336 | } | 336 | } |
337 | 337 | ||
338 | return dmaaddr; | 338 | return dmaaddr; |
@@ -343,11 +343,11 @@ static inline | |||
343 | dma_addr_t addr, size_t len, int tx) | 343 | dma_addr_t addr, size_t len, int tx) |
344 | { | 344 | { |
345 | if (tx) { | 345 | if (tx) { |
346 | dma_unmap_single(ring->dev->dev->dma_dev, | 346 | ssb_dma_unmap_single(ring->dev->dev, |
347 | addr, len, DMA_TO_DEVICE); | 347 | addr, len, DMA_TO_DEVICE); |
348 | } else { | 348 | } else { |
349 | dma_unmap_single(ring->dev->dev->dma_dev, | 349 | ssb_dma_unmap_single(ring->dev->dev, |
350 | addr, len, DMA_FROM_DEVICE); | 350 | addr, len, DMA_FROM_DEVICE); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||
@@ -356,8 +356,8 @@ static inline | |||
356 | dma_addr_t addr, size_t len) | 356 | dma_addr_t addr, size_t len) |
357 | { | 357 | { |
358 | B43_WARN_ON(ring->tx); | 358 | B43_WARN_ON(ring->tx); |
359 | dma_sync_single_for_cpu(ring->dev->dev->dma_dev, | 359 | ssb_dma_sync_single_for_cpu(ring->dev->dev, |
360 | addr, len, DMA_FROM_DEVICE); | 360 | addr, len, DMA_FROM_DEVICE); |
361 | } | 361 | } |
362 | 362 | ||
363 | static inline | 363 | static inline |
@@ -365,8 +365,8 @@ static inline | |||
365 | dma_addr_t addr, size_t len) | 365 | dma_addr_t addr, size_t len) |
366 | { | 366 | { |
367 | B43_WARN_ON(ring->tx); | 367 | B43_WARN_ON(ring->tx); |
368 | dma_sync_single_for_device(ring->dev->dev->dma_dev, | 368 | ssb_dma_sync_single_for_device(ring->dev->dev, |
369 | addr, len, DMA_FROM_DEVICE); | 369 | addr, len, DMA_FROM_DEVICE); |
370 | } | 370 | } |
371 | 371 | ||
372 | static inline | 372 | static inline |
@@ -381,7 +381,6 @@ static inline | |||
381 | 381 | ||
382 | static int alloc_ringmemory(struct b43_dmaring *ring) | 382 | static int alloc_ringmemory(struct b43_dmaring *ring) |
383 | { | 383 | { |
384 | struct device *dma_dev = ring->dev->dev->dma_dev; | ||
385 | gfp_t flags = GFP_KERNEL; | 384 | gfp_t flags = GFP_KERNEL; |
386 | 385 | ||
387 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K | 386 | /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K |
@@ -392,11 +391,14 @@ static int alloc_ringmemory(struct b43_dmaring *ring) | |||
392 | * For unknown reasons - possibly a hardware error - the BCM4311 rev | 391 | * For unknown reasons - possibly a hardware error - the BCM4311 rev |
393 | * 02, which uses 64-bit DMA, needs the ring buffer in very low memory, | 392 | * 02, which uses 64-bit DMA, needs the ring buffer in very low memory, |
394 | * which accounts for the GFP_DMA flag below. | 393 | * which accounts for the GFP_DMA flag below. |
394 | * | ||
395 | * The flags here must match the flags in free_ringmemory below! | ||
395 | */ | 396 | */ |
396 | if (ring->type == B43_DMA_64BIT) | 397 | if (ring->type == B43_DMA_64BIT) |
397 | flags |= GFP_DMA; | 398 | flags |= GFP_DMA; |
398 | ring->descbase = dma_alloc_coherent(dma_dev, B43_DMA_RINGMEMSIZE, | 399 | ring->descbase = ssb_dma_alloc_consistent(ring->dev->dev, |
399 | &(ring->dmabase), flags); | 400 | B43_DMA_RINGMEMSIZE, |
401 | &(ring->dmabase), flags); | ||
400 | if (!ring->descbase) { | 402 | if (!ring->descbase) { |
401 | b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); | 403 | b43err(ring->dev->wl, "DMA ringmemory allocation failed\n"); |
402 | return -ENOMEM; | 404 | return -ENOMEM; |
@@ -408,10 +410,13 @@ static int alloc_ringmemory(struct b43_dmaring *ring) | |||
408 | 410 | ||
409 | static void free_ringmemory(struct b43_dmaring *ring) | 411 | static void free_ringmemory(struct b43_dmaring *ring) |
410 | { | 412 | { |
411 | struct device *dma_dev = ring->dev->dev->dma_dev; | 413 | gfp_t flags = GFP_KERNEL; |
414 | |||
415 | if (ring->type == B43_DMA_64BIT) | ||
416 | flags |= GFP_DMA; | ||
412 | 417 | ||
413 | dma_free_coherent(dma_dev, B43_DMA_RINGMEMSIZE, | 418 | ssb_dma_free_consistent(ring->dev->dev, B43_DMA_RINGMEMSIZE, |
414 | ring->descbase, ring->dmabase); | 419 | ring->descbase, ring->dmabase, flags); |
415 | } | 420 | } |
416 | 421 | ||
417 | /* Reset the RX DMA channel */ | 422 | /* Reset the RX DMA channel */ |
@@ -518,7 +523,7 @@ static bool b43_dma_mapping_error(struct b43_dmaring *ring, | |||
518 | dma_addr_t addr, | 523 | dma_addr_t addr, |
519 | size_t buffersize, bool dma_to_device) | 524 | size_t buffersize, bool dma_to_device) |
520 | { | 525 | { |
521 | if (unlikely(dma_mapping_error(addr))) | 526 | if (unlikely(ssb_dma_mapping_error(ring->dev->dev, addr))) |
522 | return 1; | 527 | return 1; |
523 | 528 | ||
524 | switch (ring->type) { | 529 | switch (ring->type) { |
@@ -844,10 +849,10 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, | |||
844 | goto err_kfree_meta; | 849 | goto err_kfree_meta; |
845 | 850 | ||
846 | /* test for ability to dma to txhdr_cache */ | 851 | /* test for ability to dma to txhdr_cache */ |
847 | dma_test = dma_map_single(dev->dev->dma_dev, | 852 | dma_test = ssb_dma_map_single(dev->dev, |
848 | ring->txhdr_cache, | 853 | ring->txhdr_cache, |
849 | b43_txhdr_size(dev), | 854 | b43_txhdr_size(dev), |
850 | DMA_TO_DEVICE); | 855 | DMA_TO_DEVICE); |
851 | 856 | ||
852 | if (b43_dma_mapping_error(ring, dma_test, | 857 | if (b43_dma_mapping_error(ring, dma_test, |
853 | b43_txhdr_size(dev), 1)) { | 858 | b43_txhdr_size(dev), 1)) { |
@@ -859,10 +864,10 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, | |||
859 | if (!ring->txhdr_cache) | 864 | if (!ring->txhdr_cache) |
860 | goto err_kfree_meta; | 865 | goto err_kfree_meta; |
861 | 866 | ||
862 | dma_test = dma_map_single(dev->dev->dma_dev, | 867 | dma_test = ssb_dma_map_single(dev->dev, |
863 | ring->txhdr_cache, | 868 | ring->txhdr_cache, |
864 | b43_txhdr_size(dev), | 869 | b43_txhdr_size(dev), |
865 | DMA_TO_DEVICE); | 870 | DMA_TO_DEVICE); |
866 | 871 | ||
867 | if (b43_dma_mapping_error(ring, dma_test, | 872 | if (b43_dma_mapping_error(ring, dma_test, |
868 | b43_txhdr_size(dev), 1)) { | 873 | b43_txhdr_size(dev), 1)) { |
@@ -873,9 +878,9 @@ struct b43_dmaring *b43_setup_dmaring(struct b43_wldev *dev, | |||
873 | } | 878 | } |
874 | } | 879 | } |
875 | 880 | ||
876 | dma_unmap_single(dev->dev->dma_dev, | 881 | ssb_dma_unmap_single(dev->dev, |
877 | dma_test, b43_txhdr_size(dev), | 882 | dma_test, b43_txhdr_size(dev), |
878 | DMA_TO_DEVICE); | 883 | DMA_TO_DEVICE); |
879 | } | 884 | } |
880 | 885 | ||
881 | err = alloc_ringmemory(ring); | 886 | err = alloc_ringmemory(ring); |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 704dd3551fff..9d2eb273b726 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -373,13 +373,10 @@ static inline void b43_shm_control_word(struct b43_wldev *dev, | |||
373 | b43_write32(dev, B43_MMIO_SHM_CONTROL, control); | 373 | b43_write32(dev, B43_MMIO_SHM_CONTROL, control); |
374 | } | 374 | } |
375 | 375 | ||
376 | u32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset) | 376 | u32 __b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset) |
377 | { | 377 | { |
378 | struct b43_wl *wl = dev->wl; | ||
379 | unsigned long flags; | ||
380 | u32 ret; | 378 | u32 ret; |
381 | 379 | ||
382 | spin_lock_irqsave(&wl->shm_lock, flags); | ||
383 | if (routing == B43_SHM_SHARED) { | 380 | if (routing == B43_SHM_SHARED) { |
384 | B43_WARN_ON(offset & 0x0001); | 381 | B43_WARN_ON(offset & 0x0001); |
385 | if (offset & 0x0003) { | 382 | if (offset & 0x0003) { |
@@ -397,18 +394,26 @@ u32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset) | |||
397 | b43_shm_control_word(dev, routing, offset); | 394 | b43_shm_control_word(dev, routing, offset); |
398 | ret = b43_read32(dev, B43_MMIO_SHM_DATA); | 395 | ret = b43_read32(dev, B43_MMIO_SHM_DATA); |
399 | out: | 396 | out: |
400 | spin_unlock_irqrestore(&wl->shm_lock, flags); | ||
401 | |||
402 | return ret; | 397 | return ret; |
403 | } | 398 | } |
404 | 399 | ||
405 | u16 b43_shm_read16(struct b43_wldev * dev, u16 routing, u16 offset) | 400 | u32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset) |
406 | { | 401 | { |
407 | struct b43_wl *wl = dev->wl; | 402 | struct b43_wl *wl = dev->wl; |
408 | unsigned long flags; | 403 | unsigned long flags; |
409 | u16 ret; | 404 | u32 ret; |
410 | 405 | ||
411 | spin_lock_irqsave(&wl->shm_lock, flags); | 406 | spin_lock_irqsave(&wl->shm_lock, flags); |
407 | ret = __b43_shm_read32(dev, routing, offset); | ||
408 | spin_unlock_irqrestore(&wl->shm_lock, flags); | ||
409 | |||
410 | return ret; | ||
411 | } | ||
412 | |||
413 | u16 __b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset) | ||
414 | { | ||
415 | u16 ret; | ||
416 | |||
412 | if (routing == B43_SHM_SHARED) { | 417 | if (routing == B43_SHM_SHARED) { |
413 | B43_WARN_ON(offset & 0x0001); | 418 | B43_WARN_ON(offset & 0x0001); |
414 | if (offset & 0x0003) { | 419 | if (offset & 0x0003) { |
@@ -423,17 +428,24 @@ u16 b43_shm_read16(struct b43_wldev * dev, u16 routing, u16 offset) | |||
423 | b43_shm_control_word(dev, routing, offset); | 428 | b43_shm_control_word(dev, routing, offset); |
424 | ret = b43_read16(dev, B43_MMIO_SHM_DATA); | 429 | ret = b43_read16(dev, B43_MMIO_SHM_DATA); |
425 | out: | 430 | out: |
426 | spin_unlock_irqrestore(&wl->shm_lock, flags); | ||
427 | |||
428 | return ret; | 431 | return ret; |
429 | } | 432 | } |
430 | 433 | ||
431 | void b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value) | 434 | u16 b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset) |
432 | { | 435 | { |
433 | struct b43_wl *wl = dev->wl; | 436 | struct b43_wl *wl = dev->wl; |
434 | unsigned long flags; | 437 | unsigned long flags; |
438 | u16 ret; | ||
435 | 439 | ||
436 | spin_lock_irqsave(&wl->shm_lock, flags); | 440 | spin_lock_irqsave(&wl->shm_lock, flags); |
441 | ret = __b43_shm_read16(dev, routing, offset); | ||
442 | spin_unlock_irqrestore(&wl->shm_lock, flags); | ||
443 | |||
444 | return ret; | ||
445 | } | ||
446 | |||
447 | void __b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value) | ||
448 | { | ||
437 | if (routing == B43_SHM_SHARED) { | 449 | if (routing == B43_SHM_SHARED) { |
438 | B43_WARN_ON(offset & 0x0001); | 450 | B43_WARN_ON(offset & 0x0001); |
439 | if (offset & 0x0003) { | 451 | if (offset & 0x0003) { |
@@ -443,35 +455,47 @@ void b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value) | |||
443 | (value >> 16) & 0xffff); | 455 | (value >> 16) & 0xffff); |
444 | b43_shm_control_word(dev, routing, (offset >> 2) + 1); | 456 | b43_shm_control_word(dev, routing, (offset >> 2) + 1); |
445 | b43_write16(dev, B43_MMIO_SHM_DATA, value & 0xffff); | 457 | b43_write16(dev, B43_MMIO_SHM_DATA, value & 0xffff); |
446 | goto out; | 458 | return; |
447 | } | 459 | } |
448 | offset >>= 2; | 460 | offset >>= 2; |
449 | } | 461 | } |
450 | b43_shm_control_word(dev, routing, offset); | 462 | b43_shm_control_word(dev, routing, offset); |
451 | b43_write32(dev, B43_MMIO_SHM_DATA, value); | 463 | b43_write32(dev, B43_MMIO_SHM_DATA, value); |
452 | out: | ||
453 | spin_unlock_irqrestore(&wl->shm_lock, flags); | ||
454 | } | 464 | } |
455 | 465 | ||
456 | void b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value) | 466 | void b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value) |
457 | { | 467 | { |
458 | struct b43_wl *wl = dev->wl; | 468 | struct b43_wl *wl = dev->wl; |
459 | unsigned long flags; | 469 | unsigned long flags; |
460 | 470 | ||
461 | spin_lock_irqsave(&wl->shm_lock, flags); | 471 | spin_lock_irqsave(&wl->shm_lock, flags); |
472 | __b43_shm_write32(dev, routing, offset, value); | ||
473 | spin_unlock_irqrestore(&wl->shm_lock, flags); | ||
474 | } | ||
475 | |||
476 | void __b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value) | ||
477 | { | ||
462 | if (routing == B43_SHM_SHARED) { | 478 | if (routing == B43_SHM_SHARED) { |
463 | B43_WARN_ON(offset & 0x0001); | 479 | B43_WARN_ON(offset & 0x0001); |
464 | if (offset & 0x0003) { | 480 | if (offset & 0x0003) { |
465 | /* Unaligned access */ | 481 | /* Unaligned access */ |
466 | b43_shm_control_word(dev, routing, offset >> 2); | 482 | b43_shm_control_word(dev, routing, offset >> 2); |
467 | b43_write16(dev, B43_MMIO_SHM_DATA_UNALIGNED, value); | 483 | b43_write16(dev, B43_MMIO_SHM_DATA_UNALIGNED, value); |
468 | goto out; | 484 | return; |
469 | } | 485 | } |
470 | offset >>= 2; | 486 | offset >>= 2; |
471 | } | 487 | } |
472 | b43_shm_control_word(dev, routing, offset); | 488 | b43_shm_control_word(dev, routing, offset); |
473 | b43_write16(dev, B43_MMIO_SHM_DATA, value); | 489 | b43_write16(dev, B43_MMIO_SHM_DATA, value); |
474 | out: | 490 | } |
491 | |||
492 | void b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value) | ||
493 | { | ||
494 | struct b43_wl *wl = dev->wl; | ||
495 | unsigned long flags; | ||
496 | |||
497 | spin_lock_irqsave(&wl->shm_lock, flags); | ||
498 | __b43_shm_write16(dev, routing, offset, value); | ||
475 | spin_unlock_irqrestore(&wl->shm_lock, flags); | 499 | spin_unlock_irqrestore(&wl->shm_lock, flags); |
476 | } | 500 | } |
477 | 501 | ||
@@ -2463,6 +2487,19 @@ static void b43_gpio_cleanup(struct b43_wldev *dev) | |||
2463 | /* http://bcm-specs.sipsolutions.net/EnableMac */ | 2487 | /* http://bcm-specs.sipsolutions.net/EnableMac */ |
2464 | void b43_mac_enable(struct b43_wldev *dev) | 2488 | void b43_mac_enable(struct b43_wldev *dev) |
2465 | { | 2489 | { |
2490 | if (b43_debug(dev, B43_DBG_FIRMWARE)) { | ||
2491 | u16 fwstate; | ||
2492 | |||
2493 | fwstate = b43_shm_read16(dev, B43_SHM_SHARED, | ||
2494 | B43_SHM_SH_UCODESTAT); | ||
2495 | if ((fwstate != B43_SHM_SH_UCODESTAT_SUSP) && | ||
2496 | (fwstate != B43_SHM_SH_UCODESTAT_SLEEP)) { | ||
2497 | b43err(dev->wl, "b43_mac_enable(): The firmware " | ||
2498 | "should be suspended, but current state is %u\n", | ||
2499 | fwstate); | ||
2500 | } | ||
2501 | } | ||
2502 | |||
2466 | dev->mac_suspended--; | 2503 | dev->mac_suspended--; |
2467 | B43_WARN_ON(dev->mac_suspended < 0); | 2504 | B43_WARN_ON(dev->mac_suspended < 0); |
2468 | if (dev->mac_suspended == 0) { | 2505 | if (dev->mac_suspended == 0) { |
@@ -2783,6 +2820,21 @@ static void b43_periodic_every30sec(struct b43_wldev *dev) | |||
2783 | static void b43_periodic_every15sec(struct b43_wldev *dev) | 2820 | static void b43_periodic_every15sec(struct b43_wldev *dev) |
2784 | { | 2821 | { |
2785 | struct b43_phy *phy = &dev->phy; | 2822 | struct b43_phy *phy = &dev->phy; |
2823 | u16 wdr; | ||
2824 | |||
2825 | if (dev->fw.opensource) { | ||
2826 | /* Check if the firmware is still alive. | ||
2827 | * It will reset the watchdog counter to 0 in its idle loop. */ | ||
2828 | wdr = b43_shm_read16(dev, B43_SHM_SCRATCH, B43_WATCHDOG_REG); | ||
2829 | if (unlikely(wdr)) { | ||
2830 | b43err(dev->wl, "Firmware watchdog: The firmware died!\n"); | ||
2831 | b43_controller_restart(dev, "Firmware watchdog"); | ||
2832 | return; | ||
2833 | } else { | ||
2834 | b43_shm_write16(dev, B43_SHM_SCRATCH, | ||
2835 | B43_WATCHDOG_REG, 1); | ||
2836 | } | ||
2837 | } | ||
2786 | 2838 | ||
2787 | if (phy->type == B43_PHYTYPE_G) { | 2839 | if (phy->type == B43_PHYTYPE_G) { |
2788 | //TODO: update_aci_moving_average | 2840 | //TODO: update_aci_moving_average |
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h index dad23c42b422..f871a252cb55 100644 --- a/drivers/net/wireless/b43/main.h +++ b/drivers/net/wireless/b43/main.h | |||
@@ -95,9 +95,13 @@ void b43_tsf_read(struct b43_wldev *dev, u64 * tsf); | |||
95 | void b43_tsf_write(struct b43_wldev *dev, u64 tsf); | 95 | void b43_tsf_write(struct b43_wldev *dev, u64 tsf); |
96 | 96 | ||
97 | u32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset); | 97 | u32 b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset); |
98 | u32 __b43_shm_read32(struct b43_wldev *dev, u16 routing, u16 offset); | ||
98 | u16 b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset); | 99 | u16 b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset); |
100 | u16 __b43_shm_read16(struct b43_wldev *dev, u16 routing, u16 offset); | ||
99 | void b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value); | 101 | void b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value); |
102 | void __b43_shm_write32(struct b43_wldev *dev, u16 routing, u16 offset, u32 value); | ||
100 | void b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value); | 103 | void b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value); |
104 | void __b43_shm_write16(struct b43_wldev *dev, u16 routing, u16 offset, u16 value); | ||
101 | 105 | ||
102 | u64 b43_hf_read(struct b43_wldev *dev); | 106 | u64 b43_hf_read(struct b43_wldev *dev); |
103 | void b43_hf_write(struct b43_wldev *dev, u64 value); | 107 | void b43_hf_write(struct b43_wldev *dev, u64 value); |
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c index 8b1555d95f1c..401591267592 100644 --- a/drivers/net/wireless/b43/pio.c +++ b/drivers/net/wireless/b43/pio.c | |||
@@ -586,7 +586,7 @@ void b43_pio_handle_txstatus(struct b43_wldev *dev, | |||
586 | 586 | ||
587 | spin_lock(&q->lock); /* IRQs are already disabled. */ | 587 | spin_lock(&q->lock); /* IRQs are already disabled. */ |
588 | 588 | ||
589 | info = (void *)pack->skb; | 589 | info = IEEE80211_SKB_CB(pack->skb); |
590 | memset(&info->status, 0, sizeof(info->status)); | 590 | memset(&info->status, 0, sizeof(info->status)); |
591 | 591 | ||
592 | b43_fill_txstatus_report(info, status); | 592 | b43_fill_txstatus_report(info, status); |
diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c index 11f53cb1139e..4cca203992e8 100644 --- a/drivers/net/wireless/b43/rfkill.c +++ b/drivers/net/wireless/b43/rfkill.c | |||
@@ -88,7 +88,7 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) | |||
88 | goto out_unlock; | 88 | goto out_unlock; |
89 | err = 0; | 89 | err = 0; |
90 | switch (state) { | 90 | switch (state) { |
91 | case RFKILL_STATE_ON: | 91 | case RFKILL_STATE_UNBLOCKED: |
92 | if (!dev->radio_hw_enable) { | 92 | if (!dev->radio_hw_enable) { |
93 | /* No luck. We can't toggle the hardware RF-kill | 93 | /* No luck. We can't toggle the hardware RF-kill |
94 | * button from software. */ | 94 | * button from software. */ |
@@ -98,10 +98,13 @@ static int b43_rfkill_soft_toggle(void *data, enum rfkill_state state) | |||
98 | if (!dev->phy.radio_on) | 98 | if (!dev->phy.radio_on) |
99 | b43_radio_turn_on(dev); | 99 | b43_radio_turn_on(dev); |
100 | break; | 100 | break; |
101 | case RFKILL_STATE_OFF: | 101 | case RFKILL_STATE_SOFT_BLOCKED: |
102 | if (dev->phy.radio_on) | 102 | if (dev->phy.radio_on) |
103 | b43_radio_turn_off(dev, 0); | 103 | b43_radio_turn_off(dev, 0); |
104 | break; | 104 | break; |
105 | default: | ||
106 | b43warn(wl, "Received unexpected rfkill state %d.\n", state); | ||
107 | break; | ||
105 | } | 108 | } |
106 | out_unlock: | 109 | out_unlock: |
107 | mutex_unlock(&wl->mutex); | 110 | mutex_unlock(&wl->mutex); |
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index f9e1cff2aecb..bf6f6c1ed4cf 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c | |||
@@ -193,7 +193,7 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
193 | const struct ieee80211_hdr *wlhdr = | 193 | const struct ieee80211_hdr *wlhdr = |
194 | (const struct ieee80211_hdr *)fragment_data; | 194 | (const struct ieee80211_hdr *)fragment_data; |
195 | int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)); | 195 | int use_encryption = (!(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)); |
196 | u16 fctl = le16_to_cpu(wlhdr->frame_control); | 196 | __le16 fctl = wlhdr->frame_control; |
197 | struct ieee80211_rate *fbrate; | 197 | struct ieee80211_rate *fbrate; |
198 | u8 rate, rate_fb; | 198 | u8 rate, rate_fb; |
199 | int rate_ofdm, rate_fb_ofdm; | 199 | int rate_ofdm, rate_fb_ofdm; |
@@ -259,7 +259,7 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
259 | B43_TXH_MAC_KEYIDX; | 259 | B43_TXH_MAC_KEYIDX; |
260 | mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) & | 260 | mac_ctl |= (key->algorithm << B43_TXH_MAC_KEYALG_SHIFT) & |
261 | B43_TXH_MAC_KEYALG; | 261 | B43_TXH_MAC_KEYALG; |
262 | wlhdr_len = ieee80211_get_hdrlen(fctl); | 262 | wlhdr_len = ieee80211_hdrlen(fctl); |
263 | iv_len = min((size_t) info->control.iv_len, | 263 | iv_len = min((size_t) info->control.iv_len, |
264 | ARRAY_SIZE(txhdr->iv)); | 264 | ARRAY_SIZE(txhdr->iv)); |
265 | memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len); | 265 | memcpy(txhdr->iv, ((u8 *) wlhdr) + wlhdr_len, iv_len); |
@@ -317,8 +317,7 @@ int b43_generate_txhdr(struct b43_wldev *dev, | |||
317 | /* MAC control */ | 317 | /* MAC control */ |
318 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) | 318 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) |
319 | mac_ctl |= B43_TXH_MAC_ACK; | 319 | mac_ctl |= B43_TXH_MAC_ACK; |
320 | if (!(((fctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_CTL) && | 320 | if (!ieee80211_is_pspoll(fctl)) |
321 | ((fctl & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL))) | ||
322 | mac_ctl |= B43_TXH_MAC_HWSEQ; | 321 | mac_ctl |= B43_TXH_MAC_HWSEQ; |
323 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) | 322 | if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) |
324 | mac_ctl |= B43_TXH_MAC_STMSDU; | 323 | mac_ctl |= B43_TXH_MAC_STMSDU; |
@@ -509,7 +508,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
509 | struct b43_plcp_hdr6 *plcp; | 508 | struct b43_plcp_hdr6 *plcp; |
510 | struct ieee80211_hdr *wlhdr; | 509 | struct ieee80211_hdr *wlhdr; |
511 | const struct b43_rxhdr_fw4 *rxhdr = _rxhdr; | 510 | const struct b43_rxhdr_fw4 *rxhdr = _rxhdr; |
512 | u16 fctl; | 511 | __le16 fctl; |
513 | u16 phystat0, phystat3, chanstat, mactime; | 512 | u16 phystat0, phystat3, chanstat, mactime; |
514 | u32 macstat; | 513 | u32 macstat; |
515 | u16 chanid; | 514 | u16 chanid; |
@@ -549,7 +548,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
549 | goto drop; | 548 | goto drop; |
550 | } | 549 | } |
551 | wlhdr = (struct ieee80211_hdr *)(skb->data); | 550 | wlhdr = (struct ieee80211_hdr *)(skb->data); |
552 | fctl = le16_to_cpu(wlhdr->frame_control); | 551 | fctl = wlhdr->frame_control; |
553 | 552 | ||
554 | if (macstat & B43_RX_MAC_DEC) { | 553 | if (macstat & B43_RX_MAC_DEC) { |
555 | unsigned int keyidx; | 554 | unsigned int keyidx; |
@@ -564,7 +563,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
564 | B43_WARN_ON(keyidx >= dev->max_nr_keys); | 563 | B43_WARN_ON(keyidx >= dev->max_nr_keys); |
565 | 564 | ||
566 | if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) { | 565 | if (dev->key[keyidx].algorithm != B43_SEC_ALGO_NONE) { |
567 | wlhdr_len = ieee80211_get_hdrlen(fctl); | 566 | wlhdr_len = ieee80211_hdrlen(fctl); |
568 | if (unlikely(skb->len < (wlhdr_len + 3))) { | 567 | if (unlikely(skb->len < (wlhdr_len + 3))) { |
569 | b43dbg(dev->wl, | 568 | b43dbg(dev->wl, |
570 | "RX: Packet size underrun (3)\n"); | 569 | "RX: Packet size underrun (3)\n"); |
@@ -604,9 +603,7 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) | |||
604 | * of timestamp, i.e. about 65 milliseconds after the PHY received | 603 | * of timestamp, i.e. about 65 milliseconds after the PHY received |
605 | * the first symbol. | 604 | * the first symbol. |
606 | */ | 605 | */ |
607 | if (((fctl & (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) | 606 | if (ieee80211_is_beacon(fctl) || dev->wl->radiotap_enabled) { |
608 | == (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON)) || | ||
609 | dev->wl->radiotap_enabled) { | ||
610 | u16 low_mactime_now; | 607 | u16 low_mactime_now; |
611 | 608 | ||
612 | b43_tsf_read(dev, &status.mactime); | 609 | b43_tsf_read(dev, &status.mactime); |