aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-01-31 10:52:29 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-09 15:03:48 -0500
commit6c1bb9276c492c803611e63fa6fab8276c02ee70 (patch)
treeeae1cd342a8572defd60c7da814135a82ad6cea8 /drivers/net/wireless/b43
parent3302e44dcdb8aff99769921af12b916a914b6317 (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')
-rw-r--r--drivers/net/wireless/b43/Makefile1
-rw-r--r--drivers/net/wireless/b43/phy_lp.c78
-rw-r--r--drivers/net/wireless/b43/phy_lp.h42
-rw-r--r--drivers/net/wireless/b43/tables_lpphy.c89
-rw-r--r--drivers/net/wireless/b43/tables_lpphy.h21
5 files changed, 228 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43/Makefile b/drivers/net/wireless/b43/Makefile
index 14a02b3aea53..281ef8310350 100644
--- a/drivers/net/wireless/b43/Makefile
+++ b/drivers/net/wireless/b43/Makefile
@@ -6,6 +6,7 @@ b43-y += phy_g.o
6b43-y += phy_a.o 6b43-y += phy_a.o
7b43-$(CONFIG_B43_NPHY) += phy_n.o 7b43-$(CONFIG_B43_NPHY) += phy_n.o
8b43-$(CONFIG_B43_PHY_LP) += phy_lp.o 8b43-$(CONFIG_B43_PHY_LP) += phy_lp.o
9b43-$(CONFIG_B43_PHY_LP) += tables_lpphy.o
9b43-y += sysfs.o 10b43-y += sysfs.o
10b43-y += xmit.o 11b43-y += xmit.o
11b43-y += lo.o 12b43-y += lo.o
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index ec83b8cd2f2e..3c7be8308587 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -3,7 +3,7 @@
3 Broadcom B43 wireless driver 3 Broadcom B43 wireless driver
4 IEEE 802.11g LP-PHY driver 4 IEEE 802.11g LP-PHY driver
5 5
6 Copyright (c) 2008 Michael Buesch <mb@bu3sch.de> 6 Copyright (c) 2008-2009 Michael Buesch <mb@bu3sch.de>
7 7
8 This program is free software; you can redistribute it and/or modify 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 9 it under the terms of the GNU General Public License as published by
@@ -25,6 +25,7 @@
25#include "b43.h" 25#include "b43.h"
26#include "phy_lp.h" 26#include "phy_lp.h"
27#include "phy_common.h" 27#include "phy_common.h"
28#include "tables_lpphy.h"
28 29
29 30
30static int b43_lpphy_op_allocate(struct b43_wldev *dev) 31static int b43_lpphy_op_allocate(struct b43_wldev *dev)
@@ -69,7 +70,80 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
69 70
70static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) 71static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
71{ 72{
72 //TODO 73 struct b43_phy_lp *lpphy = dev->phy.lp;
74
75 b43_phy_write(dev, B43_LPPHY_AFE_DAC_CTL, 0x50);
76 b43_phy_write(dev, B43_LPPHY_AFE_CTL, 0x8800);
77 b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, 0);
78 b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0);
79 b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, 0);
80 b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0);
81 b43_phy_write(dev, B43_PHY_OFDM(0xF9), 0);
82 b43_phy_write(dev, B43_LPPHY_TR_LOOKUP_1, 0);
83 b43_phy_set(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x10);
84 b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x78);
85 b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xF8FF, 0x200);
86 b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xFF00, 0x7F);
87 b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFF0F, 0x40);
88 b43_phy_maskset(dev, B43_LPPHY_PREAMBLECONFIRMTO, 0xFF00, 0x2);
89 b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x4000);
90 b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x2000);
91 b43_phy_set(dev, B43_PHY_OFDM(0x10A), 0x1);
92 b43_phy_maskset(dev, B43_LPPHY_CCKLMSSTEPSIZE, 0xFF01, 0x10);
93 b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0xFF00, 0xF4);
94 b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0x00FF, 0xF100);//FIXME specs are different
95 b43_phy_write(dev, B43_LPPHY_CLIPTHRESH, 0x48);
96 b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0xFF00, 0x46);
97 b43_phy_maskset(dev, B43_PHY_OFDM(0xE4), 0xFF00, 0x10);
98 b43_phy_maskset(dev, B43_LPPHY_PWR_THRESH1, 0xFFF0, 0x9);
99 b43_phy_mask(dev, B43_LPPHY_GAINDIRECTMISMATCH, ~0xF);
100 b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5500);
101 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xF81F, 0xA0);
102 b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300);
103 b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00);
104 b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x1E00);
105 b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xD);
106 b43_phy_maskset(dev, B43_PHY_OFDM(0xFE), 0xFFE0, 0x1F);
107 b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0xFFE0, 0xC);
108 b43_phy_maskset(dev, B43_PHY_OFDM(0x100), 0xFF00, 0x19);
109 b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0x03FF, 0x3C00);
110 b43_phy_maskset(dev, B43_PHY_OFDM(0xFE), 0xFC1F, 0x3E0);
111 b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0xFFE0, 0xC);
112 b43_phy_maskset(dev, B43_PHY_OFDM(0x100), 0x00FF, 0x1900);
113 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x5800);
114 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12);
115 b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000);
116
117 if (dev->phy.rev < 2) {
118 //FIXME this will never execute.
119
120 //FIXME 32bit?
121 b43_lptab_write(dev, B43_LPTAB32(0x11, 0x14), 0);
122 b43_lptab_write(dev, B43_LPTAB32(0x08, 0x12), 0x40);
123 } else {
124 //FIXME 32bit?
125 b43_lptab_write(dev, B43_LPTAB32(0x08, 0x14), 0);
126 b43_lptab_write(dev, B43_LPTAB32(0x08, 0x12), 0x40);
127 }
128
129 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
130 b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x40);
131 b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xF0FF, 0xB00);
132 b43_phy_maskset(dev, B43_LPPHY_SYNCPEAKCNT, 0xFFF8, 0x6);
133 b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0x00FF, 0x9D00);
134 b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0xFF00, 0xA1);
135 } else /* 5GHz */
136 b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x40);
137
138 b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0xFF00, 0xB3);
139 b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00);
140 b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB, 0xFF00, lpphy->rx_pwr_offset);
141 b43_phy_set(dev, B43_LPPHY_RESET_CTL, 0x44);
142 b43_phy_write(dev, B43_LPPHY_RESET_CTL, 0x80);
143 b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, 0xA954);
144 b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_1,
145 0x2000 | ((u16)lpphy->rssi_gs << 10) |
146 ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf);
73} 147}
74 148
75static void lpphy_baseband_init(struct b43_wldev *dev) 149static void lpphy_baseband_init(struct b43_wldev *dev)
diff --git a/drivers/net/wireless/b43/phy_lp.h b/drivers/net/wireless/b43/phy_lp.h
index c3f92f172593..1e30a55d2f25 100644
--- a/drivers/net/wireless/b43/phy_lp.h
+++ b/drivers/net/wireless/b43/phy_lp.h
@@ -803,7 +803,47 @@
803 803
804 804
805struct b43_phy_lp { 805struct b43_phy_lp {
806 //TODO 806 /* Transmit isolation medium band */
807 u8 tx_isolation_med_band; /* FIXME initial value? */
808 /* Transmit isolation low band */
809 u8 tx_isolation_low_band; /* FIXME initial value? */
810 /* Transmit isolation high band */
811 u8 tx_isolation_hi_band; /* FIXME initial value? */
812
813 /* Receive power offset */
814 u8 rx_pwr_offset; /* FIXME initial value? */
815
816 /* TSSI transmit count */
817 u16 tssi_tx_count; /* FIXME initial value? */
818 /* TSSI index */
819 u16 tssi_idx; /* FIXME initial value? */
820 /* TSSI npt */
821 u16 tssi_npt; /* FIXME initial value? */
822
823 /* Target TX frequency */
824 u16 tgt_tx_freq; /* FIXME initial value? */
825
826 /* Transmit power index override */
827 s8 tx_pwr_idx_over; /* FIXME initial value? */
828
829 /* RSSI vf */
830 u8 rssi_vf; /* FIXME initial value? */
831 /* RSSI vc */
832 u8 rssi_vc; /* FIXME initial value? */
833 /* RSSI gs */
834 u8 rssi_gs; /* FIXME initial value? */
835
836 /* RC cap */
837 u8 rc_cap; /* FIXME initial value? */
838 /* BX arch */
839 u8 bx_arch; /* FIXME initial value? */
840
841 /* Full calibration channel */
842 u8 full_calib_chan; /* FIXME initial value? */
843
844 /* Transmit iqlocal best coeffs */
845 bool tx_iqloc_best_coeffs_valid;
846 u8 tx_iqloc_best_coeffs[11];
807}; 847};
808 848
809 849
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
31u32 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
62void 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}
diff --git a/drivers/net/wireless/b43/tables_lpphy.h b/drivers/net/wireless/b43/tables_lpphy.h
new file mode 100644
index 000000000000..d32e7450680b
--- /dev/null
+++ b/drivers/net/wireless/b43/tables_lpphy.h
@@ -0,0 +1,21 @@
1#ifndef B43_TABLES_LPPHY_H_
2#define B43_TABLES_LPPHY_H_
3
4
5#define B43_LPTAB_TYPEMASK 0xF0000000
6#define B43_LPTAB_8BIT 0x10000000
7#define B43_LPTAB_16BIT 0x20000000
8#define B43_LPTAB_32BIT 0x30000000
9#define B43_LPTAB8(table, offset) (((table) << 10) | (offset) | B43_LPTAB_8BIT)
10#define B43_LPTAB16(table, offset) (((table) << 10) | (offset) | B43_LPTAB_16BIT)
11#define B43_LPTAB32(table, offset) (((table) << 10) | (offset) | B43_LPTAB_32BIT)
12
13/* Table definitions */
14#define B43_LPTAB_TXPWR_R2PLUS B43_LPTAB32(0x07, 0) /* TX power lookup table (rev >= 2) */
15#define B43_LPTAB_TXPWR_R0_1 B43_LPTAB32(0xA0, 0) /* TX power lookup table (rev < 2) */
16
17u32 b43_lptab_read(struct b43_wldev *dev, u32 offset);
18void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value);
19
20
21#endif /* B43_TABLES_LPPHY_H_ */