bcm-v4 [Specification]

N PHY TX Power Fix

1. Establish a 2-element u8 array named txpi
2. Establish a u32 pointer named gaintbl
3. If phyhang_avoid

1. Call N PHY Stay in Carrier Search with argument 1

4. If the SPROM Revision < 4

1. Set txpi[0] and txpi[1] to 72
5. Otherwise
1. Call 802.11/PHY/N/GetChanFreqRange with argument 0, save return in tmp

2. If tmp is zero
1. Set txpi[i] to nphy_txpid2g[i] for i = 0, 1

3. Else if tmp is 1
1. Set txpi[i] to nphy_txpid5gl[i] for i = 0, 1

4. Else if tmp is 2
1. Set txpi[i] to nphy_txpid5g[i] for i = 0, 1

5. Else if tmp is 3
1. Set txpi[i] to nphy_txpid5gh[i] for i = 0, 1

6. Otherwise
1. Set txpi[i] to 91 for i = 0, 1
6. If PHY Revision >= 7

1. Set txpi[i] to 30 for i = 0,1
7. Else if PHY Revision >= 3

1. Set txpi[i] to 40 for i = 0, 1
8. If PHY Revision < 7

1. If txpi[0] < 40 PR txpi[0] > 100 OR If txpi[1] < 40 PR txpi[1] > 100

1. Set txpi[i] to 91 for i = 0, 1
9. Set nphy_txpwrindex[i].index_internal = txpi[i] for i = 0, 1

10. Set nphy_txpwrindex[i].index_internal_save = txpi[i] for i = 0, 1

11. Loop 2 times with index i
1. If PHY Revision >= 3

1. If ((nphy_ipa2g_on and band is 2 GHz) or (nphy_ipa5g_on and band is 5 GHz))

1. Set gaintbl to the output of N PHY Get IPA Gain Table

2. Set txgain to gaintbl[txpi[i]]
2. Otherwise
1. If the band if 5 GHz
1. If PHY Revision is 3
1. Set txgain to nphy_txpwrctrl_5GHz_txgain_rev3[txpi[i]]
2. Else if PHY Revision is 4
1. If SPROM FEM 5G extpa_gain is 3
1. Set txgain to nphy_tpc_5GHz_txgain_HiPwrEPA[txpi[i]]
2. Otherwise
1. Set txgain to nphy_txpwrctrl_5GHz_txgain_rev4[txpi[i]]
3. Otherwise
1. Set txgain to nphy_txpwrctrl_5GHz_txgain_rev5[txpi[i]]
2. Otherwise
1. If PHY Revision >= 5 AND SPROM FEM 5G extpa_gain is 3

1. Set txgain to nphy_tpc_5GHz_txgain_HiPwrEPA[txpi[i]]
2. Otherwise
1. Set txgain to nphy_txpwrctrl_5GHz_txgain_rev3[txpi[i]]
2. Otherwise
1. Set txgain to nphy_txpwrctrl_txgain[txpi[i]]
3. If PHY Revision >= 3

1. Set radio_gain to (txgain >> 16) & ((1 << 17) - 1)

4. Otherwise
1. Set radio_gain to (txgain >> 16) & ((1 << 13) - 1)

5. If If PHY Revision >= 7

1. Set dac_gain to (txgain >> 8) & ((1 << 3) - 1)

6. Otherwise
1. Set dac_gain to (txgain >> 8) & ((1 << 6) - 1)

7. Set bbmult to txgain & ((1 << 8) - 1)

8. If PHY Revision >= 3

1. If i is 0
1. Set bit 0x0100 in PHY register 0x8F
2. Otherwise
1. Set bit 0x0100 in PHY register 0xA5
9. Otherwise
1. Set bit 0x4000 in PHY Register 0xA5
10. If i is 0
1. Write dac_gain to PHY Register 0xAA
11. Otherwise
1. Write dac_gain to PHY Register 0xAB
12. Write an N PHY Table with ID 5, length 1, offset (0x110 + i), width 16, and data from rad_gain
13. Read an N PHY Table with ID 15, length 1, offset 0x57, width 16, and data m1m2
14. If i is 0
1. Maskset mlm2 with mask 0x00FF and set with bbmult << 8

15. Otherwise
1. Maskset mlm2 with mask 0xFF00 and set with bbmult
16. Write an N PHY Table with ID 15, length 1, offset 0x57, width 16, and data m1m2
17. If ((nphy_ipa2g_on and band is 2 GHz) or (nphy_ipa5g_on and band is 5 GHz))

1. Read an N PHY Table with ID (26 + i), length 1, offset 576 + txpi[i], width 32, and data tmp32
2. If i is 0
1. Maskset PHY Register 0x297 with mask 0xE00F and set with (tmp32 << 4)

2. Set bit 4 in PHY Register 0x297
3. Otherwise
1. Maskset PHY Register 0x29B with mask 0xE00F and set with (tmp32 << 4)

2. Set bit 4 in PHY Register 0x29B
12. Mask PHY Register 0xBF with mask 0xFFE0
13. If phyhang_avoid

1. Call N PHY Stay in Carrier Search with argument 0

Exported/Archived from the wiki to HTML on 2016-10-27