diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2010-01-17 18:21:21 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-01-19 16:45:35 -0500 |
commit | 2581b1434ccba6960e0b671927d87c83b5152c9d (patch) | |
tree | ae46f7d6dc8d51de7b60bb96f65187458c92e4a7 /drivers/net/wireless/b43/tables_nphy.c | |
parent | d41a3552f96673480d7913c170cab31fa00b7697 (diff) |
b43: N-PHY: implement and add multi-dimensional table writing
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/tables_nphy.c')
-rw-r--r-- | drivers/net/wireless/b43/tables_nphy.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c index 7dff853ab962..fc08be0b976e 100644 --- a/drivers/net/wireless/b43/tables_nphy.c +++ b/drivers/net/wireless/b43/tables_nphy.c | |||
@@ -2952,6 +2952,46 @@ void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value) | |||
2952 | assert_ntab_array_sizes(); | 2952 | assert_ntab_array_sizes(); |
2953 | } | 2953 | } |
2954 | 2954 | ||
2955 | void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset, | ||
2956 | unsigned int nr_elements, const void *_data) | ||
2957 | { | ||
2958 | u32 type, value; | ||
2959 | const u8 *data = _data; | ||
2960 | unsigned int i; | ||
2961 | |||
2962 | type = offset & B43_NTAB_TYPEMASK; | ||
2963 | offset &= ~B43_NTAB_TYPEMASK; | ||
2964 | B43_WARN_ON(offset > 0xFFFF); | ||
2965 | |||
2966 | b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset); | ||
2967 | |||
2968 | for (i = 0; i < nr_elements; i++) { | ||
2969 | switch (type) { | ||
2970 | case B43_NTAB_8BIT: | ||
2971 | value = *data; | ||
2972 | data++; | ||
2973 | B43_WARN_ON(value & ~0xFF); | ||
2974 | b43_phy_write(dev, B43_NPHY_TABLE_DATALO, value); | ||
2975 | break; | ||
2976 | case B43_NTAB_16BIT: | ||
2977 | value = *((u16 *)data); | ||
2978 | data += 2; | ||
2979 | B43_WARN_ON(value & ~0xFFFF); | ||
2980 | b43_phy_write(dev, B43_NPHY_TABLE_DATALO, value); | ||
2981 | break; | ||
2982 | case B43_NTAB_32BIT: | ||
2983 | value = *((u32 *)data); | ||
2984 | data += 4; | ||
2985 | b43_phy_write(dev, B43_NPHY_TABLE_DATAHI, value >> 16); | ||
2986 | b43_phy_write(dev, B43_NPHY_TABLE_DATALO, | ||
2987 | value & 0xFFFF); | ||
2988 | break; | ||
2989 | default: | ||
2990 | B43_WARN_ON(1); | ||
2991 | } | ||
2992 | } | ||
2993 | } | ||
2994 | |||
2955 | #define ntab_upload(dev, offset, data) do { \ | 2995 | #define ntab_upload(dev, offset, data) do { \ |
2956 | unsigned int i; \ | 2996 | unsigned int i; \ |
2957 | for (i = 0; i < (offset##_SIZE); i++) \ | 2997 | for (i = 0; i < (offset##_SIZE); i++) \ |