diff options
-rw-r--r-- | drivers/net/wireless/b43/phy_lp.c | 105 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_lp.h | 5 |
2 files changed, 103 insertions, 7 deletions
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c index cfb8337d3859..996b7eccfaf8 100644 --- a/drivers/net/wireless/b43/phy_lp.c +++ b/drivers/net/wireless/b43/phy_lp.c | |||
@@ -1257,18 +1257,109 @@ static void lpphy_calibration(struct b43_wldev *dev) | |||
1257 | b43_mac_enable(dev); | 1257 | b43_mac_enable(dev); |
1258 | } | 1258 | } |
1259 | 1259 | ||
1260 | static void lpphy_set_tssi_mux(struct b43_wldev *dev, enum tssi_mux_mode mode) | ||
1261 | { | ||
1262 | if (mode != TSSI_MUX_EXT) { | ||
1263 | b43_radio_set(dev, B2063_PA_SP1, 0x2); | ||
1264 | b43_phy_set(dev, B43_PHY_OFDM(0xF3), 0x1000); | ||
1265 | b43_radio_write(dev, B2063_PA_CTL10, 0x51); | ||
1266 | if (mode == TSSI_MUX_POSTPA) { | ||
1267 | b43_radio_mask(dev, B2063_PA_SP1, 0xFFFE); | ||
1268 | b43_phy_mask(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0xFFC7); | ||
1269 | } else { | ||
1270 | b43_radio_maskset(dev, B2063_PA_SP1, 0xFFFE, 0x1); | ||
1271 | b43_phy_maskset(dev, B43_LPPHY_AFE_CTL_OVRVAL, | ||
1272 | 0xFFC7, 0x20); | ||
1273 | } | ||
1274 | } else { | ||
1275 | B43_WARN_ON(1); | ||
1276 | } | ||
1277 | } | ||
1278 | |||
1279 | static void lpphy_tx_pctl_init_hw(struct b43_wldev *dev) | ||
1280 | { | ||
1281 | u16 tmp; | ||
1282 | int i; | ||
1283 | |||
1284 | //SPEC TODO Call LP PHY Clear TX Power offsets | ||
1285 | for (i = 0; i < 64; i++) { | ||
1286 | if (dev->phy.rev >= 2) | ||
1287 | b43_lptab_write(dev, B43_LPTAB32(7, i + 1), i); | ||
1288 | else | ||
1289 | b43_lptab_write(dev, B43_LPTAB32(10, i + 1), i); | ||
1290 | } | ||
1291 | |||
1292 | b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0xFF00, 0xFF); | ||
1293 | b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0x8FFF, 0x5000); | ||
1294 | b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI, 0xFFC0, 0x1F); | ||
1295 | if (dev->phy.rev < 2) { | ||
1296 | b43_phy_mask(dev, B43_LPPHY_LP_PHY_CTL, 0xEFFF); | ||
1297 | b43_phy_maskset(dev, B43_LPPHY_LP_PHY_CTL, 0xDFFF, 0x2000); | ||
1298 | } else { | ||
1299 | b43_phy_mask(dev, B43_PHY_OFDM(0x103), 0xFFFE); | ||
1300 | b43_phy_maskset(dev, B43_PHY_OFDM(0x103), 0xFFFB, 0x4); | ||
1301 | b43_phy_maskset(dev, B43_PHY_OFDM(0x103), 0xFFEF, 0x10); | ||
1302 | b43_radio_maskset(dev, B2063_IQ_CALIB_CTL2, 0xF3, 0x1); | ||
1303 | lpphy_set_tssi_mux(dev, TSSI_MUX_POSTPA); | ||
1304 | } | ||
1305 | b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI, 0x7FFF, 0x8000); | ||
1306 | b43_phy_mask(dev, B43_LPPHY_TX_PWR_CTL_DELTAPWR_LIMIT, 0xFF); | ||
1307 | b43_phy_write(dev, B43_LPPHY_TX_PWR_CTL_DELTAPWR_LIMIT, 0xA); | ||
1308 | b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD, | ||
1309 | (u16)~B43_LPPHY_TX_PWR_CTL_CMD_MODE, | ||
1310 | B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF); | ||
1311 | b43_phy_mask(dev, B43_LPPHY_TX_PWR_CTL_NNUM, 0xF8FF); | ||
1312 | b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD, | ||
1313 | (u16)~B43_LPPHY_TX_PWR_CTL_CMD_MODE, | ||
1314 | B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW); | ||
1315 | |||
1316 | if (dev->phy.rev < 2) { | ||
1317 | b43_phy_maskset(dev, B43_LPPHY_RF_OVERRIDE_0, 0xEFFF, 0x1000); | ||
1318 | b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_VAL_0, 0xEFFF); | ||
1319 | } else { | ||
1320 | lpphy_set_tx_power_by_index(dev, 0x7F); | ||
1321 | } | ||
1322 | |||
1323 | b43_dummy_transmission(dev, true, true); | ||
1324 | |||
1325 | tmp = b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_STAT); | ||
1326 | if (tmp & 0x8000) { | ||
1327 | b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_IDLETSSI, | ||
1328 | 0xFFC0, (tmp & 0xFF) - 32); | ||
1329 | } | ||
1330 | |||
1331 | b43_phy_mask(dev, B43_LPPHY_RF_OVERRIDE_0, 0xEFFF); | ||
1332 | |||
1333 | // (SPEC?) TODO Set "Target TX frequency" variable to 0 | ||
1334 | // SPEC FIXME "Set BB Multiplier to 0xE000" impossible - bb_mult is u8! | ||
1335 | } | ||
1336 | |||
1337 | static void lpphy_tx_pctl_init_sw(struct b43_wldev *dev) | ||
1338 | { | ||
1339 | struct lpphy_tx_gains gains; | ||
1340 | |||
1341 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | ||
1342 | gains.gm = 4; | ||
1343 | gains.pad = 12; | ||
1344 | gains.pga = 12; | ||
1345 | gains.dac = 0; | ||
1346 | } else { | ||
1347 | gains.gm = 7; | ||
1348 | gains.pad = 14; | ||
1349 | gains.pga = 15; | ||
1350 | gains.dac = 0; | ||
1351 | } | ||
1352 | lpphy_set_tx_gains(dev, gains); | ||
1353 | lpphy_set_bb_mult(dev, 150); | ||
1354 | } | ||
1355 | |||
1260 | /* Initialize TX power control */ | 1356 | /* Initialize TX power control */ |
1261 | static void lpphy_tx_pctl_init(struct b43_wldev *dev) | 1357 | static void lpphy_tx_pctl_init(struct b43_wldev *dev) |
1262 | { | 1358 | { |
1263 | if (0/*FIXME HWPCTL capable */) { | 1359 | if (0/*FIXME HWPCTL capable */) { |
1264 | //TODO | 1360 | lpphy_tx_pctl_init_hw(dev); |
1265 | } else { /* This device is only software TX power control capable. */ | 1361 | } else { /* This device is only software TX power control capable. */ |
1266 | if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) { | 1362 | lpphy_tx_pctl_init_sw(dev); |
1267 | //TODO | ||
1268 | } else { | ||
1269 | //TODO | ||
1270 | } | ||
1271 | //TODO set BB multiplier to 0x0096 | ||
1272 | } | 1363 | } |
1273 | } | 1364 | } |
1274 | 1365 | ||
diff --git a/drivers/net/wireless/b43/phy_lp.h b/drivers/net/wireless/b43/phy_lp.h index 0461d5b3144f..4eab760ac619 100644 --- a/drivers/net/wireless/b43/phy_lp.h +++ b/drivers/net/wireless/b43/phy_lp.h | |||
@@ -886,6 +886,11 @@ struct b43_phy_lp { | |||
886 | u16 dig_flt_state[9]; | 886 | u16 dig_flt_state[9]; |
887 | }; | 887 | }; |
888 | 888 | ||
889 | enum tssi_mux_mode { | ||
890 | TSSI_MUX_PREPA, | ||
891 | TSSI_MUX_POSTPA, | ||
892 | TSSI_MUX_EXT, | ||
893 | }; | ||
889 | 894 | ||
890 | struct b43_phy_operations; | 895 | struct b43_phy_operations; |
891 | extern const struct b43_phy_operations b43_phyops_lp; | 896 | extern const struct b43_phy_operations b43_phyops_lp; |