diff options
author | Michael Buesch <mb@bu3sch.de> | 2007-12-09 16:34:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:05:58 -0500 |
commit | 8ed7fc48eb31e583bb31c2bcfdd3a9c557bad5d0 (patch) | |
tree | 43ece4c73d9e563c9a06b8fd7cde8cc8f72bbabb /drivers/net/wireless/b43/tables.c | |
parent | bb54244be7d12c2a5985226061d598edb49c9078 (diff) |
b43: Fix ofdmtab write regression
commit f04b3787bbce4567e28069a9ec97dcd804626ac7 introduced
a regression for the ofdmtable writing.
It incorrectly removed the writing of the high 16bits for
a 32bit table write and initialized the direction identifier
too late.
This patch does also some cleanups to make the code much more
readable and adds a few comments, so non rocket scientists are
also able to understand what this address caching is all about.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/tables.c')
-rw-r--r-- | drivers/net/wireless/b43/tables.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/net/wireless/b43/tables.c b/drivers/net/wireless/b43/tables.c index be9c7eb94ac..fd5595ba5e8 100644 --- a/drivers/net/wireless/b43/tables.c +++ b/drivers/net/wireless/b43/tables.c | |||
@@ -381,13 +381,17 @@ u16 b43_ofdmtab_read16(struct b43_wldev *dev, u16 table, u16 offset) | |||
381 | u16 addr; | 381 | u16 addr; |
382 | 382 | ||
383 | addr = table + offset; | 383 | addr = table + offset; |
384 | if (addr - 1 != phy->ofdm_addr || phy->ofdm_valid != 1) { | 384 | if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_READ) || |
385 | (addr - 1 != phy->ofdmtab_addr)) { | ||
386 | /* The hardware has a different address in memory. Update it. */ | ||
385 | b43_phy_write(dev, B43_PHY_OTABLECTL, addr); | 387 | b43_phy_write(dev, B43_PHY_OTABLECTL, addr); |
386 | phy->ofdm_valid = 1; | 388 | phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_READ; |
387 | } | 389 | } |
388 | phy->ofdm_addr = addr; | 390 | phy->ofdmtab_addr = addr; |
389 | 391 | ||
390 | return b43_phy_read(dev, B43_PHY_OTABLEI); | 392 | return b43_phy_read(dev, B43_PHY_OTABLEI); |
393 | |||
394 | /* Some compiletime assertions... */ | ||
391 | assert_sizes(); | 395 | assert_sizes(); |
392 | } | 396 | } |
393 | 397 | ||
@@ -398,11 +402,13 @@ void b43_ofdmtab_write16(struct b43_wldev *dev, u16 table, | |||
398 | u16 addr; | 402 | u16 addr; |
399 | 403 | ||
400 | addr = table + offset; | 404 | addr = table + offset; |
401 | if (addr - 1 != phy->ofdm_addr || phy->ofdm_valid != 2) { | 405 | if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_WRITE) || |
406 | (addr -1 != phy->ofdmtab_addr)) { | ||
407 | /* The hardware has a different address in memory. Update it. */ | ||
402 | b43_phy_write(dev, B43_PHY_OTABLECTL, addr); | 408 | b43_phy_write(dev, B43_PHY_OTABLECTL, addr); |
403 | phy->ofdm_valid = 2; | 409 | phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_WRITE; |
404 | } | 410 | } |
405 | phy->ofdm_addr = addr; | 411 | phy->ofdmtab_addr = addr; |
406 | b43_phy_write(dev, B43_PHY_OTABLEI, value); | 412 | b43_phy_write(dev, B43_PHY_OTABLEI, value); |
407 | } | 413 | } |
408 | 414 | ||
@@ -413,11 +419,13 @@ u32 b43_ofdmtab_read32(struct b43_wldev *dev, u16 table, u16 offset) | |||
413 | u16 addr; | 419 | u16 addr; |
414 | 420 | ||
415 | addr = table + offset; | 421 | addr = table + offset; |
416 | if (addr - 1 != phy->ofdm_addr || phy->ofdm_valid != 1) { | 422 | if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_READ) || |
423 | (addr - 1 != phy->ofdmtab_addr)) { | ||
424 | /* The hardware has a different address in memory. Update it. */ | ||
417 | b43_phy_write(dev, B43_PHY_OTABLECTL, addr); | 425 | b43_phy_write(dev, B43_PHY_OTABLECTL, addr); |
418 | phy->ofdm_valid = 1; | 426 | phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_READ; |
419 | } | 427 | } |
420 | phy->ofdm_addr = addr; | 428 | phy->ofdmtab_addr = addr; |
421 | ret = b43_phy_read(dev, B43_PHY_OTABLEQ); | 429 | ret = b43_phy_read(dev, B43_PHY_OTABLEQ); |
422 | ret <<= 16; | 430 | ret <<= 16; |
423 | ret |= b43_phy_read(dev, B43_PHY_OTABLEI); | 431 | ret |= b43_phy_read(dev, B43_PHY_OTABLEI); |
@@ -432,13 +440,16 @@ void b43_ofdmtab_write32(struct b43_wldev *dev, u16 table, | |||
432 | u16 addr; | 440 | u16 addr; |
433 | 441 | ||
434 | addr = table + offset; | 442 | addr = table + offset; |
435 | if (addr - 1 != phy->ofdm_addr || phy->ofdm_valid != 2) { | 443 | if ((phy->ofdmtab_addr_direction != B43_OFDMTAB_DIRECTION_WRITE) || |
444 | (addr - 1 != phy->ofdmtab_addr)) { | ||
445 | /* The hardware has a different address in memory. Update it. */ | ||
436 | b43_phy_write(dev, B43_PHY_OTABLECTL, addr); | 446 | b43_phy_write(dev, B43_PHY_OTABLECTL, addr); |
437 | phy->ofdm_valid = 2; | 447 | phy->ofdmtab_addr_direction = B43_OFDMTAB_DIRECTION_WRITE; |
438 | } | 448 | } |
439 | phy->ofdm_addr = addr; | 449 | phy->ofdmtab_addr = addr; |
440 | 450 | ||
441 | b43_phy_write(dev, B43_PHY_OTABLEI, value); | 451 | b43_phy_write(dev, B43_PHY_OTABLEI, value); |
452 | b43_phy_write(dev, B43_PHY_OTABLEQ, (value >> 16)); | ||
442 | } | 453 | } |
443 | 454 | ||
444 | u16 b43_gtab_read(struct b43_wldev *dev, u16 table, u16 offset) | 455 | u16 b43_gtab_read(struct b43_wldev *dev, u16 table, u16 offset) |