aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-08-23 13:09:30 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-08-23 16:14:19 -0400
commit87a8c8cb2001a64034f1bd64980ab826402ab881 (patch)
tree840439da2679c7019343106367d42191fda3ab89
parent98f8dc72ac50a931b982d0610d9ec08292ceafdc (diff)
b43: HT-PHY: allow writing longer tables with a single call
Sometimes we need to write table which is 2-10 elements long. It's easier to create such a function instead of defining array every time. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/b43/tables_phy_ht.c45
-rw-r--r--drivers/net/wireless/b43/tables_phy_ht.h1
2 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/tables_phy_ht.c b/drivers/net/wireless/b43/tables_phy_ht.c
index 2127bd2ad877..677d217b5fb3 100644
--- a/drivers/net/wireless/b43/tables_phy_ht.c
+++ b/drivers/net/wireless/b43/tables_phy_ht.c
@@ -710,6 +710,51 @@ void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value)
710 return; 710 return;
711} 711}
712 712
713void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...)
714{
715 va_list args;
716 u32 type, value;
717 unsigned int i;
718
719 type = offset & B43_HTTAB_TYPEMASK;
720 offset &= 0xFFFF;
721
722 va_start(args, num);
723 switch (type) {
724 case B43_HTTAB_8BIT:
725 b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
726 for (i = 0; i < num; i++) {
727 value = va_arg(args, int);
728 B43_WARN_ON(value & ~0xFF);
729 b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
730 }
731 break;
732 case B43_HTTAB_16BIT:
733 b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
734 for (i = 0; i < num; i++) {
735 value = va_arg(args, int);
736 B43_WARN_ON(value & ~0xFFFF);
737 b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO, value);
738 }
739 break;
740 case B43_HTTAB_32BIT:
741 b43_phy_write(dev, B43_PHY_HT_TABLE_ADDR, offset);
742 for (i = 0; i < num; i++) {
743 value = va_arg(args, int);
744 b43_phy_write(dev, B43_PHY_HT_TABLE_DATAHI,
745 value >> 16);
746 b43_phy_write(dev, B43_PHY_HT_TABLE_DATALO,
747 value & 0xFFFF);
748 }
749 break;
750 default:
751 B43_WARN_ON(1);
752 }
753 va_end(args);
754
755 return;
756}
757
713void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset, 758void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset,
714 unsigned int nr_elements, const void *_data) 759 unsigned int nr_elements, const void *_data)
715{ 760{
diff --git a/drivers/net/wireless/b43/tables_phy_ht.h b/drivers/net/wireless/b43/tables_phy_ht.h
index bd20e9a818ea..1b5ef2bc770c 100644
--- a/drivers/net/wireless/b43/tables_phy_ht.h
+++ b/drivers/net/wireless/b43/tables_phy_ht.h
@@ -14,6 +14,7 @@ u32 b43_httab_read(struct b43_wldev *dev, u32 offset);
14void b43_httab_read_bulk(struct b43_wldev *dev, u32 offset, 14void b43_httab_read_bulk(struct b43_wldev *dev, u32 offset,
15 unsigned int nr_elements, void *_data); 15 unsigned int nr_elements, void *_data);
16void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value); 16void b43_httab_write(struct b43_wldev *dev, u32 offset, u32 value);
17void b43_httab_write_few(struct b43_wldev *dev, u32 offset, size_t num, ...);
17void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset, 18void b43_httab_write_bulk(struct b43_wldev *dev, u32 offset,
18 unsigned int nr_elements, const void *_data); 19 unsigned int nr_elements, const void *_data);
19 20