Lines Matching +full:channel +full:- +full:7

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 IEEE 802.11a/g LP-PHY driver
7 Copyright (c) 2008-2009 Michael Buesch <m@bues.ch>
23 static inline u16 channel2freq_lp(u8 channel) in channel2freq_lp() argument
25 if (channel < 14) in channel2freq_lp()
26 return (2407 + 5 * channel); in channel2freq_lp()
27 else if (channel == 14) in channel2freq_lp()
29 else if (channel < 184) in channel2freq_lp()
30 return (5000 + 5 * channel); in channel2freq_lp()
32 return (4000 + 5 * channel); in channel2freq_lp()
37 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in b43_lpphy_op_get_default_chan()
48 return -ENOMEM; in b43_lpphy_op_allocate()
49 dev->phy.lp = lpphy; in b43_lpphy_op_allocate()
56 struct b43_phy *phy = &dev->phy; in b43_lpphy_op_prepare_structs()
57 struct b43_phy_lp *lpphy = phy->lp; in b43_lpphy_op_prepare_structs()
60 lpphy->antenna = B43_ANTENNA_DEFAULT; in b43_lpphy_op_prepare_structs()
67 struct b43_phy_lp *lpphy = dev->phy.lp; in b43_lpphy_op_free()
70 dev->phy.lp = NULL; in b43_lpphy_op_free()
73 /* https://bcm-v4.sipsolutions.net/802.11/PHY/LP/ReadBandSrom */
76 struct ssb_sprom *sprom = dev->dev->bus_sprom; in lpphy_read_band_sprom()
77 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_read_band_sprom()
82 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in lpphy_read_band_sprom()
83 lpphy->tx_isolation_med_band = sprom->tri2g; in lpphy_read_band_sprom()
84 lpphy->bx_arch = sprom->bxa2g; in lpphy_read_band_sprom()
85 lpphy->rx_pwr_offset = sprom->rxpo2g; in lpphy_read_band_sprom()
86 lpphy->rssi_vf = sprom->rssismf2g; in lpphy_read_band_sprom()
87 lpphy->rssi_vc = sprom->rssismc2g; in lpphy_read_band_sprom()
88 lpphy->rssi_gs = sprom->rssisav2g; in lpphy_read_band_sprom()
89 lpphy->txpa[0] = sprom->pa0b0; in lpphy_read_band_sprom()
90 lpphy->txpa[1] = sprom->pa0b1; in lpphy_read_band_sprom()
91 lpphy->txpa[2] = sprom->pa0b2; in lpphy_read_band_sprom()
92 maxpwr = sprom->maxpwr_bg; in lpphy_read_band_sprom()
93 lpphy->max_tx_pwr_med_band = maxpwr; in lpphy_read_band_sprom()
94 cckpo = sprom->cck2gpo; in lpphy_read_band_sprom()
96 ofdmpo = sprom->ofdm2gpo; in lpphy_read_band_sprom()
98 lpphy->tx_max_rate[i] = in lpphy_read_band_sprom()
99 maxpwr - (ofdmpo & 0xF) * 2; in lpphy_read_band_sprom()
102 ofdmpo = sprom->ofdm2gpo; in lpphy_read_band_sprom()
104 lpphy->tx_max_rate[i] = in lpphy_read_band_sprom()
105 maxpwr - (ofdmpo & 0xF) * 2; in lpphy_read_band_sprom()
109 u8 opo = sprom->opo; in lpphy_read_band_sprom()
111 lpphy->tx_max_rate[i] = maxpwr; in lpphy_read_band_sprom()
113 lpphy->tx_max_rate[i] = maxpwr - opo; in lpphy_read_band_sprom()
116 lpphy->tx_isolation_low_band = sprom->tri5gl; in lpphy_read_band_sprom()
117 lpphy->tx_isolation_med_band = sprom->tri5g; in lpphy_read_band_sprom()
118 lpphy->tx_isolation_hi_band = sprom->tri5gh; in lpphy_read_band_sprom()
119 lpphy->bx_arch = sprom->bxa5g; in lpphy_read_band_sprom()
120 lpphy->rx_pwr_offset = sprom->rxpo5g; in lpphy_read_band_sprom()
121 lpphy->rssi_vf = sprom->rssismf5g; in lpphy_read_band_sprom()
122 lpphy->rssi_vc = sprom->rssismc5g; in lpphy_read_band_sprom()
123 lpphy->rssi_gs = sprom->rssisav5g; in lpphy_read_band_sprom()
124 lpphy->txpa[0] = sprom->pa1b0; in lpphy_read_band_sprom()
125 lpphy->txpa[1] = sprom->pa1b1; in lpphy_read_band_sprom()
126 lpphy->txpa[2] = sprom->pa1b2; in lpphy_read_band_sprom()
127 lpphy->txpal[0] = sprom->pa1lob0; in lpphy_read_band_sprom()
128 lpphy->txpal[1] = sprom->pa1lob1; in lpphy_read_band_sprom()
129 lpphy->txpal[2] = sprom->pa1lob2; in lpphy_read_band_sprom()
130 lpphy->txpah[0] = sprom->pa1hib0; in lpphy_read_band_sprom()
131 lpphy->txpah[1] = sprom->pa1hib1; in lpphy_read_band_sprom()
132 lpphy->txpah[2] = sprom->pa1hib2; in lpphy_read_band_sprom()
133 maxpwr = sprom->maxpwr_al; in lpphy_read_band_sprom()
134 ofdmpo = sprom->ofdm5glpo; in lpphy_read_band_sprom()
135 lpphy->max_tx_pwr_low_band = maxpwr; in lpphy_read_band_sprom()
137 lpphy->tx_max_ratel[i] = maxpwr - (ofdmpo & 0xF) * 2; in lpphy_read_band_sprom()
140 maxpwr = sprom->maxpwr_a; in lpphy_read_band_sprom()
141 ofdmpo = sprom->ofdm5gpo; in lpphy_read_band_sprom()
142 lpphy->max_tx_pwr_med_band = maxpwr; in lpphy_read_band_sprom()
144 lpphy->tx_max_rate[i] = maxpwr - (ofdmpo & 0xF) * 2; in lpphy_read_band_sprom()
147 maxpwr = sprom->maxpwr_ah; in lpphy_read_band_sprom()
148 ofdmpo = sprom->ofdm5ghpo; in lpphy_read_band_sprom()
149 lpphy->max_tx_pwr_hi_band = maxpwr; in lpphy_read_band_sprom()
151 lpphy->tx_max_rateh[i] = maxpwr - (ofdmpo & 0xF) * 2; in lpphy_read_band_sprom()
159 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_adjust_gain_table()
163 B43_WARN_ON(dev->phy.rev >= 2); in lpphy_adjust_gain_table()
165 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in lpphy_adjust_gain_table()
166 isolation = lpphy->tx_isolation_med_band; in lpphy_adjust_gain_table()
168 isolation = lpphy->tx_isolation_low_band; in lpphy_adjust_gain_table()
170 isolation = lpphy->tx_isolation_med_band; in lpphy_adjust_gain_table()
172 isolation = lpphy->tx_isolation_hi_band; in lpphy_adjust_gain_table()
174 temp[0] = ((isolation - 26) / 12) << 12; in lpphy_adjust_gain_table()
186 if (dev->phy.rev < 2) in lpphy_table_init()
193 if (dev->phy.rev < 2) in lpphy_table_init()
199 struct ssb_bus *bus = dev->dev->sdev->bus; in lpphy_baseband_rev0_1_init()
200 struct ssb_sprom *sprom = dev->dev->bus_sprom; in lpphy_baseband_rev0_1_init()
201 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_baseband_rev0_1_init()
227 0xFF00, lpphy->rx_pwr_offset); in lpphy_baseband_rev0_1_init()
228 if ((sprom->boardflags_lo & B43_BFL_FEM) && in lpphy_baseband_rev0_1_init()
229 ((b43_current_band(dev->wl) == NL80211_BAND_5GHZ) || in lpphy_baseband_rev0_1_init()
230 (sprom->boardflags_hi & B43_BFH_PAREF))) { in lpphy_baseband_rev0_1_init()
231 ssb_pmu_set_ldo_voltage(&bus->chipco, LDO_PAREF, 0x28); in lpphy_baseband_rev0_1_init()
232 ssb_pmu_set_ldo_paref(&bus->chipco, true); in lpphy_baseband_rev0_1_init()
233 if (dev->phy.rev == 0) { in lpphy_baseband_rev0_1_init()
237 b43_lptab_write(dev, B43_LPTAB16(11, 7), 60); in lpphy_baseband_rev0_1_init()
239 ssb_pmu_set_ldo_paref(&bus->chipco, false); in lpphy_baseband_rev0_1_init()
242 b43_lptab_write(dev, B43_LPTAB16(11, 7), 100); in lpphy_baseband_rev0_1_init()
244 tmp = lpphy->rssi_vf | lpphy->rssi_vc << 4 | 0xA000; in lpphy_baseband_rev0_1_init()
246 if (sprom->boardflags_hi & B43_BFH_RSSIINV) in lpphy_baseband_rev0_1_init()
252 0xFFF9, (lpphy->bx_arch << 1)); in lpphy_baseband_rev0_1_init()
253 if (dev->phy.rev == 1 && in lpphy_baseband_rev0_1_init()
254 (sprom->boardflags_hi & B43_BFH_FEM_BT)) { in lpphy_baseband_rev0_1_init()
271 } else if (b43_current_band(dev->wl) == NL80211_BAND_5GHZ || in lpphy_baseband_rev0_1_init()
272 (dev->dev->board_type == SSB_BOARD_BU4312) || in lpphy_baseband_rev0_1_init()
273 (dev->phy.rev == 0 && (sprom->boardflags_lo & B43_BFL_FEM))) { in lpphy_baseband_rev0_1_init()
282 } else if (dev->phy.rev == 1 || in lpphy_baseband_rev0_1_init()
283 (sprom->boardflags_lo & B43_BFL_FEM)) { in lpphy_baseband_rev0_1_init()
302 if (dev->phy.rev == 1 && (sprom->boardflags_hi & B43_BFH_PAREF)) { in lpphy_baseband_rev0_1_init()
308 if ((sprom->boardflags_hi & B43_BFH_FEM_BT) && in lpphy_baseband_rev0_1_init()
309 (dev->dev->chip_id == 0x5354) && in lpphy_baseband_rev0_1_init()
310 (dev->dev->chip_pkg == SSB_CHIPPACK_BCM4712S)) { in lpphy_baseband_rev0_1_init()
317 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in lpphy_baseband_rev0_1_init()
330 if (dev->phy.rev == 1) { in lpphy_baseband_rev0_1_init()
366 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_save_dig_flt_state()
370 lpphy->dig_flt_state[i] = b43_phy_read(dev, addr[i]); in lpphy_save_dig_flt_state()
389 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_restore_dig_flt_state()
393 b43_phy_write(dev, addr[i], lpphy->dig_flt_state[i]); in lpphy_restore_dig_flt_state()
398 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_baseband_rev2plus_init()
417 if (dev->dev->board_rev >= 0x18) { in lpphy_baseband_rev2plus_init()
434 if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { in lpphy_baseband_rev2plus_init()
452 if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { in lpphy_baseband_rev2plus_init()
457 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in lpphy_baseband_rev2plus_init()
469 b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB, 0xFF00, lpphy->rx_pwr_offset); in lpphy_baseband_rev2plus_init()
474 0x2000 | ((u16)lpphy->rssi_gs << 10) | in lpphy_baseband_rev2plus_init()
475 ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf); in lpphy_baseband_rev2plus_init()
477 if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { in lpphy_baseband_rev2plus_init()
489 if (dev->phy.rev >= 2) in lpphy_baseband_init()
503 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_2062_init()
504 struct ssb_bus *bus = dev->dev->sdev->bus; in lpphy_2062_init()
513 .data[3] = 4, .data[4] = 11, .data[5] = 7, }, in lpphy_2062_init()
515 .data[3] = 3, .data[4] = 12, .data[5] = 7, }, in lpphy_2062_init()
534 if (dev->phy.rev > 0) { in lpphy_2062_init()
538 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in lpphy_2062_init()
544 crystalfreq = bus->chipco.pmu.crystalfreq * 1000; in lpphy_2062_init()
546 B43_WARN_ON(!(bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU)); in lpphy_2062_init()
550 lpphy->pdiv = 1; in lpphy_2062_init()
553 lpphy->pdiv = 2; in lpphy_2062_init()
557 tmp = (((800000000 * lpphy->pdiv + crystalfreq) / in lpphy_2062_init()
558 (2 * crystalfreq)) - 8) & 0xFF; in lpphy_2062_init()
561 tmp = (((100 * crystalfreq + 16000000 * lpphy->pdiv) / in lpphy_2062_init()
562 (32000000 * lpphy->pdiv)) - 1) & 0xFF; in lpphy_2062_init()
565 tmp = (((2 * crystalfreq + 1000000 * lpphy->pdiv) / in lpphy_2062_init()
566 (2000000 * lpphy->pdiv)) - 1) & 0xFF; in lpphy_2062_init()
569 ref = (1000 * lpphy->pdiv + 2 * crystalfreq) / (2000 * lpphy->pdiv); in lpphy_2062_init()
578 fd = &freqdata_tab[ARRAY_SIZE(freqdata_tab) - 1]; in lpphy_2062_init()
579 b43dbg(dev->wl, "b2062: Using crystal tab entry %u kHz.\n", in lpphy_2062_init()
580 fd->freq); /* FIXME: Keep this printk until the code is fully debugged. */ in lpphy_2062_init()
583 ((u16)(fd->data[1]) << 4) | fd->data[0]); in lpphy_2062_init()
585 ((u16)(fd->data[3]) << 4) | fd->data[2]); in lpphy_2062_init()
586 b43_radio_write(dev, B2062_S_RFPLL_CTL10, fd->data[4]); in lpphy_2062_init()
587 b43_radio_write(dev, B2062_S_RFPLL_CTL11, fd->data[5]); in lpphy_2062_init()
601 if (dev->phy.rev == 2) { in lpphy_2063_init()
638 { .phy_offset = 6, .phy_shift = 0, .rf_addr = 0x52, .rf_shift = 7, .mask = 0x01, },
645 { .phy_offset = 4, .phy_shift = 7, .rf_addr = 0x43, .rf_shift = 0, .mask = 0x0f, },
647 { .phy_offset = 2, .phy_shift = 7, .rf_addr = 0x40, .rf_shift = 4, .mask = 0x0f, },
659 tmp = b43_radio_read(dev, e->rf_addr); in lpphy_sync_stx()
660 tmp >>= e->rf_shift; in lpphy_sync_stx()
661 tmp <<= e->phy_shift; in lpphy_sync_stx()
662 b43_phy_maskset(dev, B43_PHY_OFDM(0xF2 + e->phy_offset), in lpphy_sync_stx()
663 ~(e->mask << e->phy_shift), tmp); in lpphy_sync_stx()
675 if (dev->phy.radio_ver == 0x2062) { in lpphy_radio_init()
682 if (dev->dev->chip_id == 0x4325) { in lpphy_radio_init()
692 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_set_rc_cap()
694 u8 rc_cap = (lpphy->rc_cap & 0x1F) >> 1; in lpphy_set_rc_cap()
696 if (dev->phy.rev == 1) //FIXME check channel 14! in lpphy_set_rc_cap()
700 max_t(u8, lpphy->rc_cap - 4, 0x80)); in lpphy_set_rc_cap()
703 ((lpphy->rc_cap & 0x1F) >> 2) | 0x80); in lpphy_set_rc_cap()
718 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_set_deaf()
721 lpphy->crs_usr_disable = true; in lpphy_set_deaf()
723 lpphy->crs_sys_disable = true; in lpphy_set_deaf()
729 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_clear_deaf()
732 lpphy->crs_usr_disable = false; in lpphy_clear_deaf()
734 lpphy->crs_sys_disable = false; in lpphy_clear_deaf()
736 if (!lpphy->crs_usr_disable && !lpphy->crs_sys_disable) { in lpphy_clear_deaf()
737 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in lpphy_clear_deaf()
796 if (dev->phy.rev >= 2) { in lpphy_disable_rx_gain_override()
798 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in lpphy_disable_rx_gain_override()
812 if (dev->phy.rev >= 2) { in lpphy_enable_rx_gain_override()
814 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in lpphy_enable_rx_gain_override()
825 if (dev->phy.rev < 2) in lpphy_disable_tx_gain_override()
836 if (dev->phy.rev < 2) in lpphy_enable_tx_gain_override()
850 gains.dac = (b43_phy_read(dev, B43_LPPHY_AFE_DAC_CTL) & 0x380) >> 7; in lpphy_get_tx_gains()
851 if (dev->phy.rev < 2) { in lpphy_get_tx_gains()
856 gains.pad = (tmp & 0x780) >> 7; in lpphy_get_tx_gains()
870 ctl |= dac << 7; in lpphy_set_dac_gain()
890 if (dev->phy.rev < 2) { in lpphy_set_tx_gains()
891 rf_gain = (gains.pad << 7) | (gains.pga << 3) | gains.gm; in lpphy_set_tx_gains()
942 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in lpphy_rev2plus_set_rx_gain()
952 if (dev->phy.rev < 2) in lpphy_set_rx_gain()
1010 iq_est->iq_prod = b43_phy_read(dev, B43_LPPHY_IQ_ACC_HI_ADDR); in lpphy_rx_iq_est()
1011 iq_est->iq_prod <<= 16; in lpphy_rx_iq_est()
1012 iq_est->iq_prod |= b43_phy_read(dev, B43_LPPHY_IQ_ACC_LO_ADDR); in lpphy_rx_iq_est()
1014 iq_est->i_pwr = b43_phy_read(dev, B43_LPPHY_IQ_I_PWR_ACC_HI_ADDR); in lpphy_rx_iq_est()
1015 iq_est->i_pwr <<= 16; in lpphy_rx_iq_est()
1016 iq_est->i_pwr |= b43_phy_read(dev, B43_LPPHY_IQ_I_PWR_ACC_LO_ADDR); in lpphy_rx_iq_est()
1018 iq_est->q_pwr = b43_phy_read(dev, B43_LPPHY_IQ_Q_PWR_ACC_HI_ADDR); in lpphy_rx_iq_est()
1019 iq_est->q_pwr <<= 16; in lpphy_rx_iq_est()
1020 iq_est->q_pwr |= b43_phy_read(dev, B43_LPPHY_IQ_Q_PWR_ACC_LO_ADDR); in lpphy_rx_iq_est()
1029 int i, index = -1; in lpphy_loopback()
1059 /* Fixed-point division algorithm using only integer math. */
1074 remainder = (remainder << 1) - divisor; in lpphy_qdiv_roundup()
1076 precision--; in lpphy_qdiv_roundup()
1088 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_read_tx_pctl_mode_from_hardware()
1094 lpphy->txpctl_mode = B43_LPPHY_TXPCTL_OFF; in lpphy_read_tx_pctl_mode_from_hardware()
1097 lpphy->txpctl_mode = B43_LPPHY_TXPCTL_SW; in lpphy_read_tx_pctl_mode_from_hardware()
1100 lpphy->txpctl_mode = B43_LPPHY_TXPCTL_HW; in lpphy_read_tx_pctl_mode_from_hardware()
1103 lpphy->txpctl_mode = B43_LPPHY_TXPCTL_UNKNOWN; in lpphy_read_tx_pctl_mode_from_hardware()
1112 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_write_tx_pctl_mode_to_hardware()
1115 switch (lpphy->txpctl_mode) { in lpphy_write_tx_pctl_mode_to_hardware()
1136 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_set_tx_power_control()
1140 oldmode = lpphy->txpctl_mode; in lpphy_set_tx_power_control()
1143 lpphy->txpctl_mode = mode; in lpphy_set_tx_power_control()
1152 0xFF80, lpphy->tssi_idx); in lpphy_set_tx_power_control()
1154 0x8FFF, ((u16)lpphy->tssi_npt << 16)); in lpphy_set_tx_power_control()
1157 lpphy->tx_pwr_idx_over = -1; in lpphy_set_tx_power_control()
1160 if (dev->phy.rev >= 2) { in lpphy_set_tx_power_control()
1174 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_rev0_1_rc_calib()
1193 err = b43_lpphy_op_switch_channel(dev, 7); in lpphy_rev0_1_rc_calib()
1195 b43dbg(dev->wl, in lpphy_rev0_1_rc_calib()
1196 "RC calib: Failed to switch to channel 7, error = %d\n", in lpphy_rev0_1_rc_calib()
1211 old_txpctl = lpphy->txpctl_mode; in lpphy_rev0_1_rc_calib()
1216 if (loopback == -1) in lpphy_rev0_1_rc_calib()
1233 ideal_pwr = ((ideal_pwr_table[j-5] >> 3) + 1) >> 1; in lpphy_rev0_1_rc_calib()
1235 mean_sq_pwr = ideal_pwr - normal_pwr; in lpphy_rev0_1_rc_calib()
1239 lpphy->rc_cap = i; in lpphy_rev0_1_rc_calib()
1261 * has a Set here, while v4.174.64.19 has a Get - regression in in lpphy_rev0_1_rc_calib()
1268 if (lpphy->rc_cap) in lpphy_rev0_1_rc_calib()
1274 struct ssb_bus *bus = dev->dev->sdev->bus; in lpphy_rev2plus_rc_calib()
1275 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; in lpphy_rev2plus_rc_calib()
1330 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_calibrate_rc()
1332 if (dev->phy.rev >= 2) { in lpphy_calibrate_rc()
1334 } else if (!lpphy->rc_cap) { in lpphy_calibrate_rc()
1335 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) in lpphy_calibrate_rc()
1344 if (dev->phy.rev >= 2) in b43_lpphy_op_set_rx_antenna()
1357 dev->phy.lp->antenna = antenna; in b43_lpphy_op_set_rx_antenna()
1371 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_set_tx_power_by_index()
1375 lpphy->tx_pwr_idx_over = index; in lpphy_set_tx_power_by_index()
1377 if (lpphy->txpctl_mode != B43_LPPHY_TXPCTL_OFF) in lpphy_set_tx_power_by_index()
1379 if (dev->phy.rev >= 2) { in lpphy_set_tx_power_by_index()
1380 iq_comp = b43_lptab_read(dev, B43_LPTAB32(7, index + 320)); in lpphy_set_tx_power_by_index()
1381 tx_gain = b43_lptab_read(dev, B43_LPTAB32(7, index + 192)); in lpphy_set_tx_power_by_index()
1397 if (dev->phy.rev >= 2) { in lpphy_set_tx_power_by_index()
1398 coeff = b43_lptab_read(dev, B43_LPTAB32(7, index + 448)); in lpphy_set_tx_power_by_index()
1403 if (dev->phy.rev >= 2) { in lpphy_set_tx_power_by_index()
1404 rf_power = b43_lptab_read(dev, B43_LPTAB32(7, index + 576)); in lpphy_set_tx_power_by_index()
1422 if (dev->phy.rev >= 2) { in b43_lpphy_op_software_rfkill()
1436 if (dev->phy.rev >= 2) in b43_lpphy_op_software_rfkill()
1444 static void lpphy_set_analog_filter(struct b43_wldev *dev, int channel) in lpphy_set_analog_filter() argument
1446 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_set_analog_filter()
1447 u16 tmp = (channel == 14); //SPEC FIXME check japanwidefilter! in lpphy_set_analog_filter()
1449 if (dev->phy.rev < 2) { //SPEC FIXME Isn't this rev0/1-specific? in lpphy_set_analog_filter()
1451 if ((dev->phy.rev == 1) && (lpphy->rc_cap)) in lpphy_set_analog_filter()
1484 if (dev->phy.rev >= 2) in lpphy_tx_pctl_init_hw()
1485 b43_lptab_write(dev, B43_LPTAB32(7, i + 1), i); in lpphy_tx_pctl_init_hw()
1493 if (dev->phy.rev < 2) { in lpphy_tx_pctl_init_hw()
1514 if (dev->phy.rev < 2) { in lpphy_tx_pctl_init_hw()
1526 0xFFC0, (tmp & 0xFF) - 32); in lpphy_tx_pctl_init_hw()
1532 // SPEC FIXME "Set BB Multiplier to 0xE000" impossible - bb_mult is u8! in lpphy_tx_pctl_init_hw()
1539 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in lpphy_tx_pctl_init_sw()
1545 gains.gm = 7; in lpphy_tx_pctl_init_sw()
1566 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_pr41573_workaround()
1575 b43err(dev->wl, "PR41573 failed. Out of memory!\n"); in lpphy_pr41573_workaround()
1580 txpctl_mode = lpphy->txpctl_mode; in lpphy_pr41573_workaround()
1581 tx_pwr_idx_over = lpphy->tx_pwr_idx_over; in lpphy_pr41573_workaround()
1582 tssi_npt = lpphy->tssi_npt; in lpphy_pr41573_workaround()
1583 tssi_idx = lpphy->tssi_idx; in lpphy_pr41573_workaround()
1585 if (dev->phy.rev < 2) { in lpphy_pr41573_workaround()
1589 b43_lptab_read_bulk(dev, B43_LPTAB32(7, 0x140), in lpphy_pr41573_workaround()
1598 if (dev->phy.rev < 2) { in lpphy_pr41573_workaround()
1602 b43_lptab_write_bulk(dev, B43_LPTAB32(7, 0x140), in lpphy_pr41573_workaround()
1605 b43_write16(dev, B43_MMIO_CHANNEL, lpphy->channel); in lpphy_pr41573_workaround()
1606 lpphy->tssi_npt = tssi_npt; in lpphy_pr41573_workaround()
1607 lpphy->tssi_idx = tssi_idx; in lpphy_pr41573_workaround()
1608 lpphy_set_analog_filter(dev, lpphy->channel); in lpphy_pr41573_workaround()
1609 if (tx_pwr_idx_over != -1) in lpphy_pr41573_workaround()
1611 if (lpphy->rc_cap) in lpphy_pr41573_workaround()
1613 b43_lpphy_op_set_rx_antenna(dev, lpphy->antenna); in lpphy_pr41573_workaround()
1621 { .chan = 1, .c1 = -66, .c0 = 15, },
1622 { .chan = 2, .c1 = -66, .c0 = 15, },
1623 { .chan = 3, .c1 = -66, .c0 = 15, },
1624 { .chan = 4, .c1 = -66, .c0 = 15, },
1625 { .chan = 5, .c1 = -66, .c0 = 15, },
1626 { .chan = 6, .c1 = -66, .c0 = 15, },
1627 { .chan = 7, .c1 = -66, .c0 = 14, },
1628 { .chan = 8, .c1 = -66, .c0 = 14, },
1629 { .chan = 9, .c1 = -66, .c0 = 14, },
1630 { .chan = 10, .c1 = -66, .c0 = 14, },
1631 { .chan = 11, .c1 = -66, .c0 = 14, },
1632 { .chan = 12, .c1 = -66, .c0 = 13, },
1633 { .chan = 13, .c1 = -66, .c0 = 13, },
1634 { .chan = 14, .c1 = -66, .c0 = 13, },
1638 { .chan = 1, .c1 = -64, .c0 = 13, },
1639 { .chan = 2, .c1 = -64, .c0 = 13, },
1640 { .chan = 3, .c1 = -64, .c0 = 13, },
1641 { .chan = 4, .c1 = -64, .c0 = 13, },
1642 { .chan = 5, .c1 = -64, .c0 = 12, },
1643 { .chan = 6, .c1 = -64, .c0 = 12, },
1644 { .chan = 7, .c1 = -64, .c0 = 12, },
1645 { .chan = 8, .c1 = -64, .c0 = 12, },
1646 { .chan = 9, .c1 = -64, .c0 = 12, },
1647 { .chan = 10, .c1 = -64, .c0 = 11, },
1648 { .chan = 11, .c1 = -64, .c0 = 11, },
1649 { .chan = 12, .c1 = -64, .c0 = 11, },
1650 { .chan = 13, .c1 = -64, .c0 = 11, },
1651 { .chan = 14, .c1 = -64, .c0 = 10, },
1652 { .chan = 34, .c1 = -62, .c0 = 24, },
1653 { .chan = 38, .c1 = -62, .c0 = 24, },
1654 { .chan = 42, .c1 = -62, .c0 = 24, },
1655 { .chan = 46, .c1 = -62, .c0 = 23, },
1656 { .chan = 36, .c1 = -62, .c0 = 24, },
1657 { .chan = 40, .c1 = -62, .c0 = 24, },
1658 { .chan = 44, .c1 = -62, .c0 = 23, },
1659 { .chan = 48, .c1 = -62, .c0 = 23, },
1660 { .chan = 52, .c1 = -62, .c0 = 23, },
1661 { .chan = 56, .c1 = -62, .c0 = 22, },
1662 { .chan = 60, .c1 = -62, .c0 = 22, },
1663 { .chan = 64, .c1 = -62, .c0 = 22, },
1664 { .chan = 100, .c1 = -62, .c0 = 16, },
1665 { .chan = 104, .c1 = -62, .c0 = 16, },
1666 { .chan = 108, .c1 = -62, .c0 = 15, },
1667 { .chan = 112, .c1 = -62, .c0 = 14, },
1668 { .chan = 116, .c1 = -62, .c0 = 14, },
1669 { .chan = 120, .c1 = -62, .c0 = 13, },
1670 { .chan = 124, .c1 = -62, .c0 = 12, },
1671 { .chan = 128, .c1 = -62, .c0 = 12, },
1672 { .chan = 132, .c1 = -62, .c0 = 12, },
1673 { .chan = 136, .c1 = -62, .c0 = 11, },
1674 { .chan = 140, .c1 = -62, .c0 = 10, },
1675 { .chan = 149, .c1 = -61, .c0 = 9, },
1676 { .chan = 153, .c1 = -61, .c0 = 9, },
1677 { .chan = 157, .c1 = -61, .c0 = 9, },
1678 { .chan = 161, .c1 = -61, .c0 = 8, },
1679 { .chan = 165, .c1 = -61, .c0 = 8, },
1680 { .chan = 184, .c1 = -62, .c0 = 25, },
1681 { .chan = 188, .c1 = -62, .c0 = 25, },
1682 { .chan = 192, .c1 = -62, .c0 = 25, },
1683 { .chan = 196, .c1 = -62, .c0 = 25, },
1684 { .chan = 200, .c1 = -62, .c0 = 25, },
1685 { .chan = 204, .c1 = -62, .c0 = 25, },
1686 { .chan = 208, .c1 = -62, .c0 = 25, },
1687 { .chan = 212, .c1 = -62, .c0 = 25, },
1688 { .chan = 216, .c1 = -62, .c0 = 26, },
1693 .c1 = -64,
1725 tmp1 = prod_msb - 20; in lpphy_calc_rx_iq_comp()
1728 tmp3 = ((prod << (30 - prod_msb)) + (ipwr >> (1 + tmp1))) / in lpphy_calc_rx_iq_comp()
1731 tmp3 = ((prod << (30 - prod_msb)) + (ipwr << (-1 - tmp1))) / in lpphy_calc_rx_iq_comp()
1732 (ipwr << -tmp1); in lpphy_calc_rx_iq_comp()
1735 tmp2 = q_msb - 11; in lpphy_calc_rx_iq_comp()
1738 tmp4 = (qpwr << (31 - q_msb)) / (ipwr >> tmp2); in lpphy_calc_rx_iq_comp()
1740 tmp4 = (qpwr << (31 - q_msb)) / (ipwr << -tmp2); in lpphy_calc_rx_iq_comp()
1742 tmp4 -= tmp3 * tmp3; in lpphy_calc_rx_iq_comp()
1743 tmp4 = -int_sqrt(tmp4); in lpphy_calc_rx_iq_comp()
1758 0xFFC0, samples - 1); in lpphy_run_samples()
1760 loops--; in lpphy_run_samples()
1769 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_start_tx_tone()
1775 lpphy->tx_tone_freq = freq; in lpphy_start_tx_tone()
1802 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_stop_tx_tone()
1805 lpphy->tx_tone_freq = 0; in lpphy_stop_tx_tone()
1818 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_papd_cal_txpwr()
1823 old_txpctl = lpphy->txpctl_mode; in lpphy_papd_cal_txpwr()
1842 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_rx_iq_cal()
1851 if (dev->dev->chip_id == 0x5354) { in lpphy_rx_iq_cal()
1853 if (lpphy_5354_iq_table[i].chan == lpphy->channel) { in lpphy_rx_iq_cal()
1857 } else if (dev->phy.rev >= 2) { in lpphy_rx_iq_cal()
1861 if (lpphy_rev0_1_iq_table[i].chan == lpphy->channel) { in lpphy_rx_iq_cal()
1870 b43_phy_maskset(dev, B43_LPPHY_RX_COMP_COEFF_S, 0xFF00, iqcomp->c1); in lpphy_rx_iq_cal()
1872 0x00FF, iqcomp->c0 << 8); in lpphy_rx_iq_cal()
1882 if (b43_current_band(dev->wl) == NL80211_BAND_2GHZ) { in lpphy_rx_iq_cal()
1934 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_calibration()
1938 if (lpphy->full_calib_chan != lpphy->channel) { in lpphy_calibration()
1940 lpphy->full_calib_chan = lpphy->channel; in lpphy_calibration()
1946 if (dev->phy.rev >= 2) in lpphy_calibration()
1949 saved_pctl_mode = lpphy->txpctl_mode; in lpphy_calibration()
1952 if ((dev->phy.rev == 0) && (saved_pctl_mode != B43_LPPHY_TXPCTL_OFF)) in lpphy_calibration()
1954 if ((dev->phy.rev >= 2) && full_cal) { in lpphy_calibration()
1958 if (dev->phy.rev >= 2) in lpphy_calibration()
1975 /* Register 1 is a 32-bit register. */ in b43_lpphy_op_radio_read()
1977 /* LP-PHY needs a special bit set for read access */ in b43_lpphy_op_radio_read()
1978 if (dev->phy.rev < 2) { in b43_lpphy_op_radio_read()
1990 /* Register 1 is a 32-bit register. */ in b43_lpphy_op_radio_write()
1998 u8 channel; member
2004 { .channel = 1, .freq = 2412, .data[0] = 0xFF, .data[1] = 0xFF,
2006 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2007 { .channel = 2, .freq = 2417, .data[0] = 0xFF, .data[1] = 0xFF,
2009 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2010 { .channel = 3, .freq = 2422, .data[0] = 0xFF, .data[1] = 0xFF,
2012 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2013 { .channel = 4, .freq = 2427, .data[0] = 0xFF, .data[1] = 0xFF,
2015 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2016 { .channel = 5, .freq = 2432, .data[0] = 0xFF, .data[1] = 0xFF,
2018 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2019 { .channel = 6, .freq = 2437, .data[0] = 0xFF, .data[1] = 0xFF,
2021 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2022 { .channel = 7, .freq = 2442, .data[0] = 0xFF, .data[1] = 0xFF,
2024 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2025 { .channel = 8, .freq = 2447, .data[0] = 0xFF, .data[1] = 0xFF,
2027 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2028 { .channel = 9, .freq = 2452, .data[0] = 0xFF, .data[1] = 0xFF,
2030 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2031 { .channel = 10, .freq = 2457, .data[0] = 0xFF, .data[1] = 0xFF,
2033 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2034 { .channel = 11, .freq = 2462, .data[0] = 0xFF, .data[1] = 0xFF,
2036 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2037 { .channel = 12, .freq = 2467, .data[0] = 0xFF, .data[1] = 0xFF,
2039 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2040 { .channel = 13, .freq = 2472, .data[0] = 0xFF, .data[1] = 0xFF,
2042 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2043 { .channel = 14, .freq = 2484, .data[0] = 0xFF, .data[1] = 0xFF,
2045 .data[6] = 0x32, .data[7] = 0x88, .data[8] = 0x88, },
2046 { .channel = 34, .freq = 5170, .data[0] = 0x00, .data[1] = 0x22,
2048 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2049 { .channel = 38, .freq = 5190, .data[0] = 0x00, .data[1] = 0x11,
2051 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2052 { .channel = 42, .freq = 5210, .data[0] = 0x00, .data[1] = 0x11,
2054 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2055 { .channel = 46, .freq = 5230, .data[0] = 0x00, .data[1] = 0x00,
2057 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2058 { .channel = 36, .freq = 5180, .data[0] = 0x00, .data[1] = 0x11,
2060 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2061 { .channel = 40, .freq = 5200, .data[0] = 0x00, .data[1] = 0x11,
2063 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2064 { .channel = 44, .freq = 5220, .data[0] = 0x00, .data[1] = 0x11,
2066 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2067 { .channel = 48, .freq = 5240, .data[0] = 0x00, .data[1] = 0x00,
2069 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2070 { .channel = 52, .freq = 5260, .data[0] = 0x00, .data[1] = 0x00,
2072 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2073 { .channel = 56, .freq = 5280, .data[0] = 0x00, .data[1] = 0x00,
2075 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2076 { .channel = 60, .freq = 5300, .data[0] = 0x00, .data[1] = 0x00,
2078 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2079 { .channel = 64, .freq = 5320, .data[0] = 0x00, .data[1] = 0x00,
2081 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2082 { .channel = 100, .freq = 5500, .data[0] = 0x00, .data[1] = 0x00,
2084 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2085 { .channel = 104, .freq = 5520, .data[0] = 0x00, .data[1] = 0x00,
2087 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2088 { .channel = 108, .freq = 5540, .data[0] = 0x00, .data[1] = 0x00,
2090 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2091 { .channel = 112, .freq = 5560, .data[0] = 0x00, .data[1] = 0x00,
2093 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2094 { .channel = 116, .freq = 5580, .data[0] = 0x00, .data[1] = 0x00,
2096 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2097 { .channel = 120, .freq = 5600, .data[0] = 0x00, .data[1] = 0x00,
2099 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2100 { .channel = 124, .freq = 5620, .data[0] = 0x00, .data[1] = 0x00,
2102 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2103 { .channel = 128, .freq = 5640, .data[0] = 0x00, .data[1] = 0x00,
2105 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2106 { .channel = 132, .freq = 5660, .data[0] = 0x00, .data[1] = 0x00,
2108 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2109 { .channel = 136, .freq = 5680, .data[0] = 0x00, .data[1] = 0x00,
2111 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2112 { .channel = 140, .freq = 5700, .data[0] = 0x00, .data[1] = 0x00,
2114 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2115 { .channel = 149, .freq = 5745, .data[0] = 0x00, .data[1] = 0x00,
2117 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2118 { .channel = 153, .freq = 5765, .data[0] = 0x00, .data[1] = 0x00,
2120 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2121 { .channel = 157, .freq = 5785, .data[0] = 0x00, .data[1] = 0x00,
2123 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2124 { .channel = 161, .freq = 5805, .data[0] = 0x00, .data[1] = 0x00,
2126 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2127 { .channel = 165, .freq = 5825, .data[0] = 0x00, .data[1] = 0x00,
2129 .data[6] = 0x37, .data[7] = 0xFF, .data[8] = 0x88, },
2130 { .channel = 184, .freq = 4920, .data[0] = 0x55, .data[1] = 0x77,
2132 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, },
2133 { .channel = 188, .freq = 4940, .data[0] = 0x44, .data[1] = 0x77,
2135 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, },
2136 { .channel = 192, .freq = 4960, .data[0] = 0x44, .data[1] = 0x66,
2138 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, },
2139 { .channel = 196, .freq = 4980, .data[0] = 0x33, .data[1] = 0x66,
2141 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, },
2142 { .channel = 200, .freq = 5000, .data[0] = 0x22, .data[1] = 0x55,
2144 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, },
2145 { .channel = 204, .freq = 5020, .data[0] = 0x22, .data[1] = 0x55,
2147 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, },
2148 { .channel = 208, .freq = 5040, .data[0] = 0x22, .data[1] = 0x44,
2150 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0xFF, },
2151 { .channel = 212, .freq = 5060, .data[0] = 0x11, .data[1] = 0x44,
2153 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2154 { .channel = 216, .freq = 5080, .data[0] = 0x00, .data[1] = 0x44,
2156 .data[6] = 0x35, .data[7] = 0xFF, .data[8] = 0x88, },
2160 { .channel = 1, .freq = 2412, .data[0] = 0x6F, .data[1] = 0x3C,
2162 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2164 { .channel = 2, .freq = 2417, .data[0] = 0x6F, .data[1] = 0x3C,
2166 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2168 { .channel = 3, .freq = 2422, .data[0] = 0x6F, .data[1] = 0x3C,
2170 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2172 { .channel = 4, .freq = 2427, .data[0] = 0x6F, .data[1] = 0x2C,
2174 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2176 { .channel = 5, .freq = 2432, .data[0] = 0x6F, .data[1] = 0x2C,
2178 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2180 { .channel = 6, .freq = 2437, .data[0] = 0x6F, .data[1] = 0x2C,
2182 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2184 { .channel = 7, .freq = 2442, .data[0] = 0x6F, .data[1] = 0x2C,
2186 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2188 { .channel = 8, .freq = 2447, .data[0] = 0x6F, .data[1] = 0x2C,
2190 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2192 { .channel = 9, .freq = 2452, .data[0] = 0x6F, .data[1] = 0x1C,
2194 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2196 { .channel = 10, .freq = 2457, .data[0] = 0x6F, .data[1] = 0x1C,
2198 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2200 { .channel = 11, .freq = 2462, .data[0] = 0x6E, .data[1] = 0x1C,
2202 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2204 { .channel = 12, .freq = 2467, .data[0] = 0x6E, .data[1] = 0x1C,
2206 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2208 { .channel = 13, .freq = 2472, .data[0] = 0x6E, .data[1] = 0x1C,
2210 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2212 { .channel = 14, .freq = 2484, .data[0] = 0x6E, .data[1] = 0x0C,
2214 .data[6] = 0x05, .data[7] = 0x05, .data[8] = 0x77, .data[9] = 0x80,
2216 { .channel = 34, .freq = 5170, .data[0] = 0x6A, .data[1] = 0x0C,
2218 .data[6] = 0x0D, .data[7] = 0x0D, .data[8] = 0x77, .data[9] = 0x80,
2220 { .channel = 36, .freq = 5180, .data[0] = 0x6A, .data[1] = 0x0C,
2222 .data[6] = 0x0D, .data[7] = 0x0C, .data[8] = 0x77, .data[9] = 0x80,
2224 { .channel = 38, .freq = 5190, .data[0] = 0x6A, .data[1] = 0x0C,
2226 .data[6] = 0x0C, .data[7] = 0x0C, .data[8] = 0x77, .data[9] = 0x80,
2228 { .channel = 40, .freq = 5200, .data[0] = 0x69, .data[1] = 0x0C,
2230 .data[6] = 0x0C, .data[7] = 0x0C, .data[8] = 0x77, .data[9] = 0x70,
2232 { .channel = 42, .freq = 5210, .data[0] = 0x69, .data[1] = 0x0C,
2234 .data[6] = 0x0B, .data[7] = 0x0C, .data[8] = 0x77, .data[9] = 0x70,
2236 { .channel = 44, .freq = 5220, .data[0] = 0x69, .data[1] = 0x0C,
2238 .data[6] = 0x0B, .data[7] = 0x0B, .data[8] = 0x77, .data[9] = 0x60,
2240 { .channel = 46, .freq = 5230, .data[0] = 0x69, .data[1] = 0x0C,
2242 .data[6] = 0x0A, .data[7] = 0x0B, .data[8] = 0x77, .data[9] = 0x60,
2244 { .channel = 48, .freq = 5240, .data[0] = 0x69, .data[1] = 0x0C,
2246 .data[6] = 0x0A, .data[7] = 0x0A, .data[8] = 0x77, .data[9] = 0x60,
2248 { .channel = 52, .freq = 5260, .data[0] = 0x68, .data[1] = 0x0C,
2250 .data[6] = 0x09, .data[7] = 0x09, .data[8] = 0x77, .data[9] = 0x60,
2252 { .channel = 56, .freq = 5280, .data[0] = 0x68, .data[1] = 0x0C,
2254 .data[6] = 0x08, .data[7] = 0x08, .data[8] = 0x77, .data[9] = 0x50,
2256 { .channel = 60, .freq = 5300, .data[0] = 0x68, .data[1] = 0x0C,
2258 .data[6] = 0x08, .data[7] = 0x08, .data[8] = 0x77, .data[9] = 0x50,
2260 { .channel = 64, .freq = 5320, .data[0] = 0x67, .data[1] = 0x0C,
2262 .data[6] = 0x08, .data[7] = 0x08, .data[8] = 0x77, .data[9] = 0x50,
2264 { .channel = 100, .freq = 5500, .data[0] = 0x64, .data[1] = 0x0C,
2266 .data[6] = 0x02, .data[7] = 0x01, .data[8] = 0x77, .data[9] = 0x20,
2268 { .channel = 104, .freq = 5520, .data[0] = 0x64, .data[1] = 0x0C,
2270 .data[6] = 0x01, .data[7] = 0x01, .data[8] = 0x77, .data[9] = 0x20,
2272 { .channel = 108, .freq = 5540, .data[0] = 0x63, .data[1] = 0x0C,
2274 .data[6] = 0x01, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x10,
2276 { .channel = 112, .freq = 5560, .data[0] = 0x63, .data[1] = 0x0C,
2278 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x10,
2280 { .channel = 116, .freq = 5580, .data[0] = 0x62, .data[1] = 0x0C,
2282 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x10,
2284 { .channel = 120, .freq = 5600, .data[0] = 0x62, .data[1] = 0x0C,
2286 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2288 { .channel = 124, .freq = 5620, .data[0] = 0x62, .data[1] = 0x0C,
2290 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2292 { .channel = 128, .freq = 5640, .data[0] = 0x61, .data[1] = 0x0C,
2294 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2296 { .channel = 132, .freq = 5660, .data[0] = 0x61, .data[1] = 0x0C,
2298 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2300 { .channel = 136, .freq = 5680, .data[0] = 0x61, .data[1] = 0x0C,
2302 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2304 { .channel = 140, .freq = 5700, .data[0] = 0x60, .data[1] = 0x0C,
2306 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2308 { .channel = 149, .freq = 5745, .data[0] = 0x60, .data[1] = 0x0C,
2310 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2312 { .channel = 153, .freq = 5765, .data[0] = 0x60, .data[1] = 0x0C,
2314 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2316 { .channel = 157, .freq = 5785, .data[0] = 0x60, .data[1] = 0x0C,
2318 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2320 { .channel = 161, .freq = 5805, .data[0] = 0x60, .data[1] = 0x0C,
2322 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2324 { .channel = 165, .freq = 5825, .data[0] = 0x60, .data[1] = 0x0C,
2326 .data[6] = 0x00, .data[7] = 0x00, .data[8] = 0x77, .data[9] = 0x00,
2328 { .channel = 184, .freq = 4920, .data[0] = 0x6E, .data[1] = 0x0C,
2330 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xC0,
2332 { .channel = 188, .freq = 4940, .data[0] = 0x6E, .data[1] = 0x0C,
2334 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xB0,
2336 { .channel = 192, .freq = 4960, .data[0] = 0x6E, .data[1] = 0x0C,
2338 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xB0,
2340 { .channel = 196, .freq = 4980, .data[0] = 0x6D, .data[1] = 0x0C,
2342 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xA0,
2344 { .channel = 200, .freq = 5000, .data[0] = 0x6D, .data[1] = 0x0C,
2346 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xA0,
2348 { .channel = 204, .freq = 5020, .data[0] = 0x6D, .data[1] = 0x0C,
2350 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0xA0,
2352 { .channel = 208, .freq = 5040, .data[0] = 0x6C, .data[1] = 0x0C,
2354 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0x90,
2356 { .channel = 212, .freq = 5060, .data[0] = 0x6C, .data[1] = 0x0C,
2358 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0x90,
2360 { .channel = 216, .freq = 5080, .data[0] = 0x6C, .data[1] = 0x0C,
2362 .data[6] = 0x0F, .data[7] = 0x0F, .data[8] = 0x77, .data[9] = 0x90,
2370 if (dev->dev->chip_id == 0x5354) { in lpphy_b2062_reset_pll_bias()
2387 unsigned int channel) in lpphy_b2062_tune() argument
2389 struct b43_phy_lp *lpphy = dev->phy.lp; in lpphy_b2062_tune()
2390 struct ssb_bus *bus = dev->dev->sdev->bus; in lpphy_b2062_tune()
2392 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; in lpphy_b2062_tune()
2397 if (b2062_chantbl[i].channel == channel) { in lpphy_b2062_tune()
2404 return -EINVAL; in lpphy_b2062_tune()
2407 b43_radio_write(dev, B2062_N_LGENA_TUNE0, chandata->data[0]); in lpphy_b2062_tune()
2408 b43_radio_write(dev, B2062_N_LGENA_TUNE2, chandata->data[1]); in lpphy_b2062_tune()
2409 b43_radio_write(dev, B2062_N_LGENA_TUNE3, chandata->data[2]); in lpphy_b2062_tune()
2410 b43_radio_write(dev, B2062_N_TX_TUNE, chandata->data[3]); in lpphy_b2062_tune()
2411 b43_radio_write(dev, B2062_S_LGENG_CTL1, chandata->data[4]); in lpphy_b2062_tune()
2412 b43_radio_write(dev, B2062_N_LGENA_CTL5, chandata->data[5]); in lpphy_b2062_tune()
2413 b43_radio_write(dev, B2062_N_LGENA_CTL6, chandata->data[6]); in lpphy_b2062_tune()
2414 b43_radio_write(dev, B2062_N_TX_PGA, chandata->data[7]); in lpphy_b2062_tune()
2415 b43_radio_write(dev, B2062_N_TX_PAD, chandata->data[8]); in lpphy_b2062_tune()
2418 tmp2 = lpphy->pdiv * 1000; in lpphy_b2062_tune()
2422 tmp3 = tmp2 * channel2freq_lp(channel); in lpphy_b2062_tune()
2423 if (channel2freq_lp(channel) < 4000) in lpphy_b2062_tune()
2453 err = -EIO; in lpphy_b2062_tune()
2478 unsigned int channel) in lpphy_b2063_tune() argument
2480 struct ssb_bus *bus = dev->dev->sdev->bus; in lpphy_b2063_tune()
2483 u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000; in lpphy_b2063_tune()
2490 if (b2063_chantbl[i].channel == channel) { in lpphy_b2063_tune()
2497 return -EINVAL; in lpphy_b2063_tune()
2499 b43_radio_write(dev, B2063_LOGEN_VCOBUF1, chandata->data[0]); in lpphy_b2063_tune()
2500 b43_radio_write(dev, B2063_LOGEN_MIXER2, chandata->data[1]); in lpphy_b2063_tune()
2501 b43_radio_write(dev, B2063_LOGEN_BUF2, chandata->data[2]); in lpphy_b2063_tune()
2502 b43_radio_write(dev, B2063_LOGEN_RCCR1, chandata->data[3]); in lpphy_b2063_tune()
2503 b43_radio_write(dev, B2063_A_RX_1ST3, chandata->data[4]); in lpphy_b2063_tune()
2504 b43_radio_write(dev, B2063_A_RX_2ND1, chandata->data[5]); in lpphy_b2063_tune()
2505 b43_radio_write(dev, B2063_A_RX_2ND4, chandata->data[6]); in lpphy_b2063_tune()
2506 b43_radio_write(dev, B2063_A_RX_2ND7, chandata->data[7]); in lpphy_b2063_tune()
2507 b43_radio_write(dev, B2063_A_RX_PS6, chandata->data[8]); in lpphy_b2063_tune()
2508 b43_radio_write(dev, B2063_TX_RF_CTL2, chandata->data[9]); in lpphy_b2063_tune()
2509 b43_radio_write(dev, B2063_TX_RF_CTL5, chandata->data[10]); in lpphy_b2063_tune()
2510 b43_radio_write(dev, B2063_PA_CTL11, chandata->data[11]); in lpphy_b2063_tune()
2515 if (chandata->freq > 4000) /* spec says 2484, but 4000 is safer */ in lpphy_b2063_tune()
2516 vco_freq = chandata->freq << 1; in lpphy_b2063_tune()
2518 vco_freq = chandata->freq << 2; in lpphy_b2063_tune()
2524 timeout = ((((8 * crystal_freq) / (div * 5000000)) + 1) >> 1) - 1; in lpphy_b2063_tune()
2537 count--; in lpphy_b2063_tune()
2546 tmp2 -= freqref; in lpphy_b2063_tune()
2559 tmp3 = ((41 * (val3 - 3000)) /1200) + 27; in lpphy_b2063_tune()
2562 if ((tmp4 + tmp3 - 1) / tmp3 > 60) { in lpphy_b2063_tune()
2564 tmp5 = ((tmp4 + tmp3) / (tmp3 << 1)) - 8; in lpphy_b2063_tune()
2567 tmp5 = ((tmp4 + (tmp3 >> 1)) / tmp3) - 8; in lpphy_b2063_tune()
2603 struct b43_phy_lp *lpphy = dev->phy.lp; in b43_lpphy_op_switch_channel()
2606 if (dev->phy.radio_ver == 0x2063) { in b43_lpphy_op_switch_channel()
2618 lpphy->channel = new_channel; in b43_lpphy_op_switch_channel()
2628 if (dev->dev->bus_type != B43_BUS_SSB) { in b43_lpphy_op_init()
2629 b43err(dev->wl, "LP-PHY is supported only on SSB!\n"); in b43_lpphy_op_init()
2630 return -EOPNOTSUPP; in b43_lpphy_op_init()
2637 err = b43_lpphy_op_switch_channel(dev, 7); in b43_lpphy_op_init()
2639 b43dbg(dev->wl, "Switch to channel 7 failed, error = %d.\n", in b43_lpphy_op_init()