diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 86 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2200.h | 13 |
2 files changed, 76 insertions, 23 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 2a834deb60e8..d7d24b6facfe 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -227,12 +227,15 @@ static int snprintk_buf(u8 * output, size_t size, const u8 * data, size_t len) | |||
227 | return total; | 227 | return total; |
228 | } | 228 | } |
229 | 229 | ||
230 | /* alias for 32-bit indirect read (for SRAM/reg above 4K), with debug wrapper */ | ||
230 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); | 231 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg); |
231 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) | 232 | #define ipw_read_reg32(a, b) _ipw_read_reg32(a, b) |
232 | 233 | ||
234 | /* alias for 8-bit indirect read (for SRAM/reg above 4K), with debug wrapper */ | ||
233 | static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); | 235 | static u8 _ipw_read_reg8(struct ipw_priv *ipw, u32 reg); |
234 | #define ipw_read_reg8(a, b) _ipw_read_reg8(a, b) | 236 | #define ipw_read_reg8(a, b) _ipw_read_reg8(a, b) |
235 | 237 | ||
238 | /* 8-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
236 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); | 239 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value); |
237 | static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) | 240 | static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) |
238 | { | 241 | { |
@@ -241,6 +244,7 @@ static inline void ipw_write_reg8(struct ipw_priv *a, u32 b, u8 c) | |||
241 | _ipw_write_reg8(a, b, c); | 244 | _ipw_write_reg8(a, b, c); |
242 | } | 245 | } |
243 | 246 | ||
247 | /* 16-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
244 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); | 248 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value); |
245 | static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) | 249 | static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) |
246 | { | 250 | { |
@@ -249,6 +253,7 @@ static inline void ipw_write_reg16(struct ipw_priv *a, u32 b, u16 c) | |||
249 | _ipw_write_reg16(a, b, c); | 253 | _ipw_write_reg16(a, b, c); |
250 | } | 254 | } |
251 | 255 | ||
256 | /* 32-bit indirect write (for SRAM/reg above 4K), with debug wrapper */ | ||
252 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); | 257 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value); |
253 | static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) | 258 | static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) |
254 | { | 259 | { |
@@ -257,48 +262,76 @@ static inline void ipw_write_reg32(struct ipw_priv *a, u32 b, u32 c) | |||
257 | _ipw_write_reg32(a, b, c); | 262 | _ipw_write_reg32(a, b, c); |
258 | } | 263 | } |
259 | 264 | ||
265 | /* 8-bit direct write (low 4K) */ | ||
260 | #define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs)) | 266 | #define _ipw_write8(ipw, ofs, val) writeb((val), (ipw)->hw_base + (ofs)) |
267 | |||
268 | /* 8-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
261 | #define ipw_write8(ipw, ofs, val) \ | 269 | #define ipw_write8(ipw, ofs, val) \ |
262 | IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ | 270 | IPW_DEBUG_IO("%s %d: write_direct8(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
263 | _ipw_write8(ipw, ofs, val) | 271 | _ipw_write8(ipw, ofs, val) |
264 | 272 | ||
273 | |||
274 | /* 16-bit direct write (low 4K) */ | ||
265 | #define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs)) | 275 | #define _ipw_write16(ipw, ofs, val) writew((val), (ipw)->hw_base + (ofs)) |
276 | |||
277 | /* 16-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
266 | #define ipw_write16(ipw, ofs, val) \ | 278 | #define ipw_write16(ipw, ofs, val) \ |
267 | IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ | 279 | IPW_DEBUG_IO("%s %d: write_direct16(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
268 | _ipw_write16(ipw, ofs, val) | 280 | _ipw_write16(ipw, ofs, val) |
269 | 281 | ||
282 | |||
283 | /* 32-bit direct write (low 4K) */ | ||
270 | #define _ipw_write32(ipw, ofs, val) writel((val), (ipw)->hw_base + (ofs)) | 284 | #define _ipw_write32(ipw, ofs, val) writel((val), (ipw)->hw_base + (ofs)) |
285 | |||
286 | /* 32-bit direct write (for low 4K of SRAM/regs), with debug wrapper */ | ||
271 | #define ipw_write32(ipw, ofs, val) \ | 287 | #define ipw_write32(ipw, ofs, val) \ |
272 | IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ | 288 | IPW_DEBUG_IO("%s %d: write_direct32(0x%08X, 0x%08X)\n", __FILE__, __LINE__, (u32)(ofs), (u32)(val)); \ |
273 | _ipw_write32(ipw, ofs, val) | 289 | _ipw_write32(ipw, ofs, val) |
274 | 290 | ||
291 | |||
292 | /* 8-bit direct read (low 4K) */ | ||
275 | #define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) | 293 | #define _ipw_read8(ipw, ofs) readb((ipw)->hw_base + (ofs)) |
294 | |||
295 | /* 8-bit direct read (low 4K), with debug wrapper */ | ||
276 | static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 296 | static inline u8 __ipw_read8(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
277 | { | 297 | { |
278 | IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs)); | 298 | IPW_DEBUG_IO("%s %d: read_direct8(0x%08X)\n", f, l, (u32) (ofs)); |
279 | return _ipw_read8(ipw, ofs); | 299 | return _ipw_read8(ipw, ofs); |
280 | } | 300 | } |
281 | 301 | ||
302 | /* alias to 8-bit direct read (low 4K of SRAM/regs), with debug wrapper */ | ||
282 | #define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs) | 303 | #define ipw_read8(ipw, ofs) __ipw_read8(__FILE__, __LINE__, ipw, ofs) |
283 | 304 | ||
305 | |||
306 | /* 16-bit direct read (low 4K) */ | ||
284 | #define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) | 307 | #define _ipw_read16(ipw, ofs) readw((ipw)->hw_base + (ofs)) |
308 | |||
309 | /* 16-bit direct read (low 4K), with debug wrapper */ | ||
285 | static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 310 | static inline u16 __ipw_read16(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
286 | { | 311 | { |
287 | IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs)); | 312 | IPW_DEBUG_IO("%s %d: read_direct16(0x%08X)\n", f, l, (u32) (ofs)); |
288 | return _ipw_read16(ipw, ofs); | 313 | return _ipw_read16(ipw, ofs); |
289 | } | 314 | } |
290 | 315 | ||
316 | /* alias to 16-bit direct read (low 4K of SRAM/regs), with debug wrapper */ | ||
291 | #define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs) | 317 | #define ipw_read16(ipw, ofs) __ipw_read16(__FILE__, __LINE__, ipw, ofs) |
292 | 318 | ||
319 | |||
320 | /* 32-bit direct read (low 4K) */ | ||
293 | #define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) | 321 | #define _ipw_read32(ipw, ofs) readl((ipw)->hw_base + (ofs)) |
322 | |||
323 | /* 32-bit direct read (low 4K), with debug wrapper */ | ||
294 | static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) | 324 | static inline u32 __ipw_read32(char *f, u32 l, struct ipw_priv *ipw, u32 ofs) |
295 | { | 325 | { |
296 | IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs)); | 326 | IPW_DEBUG_IO("%s %d: read_direct32(0x%08X)\n", f, l, (u32) (ofs)); |
297 | return _ipw_read32(ipw, ofs); | 327 | return _ipw_read32(ipw, ofs); |
298 | } | 328 | } |
299 | 329 | ||
330 | /* alias to 32-bit direct read (low 4K of SRAM/regs), with debug wrapper */ | ||
300 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) | 331 | #define ipw_read32(ipw, ofs) __ipw_read32(__FILE__, __LINE__, ipw, ofs) |
301 | 332 | ||
333 | |||
334 | /* multi-byte read (above 4K), with debug wrapper */ | ||
302 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); | 335 | static void _ipw_read_indirect(struct ipw_priv *, u32, u8 *, int); |
303 | static inline void __ipw_read_indirect(const char *f, int l, | 336 | static inline void __ipw_read_indirect(const char *f, int l, |
304 | struct ipw_priv *a, u32 b, u8 * c, int d) | 337 | struct ipw_priv *a, u32 b, u8 * c, int d) |
@@ -308,15 +341,17 @@ static inline void __ipw_read_indirect(const char *f, int l, | |||
308 | _ipw_read_indirect(a, b, c, d); | 341 | _ipw_read_indirect(a, b, c, d); |
309 | } | 342 | } |
310 | 343 | ||
344 | /* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */ | ||
311 | #define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) | 345 | #define ipw_read_indirect(a, b, c, d) __ipw_read_indirect(__FILE__, __LINE__, a, b, c, d) |
312 | 346 | ||
347 | /* alias to multi-byte read (SRAM/regs above 4K), with debug wrapper */ | ||
313 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, | 348 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * data, |
314 | int num); | 349 | int num); |
315 | #define ipw_write_indirect(a, b, c, d) \ | 350 | #define ipw_write_indirect(a, b, c, d) \ |
316 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ | 351 | IPW_DEBUG_IO("%s %d: write_indirect(0x%08X) %d bytes\n", __FILE__, __LINE__, (u32)(b), d); \ |
317 | _ipw_write_indirect(a, b, c, d) | 352 | _ipw_write_indirect(a, b, c, d) |
318 | 353 | ||
319 | /* indirect write s */ | 354 | /* 32-bit indirect write (above 4K) */ |
320 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) | 355 | static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) |
321 | { | 356 | { |
322 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); | 357 | IPW_DEBUG_IO(" %p : reg = 0x%8X : value = 0x%8X\n", priv, reg, value); |
@@ -324,22 +359,30 @@ static void _ipw_write_reg32(struct ipw_priv *priv, u32 reg, u32 value) | |||
324 | _ipw_write32(priv, IPW_INDIRECT_DATA, value); | 359 | _ipw_write32(priv, IPW_INDIRECT_DATA, value); |
325 | } | 360 | } |
326 | 361 | ||
362 | /* 8-bit indirect write (above 4K) */ | ||
327 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) | 363 | static void _ipw_write_reg8(struct ipw_priv *priv, u32 reg, u8 value) |
328 | { | 364 | { |
365 | u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */ | ||
366 | u32 dif_len = reg - aligned_addr; | ||
367 | |||
329 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 368 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
330 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); | 369 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
331 | _ipw_write8(priv, IPW_INDIRECT_DATA, value); | 370 | _ipw_write8(priv, IPW_INDIRECT_DATA + dif_len, value); |
332 | } | 371 | } |
333 | 372 | ||
373 | /* 16-bit indirect write (above 4K) */ | ||
334 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) | 374 | static void _ipw_write_reg16(struct ipw_priv *priv, u32 reg, u16 value) |
335 | { | 375 | { |
376 | u32 aligned_addr = reg & IPW_INDIRECT_ADDR_MASK; /* dword align */ | ||
377 | u32 dif_len = (reg - aligned_addr) & (~0x1ul); | ||
378 | |||
336 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); | 379 | IPW_DEBUG_IO(" reg = 0x%8X : value = 0x%8X\n", reg, value); |
337 | _ipw_write32(priv, IPW_INDIRECT_ADDR, reg & IPW_INDIRECT_ADDR_MASK); | 380 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
338 | _ipw_write16(priv, IPW_INDIRECT_DATA, value); | 381 | _ipw_write16(priv, IPW_INDIRECT_DATA + dif_len, value); |
339 | } | 382 | } |
340 | 383 | ||
341 | /* indirect read s */ | ||
342 | 384 | ||
385 | /* 8-bit indirect read (above 4K) */ | ||
343 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | 386 | static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) |
344 | { | 387 | { |
345 | u32 word; | 388 | u32 word; |
@@ -349,6 +392,7 @@ static u8 _ipw_read_reg8(struct ipw_priv *priv, u32 reg) | |||
349 | return (word >> ((reg & 0x3) * 8)) & 0xff; | 392 | return (word >> ((reg & 0x3) * 8)) & 0xff; |
350 | } | 393 | } |
351 | 394 | ||
395 | /* 32-bit indirect read (above 4K) */ | ||
352 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | 396 | static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) |
353 | { | 397 | { |
354 | u32 value; | 398 | u32 value; |
@@ -361,11 +405,12 @@ static u32 _ipw_read_reg32(struct ipw_priv *priv, u32 reg) | |||
361 | return value; | 405 | return value; |
362 | } | 406 | } |
363 | 407 | ||
364 | /* iterative/auto-increment 32 bit reads and writes */ | 408 | /* General purpose, no alignment requirement, iterative (multi-byte) read, */ |
409 | /* for area above 1st 4K of SRAM/reg space */ | ||
365 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 410 | static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
366 | int num) | 411 | int num) |
367 | { | 412 | { |
368 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; | 413 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */ |
369 | u32 dif_len = addr - aligned_addr; | 414 | u32 dif_len = addr - aligned_addr; |
370 | u32 i; | 415 | u32 i; |
371 | 416 | ||
@@ -375,7 +420,7 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
375 | return; | 420 | return; |
376 | } | 421 | } |
377 | 422 | ||
378 | /* Read the first nibble byte by byte */ | 423 | /* Read the first dword (or portion) byte by byte */ |
379 | if (unlikely(dif_len)) { | 424 | if (unlikely(dif_len)) { |
380 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 425 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
381 | /* Start reading at aligned_addr + dif_len */ | 426 | /* Start reading at aligned_addr + dif_len */ |
@@ -384,11 +429,12 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
384 | aligned_addr += 4; | 429 | aligned_addr += 4; |
385 | } | 430 | } |
386 | 431 | ||
432 | /* Read all of the middle dwords as dwords, with auto-increment */ | ||
387 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); | 433 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
388 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) | 434 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
389 | *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); | 435 | *(u32 *) buf = _ipw_read32(priv, IPW_AUTOINC_DATA); |
390 | 436 | ||
391 | /* Copy the last nibble */ | 437 | /* Read the last dword (or portion) byte by byte */ |
392 | if (unlikely(num)) { | 438 | if (unlikely(num)) { |
393 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 439 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
394 | for (i = 0; num > 0; i++, num--) | 440 | for (i = 0; num > 0; i++, num--) |
@@ -396,10 +442,12 @@ static void _ipw_read_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
396 | } | 442 | } |
397 | } | 443 | } |
398 | 444 | ||
445 | /* General purpose, no alignment requirement, iterative (multi-byte) write, */ | ||
446 | /* for area above 1st 4K of SRAM/reg space */ | ||
399 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | 447 | static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, |
400 | int num) | 448 | int num) |
401 | { | 449 | { |
402 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; | 450 | u32 aligned_addr = addr & IPW_INDIRECT_ADDR_MASK; /* dword align */ |
403 | u32 dif_len = addr - aligned_addr; | 451 | u32 dif_len = addr - aligned_addr; |
404 | u32 i; | 452 | u32 i; |
405 | 453 | ||
@@ -409,20 +457,21 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
409 | return; | 457 | return; |
410 | } | 458 | } |
411 | 459 | ||
412 | /* Write the first nibble byte by byte */ | 460 | /* Write the first dword (or portion) byte by byte */ |
413 | if (unlikely(dif_len)) { | 461 | if (unlikely(dif_len)) { |
414 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 462 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
415 | /* Start reading at aligned_addr + dif_len */ | 463 | /* Start writing at aligned_addr + dif_len */ |
416 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) | 464 | for (i = dif_len; ((i < 4) && (num > 0)); i++, num--, buf++) |
417 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); | 465 | _ipw_write8(priv, IPW_INDIRECT_DATA + i, *buf); |
418 | aligned_addr += 4; | 466 | aligned_addr += 4; |
419 | } | 467 | } |
420 | 468 | ||
469 | /* Write all of the middle dwords as dwords, with auto-increment */ | ||
421 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); | 470 | _ipw_write32(priv, IPW_AUTOINC_ADDR, aligned_addr); |
422 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) | 471 | for (; num >= 4; buf += 4, aligned_addr += 4, num -= 4) |
423 | _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); | 472 | _ipw_write32(priv, IPW_AUTOINC_DATA, *(u32 *) buf); |
424 | 473 | ||
425 | /* Copy the last nibble */ | 474 | /* Write the last dword (or portion) byte by byte */ |
426 | if (unlikely(num)) { | 475 | if (unlikely(num)) { |
427 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); | 476 | _ipw_write32(priv, IPW_INDIRECT_ADDR, aligned_addr); |
428 | for (i = 0; num > 0; i++, num--, buf++) | 477 | for (i = 0; num > 0; i++, num--, buf++) |
@@ -430,17 +479,21 @@ static void _ipw_write_indirect(struct ipw_priv *priv, u32 addr, u8 * buf, | |||
430 | } | 479 | } |
431 | } | 480 | } |
432 | 481 | ||
482 | /* General purpose, no alignment requirement, iterative (multi-byte) write, */ | ||
483 | /* for 1st 4K of SRAM/regs space */ | ||
433 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, | 484 | static void ipw_write_direct(struct ipw_priv *priv, u32 addr, void *buf, |
434 | int num) | 485 | int num) |
435 | { | 486 | { |
436 | memcpy_toio((priv->hw_base + addr), buf, num); | 487 | memcpy_toio((priv->hw_base + addr), buf, num); |
437 | } | 488 | } |
438 | 489 | ||
490 | /* Set bit(s) in low 4K of SRAM/regs */ | ||
439 | static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask) | 491 | static inline void ipw_set_bit(struct ipw_priv *priv, u32 reg, u32 mask) |
440 | { | 492 | { |
441 | ipw_write32(priv, reg, ipw_read32(priv, reg) | mask); | 493 | ipw_write32(priv, reg, ipw_read32(priv, reg) | mask); |
442 | } | 494 | } |
443 | 495 | ||
496 | /* Clear bit(s) in low 4K of SRAM/regs */ | ||
444 | static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) | 497 | static inline void ipw_clear_bit(struct ipw_priv *priv, u32 reg, u32 mask) |
445 | { | 498 | { |
446 | ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); | 499 | ipw_write32(priv, reg, ipw_read32(priv, reg) & ~mask); |
@@ -1076,6 +1129,7 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO, | |||
1076 | 1129 | ||
1077 | static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) | 1130 | static inline u32 ipw_get_event_log_len(struct ipw_priv *priv) |
1078 | { | 1131 | { |
1132 | /* length = 1st dword in log */ | ||
1079 | return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); | 1133 | return ipw_read_reg32(priv, ipw_read32(priv, IPW_EVENT_LOG)); |
1080 | } | 1134 | } |
1081 | 1135 | ||
@@ -2892,8 +2946,8 @@ static int ipw_load_ucode(struct ipw_priv *priv, u8 * data, size_t len) | |||
2892 | mdelay(1); | 2946 | mdelay(1); |
2893 | 2947 | ||
2894 | /* enable ucode store */ | 2948 | /* enable ucode store */ |
2895 | ipw_write_reg8(priv, DINO_CONTROL_REG, 0x0); | 2949 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, 0x0); |
2896 | ipw_write_reg8(priv, DINO_CONTROL_REG, DINO_ENABLE_CS); | 2950 | ipw_write_reg8(priv, IPW_BASEBAND_CONTROL_STATUS, DINO_ENABLE_CS); |
2897 | mdelay(1); | 2951 | mdelay(1); |
2898 | 2952 | ||
2899 | /* write ucode */ | 2953 | /* write ucode */ |
diff --git a/drivers/net/wireless/ipw2200.h b/drivers/net/wireless/ipw2200.h index e2afa76ad3cd..44ff76386a8e 100644 --- a/drivers/net/wireless/ipw2200.h +++ b/drivers/net/wireless/ipw2200.h | |||
@@ -1406,13 +1406,6 @@ do { if (ipw_debug_level & (level)) \ | |||
1406 | * Register bit definitions | 1406 | * Register bit definitions |
1407 | */ | 1407 | */ |
1408 | 1408 | ||
1409 | /* Dino control registers bits */ | ||
1410 | |||
1411 | #define DINO_ENABLE_SYSTEM 0x80 | ||
1412 | #define DINO_ENABLE_CS 0x40 | ||
1413 | #define DINO_RXFIFO_DATA 0x01 | ||
1414 | #define DINO_CONTROL_REG 0x00200000 | ||
1415 | |||
1416 | #define IPW_INTA_RW 0x00000008 | 1409 | #define IPW_INTA_RW 0x00000008 |
1417 | #define IPW_INTA_MASK_R 0x0000000C | 1410 | #define IPW_INTA_MASK_R 0x0000000C |
1418 | #define IPW_INDIRECT_ADDR 0x00000010 | 1411 | #define IPW_INDIRECT_ADDR 0x00000010 |
@@ -1459,6 +1452,12 @@ do { if (ipw_debug_level & (level)) \ | |||
1459 | #define IPW_DOMAIN_0_END 0x1000 | 1452 | #define IPW_DOMAIN_0_END 0x1000 |
1460 | #define CLX_MEM_BAR_SIZE 0x1000 | 1453 | #define CLX_MEM_BAR_SIZE 0x1000 |
1461 | 1454 | ||
1455 | |||
1456 | /* Dino/baseband control registers bits */ | ||
1457 | |||
1458 | #define DINO_ENABLE_SYSTEM 0x80 /* 1 = baseband processor on, 0 = reset */ | ||
1459 | #define DINO_ENABLE_CS 0x40 /* 1 = enable ucode load */ | ||
1460 | #define DINO_RXFIFO_DATA 0x01 /* 1 = data available */ | ||
1462 | #define IPW_BASEBAND_CONTROL_STATUS 0X00200000 | 1461 | #define IPW_BASEBAND_CONTROL_STATUS 0X00200000 |
1463 | #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 | 1462 | #define IPW_BASEBAND_TX_FIFO_WRITE 0X00200004 |
1464 | #define IPW_BASEBAND_RX_FIFO_READ 0X00200004 | 1463 | #define IPW_BASEBAND_RX_FIFO_READ 0X00200004 |