aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43
diff options
context:
space:
mode:
authorGábor Stefanik <netrolller.3d@gmail.com>2009-08-15 19:15:49 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-08-20 11:35:55 -0400
commit96909e97716de1d86e6e24d6aabce09980372771 (patch)
treef4c28ce48703390f3dde243cefadcf4d15fd21b6 /drivers/net/wireless/b43
parent826ee70664c658a022d999f7eb4d3cd9448895dd (diff)
b43: LP-PHY: Update baseband init for recent spec changes
The spec had some nasty typos, and a large part of the rev0/1 BB init procedure was also missing. Fix these. Also make the init-time channel switch debuggable. (The change from -EINVAL to -EIO is simply to make it possible to distinguish the PLL charge pump error from a channel-not-found error.) Signed-off-by: Gábor Stefanik <netrolller.3d@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r--drivers/net/wireless/b43/phy_lp.c73
1 files changed, 68 insertions, 5 deletions
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
index 038a59d63a42..85af82a7f949 100644
--- a/drivers/net/wireless/b43/phy_lp.c
+++ b/drivers/net/wireless/b43/phy_lp.c
@@ -204,8 +204,62 @@ static void lpphy_table_init(struct b43_wldev *dev)
204static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) 204static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
205{ 205{
206 struct ssb_bus *bus = dev->dev->bus; 206 struct ssb_bus *bus = dev->dev->bus;
207 struct b43_phy_lp *lpphy = dev->phy.lp;
207 u16 tmp, tmp2; 208 u16 tmp, tmp2;
208 209
210 b43_phy_mask(dev, B43_LPPHY_AFE_DAC_CTL, 0xF7FF);
211 b43_phy_write(dev, B43_LPPHY_AFE_CTL, 0);
212 b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, 0);
213 b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, 0);
214 b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0);
215 b43_phy_set(dev, B43_LPPHY_AFE_DAC_CTL, 0x0004);
216 b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x0078);
217 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x5800);
218 b43_phy_write(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x0016);
219 b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_0, 0xFFF8, 0x0004);
220 b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5400);
221 b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2400);
222 b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100);
223 b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0x0006);
224 b43_phy_mask(dev, B43_LPPHY_RX_RADIO_CTL, 0xFFFE);
225 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x0005);
226 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC10, 0x0180);
227 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x3800);
228 b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFFF0, 0x0005);
229 b43_phy_maskset(dev, B43_LPPHY_GAIN_MISMATCH_LIMIT, 0xFFC0, 0x001A);
230 b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0xFF00, 0x00B3);
231 b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00);
232 b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB,
233 0xFF00, lpphy->rx_pwr_offset);
234 if ((bus->sprom.boardflags_lo & B43_BFL_FEM) &&
235 ((b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ) ||
236 (bus->sprom.boardflags_hi & B43_BFH_PAREF))) {
237 /* TODO:
238 * Set the LDO voltage to 0x0028 - FIXME: What is this?
239 * Call sb_pmu_set_ldo_voltage with 4 and the LDO voltage
240 * as arguments
241 * Call sb_pmu_paref_ldo_enable with argument TRUE
242 */
243 if (dev->phy.rev == 0) {
244 b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT,
245 0xFFCF, 0x0010);
246 }
247 b43_lptab_write(dev, B43_LPTAB16(11, 7), 60);
248 } else {
249 //TODO: Call ssb_pmu_paref_ldo_enable with argument FALSE
250 b43_phy_maskset(dev, B43_LPPHY_LP_RF_SIGNAL_LUT,
251 0xFFCF, 0x0020);
252 b43_lptab_write(dev, B43_LPTAB16(11, 7), 100);
253 }
254 tmp = lpphy->rssi_vf | lpphy->rssi_vc << 4 | 0xA000;
255 b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, tmp);
256 if (bus->sprom.boardflags_hi & B43_BFH_RSSIINV)
257 b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x0AAA);
258 else
259 b43_phy_maskset(dev, B43_LPPHY_AFE_RSSI_CTL_1, 0xF000, 0x02AA);
260 b43_lptab_write(dev, B43_LPTAB16(11, 1), 24);
261 b43_phy_maskset(dev, B43_LPPHY_RX_RADIO_CTL,
262 0xFFF9, (lpphy->bx_arch << 1));
209 if (dev->phy.rev == 1 && 263 if (dev->phy.rev == 1 &&
210 (bus->sprom.boardflags_hi & B43_BFH_FEM_BT)) { 264 (bus->sprom.boardflags_hi & B43_BFH_FEM_BT)) {
211 b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A); 265 b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_1, 0xFFC0, 0x000A);
@@ -255,7 +309,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
255 b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0006); 309 b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xFFC0, 0x0006);
256 b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0700); 310 b43_phy_maskset(dev, B43_LPPHY_TR_LOOKUP_4, 0xC0FF, 0x0700);
257 } 311 }
258 if (dev->phy.rev == 1) { 312 if (dev->phy.rev == 1 && (bus->sprom.boardflags_hi & B43_BFH_PAREF)) {
259 b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_5, B43_LPPHY_TR_LOOKUP_1); 313 b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_5, B43_LPPHY_TR_LOOKUP_1);
260 b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_6, B43_LPPHY_TR_LOOKUP_2); 314 b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_6, B43_LPPHY_TR_LOOKUP_2);
261 b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_7, B43_LPPHY_TR_LOOKUP_3); 315 b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_7, B43_LPPHY_TR_LOOKUP_3);
@@ -267,6 +321,7 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
267 b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006); 321 b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006);
268 b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005); 322 b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005);
269 b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0xFFFF); 323 b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0xFFFF);
324 //FIXME the Broadcom driver caches & delays this HF write!
270 b43_hf_write(dev, b43_hf_read(dev) | B43_HF_PR45960W); 325 b43_hf_write(dev, b43_hf_read(dev) | B43_HF_PR45960W);
271 } 326 }
272 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { 327 if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
@@ -384,7 +439,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
384 b43_phy_maskset(dev, B43_LPPHY_PWR_THRESH1, 0xFFF0, 0x9); 439 b43_phy_maskset(dev, B43_LPPHY_PWR_THRESH1, 0xFFF0, 0x9);
385 b43_phy_mask(dev, B43_LPPHY_GAINDIRECTMISMATCH, ~0xF); 440 b43_phy_mask(dev, B43_LPPHY_GAINDIRECTMISMATCH, ~0xF);
386 b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5500); 441 b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5500);
387 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xF81F, 0xA0); 442 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC1F, 0xA0);
388 b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300); 443 b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300);
389 b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00); 444 b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00);
390 if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { 445 if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) {
@@ -405,7 +460,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
405 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12); 460 b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12);
406 b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000); 461 b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000);
407 462
408 if ((bus->chip_id == 0x4325) && (bus->chip_rev == 1)) { 463 if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) {
409 b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0); 464 b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0);
410 b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40); 465 b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40);
411 } 466 }
@@ -416,6 +471,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
416 b43_phy_maskset(dev, B43_LPPHY_SYNCPEAKCNT, 0xFFF8, 0x6); 471 b43_phy_maskset(dev, B43_LPPHY_SYNCPEAKCNT, 0xFFF8, 0x6);
417 b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0x00FF, 0x9D00); 472 b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0x00FF, 0x9D00);
418 b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0xFF00, 0xA1); 473 b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0xFF00, 0xA1);
474 b43_phy_mask(dev, B43_LPPHY_IDLEAFTERPKTRXTO, 0x00FF);
419 } else /* 5GHz */ 475 } else /* 5GHz */
420 b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x40); 476 b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x40);
421 477
@@ -1883,7 +1939,7 @@ static int lpphy_b2062_tune(struct b43_wldev *dev,
1883 lpphy_b2062_reset_pll_bias(dev); 1939 lpphy_b2062_reset_pll_bias(dev);
1884 lpphy_b2062_vco_calib(dev); 1940 lpphy_b2062_vco_calib(dev);
1885 if (b43_radio_read(dev, B2062_S_RFPLL_CTL3) & 0x10) 1941 if (b43_radio_read(dev, B2062_S_RFPLL_CTL3) & 0x10)
1886 err = -EINVAL; 1942 err = -EIO;
1887 } 1943 }
1888 1944
1889 b43_radio_mask(dev, B2062_S_RFPLL_CTL14, ~0x04); 1945 b43_radio_mask(dev, B2062_S_RFPLL_CTL14, ~0x04);
@@ -2068,11 +2124,18 @@ static int b43_lpphy_op_switch_channel(struct b43_wldev *dev,
2068 2124
2069static int b43_lpphy_op_init(struct b43_wldev *dev) 2125static int b43_lpphy_op_init(struct b43_wldev *dev)
2070{ 2126{
2127 int err;
2128
2071 lpphy_read_band_sprom(dev); //FIXME should this be in prepare_structs? 2129 lpphy_read_band_sprom(dev); //FIXME should this be in prepare_structs?
2072 lpphy_baseband_init(dev); 2130 lpphy_baseband_init(dev);
2073 lpphy_radio_init(dev); 2131 lpphy_radio_init(dev);
2074 lpphy_calibrate_rc(dev); 2132 lpphy_calibrate_rc(dev);
2075 b43_lpphy_op_switch_channel(dev, b43_lpphy_op_get_default_chan(dev)); 2133 err = b43_lpphy_op_switch_channel(dev,
2134 b43_lpphy_op_get_default_chan(dev));
2135 if (err) {
2136 b43dbg(dev->wl, "Switch to init channel failed, error = %d.\n",
2137 err);
2138 }
2076 lpphy_tx_pctl_init(dev); 2139 lpphy_tx_pctl_init(dev);
2077 lpphy_calibration(dev); 2140 lpphy_calibration(dev);
2078 //TODO ACI init 2141 //TODO ACI init