diff options
author | Michael Buesch <mb@bu3sch.de> | 2009-01-31 10:52:29 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-09 15:03:48 -0500 |
commit | 6c1bb9276c492c803611e63fa6fab8276c02ee70 (patch) | |
tree | eae1cd342a8572defd60c7da814135a82ad6cea8 /drivers/net/wireless/b43/tables_lpphy.c | |
parent | 3302e44dcdb8aff99769921af12b916a914b6317 (diff) |
b43: Add LP-PHY baseband init for >=rev2
This adds code for the baseband init of LP-PHY >=2.
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_lpphy.c')
-rw-r--r-- | drivers/net/wireless/b43/tables_lpphy.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/drivers/net/wireless/b43/tables_lpphy.c b/drivers/net/wireless/b43/tables_lpphy.c new file mode 100644 index 000000000000..c9cff8b6827e --- /dev/null +++ b/drivers/net/wireless/b43/tables_lpphy.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | |||
3 | Broadcom B43 wireless driver | ||
4 | IEEE 802.11g LP-PHY and radio device data tables | ||
5 | |||
6 | Copyright (c) 2009 Michael Buesch <mb@bu3sch.de> | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation; either version 2 of the License, or | ||
11 | (at your option) any later version. | ||
12 | |||
13 | This program is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | GNU General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program; see the file COPYING. If not, write to | ||
20 | the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, | ||
21 | Boston, MA 02110-1301, USA. | ||
22 | |||
23 | */ | ||
24 | |||
25 | #include "b43.h" | ||
26 | #include "tables_lpphy.h" | ||
27 | #include "phy_common.h" | ||
28 | #include "phy_lp.h" | ||
29 | |||
30 | |||
31 | u32 b43_lptab_read(struct b43_wldev *dev, u32 offset) | ||
32 | { | ||
33 | u32 type, value; | ||
34 | |||
35 | type = offset & B43_LPTAB_TYPEMASK; | ||
36 | offset &= ~B43_LPTAB_TYPEMASK; | ||
37 | B43_WARN_ON(offset > 0xFFFF); | ||
38 | |||
39 | switch (type) { | ||
40 | case B43_LPTAB_8BIT: | ||
41 | b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); | ||
42 | value = b43_phy_read(dev, B43_LPPHY_TABLEDATALO) & 0xFF; | ||
43 | break; | ||
44 | case B43_LPTAB_16BIT: | ||
45 | b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); | ||
46 | value = b43_phy_read(dev, B43_LPPHY_TABLEDATALO); | ||
47 | break; | ||
48 | case B43_LPTAB_32BIT: | ||
49 | b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); | ||
50 | value = b43_phy_read(dev, B43_LPPHY_TABLEDATAHI); | ||
51 | value <<= 16; | ||
52 | value |= b43_phy_read(dev, B43_LPPHY_TABLEDATALO); | ||
53 | break; | ||
54 | default: | ||
55 | B43_WARN_ON(1); | ||
56 | value = 0; | ||
57 | } | ||
58 | |||
59 | return value; | ||
60 | } | ||
61 | |||
62 | void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value) | ||
63 | { | ||
64 | u32 type; | ||
65 | |||
66 | type = offset & B43_LPTAB_TYPEMASK; | ||
67 | offset &= ~B43_LPTAB_TYPEMASK; | ||
68 | B43_WARN_ON(offset > 0xFFFF); | ||
69 | |||
70 | switch (type) { | ||
71 | case B43_LPTAB_8BIT: | ||
72 | B43_WARN_ON(value & ~0xFF); | ||
73 | b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); | ||
74 | b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); | ||
75 | break; | ||
76 | case B43_LPTAB_16BIT: | ||
77 | B43_WARN_ON(value & ~0xFFFF); | ||
78 | b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); | ||
79 | b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); | ||
80 | break; | ||
81 | case B43_LPTAB_32BIT: | ||
82 | b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset); | ||
83 | b43_phy_write(dev, B43_LPPHY_TABLEDATAHI, value >> 16); | ||
84 | b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value); | ||
85 | break; | ||
86 | default: | ||
87 | B43_WARN_ON(1); | ||
88 | } | ||
89 | } | ||