forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/broadcom/b43/phy_n.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23
34 Broadcom B43 wireless driver
....@@ -6,23 +7,10 @@
67 Copyright (c) 2008 Michael Buesch <m@bues.ch>
78 Copyright (c) 2010-2011 Rafał Miłecki <zajec5@gmail.com>
89
9
- This program is free software; you can redistribute it and/or modify
10
- it under the terms of the GNU General Public License as published by
11
- the Free Software Foundation; either version 2 of the License, or
12
- (at your option) any later version.
13
-
14
- This program is distributed in the hope that it will be useful,
15
- but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- GNU General Public License for more details.
18
-
19
- You should have received a copy of the GNU General Public License
20
- along with this program; see the file COPYING. If not, write to
21
- the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
22
- Boston, MA 02110-1301, USA.
2310
2411 */
2512
13
+#include <linux/cordic.h>
2614 #include <linux/delay.h>
2715 #include <linux/slab.h>
2816 #include <linux/types.h>
....@@ -110,7 +98,7 @@
11098 (dev->phy.n->ipa5g_on && band == NL80211_BAND_5GHZ));
11199 }
112100
113
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreGetState */
101
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreGetState */
114102 static u8 b43_nphy_get_rx_core_state(struct b43_wldev *dev)
115103 {
116104 return (b43_phy_read(dev, B43_NPHY_RFSEQCA) & B43_NPHY_RFSEQCA_RXEN) >>
....@@ -121,7 +109,7 @@
121109 * RF (just without b43_nphy_rf_ctl_intc_override)
122110 **************************************************/
123111
124
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ForceRFSeq */
112
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ForceRFSeq */
125113 static void b43_nphy_force_rf_sequence(struct b43_wldev *dev,
126114 enum b43_nphy_rf_sequence seq)
127115 {
....@@ -158,7 +146,7 @@
158146 /* TODO */
159147 }
160148
161
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverrideRev7 */
149
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverrideRev7 */
162150 static void b43_nphy_rf_ctl_override_rev7(struct b43_wldev *dev, u16 field,
163151 u16 value, u8 core, bool off,
164152 u8 override)
....@@ -205,7 +193,7 @@
205193 }
206194 }
207195
208
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverideOneToMany */
196
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverideOneToMany */
209197 static void b43_nphy_rf_ctl_override_one_to_many(struct b43_wldev *dev,
210198 enum n_rf_ctl_over_cmd cmd,
211199 u16 value, u8 core, bool off)
....@@ -249,7 +237,7 @@
249237 }
250238 }
251239
252
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverride */
240
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlOverride */
253241 static void b43_nphy_rf_ctl_override(struct b43_wldev *dev, u16 field,
254242 u16 value, u8 core, bool off)
255243 {
....@@ -394,7 +382,7 @@
394382 }
395383 }
396384
397
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlIntcOverride */
385
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RFCtrlIntcOverride */
398386 static void b43_nphy_rf_ctl_intc_override(struct b43_wldev *dev,
399387 enum n_intc_override intc_override,
400388 u16 value, u8 core)
....@@ -502,7 +490,7 @@
502490 * Various PHY ops
503491 **************************************************/
504492
505
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
493
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
506494 static void b43_nphy_write_clip_detection(struct b43_wldev *dev,
507495 const u16 *clip_st)
508496 {
....@@ -510,14 +498,14 @@
510498 b43_phy_write(dev, B43_NPHY_C2_CLIP1THRES, clip_st[1]);
511499 }
512500
513
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
501
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/clip-detection */
514502 static void b43_nphy_read_clip_detection(struct b43_wldev *dev, u16 *clip_st)
515503 {
516504 clip_st[0] = b43_phy_read(dev, B43_NPHY_C1_CLIP1THRES);
517505 clip_st[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES);
518506 }
519507
520
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */
508
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */
521509 static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
522510 {
523511 u16 tmp;
....@@ -538,7 +526,7 @@
538526 return tmp;
539527 }
540528
541
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */
529
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CCA */
542530 static void b43_nphy_reset_cca(struct b43_wldev *dev)
543531 {
544532 u16 bbcfg;
....@@ -552,7 +540,7 @@
552540 b43_nphy_force_rf_sequence(dev, B43_RFSEQ_RESET2RX);
553541 }
554542
555
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/carriersearch */
543
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/carriersearch */
556544 static void b43_nphy_stay_in_carrier_search(struct b43_wldev *dev, bool enable)
557545 {
558546 struct b43_phy *phy = &dev->phy;
....@@ -576,7 +564,7 @@
576564 }
577565 }
578566
579
-/* http://bcm-v4.sipsolutions.net/PHY/N/Read_Lpf_Bw_Ctl */
567
+/* https://bcm-v4.sipsolutions.net/PHY/N/Read_Lpf_Bw_Ctl */
580568 static u16 b43_nphy_read_lpf_ctl(struct b43_wldev *dev, u16 offset)
581569 {
582570 if (!offset)
....@@ -584,7 +572,7 @@
584572 return b43_ntab_read(dev, B43_NTAB16(7, offset)) & 0x7;
585573 }
586574
587
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/AdjustLnaGainTbl */
575
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/AdjustLnaGainTbl */
588576 static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)
589577 {
590578 struct b43_phy_n *nphy = dev->phy.n;
....@@ -594,7 +582,7 @@
594582 u16 data[4];
595583 s16 gain[2];
596584 u16 minmax[2];
597
- static const u16 lna_gain[4] = { -2, 10, 19, 25 };
585
+ static const s16 lna_gain[4] = { -2, 10, 19, 25 };
598586
599587 if (nphy->hang_avoid)
600588 b43_nphy_stay_in_carrier_search(dev, 1);
....@@ -640,7 +628,7 @@
640628 b43_nphy_stay_in_carrier_search(dev, 0);
641629 }
642630
643
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRfSeq */
631
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRfSeq */
644632 static void b43_nphy_set_rf_sequence(struct b43_wldev *dev, u8 cmd,
645633 u8 *events, u8 *delays, u8 length)
646634 {
....@@ -817,7 +805,7 @@
817805 }
818806
819807 /* Calibrate resistors in LPF of PLL?
820
- * http://bcm-v4.sipsolutions.net/PHY/radio205x_rcal
808
+ * https://bcm-v4.sipsolutions.net/PHY/radio205x_rcal
821809 */
822810 static u8 b43_radio_2057_rcal(struct b43_wldev *dev)
823811 {
....@@ -931,7 +919,7 @@
931919 }
932920
933921 /* Calibrate the internal RC oscillator?
934
- * http://bcm-v4.sipsolutions.net/PHY/radio2057_rccal
922
+ * https://bcm-v4.sipsolutions.net/PHY/radio2057_rccal
935923 */
936924 static u16 b43_radio_2057_rccal(struct b43_wldev *dev)
937925 {
....@@ -1042,7 +1030,7 @@
10421030 b43_radio_mask(dev, R2057_RFPLL_MASTER, ~0x8);
10431031 }
10441032
1045
-/* http://bcm-v4.sipsolutions.net/802.11/Radio/2057/Init */
1033
+/* https://bcm-v4.sipsolutions.net/802.11/Radio/2057/Init */
10461034 static void b43_radio_2057_init(struct b43_wldev *dev)
10471035 {
10481036 b43_radio_2057_init_pre(dev);
....@@ -1129,7 +1117,7 @@
11291117 e->radio_tx1_mixg_boost_tune);
11301118 }
11311119
1132
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2056Setup */
1120
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2056Setup */
11331121 static void b43_radio_2056_setup(struct b43_wldev *dev,
11341122 const struct b43_nphy_channeltab_entry_rev3 *e)
11351123 {
....@@ -1368,7 +1356,7 @@
13681356
13691357 /*
13701358 * Initialize a Broadcom 2056 N-radio
1371
- * http://bcm-v4.sipsolutions.net/802.11/Radio/2056/Init
1359
+ * https://bcm-v4.sipsolutions.net/802.11/Radio/2056/Init
13721360 */
13731361 static void b43_radio_init2056(struct b43_wldev *dev)
13741362 {
....@@ -1418,7 +1406,7 @@
14181406 b43_radio_write(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim);
14191407 }
14201408
1421
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
1409
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
14221410 static void b43_radio_2055_setup(struct b43_wldev *dev,
14231411 const struct b43_nphy_channeltab_entry_rev2 *e)
14241412 {
....@@ -1492,7 +1480,7 @@
14921480
14931481 /*
14941482 * Initialize a Broadcom 2055 N-radio
1495
- * http://bcm-v4.sipsolutions.net/802.11/Radio/2055/Init
1483
+ * https://bcm-v4.sipsolutions.net/802.11/Radio/2055/Init
14961484 */
14971485 static void b43_radio_init2055(struct b43_wldev *dev)
14981486 {
....@@ -1511,9 +1499,9 @@
15111499 * Samples
15121500 **************************************************/
15131501
1514
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/LoadSampleTable */
1502
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/LoadSampleTable */
15151503 static int b43_nphy_load_samples(struct b43_wldev *dev,
1516
- struct b43_c32 *samples, u16 len) {
1504
+ struct cordic_iq *samples, u16 len) {
15171505 struct b43_phy_n *nphy = dev->phy.n;
15181506 u16 i;
15191507 u32 *data;
....@@ -1538,13 +1526,13 @@
15381526 return 0;
15391527 }
15401528
1541
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */
1529
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/GenLoadSamples */
15421530 static u16 b43_nphy_gen_load_samples(struct b43_wldev *dev, u32 freq, u16 max,
15431531 bool test)
15441532 {
15451533 int i;
15461534 u16 bw, len, rot, angle;
1547
- struct b43_c32 *samples;
1535
+ struct cordic_iq *samples;
15481536
15491537 bw = b43_is_40mhz(dev) ? 40 : 20;
15501538 len = bw << 3;
....@@ -1561,7 +1549,7 @@
15611549 len = bw << 1;
15621550 }
15631551
1564
- samples = kcalloc(len, sizeof(struct b43_c32), GFP_KERNEL);
1552
+ samples = kcalloc(len, sizeof(struct cordic_iq), GFP_KERNEL);
15651553 if (!samples) {
15661554 b43err(dev->wl, "allocation for samples generation failed\n");
15671555 return 0;
....@@ -1570,10 +1558,10 @@
15701558 angle = 0;
15711559
15721560 for (i = 0; i < len; i++) {
1573
- samples[i] = b43_cordic(angle);
1561
+ samples[i] = cordic_calc_iq(CORDIC_FIXED(angle));
15741562 angle += rot;
1575
- samples[i].q = CORDIC_CONVERT(samples[i].q * max);
1576
- samples[i].i = CORDIC_CONVERT(samples[i].i * max);
1563
+ samples[i].q = CORDIC_FLOAT(samples[i].q * max);
1564
+ samples[i].i = CORDIC_FLOAT(samples[i].i * max);
15771565 }
15781566
15791567 i = b43_nphy_load_samples(dev, samples, len);
....@@ -1581,7 +1569,7 @@
15811569 return (i < 0) ? 0 : len;
15821570 }
15831571
1584
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
1572
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RunSamples */
15851573 static void b43_nphy_run_samples(struct b43_wldev *dev, u16 samps, u16 loops,
15861574 u16 wait, bool iqmode, bool dac_test,
15871575 bool modify_bbmult)
....@@ -1662,7 +1650,7 @@
16621650 * RSSI
16631651 **************************************************/
16641652
1665
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */
1653
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ScaleOffsetRssi */
16661654 static void b43_nphy_scale_offset_rssi(struct b43_wldev *dev, u16 scale,
16671655 s8 offset, u8 core,
16681656 enum n_rail_type rail,
....@@ -1907,7 +1895,7 @@
19071895 }
19081896 }
19091897
1910
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSISel */
1898
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSISel */
19111899 static void b43_nphy_rssi_select(struct b43_wldev *dev, u8 code,
19121900 enum n_rssi_type type)
19131901 {
....@@ -1919,7 +1907,7 @@
19191907 b43_nphy_rev2_rssi_select(dev, code, type);
19201908 }
19211909
1922
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRssi2055Vcm */
1910
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SetRssi2055Vcm */
19231911 static void b43_nphy_set_rssi_2055_vcm(struct b43_wldev *dev,
19241912 enum n_rssi_type rssi_type, u8 *buf)
19251913 {
....@@ -1948,7 +1936,7 @@
19481936 }
19491937 }
19501938
1951
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/PollRssi */
1939
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/PollRssi */
19521940 static int b43_nphy_poll_rssi(struct b43_wldev *dev, enum n_rssi_type rssi_type,
19531941 s32 *buf, u8 nsamp)
19541942 {
....@@ -2037,7 +2025,7 @@
20372025 return out;
20382026 }
20392027
2040
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */
2028
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICalRev3 */
20412029 static void b43_nphy_rev3_rssi_cal(struct b43_wldev *dev)
20422030 {
20432031 struct b43_phy *phy = &dev->phy;
....@@ -2299,7 +2287,7 @@
22992287 b43_nphy_write_clip_detection(dev, clip_state);
23002288 }
23012289
2302
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal */
2290
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal */
23032291 static void b43_nphy_rev2_rssi_cal(struct b43_wldev *dev, enum n_rssi_type type)
23042292 {
23052293 int i, j, vcm;
....@@ -2465,7 +2453,7 @@
24652453
24662454 /*
24672455 * RSSI Calibration
2468
- * http://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal
2456
+ * https://bcm-v4.sipsolutions.net/802.11/PHY/N/RSSICal
24692457 */
24702458 static void b43_nphy_rssi_cal(struct b43_wldev *dev)
24712459 {
....@@ -2692,7 +2680,7 @@
26922680 b43_phy_maskset(dev, B43_PHY_N(0xC5D), 0xFF80, 4);
26932681 }
26942682
2695
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */
2683
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */
26962684 static void b43_nphy_gain_ctl_workarounds(struct b43_wldev *dev)
26972685 {
26982686 if (dev->phy.rev >= 19)
....@@ -3251,7 +3239,7 @@
32513239 if (!(dev->phy.rev >= 4 &&
32523240 b43_current_band(dev->wl) == NL80211_BAND_2GHZ))
32533241 break;
3254
- /* FALL THROUGH */
3242
+ fallthrough;
32553243 case 0:
32563244 case 1:
32573245 b43_ntab_write_bulk(dev, B43_NTAB16(8, 0x08), 4, vmid);
....@@ -3354,8 +3342,9 @@
33543342 b43_phy_write(dev, B43_NPHY_ED_CRS20UDEASSERTTHRESH0, 0x0381);
33553343 b43_phy_write(dev, B43_NPHY_ED_CRS20UDEASSERTTHRESH1, 0x0381);
33563344
3357
- if (dev->phy.rev >= 6 && sprom->boardflags2_lo & B43_BFL2_SINGLEANT_CCK)
3345
+ if (dev->phy.rev >= 6 && sprom->boardflags2_lo & B43_BFL2_SINGLEANT_CCK) {
33583346 ; /* TODO: 0x0080000000000000 HF */
3347
+ }
33593348 }
33603349
33613350 static void b43_nphy_workarounds_rev1_2(struct b43_wldev *dev)
....@@ -3445,7 +3434,7 @@
34453434 B43_NPHY_FINERX2_CGC_DECGC);
34463435 }
34473436
3448
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */
3437
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/Workarounds */
34493438 static void b43_nphy_workarounds(struct b43_wldev *dev)
34503439 {
34513440 struct b43_phy *phy = &dev->phy;
....@@ -3480,7 +3469,7 @@
34803469
34813470 /*
34823471 * Transmits a known value for LO calibration
3483
- * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone
3472
+ * https://bcm-v4.sipsolutions.net/802.11/PHY/N/TXTone
34843473 */
34853474 static int b43_nphy_tx_tone(struct b43_wldev *dev, u32 freq, u16 max_val,
34863475 bool iqmode, bool dac_test, bool modify_bbmult)
....@@ -3493,7 +3482,7 @@
34933482 return 0;
34943483 }
34953484
3496
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/Chains */
3485
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/Chains */
34973486 static void b43_nphy_update_txrx_chain(struct b43_wldev *dev)
34983487 {
34993488 struct b43_phy_n *nphy = dev->phy.n;
....@@ -3521,7 +3510,7 @@
35213510 ~B43_NPHY_RFSEQMODE_CAOVER);
35223511 }
35233512
3524
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/stop-playback */
3513
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/stop-playback */
35253514 static void b43_nphy_stop_playback(struct b43_wldev *dev)
35263515 {
35273516 struct b43_phy *phy = &dev->phy;
....@@ -3558,7 +3547,7 @@
35583547 b43_nphy_stay_in_carrier_search(dev, 0);
35593548 }
35603549
3561
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IqCalGainParams */
3550
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/IqCalGainParams */
35623551 static void b43_nphy_iq_cal_gain_params(struct b43_wldev *dev, u16 core,
35633552 struct nphy_txgains target,
35643553 struct nphy_iqcal_params *params)
....@@ -3607,7 +3596,7 @@
36073596 * Tx and Rx
36083597 **************************************************/
36093598
3610
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlEnable */
3599
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlEnable */
36113600 static void b43_nphy_tx_power_ctrl(struct b43_wldev *dev, bool enable)
36123601 {
36133602 struct b43_phy *phy = &dev->phy;
....@@ -3744,7 +3733,7 @@
37443733 b43_nphy_stay_in_carrier_search(dev, 0);
37453734 }
37463735
3747
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */
3736
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrFix */
37483737 static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
37493738 {
37503739 struct b43_phy *phy = &dev->phy;
....@@ -3938,7 +3927,7 @@
39383927 /*
39393928 * Stop radio and transmit known signal. Then check received signal strength to
39403929 * get TSSI (Transmit Signal Strength Indicator).
3941
- * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlIdleTssi
3930
+ * https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlIdleTssi
39423931 */
39433932 static void b43_nphy_tx_power_ctl_idle_tssi(struct b43_wldev *dev)
39443933 {
....@@ -3990,7 +3979,7 @@
39903979 nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF;
39913980 }
39923981
3993
-/* http://bcm-v4.sipsolutions.net/PHY/N/TxPwrLimitToTbl */
3982
+/* https://bcm-v4.sipsolutions.net/PHY/N/TxPwrLimitToTbl */
39943983 static void b43_nphy_tx_prepare_adjusted_power_table(struct b43_wldev *dev)
39953984 {
39963985 struct b43_phy_n *nphy = dev->phy.n;
....@@ -4051,7 +4040,7 @@
40514040 }
40524041 }
40534042
4054
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlSetup */
4043
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlSetup */
40554044 static void b43_nphy_tx_power_ctl_setup(struct b43_wldev *dev)
40564045 {
40574046 struct b43_phy *phy = &dev->phy;
....@@ -4234,7 +4223,7 @@
42344223 u32 rfpwr_offset;
42354224 u8 pga_gain, pad_gain;
42364225 int i;
4237
- const s16 *uninitialized_var(rf_pwr_offset_table);
4226
+ const s16 *rf_pwr_offset_table = NULL;
42384227
42394228 table = b43_nphy_get_tx_gain_table(dev);
42404229 if (!table)
....@@ -4284,7 +4273,7 @@
42844273 }
42854274 }
42864275
4287
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/PA%20override */
4276
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/PA%20override */
42884277 static void b43_nphy_pa_override(struct b43_wldev *dev, bool enable)
42894278 {
42904279 struct b43_phy_n *nphy = dev->phy.n;
....@@ -4322,7 +4311,7 @@
43224311
43234312 /*
43244313 * TX low-pass filter bandwidth setup
4325
- * http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxLpFbw
4314
+ * https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxLpFbw
43264315 */
43274316 static void b43_nphy_tx_lpf_bw(struct b43_wldev *dev)
43284317 {
....@@ -4345,7 +4334,7 @@
43454334 }
43464335 }
43474336
4348
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqEst */
4337
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqEst */
43494338 static void b43_nphy_rx_iq_est(struct b43_wldev *dev, struct nphy_iq_est *est,
43504339 u16 samps, u8 time, bool wait)
43514340 {
....@@ -4384,7 +4373,7 @@
43844373 memset(est, 0, sizeof(*est));
43854374 }
43864375
4387
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqCoeffs */
4376
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxIqCoeffs */
43884377 static void b43_nphy_rx_iq_coeffs(struct b43_wldev *dev, bool write,
43894378 struct b43_phy_n_iq_comp *pcomp)
43904379 {
....@@ -4403,7 +4392,7 @@
44034392
44044393 #if 0
44054394 /* Ready but not used anywhere */
4406
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhyCleanup */
4395
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhyCleanup */
44074396 static void b43_nphy_rx_cal_phy_cleanup(struct b43_wldev *dev, u8 core)
44084397 {
44094398 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
....@@ -4426,7 +4415,7 @@
44264415 b43_phy_write(dev, B43_NPHY_PAPD_EN1, regs[10]);
44274416 }
44284417
4429
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhySetup */
4418
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCalPhySetup */
44304419 static void b43_nphy_rx_cal_phy_setup(struct b43_wldev *dev, u8 core)
44314420 {
44324421 u8 rxval, txval;
....@@ -4488,7 +4477,7 @@
44884477 }
44894478 #endif
44904479
4491
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalcRxIqComp */
4480
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CalcRxIqComp */
44924481 static void b43_nphy_calc_rx_iq_comp(struct b43_wldev *dev, u8 mask)
44934482 {
44944483 int i;
....@@ -4586,7 +4575,7 @@
45864575 b43_nphy_rx_iq_coeffs(dev, true, &new);
45874576 }
45884577
4589
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxIqWar */
4578
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxIqWar */
45904579 static void b43_nphy_tx_iq_workaround(struct b43_wldev *dev)
45914580 {
45924581 u16 array[4];
....@@ -4598,7 +4587,7 @@
45984587 b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_NPHY_TXIQW3, array[3]);
45994588 }
46004589
4601
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SpurWar */
4590
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SpurWar */
46024591 static void b43_nphy_spur_workaround(struct b43_wldev *dev)
46034592 {
46044593 struct b43_phy_n *nphy = dev->phy.n;
....@@ -4614,10 +4603,11 @@
46144603
46154604 if (nphy->gband_spurwar_en) {
46164605 /* TODO: N PHY Adjust Analog Pfbw (7) */
4617
- if (channel == 11 && b43_is_40mhz(dev))
4606
+ if (channel == 11 && b43_is_40mhz(dev)) {
46184607 ; /* TODO: N PHY Adjust Min Noise Var(2, tone, noise)*/
4619
- else
4608
+ } else {
46204609 ; /* TODO: N PHY Adjust Min Noise Var(0, NULL, NULL)*/
4610
+ }
46214611 /* TODO: N PHY Adjust CRS Min Power (0x1E) */
46224612 }
46234613
....@@ -4647,17 +4637,18 @@
46474637 noise[0] = 0;
46484638 }
46494639
4650
- if (!tone[0] && !noise[0])
4640
+ if (!tone[0] && !noise[0]) {
46514641 ; /* TODO: N PHY Adjust Min Noise Var(1, tone, noise)*/
4652
- else
4642
+ } else {
46534643 ; /* TODO: N PHY Adjust Min Noise Var(0, NULL, NULL)*/
4644
+ }
46544645 }
46554646
46564647 if (nphy->hang_avoid)
46574648 b43_nphy_stay_in_carrier_search(dev, 0);
46584649 }
46594650
4660
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */
4651
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxPwrCtrlCoefSetup */
46614652 static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
46624653 {
46634654 struct b43_phy_n *nphy = dev->phy.n;
....@@ -4725,7 +4716,7 @@
47254716
47264717 /*
47274718 * Restore RSSI Calibration
4728
- * http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreRssiCal
4719
+ * https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreRssiCal
47294720 */
47304721 static void b43_nphy_restore_rssi_cal(struct b43_wldev *dev)
47314722 {
....@@ -4834,7 +4825,7 @@
48344825 }
48354826 }
48364827
4837
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalRadioSetup */
4828
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalRadioSetup */
48384829 static void b43_nphy_tx_cal_radio_setup(struct b43_wldev *dev)
48394830 {
48404831 struct b43_phy *phy = &dev->phy;
....@@ -4933,7 +4924,7 @@
49334924 }
49344925 }
49354926
4936
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/UpdateTxCalLadder */
4927
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/UpdateTxCalLadder */
49374928 static void b43_nphy_update_tx_cal_ladder(struct b43_wldev *dev, u16 core)
49384929 {
49394930 struct b43_phy_n *nphy = dev->phy.n;
....@@ -4967,14 +4958,14 @@
49674958 b43_phy_write(dev, offset, filter[i]);
49684959 }
49694960
4970
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ExtPaSetTxDigiFilts */
4961
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ExtPaSetTxDigiFilts */
49714962 static void b43_nphy_ext_pa_set_tx_dig_filters(struct b43_wldev *dev)
49724963 {
49734964 b43_nphy_pa_set_tx_dig_filter(dev, 0x2C5,
49744965 tbl_tx_filter_coef_rev4[2]);
49754966 }
49764967
4977
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/IpaSetTxDigiFilts */
4968
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/IpaSetTxDigiFilts */
49784969 static void b43_nphy_int_pa_set_tx_dig_filters(struct b43_wldev *dev)
49794970 {
49804971 /* B43_NPHY_TXF_20CO_S0A1, B43_NPHY_TXF_40CO_S0A1, unknown */
....@@ -5014,7 +5005,7 @@
50145005 }
50155006 }
50165007
5017
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetTxGain */
5008
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/GetTxGain */
50185009 static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
50195010 {
50205011 struct b43_phy_n *nphy = dev->phy.n;
....@@ -5089,7 +5080,7 @@
50895080 return target;
50905081 }
50915082
5092
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhyCleanup */
5083
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhyCleanup */
50935084 static void b43_nphy_tx_cal_phy_cleanup(struct b43_wldev *dev)
50945085 {
50955086 u16 *regs = dev->phy.n->tx_rx_cal_phy_saveregs;
....@@ -5118,7 +5109,7 @@
51185109 }
51195110 }
51205111
5121
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhySetup */
5112
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/TxCalPhySetup */
51225113 static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
51235114 {
51245115 struct b43_phy *phy = &dev->phy;
....@@ -5219,7 +5210,7 @@
52195210 }
52205211 }
52215212
5222
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SaveCal */
5213
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SaveCal */
52235214 static void b43_nphy_save_cal(struct b43_wldev *dev)
52245215 {
52255216 struct b43_phy *phy = &dev->phy;
....@@ -5290,7 +5281,7 @@
52905281 b43_nphy_stay_in_carrier_search(dev, 0);
52915282 }
52925283
5293
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
5284
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RestoreCal */
52945285 static void b43_nphy_restore_cal(struct b43_wldev *dev)
52955286 {
52965287 struct b43_phy *phy = &dev->phy;
....@@ -5378,7 +5369,7 @@
53785369 b43_nphy_rx_iq_coeffs(dev, true, rxcal_coeffs);
53795370 }
53805371
5381
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalTxIqlo */
5372
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CalTxIqlo */
53825373 static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
53835374 struct nphy_txgains target,
53845375 bool full, bool mphase)
....@@ -5519,7 +5510,7 @@
55195510 core = (cmd & 0x3000) >> 12;
55205511 type = (cmd & 0x0F00) >> 8;
55215512
5522
- if (phy6or5x && updated[core] == 0) {
5513
+ if (phy6or5x && !updated[core]) {
55235514 b43_nphy_update_tx_cal_ladder(dev, core);
55245515 updated[core] = true;
55255516 }
....@@ -5611,7 +5602,7 @@
56115602 return error;
56125603 }
56135604
5614
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ReapplyTxCalCoeffs */
5605
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ReapplyTxCalCoeffs */
56155606 static void b43_nphy_reapply_tx_cal_coeffs(struct b43_wldev *dev)
56165607 {
56175608 struct b43_phy_n *nphy = dev->phy.n;
....@@ -5646,7 +5637,7 @@
56465637 }
56475638 }
56485639
5649
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIqRev2 */
5640
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIqRev2 */
56505641 static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
56515642 struct nphy_txgains target, u8 type, bool debug)
56525643 {
....@@ -5655,7 +5646,7 @@
56555646 u8 rfctl[2];
56565647 u8 afectl_core;
56575648 u16 tmp[6];
5658
- u16 uninitialized_var(cur_hpf1), uninitialized_var(cur_hpf2), cur_lna;
5649
+ u16 cur_hpf1, cur_hpf2, cur_lna;
56595650 u32 real, imag;
56605651 enum nl80211_band band;
56615652
....@@ -5833,7 +5824,7 @@
58335824 return -1;
58345825 }
58355826
5836
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIq */
5827
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/CalRxIq */
58375828 static int b43_nphy_cal_rx_iq(struct b43_wldev *dev,
58385829 struct nphy_txgains target, u8 type, bool debug)
58395830 {
....@@ -5846,7 +5837,7 @@
58465837 return b43_nphy_rev2_cal_rx_iq(dev, target, type, debug);
58475838 }
58485839
5849
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreSetState */
5840
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/RxCoreSetState */
58505841 static void b43_nphy_set_rx_core_state(struct b43_wldev *dev, u8 mask)
58515842 {
58525843 struct b43_phy *phy = &dev->phy;
....@@ -5894,7 +5885,6 @@
58945885 struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan;
58955886 struct b43_ppr *ppr = &nphy->tx_pwr_max_ppr;
58965887 u8 max; /* qdBm */
5897
- bool tx_pwr_state;
58985888
58995889 if (nphy->tx_pwr_last_recalc_freq == channel->center_freq &&
59005890 nphy->tx_pwr_last_recalc_limit == phy->desired_txpower)
....@@ -5930,7 +5920,6 @@
59305920 b43_ppr_apply_min(dev, ppr, INT_TO_Q52(8));
59315921
59325922 /* Apply */
5933
- tx_pwr_state = nphy->txpwrctrl;
59345923 b43_mac_suspend(dev);
59355924 b43_nphy_tx_power_ctl_setup(dev);
59365925 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) {
....@@ -5953,7 +5942,7 @@
59535942 * N-PHY init
59545943 **************************************************/
59555944
5956
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/MIMOConfig */
5945
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/MIMOConfig */
59575946 static void b43_nphy_update_mimo_config(struct b43_wldev *dev, s32 preamble)
59585947 {
59595948 u16 mimocfg = b43_phy_read(dev, B43_NPHY_MIMOCFG);
....@@ -5967,7 +5956,7 @@
59675956 b43_phy_write(dev, B43_NPHY_MIMOCFG, mimocfg);
59685957 }
59695958
5970
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/BPHYInit */
5959
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/BPHYInit */
59715960 static void b43_nphy_bphy_init(struct b43_wldev *dev)
59725961 {
59735962 unsigned int i;
....@@ -5986,7 +5975,7 @@
59865975 b43_phy_write(dev, B43_PHY_N_BMODE(0x38), 0x668);
59875976 }
59885977
5989
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SuperSwitchInit */
5978
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SuperSwitchInit */
59905979 static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init)
59915980 {
59925981 if (dev->phy.rev >= 7)
....@@ -6043,7 +6032,6 @@
60436032 u8 tx_pwr_state;
60446033 struct nphy_txgains target;
60456034 u16 tmp;
6046
- enum nl80211_band tmp2;
60476035 bool do_rssi_cal;
60486036
60496037 u16 clip[2];
....@@ -6137,7 +6125,6 @@
61376125 b43_phy_write(dev, B43_NPHY_DUP40_BL, 0x9A4);
61386126 }
61396127
6140
- tmp2 = b43_current_band(dev->wl);
61416128 if (b43_nphy_ipa(dev)) {
61426129 b43_phy_set(dev, B43_NPHY_PAPD_EN0, 0x1);
61436130 b43_phy_maskset(dev, B43_NPHY_EPS_TABLE_ADJ0, 0x007F,
....@@ -6182,8 +6169,9 @@
61826169
61836170 if (nphy->phyrxchain != 3)
61846171 b43_nphy_set_rx_core_state(dev, nphy->phyrxchain);
6185
- if (nphy->mphase_cal_phase_id > 0)
6172
+ if (nphy->mphase_cal_phase_id > 0) {
61866173 ;/* TODO PHY Periodic Calibration Multi-Phase Restart */
6174
+ }
61876175
61886176 do_rssi_cal = false;
61896177 if (phy->rev >= 3) {
....@@ -6227,8 +6215,9 @@
62276215 if (!b43_nphy_cal_tx_iq_lo(dev, target, true, false))
62286216 if (b43_nphy_cal_rx_iq(dev, target, 2, 0) == 0)
62296217 b43_nphy_save_cal(dev);
6230
- } else if (nphy->mphase_cal_phase_id == 0)
6218
+ } else if (nphy->mphase_cal_phase_id == 0) {
62316219 ;/* N PHY Periodic Calibration with arg 3 */
6220
+ }
62326221 } else {
62336222 b43_nphy_restore_cal(dev);
62346223 }
....@@ -6262,7 +6251,7 @@
62626251 b43_phy_write(dev, B43_NPHY_BW6, e->phy_bw6);
62636252 }
62646253
6265
-/* http://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */
6254
+/* https://bcm-v4.sipsolutions.net/802.11/PmuSpurAvoid */
62666255 static void b43_nphy_pmu_spur_avoid(struct b43_wldev *dev, bool avoid)
62676256 {
62686257 switch (dev->dev->bus_type) {
....@@ -6281,7 +6270,7 @@
62816270 }
62826271 }
62836272
6284
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */
6273
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */
62856274 static void b43_nphy_channel_setup(struct b43_wldev *dev,
62866275 const struct b43_phy_n_sfo_cfg *e,
62876276 struct ieee80211_channel *new_channel)
....@@ -6388,7 +6377,7 @@
63886377 b43_nphy_spur_workaround(dev);
63896378 }
63906379
6391
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */
6380
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */
63926381 static int b43_nphy_set_channel(struct b43_wldev *dev,
63936382 struct ieee80211_channel *channel,
63946383 enum nl80211_channel_type channel_type)
....@@ -6605,7 +6594,7 @@
66056594 b43_write16(dev, B43_MMIO_RADIO_DATA_LOW, value);
66066595 }
66076596
6608
-/* http://bcm-v4.sipsolutions.net/802.11/Radio/Switch%20Radio */
6597
+/* https://bcm-v4.sipsolutions.net/802.11/Radio/Switch%20Radio */
66096598 static void b43_nphy_op_software_rfkill(struct b43_wldev *dev,
66106599 bool blocked)
66116600 {
....@@ -6659,7 +6648,7 @@
66596648 }
66606649 }
66616650
6662
-/* http://bcm-v4.sipsolutions.net/802.11/PHY/Anacore */
6651
+/* https://bcm-v4.sipsolutions.net/802.11/PHY/Anacore */
66636652 static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
66646653 {
66656654 struct b43_phy *phy = &dev->phy;