Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'wireless-drivers-next-for-davem-2018-12-20' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next

Kalle Valo says:

====================
wireless-drivers-next patches for 4.21

Last set of patches for 4.21. mt76 is still in very active development
and having some refactoring as well as new features. But also other
drivers got few new features and fixes.

Major changes:

ath10k

* add amsdu support for QCA6174 monitor mode

* report tx rate using the new ieee80211_tx_rate_update() API

* wcn3990 support is not experimental anymore

iwlwifi

* support for FW version 43 for 9000 and 22000 series

brcmfmac

* add support for CYW43012 SDIO chipset

* add the raw 4354 PCIe device ID for unprogrammed Cypress boards

mwifiex

* add NL80211_STA_INFO_RX_BITRATE support

mt76

* use the same firmware for mt76x2e and mt76x2u

* mt76x0e survey support

* more unification between mt76x2 and mt76x0

* mt76x0e AP mode support

* mt76x0e DFS support

* rework and fix tx status handling for mt76x0 and mt76x2
====================

Signed-off-by: David S. Miller <davem@davemloft.net>

+5030 -4327
+49 -25
Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
··· 21 21 22 22 SNOC based devices (i.e. wcn3990) uses compatible string "qcom,wcn3990-wifi". 23 23 24 - Optional properties: 25 24 - reg: Address and length of the register set for the device. 26 25 - reg-names: Must include the list of following reg names, 27 26 "membase" 27 + - interrupts: reference to the list of 17 interrupt numbers for "qcom,ipq4019-wifi" 28 + compatible target. 29 + reference to the list of 12 interrupt numbers for "qcom,wcn3990-wifi" 30 + compatible target. 31 + Must contain interrupt-names property per entry for 32 + "qcom,ath10k", "qcom,ipq4019-wifi" compatible targets. 33 + 34 + - interrupt-names: Must include the entries for MSI interrupt 35 + names ("msi0" to "msi15") and legacy interrupt 36 + name ("legacy") for "qcom,ath10k", "qcom,ipq4019-wifi" 37 + compatible targets. 38 + 39 + Optional properties: 28 40 - resets: Must contain an entry for each entry in reset-names. 29 41 See ../reset/reseti.txt for details. 30 42 - reset-names: Must include the list of following reset names, ··· 49 37 - clocks: List of clock specifiers, must contain an entry for each required 50 38 entry in clock-names. 51 39 - clock-names: Should contain the clock names "wifi_wcss_cmd", "wifi_wcss_ref", 52 - "wifi_wcss_rtc". 53 - - interrupts: List of interrupt lines. Must contain an entry 54 - for each entry in the interrupt-names property. 55 - - interrupt-names: Must include the entries for MSI interrupt 56 - names ("msi0" to "msi15") and legacy interrupt 57 - name ("legacy"), 40 + "wifi_wcss_rtc" for "qcom,ipq4019-wifi" compatible target and 41 + "cxo_ref_clk_pin" for "qcom,wcn3990-wifi" 42 + compatible target. 58 43 - qcom,msi_addr: MSI interrupt address. 59 44 - qcom,msi_base: Base value to add before writing MSI data into 60 45 MSI address register. ··· 64 55 - qcom,ath10k-pre-calibration-data : pre calibration data as an array, 65 56 the length can vary between hw versions. 66 57 - <supply-name>-supply: handle to the regulator device tree node 67 - optional "supply-name" is "vdd-0.8-cx-mx". 58 + optional "supply-name" are "vdd-0.8-cx-mx", 59 + "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0". 68 60 - memory-region: 69 61 Usage: optional 70 62 Value type: <phandle> 71 63 Definition: reference to the reserved-memory for the msa region 72 64 used by the wifi firmware running in Q6. 65 + - iommus: 66 + Usage: optional 67 + Value type: <prop-encoded-array> 68 + Definition: A list of phandle and IOMMU specifier pairs. 69 + - ext-fem-name: 70 + Usage: Optional 71 + Value type: string 72 + Definition: Name of external front end module used. Some valid FEM names 73 + for example: "microsemi-lx5586", "sky85703-11" 74 + and "sky85803" etc. 73 75 74 - Example (to supply the calibration data alone): 76 + Example (to supply PCI based wifi block details): 75 77 76 78 In this example, the node is defined as child node of the PCI controller. 77 79 ··· 94 74 #address-cells = <3>; 95 75 device_type = "pci"; 96 76 97 - ath10k@0,0 { 77 + wifi@0,0 { 98 78 reg = <0 0 0 0 0>; 99 - device_type = "pci"; 100 79 qcom,ath10k-calibration-data = [ 01 02 03 ... ]; 80 + ext-fem-name = "microsemi-lx5586"; 101 81 }; 102 82 }; 103 83 }; ··· 158 138 compatible = "qcom,wcn3990-wifi"; 159 139 reg = <0x18800000 0x800000>; 160 140 reg-names = "membase"; 161 - clocks = <&clock_gcc clk_aggre2_noc_clk>; 162 - clock-names = "smmu_aggre2_noc_clk" 141 + clocks = <&clock_gcc clk_rf_clk2_pin>; 142 + clock-names = "cxo_ref_clk_pin"; 163 143 interrupts = 164 - <0 130 0 /* CE0 */ >, 165 - <0 131 0 /* CE1 */ >, 166 - <0 132 0 /* CE2 */ >, 167 - <0 133 0 /* CE3 */ >, 168 - <0 134 0 /* CE4 */ >, 169 - <0 135 0 /* CE5 */ >, 170 - <0 136 0 /* CE6 */ >, 171 - <0 137 0 /* CE7 */ >, 172 - <0 138 0 /* CE8 */ >, 173 - <0 139 0 /* CE9 */ >, 174 - <0 140 0 /* CE10 */ >, 175 - <0 141 0 /* CE11 */ >; 144 + <GIC_SPI 414 IRQ_TYPE_LEVEL_HIGH>, 145 + <GIC_SPI 415 IRQ_TYPE_LEVEL_HIGH>, 146 + <GIC_SPI 416 IRQ_TYPE_LEVEL_HIGH>, 147 + <GIC_SPI 417 IRQ_TYPE_LEVEL_HIGH>, 148 + <GIC_SPI 418 IRQ_TYPE_LEVEL_HIGH>, 149 + <GIC_SPI 419 IRQ_TYPE_LEVEL_HIGH>, 150 + <GIC_SPI 420 IRQ_TYPE_LEVEL_HIGH>, 151 + <GIC_SPI 421 IRQ_TYPE_LEVEL_HIGH>, 152 + <GIC_SPI 422 IRQ_TYPE_LEVEL_HIGH>, 153 + <GIC_SPI 423 IRQ_TYPE_LEVEL_HIGH>, 154 + <GIC_SPI 424 IRQ_TYPE_LEVEL_HIGH>, 155 + <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH>; 176 156 vdd-0.8-cx-mx-supply = <&pm8998_l5>; 157 + vdd-1.8-xo-supply = <&vreg_l7a_1p8>; 158 + vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; 159 + vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; 177 160 memory-region = <&wifi_msa_mem>; 161 + iommus = <&apps_smmu 0x0040 0x1>; 178 162 };
+1 -2
drivers/net/wireless/ath/ath10k/Kconfig
··· 47 47 select QCOM_QMI_HELPERS 48 48 ---help--- 49 49 This module adds support for integrated WCN3990 chip connected 50 - to system NOC(SNOC). Currently work in progress and will not 51 - fully work. 50 + to system NOC(SNOC). 52 51 53 52 config ATH10K_DEBUG 54 53 bool "Atheros ath10k debugging"
+1
drivers/net/wireless/ath/ath10k/core.h
··· 494 494 u32 smps; 495 495 u16 peer_id; 496 496 struct rate_info txrate; 497 + struct ieee80211_tx_info tx_info; 497 498 498 499 struct work_struct update_wk; 499 500 u64 rx_duration;
+1 -1
drivers/net/wireless/ath/ath10k/debugfs_sta.c
··· 71 71 spin_lock_bh(&ar->data_lock); 72 72 73 73 peer = ath10k_peer_find_by_id(ar, peer_id); 74 - if (!peer) 74 + if (!peer || !peer->sta) 75 75 goto out; 76 76 77 77 arsta = (struct ath10k_sta *)peer->sta->drv_priv;
+287 -13
drivers/net/wireless/ath/ath10k/htt_rx.c
··· 469 469 return msdu; 470 470 } 471 471 472 + static inline void ath10k_htt_append_frag_list(struct sk_buff *skb_head, 473 + struct sk_buff *frag_list, 474 + unsigned int frag_len) 475 + { 476 + skb_shinfo(skb_head)->frag_list = frag_list; 477 + skb_head->data_len = frag_len; 478 + skb_head->len += skb_head->data_len; 479 + } 480 + 481 + static int ath10k_htt_rx_handle_amsdu_mon_32(struct ath10k_htt *htt, 482 + struct sk_buff *msdu, 483 + struct htt_rx_in_ord_msdu_desc **msdu_desc) 484 + { 485 + struct ath10k *ar = htt->ar; 486 + u32 paddr; 487 + struct sk_buff *frag_buf; 488 + struct sk_buff *prev_frag_buf; 489 + u8 last_frag; 490 + struct htt_rx_in_ord_msdu_desc *ind_desc = *msdu_desc; 491 + struct htt_rx_desc *rxd; 492 + int amsdu_len = __le16_to_cpu(ind_desc->msdu_len); 493 + 494 + rxd = (void *)msdu->data; 495 + trace_ath10k_htt_rx_desc(ar, rxd, sizeof(*rxd)); 496 + 497 + skb_put(msdu, sizeof(struct htt_rx_desc)); 498 + skb_pull(msdu, sizeof(struct htt_rx_desc)); 499 + skb_put(msdu, min(amsdu_len, HTT_RX_MSDU_SIZE)); 500 + amsdu_len -= msdu->len; 501 + 502 + last_frag = ind_desc->reserved; 503 + if (last_frag) { 504 + if (amsdu_len) { 505 + ath10k_warn(ar, "invalid amsdu len %u, left %d", 506 + __le16_to_cpu(ind_desc->msdu_len), 507 + amsdu_len); 508 + } 509 + return 0; 510 + } 511 + 512 + ind_desc++; 513 + paddr = __le32_to_cpu(ind_desc->msdu_paddr); 514 + frag_buf = ath10k_htt_rx_pop_paddr(htt, paddr); 515 + if (!frag_buf) { 516 + ath10k_warn(ar, "failed to pop frag-1 paddr: 0x%x", paddr); 517 + return -ENOENT; 518 + } 519 + 520 + skb_put(frag_buf, min(amsdu_len, HTT_RX_BUF_SIZE)); 521 + ath10k_htt_append_frag_list(msdu, frag_buf, amsdu_len); 522 + 523 + amsdu_len -= frag_buf->len; 524 + prev_frag_buf = frag_buf; 525 + last_frag = ind_desc->reserved; 526 + while (!last_frag) { 527 + ind_desc++; 528 + paddr = __le32_to_cpu(ind_desc->msdu_paddr); 529 + frag_buf = ath10k_htt_rx_pop_paddr(htt, paddr); 530 + if (!frag_buf) { 531 + ath10k_warn(ar, "failed to pop frag-n paddr: 0x%x", 532 + paddr); 533 + prev_frag_buf->next = NULL; 534 + return -ENOENT; 535 + } 536 + 537 + skb_put(frag_buf, min(amsdu_len, HTT_RX_BUF_SIZE)); 538 + last_frag = ind_desc->reserved; 539 + amsdu_len -= frag_buf->len; 540 + 541 + prev_frag_buf->next = frag_buf; 542 + prev_frag_buf = frag_buf; 543 + } 544 + 545 + if (amsdu_len) { 546 + ath10k_warn(ar, "invalid amsdu len %u, left %d", 547 + __le16_to_cpu(ind_desc->msdu_len), amsdu_len); 548 + } 549 + 550 + *msdu_desc = ind_desc; 551 + 552 + prev_frag_buf->next = NULL; 553 + return 0; 554 + } 555 + 556 + static int 557 + ath10k_htt_rx_handle_amsdu_mon_64(struct ath10k_htt *htt, 558 + struct sk_buff *msdu, 559 + struct htt_rx_in_ord_msdu_desc_ext **msdu_desc) 560 + { 561 + struct ath10k *ar = htt->ar; 562 + u64 paddr; 563 + struct sk_buff *frag_buf; 564 + struct sk_buff *prev_frag_buf; 565 + u8 last_frag; 566 + struct htt_rx_in_ord_msdu_desc_ext *ind_desc = *msdu_desc; 567 + struct htt_rx_desc *rxd; 568 + int amsdu_len = __le16_to_cpu(ind_desc->msdu_len); 569 + 570 + rxd = (void *)msdu->data; 571 + trace_ath10k_htt_rx_desc(ar, rxd, sizeof(*rxd)); 572 + 573 + skb_put(msdu, sizeof(struct htt_rx_desc)); 574 + skb_pull(msdu, sizeof(struct htt_rx_desc)); 575 + skb_put(msdu, min(amsdu_len, HTT_RX_MSDU_SIZE)); 576 + amsdu_len -= msdu->len; 577 + 578 + last_frag = ind_desc->reserved; 579 + if (last_frag) { 580 + if (amsdu_len) { 581 + ath10k_warn(ar, "invalid amsdu len %u, left %d", 582 + __le16_to_cpu(ind_desc->msdu_len), 583 + amsdu_len); 584 + } 585 + return 0; 586 + } 587 + 588 + ind_desc++; 589 + paddr = __le64_to_cpu(ind_desc->msdu_paddr); 590 + frag_buf = ath10k_htt_rx_pop_paddr(htt, paddr); 591 + if (!frag_buf) { 592 + ath10k_warn(ar, "failed to pop frag-1 paddr: 0x%llx", paddr); 593 + return -ENOENT; 594 + } 595 + 596 + skb_put(frag_buf, min(amsdu_len, HTT_RX_BUF_SIZE)); 597 + ath10k_htt_append_frag_list(msdu, frag_buf, amsdu_len); 598 + 599 + amsdu_len -= frag_buf->len; 600 + prev_frag_buf = frag_buf; 601 + last_frag = ind_desc->reserved; 602 + while (!last_frag) { 603 + ind_desc++; 604 + paddr = __le64_to_cpu(ind_desc->msdu_paddr); 605 + frag_buf = ath10k_htt_rx_pop_paddr(htt, paddr); 606 + if (!frag_buf) { 607 + ath10k_warn(ar, "failed to pop frag-n paddr: 0x%llx", 608 + paddr); 609 + prev_frag_buf->next = NULL; 610 + return -ENOENT; 611 + } 612 + 613 + skb_put(frag_buf, min(amsdu_len, HTT_RX_BUF_SIZE)); 614 + last_frag = ind_desc->reserved; 615 + amsdu_len -= frag_buf->len; 616 + 617 + prev_frag_buf->next = frag_buf; 618 + prev_frag_buf = frag_buf; 619 + } 620 + 621 + if (amsdu_len) { 622 + ath10k_warn(ar, "invalid amsdu len %u, left %d", 623 + __le16_to_cpu(ind_desc->msdu_len), amsdu_len); 624 + } 625 + 626 + *msdu_desc = ind_desc; 627 + 628 + prev_frag_buf->next = NULL; 629 + return 0; 630 + } 631 + 472 632 static int ath10k_htt_rx_pop_paddr32_list(struct ath10k_htt *htt, 473 633 struct htt_rx_in_ord_ind *ev, 474 634 struct sk_buff_head *list) ··· 637 477 struct htt_rx_in_ord_msdu_desc *msdu_desc = ev->msdu_descs32; 638 478 struct htt_rx_desc *rxd; 639 479 struct sk_buff *msdu; 640 - int msdu_count; 480 + int msdu_count, ret; 641 481 bool is_offload; 642 482 u32 paddr; 643 483 ··· 653 493 if (!msdu) { 654 494 __skb_queue_purge(list); 655 495 return -ENOENT; 496 + } 497 + 498 + if (!is_offload && ar->monitor_arvif) { 499 + ret = ath10k_htt_rx_handle_amsdu_mon_32(htt, msdu, 500 + &msdu_desc); 501 + if (ret) { 502 + __skb_queue_purge(list); 503 + return ret; 504 + } 505 + __skb_queue_tail(list, msdu); 506 + msdu_desc++; 507 + continue; 656 508 } 657 509 658 510 __skb_queue_tail(list, msdu); ··· 699 527 struct htt_rx_in_ord_msdu_desc_ext *msdu_desc = ev->msdu_descs64; 700 528 struct htt_rx_desc *rxd; 701 529 struct sk_buff *msdu; 702 - int msdu_count; 530 + int msdu_count, ret; 703 531 bool is_offload; 704 532 u64 paddr; 705 533 ··· 714 542 if (!msdu) { 715 543 __skb_queue_purge(list); 716 544 return -ENOENT; 545 + } 546 + 547 + if (!is_offload && ar->monitor_arvif) { 548 + ret = ath10k_htt_rx_handle_amsdu_mon_64(htt, msdu, 549 + &msdu_desc); 550 + if (ret) { 551 + __skb_queue_purge(list); 552 + return ret; 553 + } 554 + __skb_queue_tail(list, msdu); 555 + msdu_desc++; 556 + continue; 717 557 } 718 558 719 559 __skb_queue_tail(list, msdu); ··· 1343 1159 struct sk_buff *msdu, 1344 1160 struct ieee80211_rx_status *status, 1345 1161 enum htt_rx_mpdu_encrypt_type enctype, 1346 - bool is_decrypted) 1162 + bool is_decrypted, 1163 + const u8 first_hdr[64]) 1347 1164 { 1348 1165 struct ieee80211_hdr *hdr; 1349 1166 struct htt_rx_desc *rxd; ··· 1352 1167 size_t crypto_len; 1353 1168 bool is_first; 1354 1169 bool is_last; 1170 + bool msdu_limit_err; 1171 + int bytes_aligned = ar->hw_params.decap_align_bytes; 1172 + u8 *qos; 1355 1173 1356 1174 rxd = (void *)msdu->data - sizeof(*rxd); 1357 1175 is_first = !!(rxd->msdu_end.common.info0 & ··· 1372 1184 * [FCS] <-- at end, needs to be trimmed 1373 1185 */ 1374 1186 1187 + /* Some hardwares(QCA99x0 variants) limit number of msdus in a-msdu when 1188 + * deaggregate, so that unwanted MSDU-deaggregation is avoided for 1189 + * error packets. If limit exceeds, hw sends all remaining MSDUs as 1190 + * a single last MSDU with this msdu limit error set. 1191 + */ 1192 + msdu_limit_err = ath10k_rx_desc_msdu_limit_error(&ar->hw_params, rxd); 1193 + 1194 + /* If MSDU limit error happens, then don't warn on, the partial raw MSDU 1195 + * without first MSDU is expected in that case, and handled later here. 1196 + */ 1375 1197 /* This probably shouldn't happen but warn just in case */ 1376 - if (WARN_ON_ONCE(!is_first)) 1198 + if (WARN_ON_ONCE(!is_first && !msdu_limit_err)) 1377 1199 return; 1378 1200 1379 1201 /* This probably shouldn't happen but warn just in case */ 1380 - if (WARN_ON_ONCE(!(is_first && is_last))) 1202 + if (WARN_ON_ONCE(!(is_first && is_last) && !msdu_limit_err)) 1381 1203 return; 1382 1204 1383 1205 skb_trim(msdu, msdu->len - FCS_LEN); 1206 + 1207 + /* Push original 80211 header */ 1208 + if (unlikely(msdu_limit_err)) { 1209 + hdr = (struct ieee80211_hdr *)first_hdr; 1210 + hdr_len = ieee80211_hdrlen(hdr->frame_control); 1211 + crypto_len = ath10k_htt_rx_crypto_param_len(ar, enctype); 1212 + 1213 + if (ieee80211_is_data_qos(hdr->frame_control)) { 1214 + qos = ieee80211_get_qos_ctl(hdr); 1215 + qos[0] |= IEEE80211_QOS_CTL_A_MSDU_PRESENT; 1216 + } 1217 + 1218 + if (crypto_len) 1219 + memcpy(skb_push(msdu, crypto_len), 1220 + (void *)hdr + round_up(hdr_len, bytes_aligned), 1221 + crypto_len); 1222 + 1223 + memcpy(skb_push(msdu, hdr_len), hdr, hdr_len); 1224 + } 1384 1225 1385 1226 /* In most cases this will be true for sniffed frames. It makes sense 1386 1227 * to deliver them as-is without stripping the crypto param. This is ··· 1684 1467 switch (decap) { 1685 1468 case RX_MSDU_DECAP_RAW: 1686 1469 ath10k_htt_rx_h_undecap_raw(ar, msdu, status, enctype, 1687 - is_decrypted); 1470 + is_decrypted, first_hdr); 1688 1471 break; 1689 1472 case RX_MSDU_DECAP_NATIVE_WIFI: 1690 1473 ath10k_htt_rx_h_undecap_nwifi(ar, msdu, status, first_hdr, ··· 2844 2627 dev_kfree_skb_any(skb); 2845 2628 } 2846 2629 2847 - static inline int ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) 2630 + static inline s8 ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) 2848 2631 { 2849 2632 static const u8 legacy_rates[] = {1, 2, 5, 11, 6, 9, 12, 2850 2633 18, 24, 36, 48, 54}; ··· 2863 2646 ath10k_accumulate_per_peer_tx_stats(struct ath10k *ar, 2864 2647 struct ath10k_sta *arsta, 2865 2648 struct ath10k_per_peer_tx_stats *pstats, 2866 - u8 legacy_rate_idx) 2649 + s8 legacy_rate_idx) 2867 2650 { 2868 2651 struct rate_info *txrate = &arsta->txrate; 2869 2652 struct ath10k_htt_tx_stats *tx_stats; ··· 2983 2766 struct ath10k_per_peer_tx_stats *peer_stats) 2984 2767 { 2985 2768 struct ath10k_sta *arsta = (struct ath10k_sta *)sta->drv_priv; 2769 + struct ieee80211_chanctx_conf *conf = NULL; 2986 2770 u8 rate = 0, sgi; 2987 2771 s8 rate_idx = 0; 2772 + bool skip_auto_rate; 2988 2773 struct rate_info txrate; 2989 2774 2990 2775 lockdep_assert_held(&ar->data_lock); ··· 2996 2777 txrate.nss = ATH10K_HW_NSS(peer_stats->ratecode); 2997 2778 txrate.mcs = ATH10K_HW_MCS_RATE(peer_stats->ratecode); 2998 2779 sgi = ATH10K_HW_GI(peer_stats->flags); 2780 + skip_auto_rate = ATH10K_FW_SKIPPED_RATE_CTRL(peer_stats->flags); 2781 + 2782 + /* Firmware's rate control skips broadcast/management frames, 2783 + * if host has configure fixed rates and in some other special cases. 2784 + */ 2785 + if (skip_auto_rate) 2786 + return; 2999 2787 3000 2788 if (txrate.flags == WMI_RATE_PREAMBLE_VHT && txrate.mcs > 9) { 3001 2789 ath10k_warn(ar, "Invalid VHT mcs %hhd peer stats", txrate.mcs); ··· 3017 2791 } 3018 2792 3019 2793 memset(&arsta->txrate, 0, sizeof(arsta->txrate)); 3020 - 2794 + memset(&arsta->tx_info.status, 0, sizeof(arsta->tx_info.status)); 3021 2795 if (txrate.flags == WMI_RATE_PREAMBLE_CCK || 3022 2796 txrate.flags == WMI_RATE_PREAMBLE_OFDM) { 3023 2797 rate = ATH10K_HW_LEGACY_RATE(peer_stats->ratecode); ··· 3036 2810 arsta->txrate.mcs = txrate.mcs; 3037 2811 } 3038 2812 3039 - if (sgi) 3040 - arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 2813 + switch (txrate.flags) { 2814 + case WMI_RATE_PREAMBLE_OFDM: 2815 + if (arsta->arvif && arsta->arvif->vif) 2816 + conf = rcu_dereference(arsta->arvif->vif->chanctx_conf); 2817 + if (conf && conf->def.chan->band == NL80211_BAND_5GHZ) 2818 + arsta->tx_info.status.rates[0].idx = rate_idx - 4; 2819 + break; 2820 + case WMI_RATE_PREAMBLE_CCK: 2821 + arsta->tx_info.status.rates[0].idx = rate_idx; 2822 + if (sgi) 2823 + arsta->tx_info.status.rates[0].flags |= 2824 + (IEEE80211_TX_RC_USE_SHORT_PREAMBLE | 2825 + IEEE80211_TX_RC_SHORT_GI); 2826 + break; 2827 + case WMI_RATE_PREAMBLE_HT: 2828 + arsta->tx_info.status.rates[0].idx = 2829 + txrate.mcs + ((txrate.nss - 1) * 8); 2830 + if (sgi) 2831 + arsta->tx_info.status.rates[0].flags |= 2832 + IEEE80211_TX_RC_SHORT_GI; 2833 + arsta->tx_info.status.rates[0].flags |= IEEE80211_TX_RC_MCS; 2834 + break; 2835 + case WMI_RATE_PREAMBLE_VHT: 2836 + ieee80211_rate_set_vht(&arsta->tx_info.status.rates[0], 2837 + txrate.mcs, txrate.nss); 2838 + if (sgi) 2839 + arsta->tx_info.status.rates[0].flags |= 2840 + IEEE80211_TX_RC_SHORT_GI; 2841 + arsta->tx_info.status.rates[0].flags |= IEEE80211_TX_RC_VHT_MCS; 2842 + break; 2843 + } 3041 2844 3042 2845 arsta->txrate.nss = txrate.nss; 3043 2846 arsta->txrate.bw = ath10k_bw_to_mac80211_bw(txrate.bw); 2847 + if (sgi) 2848 + arsta->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; 2849 + 2850 + switch (arsta->txrate.bw) { 2851 + case RATE_INFO_BW_40: 2852 + arsta->tx_info.status.rates[0].flags |= 2853 + IEEE80211_TX_RC_40_MHZ_WIDTH; 2854 + break; 2855 + case RATE_INFO_BW_80: 2856 + arsta->tx_info.status.rates[0].flags |= 2857 + IEEE80211_TX_RC_80_MHZ_WIDTH; 2858 + break; 2859 + } 2860 + 2861 + if (peer_stats->succ_pkts) { 2862 + arsta->tx_info.flags = IEEE80211_TX_STAT_ACK; 2863 + arsta->tx_info.status.rates[0].count = 1; 2864 + ieee80211_tx_rate_update(ar->hw, sta, &arsta->tx_info); 2865 + } 3044 2866 3045 2867 if (ath10k_debug_is_extd_tx_stats_enabled(ar)) 3046 2868 ath10k_accumulate_per_peer_tx_stats(ar, arsta, peer_stats, ··· 3121 2847 rcu_read_lock(); 3122 2848 spin_lock_bh(&ar->data_lock); 3123 2849 peer = ath10k_peer_find_by_id(ar, peer_id); 3124 - if (!peer) { 2850 + if (!peer || !peer->sta) { 3125 2851 ath10k_warn(ar, "Invalid peer id %d peer stats buffer\n", 3126 2852 peer_id); 3127 2853 goto out; ··· 3174 2900 rcu_read_lock(); 3175 2901 spin_lock_bh(&ar->data_lock); 3176 2902 peer = ath10k_peer_find_by_id(ar, peer_id); 3177 - if (!peer) { 2903 + if (!peer || !peer->sta) { 3178 2904 ath10k_warn(ar, "Invalid peer id %d in peer stats buffer\n", 3179 2905 peer_id); 3180 2906 goto out;
+7
drivers/net/wireless/ath/ath10k/hw.c
··· 1119 1119 RX_MSDU_END_INFO1_L3_HDR_PAD); 1120 1120 } 1121 1121 1122 + static bool ath10k_qca99x0_rx_desc_msdu_limit_error(struct htt_rx_desc *rxd) 1123 + { 1124 + return !!(rxd->msdu_end.common.info0 & 1125 + __cpu_to_le32(RX_MSDU_END_INFO0_MSDU_LIMIT_ERR)); 1126 + } 1127 + 1122 1128 const struct ath10k_hw_ops qca99x0_ops = { 1123 1129 .rx_desc_get_l3_pad_bytes = ath10k_qca99x0_rx_desc_get_l3_pad_bytes, 1130 + .rx_desc_get_msdu_limit_error = ath10k_qca99x0_rx_desc_msdu_limit_error, 1124 1131 }; 1125 1132 1126 1133 const struct ath10k_hw_ops qca6174_ops = {
+10
drivers/net/wireless/ath/ath10k/hw.h
··· 624 624 int (*rx_desc_get_l3_pad_bytes)(struct htt_rx_desc *rxd); 625 625 void (*set_coverage_class)(struct ath10k *ar, s16 value); 626 626 int (*enable_pll_clk)(struct ath10k *ar); 627 + bool (*rx_desc_get_msdu_limit_error)(struct htt_rx_desc *rxd); 627 628 }; 628 629 629 630 extern const struct ath10k_hw_ops qca988x_ops; ··· 641 640 if (hw->hw_ops->rx_desc_get_l3_pad_bytes) 642 641 return hw->hw_ops->rx_desc_get_l3_pad_bytes(rxd); 643 642 return 0; 643 + } 644 + 645 + static inline bool 646 + ath10k_rx_desc_msdu_limit_error(struct ath10k_hw_params *hw, 647 + struct htt_rx_desc *rxd) 648 + { 649 + if (hw->hw_ops->rx_desc_get_msdu_limit_error) 650 + return hw->hw_ops->rx_desc_get_msdu_limit_error(rxd); 651 + return false; 644 652 } 645 653 646 654 /* Target specific defines for MAIN firmware */
+76 -40
drivers/net/wireless/ath/ath10k/mac.c
··· 22 22 #include <net/mac80211.h> 23 23 #include <linux/etherdevice.h> 24 24 #include <linux/acpi.h> 25 + #include <linux/of.h> 25 26 26 27 #include "hif.h" 27 28 #include "core.h" ··· 4638 4637 return ret; 4639 4638 } 4640 4639 4640 + static int __ath10k_fetch_bb_timing_dt(struct ath10k *ar, 4641 + struct wmi_bb_timing_cfg_arg *bb_timing) 4642 + { 4643 + struct device_node *node; 4644 + const char *fem_name; 4645 + int ret; 4646 + 4647 + node = ar->dev->of_node; 4648 + if (!node) 4649 + return -ENOENT; 4650 + 4651 + ret = of_property_read_string_index(node, "ext-fem-name", 0, &fem_name); 4652 + if (ret) 4653 + return -ENOENT; 4654 + 4655 + /* 4656 + * If external Front End module used in hardware, then default base band timing 4657 + * parameter cannot be used since they were fine tuned for reference hardware, 4658 + * so choosing different value suitable for that external FEM. 4659 + */ 4660 + if (!strcmp("microsemi-lx5586", fem_name)) { 4661 + bb_timing->bb_tx_timing = 0x00; 4662 + bb_timing->bb_xpa_timing = 0x0101; 4663 + } else { 4664 + return -ENOENT; 4665 + } 4666 + 4667 + ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot bb_tx_timing 0x%x bb_xpa_timing 0x%x\n", 4668 + bb_timing->bb_tx_timing, bb_timing->bb_xpa_timing); 4669 + return 0; 4670 + } 4671 + 4641 4672 static int ath10k_start(struct ieee80211_hw *hw) 4642 4673 { 4643 4674 struct ath10k *ar = hw->priv; 4644 4675 u32 param; 4645 4676 int ret = 0; 4677 + struct wmi_bb_timing_cfg_arg bb_timing = {0}; 4646 4678 4647 4679 /* 4648 4680 * This makes sense only when restarting hw. It is harmless to call ··· 4828 4794 goto err_core_stop; 4829 4795 } 4830 4796 clear_bit(ATH10K_FLAG_BTCOEX, &ar->dev_flags); 4797 + } 4798 + 4799 + if (test_bit(WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, ar->wmi.svc_map)) { 4800 + ret = __ath10k_fetch_bb_timing_dt(ar, &bb_timing); 4801 + if (!ret) { 4802 + ret = ath10k_wmi_pdev_bb_timing(ar, &bb_timing); 4803 + if (ret) { 4804 + ath10k_warn(ar, 4805 + "failed to set bb timings: %d\n", 4806 + ret); 4807 + goto err_core_stop; 4808 + } 4809 + } 4831 4810 } 4832 4811 4833 4812 ar->num_started_vdevs = 0; ··· 5199 5152 ath10k_warn(ar, "failed to create WMI vdev %i: %d\n", 5200 5153 arvif->vdev_id, ret); 5201 5154 goto err; 5155 + } 5156 + 5157 + if (test_bit(WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, 5158 + ar->wmi.svc_map)) { 5159 + vdev_param = ar->wmi.vdev_param->disable_4addr_src_lrn; 5160 + ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id, vdev_param, 5161 + WMI_VDEV_DISABLE_4_ADDR_SRC_LRN); 5162 + if (ret && ret != -EOPNOTSUPP) { 5163 + ath10k_warn(ar, "failed to disable 4addr src lrn vdev %i: %d\n", 5164 + arvif->vdev_id, ret); 5165 + } 5202 5166 } 5203 5167 5204 5168 ar->free_vdev_map &= ~(1LL << arvif->vdev_id); ··· 5812 5754 return data.num_tdls_stations; 5813 5755 } 5814 5756 5815 - static void ath10k_mac_tdls_vifs_count_iter(void *data, u8 *mac, 5816 - struct ieee80211_vif *vif) 5817 - { 5818 - struct ath10k_vif *arvif = (void *)vif->drv_priv; 5819 - int *num_tdls_vifs = data; 5820 - 5821 - if (vif->type != NL80211_IFTYPE_STATION) 5822 - return; 5823 - 5824 - if (ath10k_mac_tdls_vif_stations_count(arvif->ar->hw, vif) > 0) 5825 - (*num_tdls_vifs)++; 5826 - } 5827 - 5828 - static int ath10k_mac_tdls_vifs_count(struct ieee80211_hw *hw) 5829 - { 5830 - int num_tdls_vifs = 0; 5831 - 5832 - ieee80211_iterate_active_interfaces_atomic(hw, 5833 - IEEE80211_IFACE_ITER_NORMAL, 5834 - ath10k_mac_tdls_vifs_count_iter, 5835 - &num_tdls_vifs); 5836 - return num_tdls_vifs; 5837 - } 5838 - 5839 5757 static int ath10k_hw_scan(struct ieee80211_hw *hw, 5840 5758 struct ieee80211_vif *vif, 5841 5759 struct ieee80211_scan_request *hw_req) ··· 6319 6285 */ 6320 6286 enum wmi_peer_type peer_type = WMI_PEER_TYPE_DEFAULT; 6321 6287 u32 num_tdls_stations; 6322 - u32 num_tdls_vifs; 6323 6288 6324 6289 ath10k_dbg(ar, ATH10K_DBG_MAC, 6325 6290 "mac vdev %d peer create %pM (new sta) sta %d / %d peer %d / %d\n", ··· 6326 6293 ar->num_stations + 1, ar->max_num_stations, 6327 6294 ar->num_peers + 1, ar->max_num_peers); 6328 6295 6329 - if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { 6330 - arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), 6331 - GFP_KERNEL); 6332 - if (!arsta->tx_stats) { 6333 - ret = -ENOMEM; 6334 - goto exit; 6335 - } 6336 - } 6337 - 6338 6296 num_tdls_stations = ath10k_mac_tdls_vif_stations_count(hw, vif); 6339 - num_tdls_vifs = ath10k_mac_tdls_vifs_count(hw); 6340 6297 6341 6298 if (sta->tdls) { 6342 6299 if (num_tdls_stations >= ar->max_num_tdls_vdevs) { ··· 6346 6323 goto exit; 6347 6324 } 6348 6325 6326 + if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { 6327 + arsta->tx_stats = kzalloc(sizeof(*arsta->tx_stats), 6328 + GFP_KERNEL); 6329 + if (!arsta->tx_stats) { 6330 + ret = -ENOMEM; 6331 + goto exit; 6332 + } 6333 + } 6334 + 6349 6335 ret = ath10k_peer_create(ar, vif, sta, arvif->vdev_id, 6350 6336 sta->addr, peer_type); 6351 6337 if (ret) { 6352 6338 ath10k_warn(ar, "failed to add peer %pM for vdev %d when adding a new sta: %i\n", 6353 6339 sta->addr, arvif->vdev_id, ret); 6354 6340 ath10k_mac_dec_num_stations(arvif, sta); 6341 + kfree(arsta->tx_stats); 6355 6342 goto exit; 6356 6343 } 6357 6344 ··· 6374 6341 spin_unlock_bh(&ar->data_lock); 6375 6342 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); 6376 6343 ath10k_mac_dec_num_stations(arvif, sta); 6344 + kfree(arsta->tx_stats); 6377 6345 ret = -ENOENT; 6378 6346 goto exit; 6379 6347 } ··· 6395 6361 ath10k_peer_delete(ar, arvif->vdev_id, 6396 6362 sta->addr); 6397 6363 ath10k_mac_dec_num_stations(arvif, sta); 6364 + kfree(arsta->tx_stats); 6398 6365 goto exit; 6399 6366 } 6400 6367 ··· 6407 6372 sta->addr, arvif->vdev_id, ret); 6408 6373 ath10k_peer_delete(ar, arvif->vdev_id, sta->addr); 6409 6374 ath10k_mac_dec_num_stations(arvif, sta); 6375 + kfree(arsta->tx_stats); 6410 6376 6411 6377 if (num_tdls_stations != 0) 6412 6378 goto exit; ··· 6422 6386 ath10k_dbg(ar, ATH10K_DBG_MAC, 6423 6387 "mac vdev %d peer delete %pM sta %pK (sta gone)\n", 6424 6388 arvif->vdev_id, sta->addr, sta); 6425 - 6426 - if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { 6427 - kfree(arsta->tx_stats); 6428 - arsta->tx_stats = NULL; 6429 - } 6430 6389 6431 6390 if (sta->tdls) { 6432 6391 ret = ath10k_mac_tdls_peer_update(ar, arvif->vdev_id, ··· 6461 6430 } 6462 6431 } 6463 6432 spin_unlock_bh(&ar->data_lock); 6433 + 6434 + if (ath10k_debug_is_extd_tx_stats_enabled(ar)) { 6435 + kfree(arsta->tx_stats); 6436 + arsta->tx_stats = NULL; 6437 + } 6464 6438 6465 6439 for (i = 0; i < ARRAY_SIZE(sta->txq); i++) 6466 6440 ath10k_mac_txq_unref(ar, sta->txq[i]);
+2 -2
drivers/net/wireless/ath/ath10k/qmi.c
··· 931 931 qmi->msa_mem_size = resource_size(&r); 932 932 qmi->msa_va = devm_memremap(dev, qmi->msa_pa, qmi->msa_mem_size, 933 933 MEMREMAP_WT); 934 - if (!qmi->msa_va) { 934 + if (IS_ERR(qmi->msa_va)) { 935 935 dev_err(dev, "failed to map memory region: %pa\n", &r.start); 936 - return -EBUSY; 936 + return PTR_ERR(qmi->msa_va); 937 937 } 938 938 } else { 939 939 qmi->msa_va = dmam_alloc_coherent(dev, msa_size,
+7
drivers/net/wireless/ath/ath10k/rx_desc.h
··· 572 572 #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_LSB 0 573 573 #define RX_MSDU_END_INFO0_FIRST_MSDU BIT(14) 574 574 #define RX_MSDU_END_INFO0_LAST_MSDU BIT(15) 575 + #define RX_MSDU_END_INFO0_MSDU_LIMIT_ERR BIT(18) 575 576 #define RX_MSDU_END_INFO0_PRE_DELIM_ERR BIT(30) 576 577 #define RX_MSDU_END_INFO0_RESERVED_3B BIT(31) 577 578 ··· 676 675 *last_msdu 677 676 * Indicates the last MSDU of the A-MSDU. MPDU end status is 678 677 * only valid when last_msdu is set. 678 + * 679 + *msdu_limit_error 680 + * Indicates that the MSDU threshold was exceeded and thus 681 + * all the rest of the MSDUs will not be scattered and 682 + * will not be decapsulated but will be received in RAW format 683 + * as a single MSDU buffer. 679 684 * 680 685 *reserved_3a 681 686 * Reserved: HW should fill with zero. FW should ignore.
-1
drivers/net/wireless/ath/ath10k/snoc.c
··· 1654 1654 } 1655 1655 1656 1656 ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc probe\n"); 1657 - ath10k_warn(ar, "Warning: SNOC support is still work-in-progress, it will not work properly!"); 1658 1657 1659 1658 return 0; 1660 1659
+20
drivers/net/wireless/ath/ath10k/wmi-ops.h
··· 219 219 struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value); 220 220 struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar, 221 221 u32 param); 222 + struct sk_buff *(*gen_bb_timing) 223 + (struct ath10k *ar, 224 + const struct wmi_bb_timing_cfg_arg *arg); 222 225 223 226 }; 224 227 ··· 1579 1576 ar->wmi.cmd->radar_found_cmdid); 1580 1577 } 1581 1578 1579 + static inline int 1580 + ath10k_wmi_pdev_bb_timing(struct ath10k *ar, 1581 + const struct wmi_bb_timing_cfg_arg *arg) 1582 + { 1583 + struct sk_buff *skb; 1584 + 1585 + if (!ar->wmi.ops->gen_bb_timing) 1586 + return -EOPNOTSUPP; 1587 + 1588 + skb = ar->wmi.ops->gen_bb_timing(ar, arg); 1589 + 1590 + if (IS_ERR(skb)) 1591 + return PTR_ERR(skb); 1592 + 1593 + return ath10k_wmi_cmd_send(ar, skb, 1594 + ar->wmi.cmd->set_bb_timing_cmdid); 1595 + } 1582 1596 #endif
+1 -1
drivers/net/wireless/ath/ath10k/wmi-tlv.c
··· 621 621 ath10k_wmi_event_mgmt_tx_compl(ar, skb); 622 622 break; 623 623 default: 624 - ath10k_warn(ar, "Unknown eventid: %d\n", id); 624 + ath10k_dbg(ar, ATH10K_DBG_WMI, "Unknown eventid: %d\n", id); 625 625 break; 626 626 } 627 627
+28 -1
drivers/net/wireless/ath/ath10k/wmi.c
··· 539 539 WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID, 540 540 .pdev_get_tpc_table_cmdid = WMI_CMD_UNSUPPORTED, 541 541 .radar_found_cmdid = WMI_CMD_UNSUPPORTED, 542 + .set_bb_timing_cmdid = WMI_10_2_PDEV_SET_BB_TIMING_CONFIG_CMDID, 542 543 }; 543 544 544 545 /* 10.4 WMI cmd track */ ··· 826 825 .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, 827 826 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, 828 827 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, 828 + .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED, 829 829 }; 830 830 831 831 /* 10.X WMI VDEV param map */ ··· 902 900 .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, 903 901 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, 904 902 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, 903 + .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED, 905 904 }; 906 905 907 906 static struct wmi_vdev_param_map wmi_10_2_4_vdev_param_map = { ··· 977 974 .meru_vc = WMI_VDEV_PARAM_UNSUPPORTED, 978 975 .rx_decap_type = WMI_VDEV_PARAM_UNSUPPORTED, 979 976 .bw_nss_ratemask = WMI_VDEV_PARAM_UNSUPPORTED, 977 + .disable_4addr_src_lrn = WMI_VDEV_PARAM_UNSUPPORTED, 980 978 }; 981 979 982 980 static struct wmi_vdev_param_map wmi_10_4_vdev_param_map = { ··· 1055 1051 .bw_nss_ratemask = WMI_10_4_VDEV_PARAM_BW_NSS_RATEMASK, 1056 1052 .inc_tsf = WMI_10_4_VDEV_PARAM_TSF_INCREMENT, 1057 1053 .dec_tsf = WMI_10_4_VDEV_PARAM_TSF_DECREMENT, 1054 + .disable_4addr_src_lrn = WMI_10_4_VDEV_PARAM_DISABLE_4_ADDR_SRC_LRN, 1058 1055 }; 1059 1056 1060 1057 static struct wmi_pdev_param_map wmi_pdev_param_map = { ··· 2583 2578 2584 2579 survey = &ar->survey[idx]; 2585 2580 2586 - if (!params->mac_clk_mhz || !survey) 2581 + if (!params->mac_clk_mhz) 2587 2582 return; 2588 2583 2589 2584 memset(survey, 0, sizeof(*survey)); ··· 8844 8839 return 0; 8845 8840 } 8846 8841 8842 + static struct sk_buff * 8843 + ath10k_wmi_10_2_4_op_gen_bb_timing(struct ath10k *ar, 8844 + const struct wmi_bb_timing_cfg_arg *arg) 8845 + { 8846 + struct wmi_pdev_bb_timing_cfg_cmd *cmd; 8847 + struct sk_buff *skb; 8848 + 8849 + skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd)); 8850 + if (!skb) 8851 + return ERR_PTR(-ENOMEM); 8852 + 8853 + cmd = (struct wmi_pdev_bb_timing_cfg_cmd *)skb->data; 8854 + cmd->bb_tx_timing = __cpu_to_le32(arg->bb_tx_timing); 8855 + cmd->bb_xpa_timing = __cpu_to_le32(arg->bb_xpa_timing); 8856 + 8857 + ath10k_dbg(ar, ATH10K_DBG_WMI, 8858 + "wmi pdev bb_tx_timing 0x%x bb_xpa_timing 0x%x\n", 8859 + arg->bb_tx_timing, arg->bb_xpa_timing); 8860 + return skb; 8861 + } 8862 + 8847 8863 static const struct wmi_ops wmi_ops = { 8848 8864 .rx = ath10k_wmi_op_rx, 8849 8865 .map_svc = wmi_main_svc_map, ··· 9138 9112 .gen_pdev_enable_adaptive_cca = 9139 9113 ath10k_wmi_op_gen_pdev_enable_adaptive_cca, 9140 9114 .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype, 9115 + .gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing, 9141 9116 /* .gen_bcn_tmpl not implemented */ 9142 9117 /* .gen_prb_tmpl not implemented */ 9143 9118 /* .gen_p2p_go_bcn_ie not implemented */
+46
drivers/net/wireless/ath/ath10k/wmi.h
··· 205 205 WMI_SERVICE_SPOOF_MAC_SUPPORT, 206 206 WMI_SERVICE_TX_DATA_ACK_RSSI, 207 207 WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, 208 + WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, 209 + WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, 208 210 WMI_SERVICE_THERM_THROT, 209 211 210 212 /* keep last */ ··· 247 245 WMI_10X_SERVICE_PEER_STATS, 248 246 WMI_10X_SERVICE_RESET_CHIP, 249 247 WMI_10X_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, 248 + WMI_10X_SERVICE_VDEV_BCN_RATE_CONTROL, 249 + WMI_10X_SERVICE_PER_PACKET_SW_ENCRYPT, 250 + WMI_10X_SERVICE_BB_TIMING_CONFIG_SUPPORT, 250 251 }; 251 252 252 253 enum wmi_main_service { ··· 365 360 WMI_10_4_SERVICE_PEER_TID_CONFIGS_SUPPORT, 366 361 WMI_10_4_SERVICE_VDEV_BCN_RATE_CONTROL, 367 362 WMI_10_4_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, 363 + WMI_10_4_SERVICE_HTT_ASSERT_TRIGGER_SUPPORT, 364 + WMI_10_4_SERVICE_VDEV_FILTER_NEIGHBOR_RX_PACKETS, 365 + WMI_10_4_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, 368 366 }; 369 367 370 368 static inline char *wmi_service_name(int service_id) ··· 577 569 WMI_SERVICE_RESET_CHIP, len); 578 570 SVCMAP(WMI_10X_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, 579 571 WMI_SERVICE_HTT_MGMT_TX_COMP_VALID_FLAGS, len); 572 + SVCMAP(WMI_10X_SERVICE_BB_TIMING_CONFIG_SUPPORT, 573 + WMI_SERVICE_BB_TIMING_CONFIG_SUPPORT, len); 580 574 } 581 575 582 576 static inline void wmi_main_svc_map(const __le32 *in, unsigned long *out, ··· 797 787 WMI_SERVICE_TX_DATA_ACK_RSSI, len); 798 788 SVCMAP(WMI_10_4_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, 799 789 WMI_SERVICE_VDEV_DIFFERENT_BEACON_INTERVAL_SUPPORT, len); 790 + SVCMAP(WMI_10_4_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, 791 + WMI_SERVICE_VDEV_DISABLE_4_ADDR_SRC_LRN_SUPPORT, len); 800 792 } 801 793 802 794 #undef SVCMAP ··· 999 987 u32 pdev_wds_entry_list_cmdid; 1000 988 u32 tdls_set_offchan_mode_cmdid; 1001 989 u32 radar_found_cmdid; 990 + u32 set_bb_timing_cmdid; 1002 991 }; 1003 992 1004 993 /* ··· 1615 1602 WMI_10_2_SET_LTEU_CONFIG_CMDID, 1616 1603 WMI_10_2_SET_CCA_PARAMS, 1617 1604 WMI_10_2_PDEV_BSS_CHAN_INFO_REQUEST_CMDID, 1605 + WMI_10_2_FWTEST_CMDID, 1606 + WMI_10_2_PDEV_SET_BB_TIMING_CONFIG_CMDID, 1618 1607 WMI_10_2_PDEV_UTF_CMDID = WMI_10_2_END_CMDID - 1, 1619 1608 }; 1620 1609 ··· 5000 4985 (((preamble) << 6) | ((nss) << 4) | (rate)) 5001 4986 #define ATH10K_HW_AMPDU(flags) ((flags) & 0x1) 5002 4987 #define ATH10K_HW_BA_FAIL(flags) (((flags) >> 1) & 0x3) 4988 + #define ATH10K_FW_SKIPPED_RATE_CTRL(flags) (((flags) >> 6) & 0x1) 5003 4989 5004 4990 #define ATH10K_VHT_MCS_NUM 10 5005 4991 #define ATH10K_BW_NUM 4 ··· 5082 5066 u32 bw_nss_ratemask; 5083 5067 u32 inc_tsf; 5084 5068 u32 dec_tsf; 5069 + u32 disable_4addr_src_lrn; 5085 5070 }; 5086 5071 5087 5072 #define WMI_VDEV_PARAM_UNSUPPORTED 0 ··· 5422 5405 WMI_10_4_VDEV_PARAM_ATF_SSID_SCHED_POLICY, 5423 5406 WMI_10_4_VDEV_PARAM_DISABLE_DYN_BW_RTS, 5424 5407 WMI_10_4_VDEV_PARAM_TSF_DECREMENT, 5408 + WMI_10_4_VDEV_PARAM_SELFGEN_FIXED_RATE, 5409 + WMI_10_4_VDEV_PARAM_AMPDU_SUBFRAME_SIZE_PER_AC, 5410 + WMI_10_4_VDEV_PARAM_NSS_VHT160, 5411 + WMI_10_4_VDEV_PARAM_NSS_VHT80_80, 5412 + WMI_10_4_VDEV_PARAM_AMSDU_SUBFRAME_SIZE_PER_AC, 5413 + WMI_10_4_VDEV_PARAM_DISABLE_CABQ, 5414 + WMI_10_4_VDEV_PARAM_SIFS_TRIGGER_RATE, 5415 + WMI_10_4_VDEV_PARAM_TX_POWER, 5416 + WMI_10_4_VDEV_PARAM_ENABLE_DISABLE_RTT_RESPONDER_ROLE, 5417 + WMI_10_4_VDEV_PARAM_DISABLE_4_ADDR_SRC_LRN, 5425 5418 }; 5419 + 5420 + #define WMI_VDEV_DISABLE_4_ADDR_SRC_LRN 1 5426 5421 5427 5422 #define WMI_VDEV_PARAM_TXBF_SU_TX_BFEE BIT(0) 5428 5423 #define WMI_VDEV_PARAM_TXBF_MU_TX_BFEE BIT(1) ··· 7181 7152 struct wmi_pdev_chan_info_req_cmd { 7182 7153 __le32 type; 7183 7154 __le32 reserved; 7155 + } __packed; 7156 + 7157 + /* bb timing register configurations */ 7158 + struct wmi_bb_timing_cfg_arg { 7159 + /* Tx_end to pa off timing */ 7160 + u32 bb_tx_timing; 7161 + 7162 + /* Tx_end to external pa off timing */ 7163 + u32 bb_xpa_timing; 7164 + }; 7165 + 7166 + struct wmi_pdev_bb_timing_cfg_cmd { 7167 + /* Tx_end to pa off timing */ 7168 + __le32 bb_tx_timing; 7169 + 7170 + /* Tx_end to external pa off timing */ 7171 + __le32 bb_xpa_timing; 7184 7172 } __packed; 7185 7173 7186 7174 struct ath10k;
+3 -3
drivers/net/wireless/ath/ath6kl/cfg80211.c
··· 291 291 } 292 292 293 293 if (!test_bit(WLAN_ENABLED, &vif->flags)) { 294 - ath6kl_err("wlan disabled\n"); 294 + ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "wlan disabled\n"); 295 295 return false; 296 296 } 297 297 ··· 939 939 else 940 940 ssid_list[i].flag = ANY_SSID_FLAG; 941 941 942 - if (n_match_ssid == 0) 942 + if (ar->wiphy->max_match_sets != 0 && n_match_ssid == 0) 943 943 ssid_list[i].flag |= MATCH_SSID_FLAG; 944 944 } 945 945 ··· 1093 1093 if (vif->scan_req->n_ssids && vif->scan_req->ssids[0].ssid_len) { 1094 1094 for (i = 0; i < vif->scan_req->n_ssids; i++) { 1095 1095 ath6kl_wmi_probedssid_cmd(ar->wmi, vif->fw_vif_idx, 1096 - i + 1, DISABLE_SSID_FLAG, 1096 + i, DISABLE_SSID_FLAG, 1097 1097 0, NULL); 1098 1098 } 1099 1099 }
+42 -198
drivers/net/wireless/ath/wil6210/debugfs.c
··· 124 124 seq_puts(s, "}\n"); 125 125 } 126 126 127 - static int wil_ring_debugfs_show(struct seq_file *s, void *data) 127 + static int ring_show(struct seq_file *s, void *data) 128 128 { 129 129 uint i; 130 130 struct wil6210_priv *wil = s->private; ··· 183 183 184 184 return 0; 185 185 } 186 - 187 - static int wil_ring_seq_open(struct inode *inode, struct file *file) 188 - { 189 - return single_open(file, wil_ring_debugfs_show, inode->i_private); 190 - } 191 - 192 - static const struct file_operations fops_ring = { 193 - .open = wil_ring_seq_open, 194 - .release = single_release, 195 - .read = seq_read, 196 - .llseek = seq_lseek, 197 - }; 186 + DEFINE_SHOW_ATTRIBUTE(ring); 198 187 199 188 static void wil_print_sring(struct seq_file *s, struct wil6210_priv *wil, 200 189 struct wil_status_ring *sring) ··· 229 240 seq_puts(s, "}\n"); 230 241 } 231 242 232 - static int wil_srings_debugfs_show(struct seq_file *s, void *data) 243 + static int srings_show(struct seq_file *s, void *data) 233 244 { 234 245 struct wil6210_priv *wil = s->private; 235 246 int i = 0; ··· 240 251 241 252 return 0; 242 253 } 243 - 244 - static int wil_srings_seq_open(struct inode *inode, struct file *file) 245 - { 246 - return single_open(file, wil_srings_debugfs_show, inode->i_private); 247 - } 248 - 249 - static const struct file_operations fops_srings = { 250 - .open = wil_srings_seq_open, 251 - .release = single_release, 252 - .read = seq_read, 253 - .llseek = seq_lseek, 254 - }; 254 + DEFINE_SHOW_ATTRIBUTE(srings); 255 255 256 256 static void wil_seq_hexdump(struct seq_file *s, void *p, int len, 257 257 const char *prefix) ··· 326 348 wil_halp_unvote(wil); 327 349 } 328 350 329 - static int wil_mbox_debugfs_show(struct seq_file *s, void *data) 351 + static int mbox_show(struct seq_file *s, void *data) 330 352 { 331 353 struct wil6210_priv *wil = s->private; 332 354 int ret; ··· 344 366 345 367 return 0; 346 368 } 347 - 348 - static int wil_mbox_seq_open(struct inode *inode, struct file *file) 349 - { 350 - return single_open(file, wil_mbox_debugfs_show, inode->i_private); 351 - } 352 - 353 - static const struct file_operations fops_mbox = { 354 - .open = wil_mbox_seq_open, 355 - .release = single_release, 356 - .read = seq_read, 357 - .llseek = seq_lseek, 358 - }; 369 + DEFINE_SHOW_ATTRIBUTE(mbox); 359 370 360 371 static int wil_debugfs_iomem_x32_set(void *data, u64 val) 361 372 { ··· 591 624 return 0; 592 625 } 593 626 594 - static int wil_memread_debugfs_show(struct seq_file *s, void *data) 627 + static int memread_show(struct seq_file *s, void *data) 595 628 { 596 629 struct wil6210_priv *wil = s->private; 597 630 void __iomem *a; ··· 612 645 613 646 return 0; 614 647 } 615 - 616 - static int wil_memread_seq_open(struct inode *inode, struct file *file) 617 - { 618 - return single_open(file, wil_memread_debugfs_show, inode->i_private); 619 - } 620 - 621 - static const struct file_operations fops_memread = { 622 - .open = wil_memread_seq_open, 623 - .release = single_release, 624 - .read = seq_read, 625 - .llseek = seq_lseek, 626 - }; 648 + DEFINE_SHOW_ATTRIBUTE(memread); 627 649 628 650 static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf, 629 651 size_t count, loff_t *ppos) ··· 1016 1060 } 1017 1061 1018 1062 /*---------Tx/Rx descriptor------------*/ 1019 - static int wil_txdesc_debugfs_show(struct seq_file *s, void *data) 1063 + static int txdesc_show(struct seq_file *s, void *data) 1020 1064 { 1021 1065 struct wil6210_priv *wil = s->private; 1022 1066 struct wil_ring *ring; ··· 1109 1153 1110 1154 return 0; 1111 1155 } 1112 - 1113 - static int wil_txdesc_seq_open(struct inode *inode, struct file *file) 1114 - { 1115 - return single_open(file, wil_txdesc_debugfs_show, inode->i_private); 1116 - } 1117 - 1118 - static const struct file_operations fops_txdesc = { 1119 - .open = wil_txdesc_seq_open, 1120 - .release = single_release, 1121 - .read = seq_read, 1122 - .llseek = seq_lseek, 1123 - }; 1156 + DEFINE_SHOW_ATTRIBUTE(txdesc); 1124 1157 1125 1158 /*---------Tx/Rx status message------------*/ 1126 - static int wil_status_msg_debugfs_show(struct seq_file *s, void *data) 1159 + static int status_msg_show(struct seq_file *s, void *data) 1127 1160 { 1128 1161 struct wil6210_priv *wil = s->private; 1129 1162 int sring_idx = dbg_sring_index; ··· 1154 1209 1155 1210 return 0; 1156 1211 } 1157 - 1158 - static int wil_status_msg_seq_open(struct inode *inode, struct file *file) 1159 - { 1160 - return single_open(file, wil_status_msg_debugfs_show, 1161 - inode->i_private); 1162 - } 1163 - 1164 - static const struct file_operations fops_status_msg = { 1165 - .open = wil_status_msg_seq_open, 1166 - .release = single_release, 1167 - .read = seq_read, 1168 - .llseek = seq_lseek, 1169 - }; 1212 + DEFINE_SHOW_ATTRIBUTE(status_msg); 1170 1213 1171 1214 static int wil_print_rx_buff(struct seq_file *s, struct list_head *lh) 1172 1215 { ··· 1172 1239 return i; 1173 1240 } 1174 1241 1175 - static int wil_rx_buff_mgmt_debugfs_show(struct seq_file *s, void *data) 1242 + static int rx_buff_mgmt_show(struct seq_file *s, void *data) 1176 1243 { 1177 1244 struct wil6210_priv *wil = s->private; 1178 1245 struct wil_rx_buff_mgmt *rbm = &wil->rx_buff_mgmt; ··· 1197 1264 1198 1265 return 0; 1199 1266 } 1200 - 1201 - static int wil_rx_buff_mgmt_seq_open(struct inode *inode, struct file *file) 1202 - { 1203 - return single_open(file, wil_rx_buff_mgmt_debugfs_show, 1204 - inode->i_private); 1205 - } 1206 - 1207 - static const struct file_operations fops_rx_buff_mgmt = { 1208 - .open = wil_rx_buff_mgmt_seq_open, 1209 - .release = single_release, 1210 - .read = seq_read, 1211 - .llseek = seq_lseek, 1212 - }; 1267 + DEFINE_SHOW_ATTRIBUTE(rx_buff_mgmt); 1213 1268 1214 1269 /*---------beamforming------------*/ 1215 1270 static char *wil_bfstatus_str(u32 status) ··· 1227 1306 return true; 1228 1307 } 1229 1308 1230 - static int wil_bf_debugfs_show(struct seq_file *s, void *data) 1309 + static int bf_show(struct seq_file *s, void *data) 1231 1310 { 1232 1311 int rc; 1233 1312 int i; ··· 1281 1360 } 1282 1361 return 0; 1283 1362 } 1284 - 1285 - static int wil_bf_seq_open(struct inode *inode, struct file *file) 1286 - { 1287 - return single_open(file, wil_bf_debugfs_show, inode->i_private); 1288 - } 1289 - 1290 - static const struct file_operations fops_bf = { 1291 - .open = wil_bf_seq_open, 1292 - .release = single_release, 1293 - .read = seq_read, 1294 - .llseek = seq_lseek, 1295 - }; 1363 + DEFINE_SHOW_ATTRIBUTE(bf); 1296 1364 1297 1365 /*---------temp------------*/ 1298 1366 static void print_temp(struct seq_file *s, const char *prefix, s32 t) ··· 1298 1388 } 1299 1389 } 1300 1390 1301 - static int wil_temp_debugfs_show(struct seq_file *s, void *data) 1391 + static int temp_show(struct seq_file *s, void *data) 1302 1392 { 1303 1393 struct wil6210_priv *wil = s->private; 1304 1394 s32 t_m, t_r; ··· 1314 1404 1315 1405 return 0; 1316 1406 } 1317 - 1318 - static int wil_temp_seq_open(struct inode *inode, struct file *file) 1319 - { 1320 - return single_open(file, wil_temp_debugfs_show, inode->i_private); 1321 - } 1322 - 1323 - static const struct file_operations fops_temp = { 1324 - .open = wil_temp_seq_open, 1325 - .release = single_release, 1326 - .read = seq_read, 1327 - .llseek = seq_lseek, 1328 - }; 1407 + DEFINE_SHOW_ATTRIBUTE(temp); 1329 1408 1330 1409 /*---------freq------------*/ 1331 - static int wil_freq_debugfs_show(struct seq_file *s, void *data) 1410 + static int freq_show(struct seq_file *s, void *data) 1332 1411 { 1333 1412 struct wil6210_priv *wil = s->private; 1334 1413 struct wireless_dev *wdev = wil->main_ndev->ieee80211_ptr; ··· 1327 1428 1328 1429 return 0; 1329 1430 } 1330 - 1331 - static int wil_freq_seq_open(struct inode *inode, struct file *file) 1332 - { 1333 - return single_open(file, wil_freq_debugfs_show, inode->i_private); 1334 - } 1335 - 1336 - static const struct file_operations fops_freq = { 1337 - .open = wil_freq_seq_open, 1338 - .release = single_release, 1339 - .read = seq_read, 1340 - .llseek = seq_lseek, 1341 - }; 1431 + DEFINE_SHOW_ATTRIBUTE(freq); 1342 1432 1343 1433 /*---------link------------*/ 1344 - static int wil_link_debugfs_show(struct seq_file *s, void *data) 1434 + static int link_show(struct seq_file *s, void *data) 1345 1435 { 1346 1436 struct wil6210_priv *wil = s->private; 1347 1437 struct station_info *sinfo; ··· 1382 1494 kfree(sinfo); 1383 1495 return rc; 1384 1496 } 1385 - 1386 - static int wil_link_seq_open(struct inode *inode, struct file *file) 1387 - { 1388 - return single_open(file, wil_link_debugfs_show, inode->i_private); 1389 - } 1390 - 1391 - static const struct file_operations fops_link = { 1392 - .open = wil_link_seq_open, 1393 - .release = single_release, 1394 - .read = seq_read, 1395 - .llseek = seq_lseek, 1396 - }; 1497 + DEFINE_SHOW_ATTRIBUTE(link); 1397 1498 1398 1499 /*---------info------------*/ 1399 - static int wil_info_debugfs_show(struct seq_file *s, void *data) 1500 + static int info_show(struct seq_file *s, void *data) 1400 1501 { 1401 1502 struct wil6210_priv *wil = s->private; 1402 1503 struct net_device *ndev = wil->main_ndev; ··· 1420 1543 #undef CHECK_QSTATE 1421 1544 return 0; 1422 1545 } 1423 - 1424 - static int wil_info_seq_open(struct inode *inode, struct file *file) 1425 - { 1426 - return single_open(file, wil_info_debugfs_show, inode->i_private); 1427 - } 1428 - 1429 - static const struct file_operations fops_info = { 1430 - .open = wil_info_seq_open, 1431 - .release = single_release, 1432 - .read = seq_read, 1433 - .llseek = seq_lseek, 1434 - }; 1546 + DEFINE_SHOW_ATTRIBUTE(info); 1435 1547 1436 1548 /*---------recovery------------*/ 1437 1549 /* mode = [manual|auto] ··· 1536 1670 seq_puts(s, "\n"); 1537 1671 } 1538 1672 1539 - static int wil_sta_debugfs_show(struct seq_file *s, void *data) 1673 + static int sta_show(struct seq_file *s, void *data) 1540 1674 __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock) 1541 1675 { 1542 1676 struct wil6210_priv *wil = s->private; ··· 1618 1752 1619 1753 return 0; 1620 1754 } 1755 + DEFINE_SHOW_ATTRIBUTE(sta); 1621 1756 1622 - static int wil_sta_seq_open(struct inode *inode, struct file *file) 1623 - { 1624 - return single_open(file, wil_sta_debugfs_show, inode->i_private); 1625 - } 1626 - 1627 - static const struct file_operations fops_sta = { 1628 - .open = wil_sta_seq_open, 1629 - .release = single_release, 1630 - .read = seq_read, 1631 - .llseek = seq_lseek, 1632 - }; 1633 - 1634 - static int wil_mids_debugfs_show(struct seq_file *s, void *data) 1757 + static int mids_show(struct seq_file *s, void *data) 1635 1758 { 1636 1759 struct wil6210_priv *wil = s->private; 1637 1760 struct wil6210_vif *vif; ··· 1643 1788 1644 1789 return 0; 1645 1790 } 1646 - 1647 - static int wil_mids_seq_open(struct inode *inode, struct file *file) 1648 - { 1649 - return single_open(file, wil_mids_debugfs_show, inode->i_private); 1650 - } 1651 - 1652 - static const struct file_operations fops_mids = { 1653 - .open = wil_mids_seq_open, 1654 - .release = single_release, 1655 - .read = seq_read, 1656 - .llseek = seq_lseek, 1657 - }; 1791 + DEFINE_SHOW_ATTRIBUTE(mids); 1658 1792 1659 1793 static int wil_tx_latency_debugfs_show(struct seq_file *s, void *data) 1660 1794 __acquires(&p->tid_rx_lock) __releases(&p->tid_rx_lock) ··· 2287 2443 umode_t mode; 2288 2444 const struct file_operations *fops; 2289 2445 } dbg_files[] = { 2290 - {"mbox", 0444, &fops_mbox}, 2291 - {"rings", 0444, &fops_ring}, 2292 - {"stations", 0444, &fops_sta}, 2293 - {"mids", 0444, &fops_mids}, 2294 - {"desc", 0444, &fops_txdesc}, 2295 - {"bf", 0444, &fops_bf}, 2296 - {"mem_val", 0644, &fops_memread}, 2446 + {"mbox", 0444, &mbox_fops}, 2447 + {"rings", 0444, &ring_fops}, 2448 + {"stations", 0444, &sta_fops}, 2449 + {"mids", 0444, &mids_fops}, 2450 + {"desc", 0444, &txdesc_fops}, 2451 + {"bf", 0444, &bf_fops}, 2452 + {"mem_val", 0644, &memread_fops}, 2297 2453 {"rxon", 0244, &fops_rxon}, 2298 2454 {"tx_mgmt", 0244, &fops_txmgmt}, 2299 2455 {"wmi_send", 0244, &fops_wmi}, 2300 2456 {"back", 0644, &fops_back}, 2301 2457 {"pmccfg", 0644, &fops_pmccfg}, 2302 2458 {"pmcdata", 0444, &fops_pmcdata}, 2303 - {"temp", 0444, &fops_temp}, 2304 - {"freq", 0444, &fops_freq}, 2305 - {"link", 0444, &fops_link}, 2306 - {"info", 0444, &fops_info}, 2459 + {"temp", 0444, &temp_fops}, 2460 + {"freq", 0444, &freq_fops}, 2461 + {"link", 0444, &link_fops}, 2462 + {"info", 0444, &info_fops}, 2307 2463 {"recovery", 0644, &fops_recovery}, 2308 2464 {"led_cfg", 0644, &fops_led_cfg}, 2309 2465 {"led_blink_time", 0644, &fops_led_blink_time}, ··· 2311 2467 {"fw_version", 0444, &fops_fw_version}, 2312 2468 {"suspend_stats", 0644, &fops_suspend_stats}, 2313 2469 {"compressed_rx_status", 0644, &fops_compressed_rx_status}, 2314 - {"srings", 0444, &fops_srings}, 2315 - {"status_msg", 0444, &fops_status_msg}, 2316 - {"rx_buff_mgmt", 0444, &fops_rx_buff_mgmt}, 2470 + {"srings", 0444, &srings_fops}, 2471 + {"status_msg", 0444, &status_msg_fops}, 2472 + {"rx_buff_mgmt", 0444, &rx_buff_mgmt_fops}, 2317 2473 {"tx_latency", 0644, &fops_tx_latency}, 2318 2474 {"link_stats", 0644, &fops_link_stats}, 2319 2475 {"link_stats_global", 0644, &fops_link_stats_global},
-2
drivers/net/wireless/ath/wil6210/main.c
··· 404 404 { 405 405 struct wil6210_priv *wil; 406 406 struct net_device *ndev; 407 - struct wireless_dev *wdev; 408 407 int cid = -ENOENT; 409 408 410 409 if (unlikely(!vif)) ··· 411 412 412 413 wil = vif_to_wil(vif); 413 414 ndev = vif_to_ndev(vif); 414 - wdev = vif_to_wdev(vif); 415 415 416 416 might_sleep(); 417 417 wil_info(wil, "disconnect bssid=%pM, reason=%d\n", bssid, reason_code);
-4
drivers/net/wireless/broadcom/b43/phy_n.c
··· 5895 5895 struct ieee80211_channel *channel = dev->wl->hw->conf.chandef.chan; 5896 5896 struct b43_ppr *ppr = &nphy->tx_pwr_max_ppr; 5897 5897 u8 max; /* qdBm */ 5898 - bool tx_pwr_state; 5899 5898 5900 5899 if (nphy->tx_pwr_last_recalc_freq == channel->center_freq && 5901 5900 nphy->tx_pwr_last_recalc_limit == phy->desired_txpower) ··· 5930 5931 b43_ppr_apply_min(dev, ppr, INT_TO_Q52(8)); 5931 5932 5932 5933 /* Apply */ 5933 - tx_pwr_state = nphy->txpwrctrl; 5934 5934 b43_mac_suspend(dev); 5935 5935 b43_nphy_tx_power_ctl_setup(dev); 5936 5936 if (dev->dev->core_rev == 11 || dev->dev->core_rev == 12) { ··· 6042 6044 u8 tx_pwr_state; 6043 6045 struct nphy_txgains target; 6044 6046 u16 tmp; 6045 - enum nl80211_band tmp2; 6046 6047 bool do_rssi_cal; 6047 6048 6048 6049 u16 clip[2]; ··· 6135 6138 b43_phy_write(dev, B43_NPHY_DUP40_BL, 0x9A4); 6136 6139 } 6137 6140 6138 - tmp2 = b43_current_band(dev->wl); 6139 6141 if (b43_nphy_ipa(dev)) { 6140 6142 b43_phy_set(dev, B43_NPHY_PAPD_EN0, 0x1); 6141 6143 b43_phy_maskset(dev, B43_NPHY_EPS_TABLE_ADJ0, 0x007F,
+1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
··· 983 983 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4354), 984 984 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_BROADCOM_4356), 985 985 BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_4373), 986 + BRCMF_SDIO_DEVICE(SDIO_DEVICE_ID_CYPRESS_43012), 986 987 { /* end: all zeroes */ } 987 988 }; 988 989 MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids);
+25 -2
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
··· 5196 5196 .del_pmk = brcmf_cfg80211_del_pmk, 5197 5197 }; 5198 5198 5199 - struct cfg80211_ops *brcmf_cfg80211_get_ops(void) 5199 + struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings) 5200 5200 { 5201 - return kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops), 5201 + struct cfg80211_ops *ops; 5202 + 5203 + ops = kmemdup(&brcmf_cfg80211_ops, sizeof(brcmf_cfg80211_ops), 5202 5204 GFP_KERNEL); 5205 + 5206 + if (ops && settings->roamoff) 5207 + ops->update_connect_params = NULL; 5208 + 5209 + return ops; 5203 5210 } 5204 5211 5205 5212 struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg, ··· 6316 6309 .tx = 0xffff, 6317 6310 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) | 6318 6311 BIT(IEEE80211_STYPE_PROBE_REQ >> 4) 6312 + }, 6313 + [NL80211_IFTYPE_AP] = { 6314 + .tx = 0xffff, 6315 + .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) | 6316 + BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) | 6317 + BIT(IEEE80211_STYPE_PROBE_REQ >> 4) | 6318 + BIT(IEEE80211_STYPE_DISASSOC >> 4) | 6319 + BIT(IEEE80211_STYPE_AUTH >> 4) | 6320 + BIT(IEEE80211_STYPE_DEAUTH >> 4) | 6321 + BIT(IEEE80211_STYPE_ACTION >> 4) 6319 6322 } 6320 6323 }; 6321 6324 ··· 6655 6638 goto default_conf_out; 6656 6639 6657 6640 brcmf_configure_arp_nd_offload(ifp, true); 6641 + 6642 + err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_FAKEFRAG, 1); 6643 + if (err) { 6644 + brcmf_err("failed to set frameburst mode\n"); 6645 + goto default_conf_out; 6646 + } 6658 6647 6659 6648 cfg->dongle_up = true; 6660 6649 default_conf_out:
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.h
··· 404 404 void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg); 405 405 s32 brcmf_cfg80211_up(struct net_device *ndev); 406 406 s32 brcmf_cfg80211_down(struct net_device *ndev); 407 - struct cfg80211_ops *brcmf_cfg80211_get_ops(void); 407 + struct cfg80211_ops *brcmf_cfg80211_get_ops(struct brcmf_mp_device *settings); 408 408 enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp); 409 409 410 410 struct brcmf_cfg80211_vif *brcmf_alloc_vif(struct brcmf_cfg80211_info *cfg,
+26 -7
drivers/net/wireless/broadcom/brcm80211/brcmfmac/chip.c
··· 165 165 #define SRCI_LSS_MASK 0x00f00000 166 166 #define SRCI_LSS_SHIFT 20 167 167 #define SRCI_SRNB_MASK 0xf0 168 + #define SRCI_SRNB_MASK_EXT 0x100 168 169 #define SRCI_SRNB_SHIFT 4 169 170 #define SRCI_SRBSZ_MASK 0xf 170 171 #define SRCI_SRBSZ_SHIFT 0 ··· 593 592 if (lss != 0) 594 593 *ramsize += (1 << ((lss - 1) + SR_BSZ_BASE)); 595 594 } else { 596 - nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT; 595 + /* length of SRAM Banks increased for corerev greater than 23 */ 596 + if (sr->pub.rev >= 23) { 597 + nb = (coreinfo & (SRCI_SRNB_MASK | SRCI_SRNB_MASK_EXT)) 598 + >> SRCI_SRNB_SHIFT; 599 + } else { 600 + nb = (coreinfo & SRCI_SRNB_MASK) >> SRCI_SRNB_SHIFT; 601 + } 597 602 for (i = 0; i < nb; i++) { 598 603 retent = brcmf_chip_socram_banksize(sr, i, &banksize); 599 604 *ramsize += banksize; ··· 786 779 u32 *regbase, u32 *wrapbase) 787 780 { 788 781 u8 desc; 789 - u32 val; 782 + u32 val, szdesc; 790 783 u8 mpnum = 0; 791 784 u8 stype, sztype, wraptype; 792 785 ··· 832 825 833 826 /* next size descriptor can be skipped */ 834 827 if (sztype == DMP_SLAVE_SIZE_DESC) { 835 - val = brcmf_chip_dmp_get_desc(ci, eromaddr, NULL); 828 + szdesc = brcmf_chip_dmp_get_desc(ci, eromaddr, NULL); 836 829 /* skip upper size descriptor if present */ 837 - if (val & DMP_DESC_ADDRSIZE_GT32) 830 + if (szdesc & DMP_DESC_ADDRSIZE_GT32) 838 831 brcmf_chip_dmp_get_desc(ci, eromaddr, NULL); 839 832 } 840 833 841 - /* only look for 4K register regions */ 842 - if (sztype != DMP_SLAVE_SIZE_4K) 834 + /* look for 4K or 8K register regions */ 835 + if (sztype != DMP_SLAVE_SIZE_4K && 836 + sztype != DMP_SLAVE_SIZE_8K) 843 837 continue; 844 838 845 839 stype = (val & DMP_SLAVE_TYPE) >> DMP_SLAVE_TYPE_S; ··· 897 889 898 890 /* need core with ports */ 899 891 if (nmw + nsw == 0 && 900 - id != BCMA_CORE_PMU) 892 + id != BCMA_CORE_PMU && 893 + id != BCMA_CORE_GCI) 901 894 continue; 902 895 903 896 /* try to obtain register address info */ ··· 1365 1356 addr = CORE_CC_REG(base, sr_control1); 1366 1357 reg = chip->ops->read32(chip->ctx, addr); 1367 1358 return reg != 0; 1359 + case CY_CC_4373_CHIP_ID: 1360 + /* explicitly check SR engine enable bit */ 1361 + addr = CORE_CC_REG(base, sr_control0); 1362 + reg = chip->ops->read32(chip->ctx, addr); 1363 + return (reg & CC_SR_CTL0_ENABLE_MASK) != 0; 1364 + case CY_CC_43012_CHIP_ID: 1365 + addr = CORE_CC_REG(pmu->base, retention_ctl); 1366 + reg = chip->ops->read32(chip->ctx, addr); 1367 + return (reg & (PMU_RCTL_MACPHY_DISABLE_MASK | 1368 + PMU_RCTL_LOGIC_DISABLE_MASK)) == 0; 1368 1369 default: 1369 1370 addr = CORE_CC_REG(pmu->base, pmucapabilities_ext); 1370 1371 reg = chip->ops->read32(chip->ctx, addr);
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
··· 1130 1130 1131 1131 brcmf_dbg(TRACE, "Enter\n"); 1132 1132 1133 - ops = brcmf_cfg80211_get_ops(); 1133 + ops = brcmf_cfg80211_get_ops(settings); 1134 1134 if (!ops) 1135 1135 return -ENOMEM; 1136 1136
+1 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
··· 512 512 return NULL; 513 513 } 514 514 #else 515 - static u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; } 515 + static inline u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; } 516 516 #endif 517 517 518 518 static void brcmf_fw_free_request(struct brcmf_fw_request *req)
+1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h
··· 80 80 #define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201 81 81 #define BRCMF_C_SET_ASSOC_PREFER 205 82 82 #define BRCMF_C_GET_VALID_CHANNELS 217 83 + #define BRCMF_C_SET_FAKEFRAG 219 83 84 #define BRCMF_C_GET_KEY_PRIMARY 235 84 85 #define BRCMF_C_SET_KEY_PRIMARY 236 85 86 #define BRCMF_C_SET_SCAN_PASSIVE_TIME 258
+86 -58
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c
··· 511 511 struct work_struct fws_dequeue_work; 512 512 u32 fifo_enqpkt[BRCMF_FWS_FIFO_COUNT]; 513 513 int fifo_credit[BRCMF_FWS_FIFO_COUNT]; 514 + int init_fifo_credit[BRCMF_FWS_FIFO_COUNT]; 514 515 int credits_borrowed[BRCMF_FWS_FIFO_AC_VO + 1]; 515 516 int deq_node_pos[BRCMF_FWS_FIFO_COUNT]; 516 517 u32 fifo_credit_map; ··· 1238 1237 } 1239 1238 1240 1239 fws->fifo_credit[fifo] += credits; 1240 + if (fws->fifo_credit[fifo] > fws->init_fifo_credit[fifo]) 1241 + fws->fifo_credit[fifo] = fws->init_fifo_credit[fifo]; 1242 + 1241 1243 } 1242 1244 1243 1245 static void brcmf_fws_schedule_deq(struct brcmf_fws_info *fws) ··· 1455 1451 1456 1452 static int 1457 1453 brcmf_fws_txs_process(struct brcmf_fws_info *fws, u8 flags, u32 hslot, 1458 - u32 genbit, u16 seq) 1454 + u32 genbit, u16 seq, u8 compcnt) 1459 1455 { 1460 1456 u32 fifo; 1457 + u8 cnt = 0; 1461 1458 int ret; 1462 1459 bool remove_from_hanger = true; 1463 1460 struct sk_buff *skb; ··· 1469 1464 brcmf_dbg(DATA, "flags %d\n", flags); 1470 1465 1471 1466 if (flags == BRCMF_FWS_TXSTATUS_DISCARD) 1472 - fws->stats.txs_discard++; 1467 + fws->stats.txs_discard += compcnt; 1473 1468 else if (flags == BRCMF_FWS_TXSTATUS_CORE_SUPPRESS) { 1474 - fws->stats.txs_supp_core++; 1469 + fws->stats.txs_supp_core += compcnt; 1475 1470 remove_from_hanger = false; 1476 1471 } else if (flags == BRCMF_FWS_TXSTATUS_FW_PS_SUPPRESS) { 1477 - fws->stats.txs_supp_ps++; 1472 + fws->stats.txs_supp_ps += compcnt; 1478 1473 remove_from_hanger = false; 1479 1474 } else if (flags == BRCMF_FWS_TXSTATUS_FW_TOSSED) 1480 - fws->stats.txs_tossed++; 1475 + fws->stats.txs_tossed += compcnt; 1481 1476 else if (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED) 1482 - fws->stats.txs_host_tossed++; 1477 + fws->stats.txs_host_tossed += compcnt; 1483 1478 else 1484 1479 brcmf_err("unexpected txstatus\n"); 1485 1480 1486 - ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, 1487 - remove_from_hanger); 1488 - if (ret != 0) { 1489 - brcmf_err("no packet in hanger slot: hslot=%d\n", hslot); 1490 - return ret; 1491 - } 1481 + while (cnt < compcnt) { 1482 + ret = brcmf_fws_hanger_poppkt(&fws->hanger, hslot, &skb, 1483 + remove_from_hanger); 1484 + if (ret != 0) { 1485 + brcmf_err("no packet in hanger slot: hslot=%d\n", 1486 + hslot); 1487 + goto cont; 1488 + } 1492 1489 1493 - skcb = brcmf_skbcb(skb); 1494 - entry = skcb->mac; 1495 - if (WARN_ON(!entry)) { 1496 - brcmu_pkt_buf_free_skb(skb); 1497 - return -EINVAL; 1498 - } 1499 - entry->transit_count--; 1500 - if (entry->suppressed && entry->suppr_transit_count) 1501 - entry->suppr_transit_count--; 1490 + skcb = brcmf_skbcb(skb); 1491 + entry = skcb->mac; 1492 + if (WARN_ON(!entry)) { 1493 + brcmu_pkt_buf_free_skb(skb); 1494 + goto cont; 1495 + } 1496 + entry->transit_count--; 1497 + if (entry->suppressed && entry->suppr_transit_count) 1498 + entry->suppr_transit_count--; 1502 1499 1503 - brcmf_dbg(DATA, "%s flags %d htod %X seq %X\n", entry->name, flags, 1504 - skcb->htod, seq); 1500 + brcmf_dbg(DATA, "%s flags %d htod %X seq %X\n", entry->name, 1501 + flags, skcb->htod, seq); 1505 1502 1506 - /* pick up the implicit credit from this packet */ 1507 - fifo = brcmf_skb_htod_tag_get_field(skb, FIFO); 1508 - if ((fws->fcmode == BRCMF_FWS_FCMODE_IMPLIED_CREDIT) || 1509 - (brcmf_skb_if_flags_get_field(skb, REQ_CREDIT)) || 1510 - (flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED)) { 1511 - brcmf_fws_return_credits(fws, fifo, 1); 1512 - brcmf_fws_schedule_deq(fws); 1513 - } 1514 - brcmf_fws_macdesc_return_req_credit(skb); 1503 + /* pick up the implicit credit from this packet */ 1504 + fifo = brcmf_skb_htod_tag_get_field(skb, FIFO); 1505 + if (fws->fcmode == BRCMF_FWS_FCMODE_IMPLIED_CREDIT || 1506 + (brcmf_skb_if_flags_get_field(skb, REQ_CREDIT)) || 1507 + flags == BRCMF_FWS_TXSTATUS_HOST_TOSSED) { 1508 + brcmf_fws_return_credits(fws, fifo, 1); 1509 + brcmf_fws_schedule_deq(fws); 1510 + } 1511 + brcmf_fws_macdesc_return_req_credit(skb); 1515 1512 1516 - ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp); 1517 - if (ret) { 1518 - brcmu_pkt_buf_free_skb(skb); 1519 - return -EINVAL; 1513 + ret = brcmf_proto_hdrpull(fws->drvr, false, skb, &ifp); 1514 + if (ret) { 1515 + brcmu_pkt_buf_free_skb(skb); 1516 + goto cont; 1517 + } 1518 + if (!remove_from_hanger) 1519 + ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, 1520 + genbit, seq); 1521 + if (remove_from_hanger || ret) 1522 + brcmf_txfinalize(ifp, skb, true); 1523 + 1524 + cont: 1525 + hslot = (hslot + 1) & (BRCMF_FWS_TXSTAT_HSLOT_MASK >> 1526 + BRCMF_FWS_TXSTAT_HSLOT_SHIFT); 1527 + if (BRCMF_FWS_MODE_GET_REUSESEQ(fws->mode)) 1528 + seq = (seq + 1) & BRCMF_SKB_HTOD_SEQ_NR_MASK; 1529 + 1530 + cnt++; 1520 1531 } 1521 - if (!remove_from_hanger) 1522 - ret = brcmf_fws_txstatus_suppressed(fws, fifo, skb, 1523 - genbit, seq); 1524 - if (remove_from_hanger || ret) 1525 - brcmf_txfinalize(ifp, skb, true); 1526 1532 1527 1533 return 0; 1528 1534 } ··· 1559 1543 return BRCMF_FWS_RET_OK_SCHEDULE; 1560 1544 } 1561 1545 1562 - static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 *data) 1546 + static int brcmf_fws_txstatus_indicate(struct brcmf_fws_info *fws, u8 type, 1547 + u8 *data) 1563 1548 { 1564 1549 __le32 status_le; 1565 1550 __le16 seq_le; ··· 1569 1552 u32 genbit; 1570 1553 u8 flags; 1571 1554 u16 seq; 1555 + u8 compcnt; 1556 + u8 compcnt_offset = BRCMF_FWS_TYPE_TXSTATUS_LEN; 1572 1557 1573 - fws->stats.txs_indicate++; 1574 1558 memcpy(&status_le, data, sizeof(status_le)); 1575 1559 status = le32_to_cpu(status_le); 1576 1560 flags = brcmf_txstatus_get_field(status, FLAGS); 1577 1561 hslot = brcmf_txstatus_get_field(status, HSLOT); 1578 1562 genbit = brcmf_txstatus_get_field(status, GENERATION); 1579 1563 if (BRCMF_FWS_MODE_GET_REUSESEQ(fws->mode)) { 1580 - memcpy(&seq_le, &data[BRCMF_FWS_TYPE_PKTTAG_LEN], 1564 + memcpy(&seq_le, &data[BRCMF_FWS_TYPE_TXSTATUS_LEN], 1581 1565 sizeof(seq_le)); 1582 1566 seq = le16_to_cpu(seq_le); 1567 + compcnt_offset += BRCMF_FWS_TYPE_SEQ_LEN; 1583 1568 } else { 1584 1569 seq = 0; 1585 1570 } 1586 1571 1572 + if (type == BRCMF_FWS_TYPE_COMP_TXSTATUS) 1573 + compcnt = data[compcnt_offset]; 1574 + else 1575 + compcnt = 1; 1576 + fws->stats.txs_indicate += compcnt; 1577 + 1587 1578 brcmf_fws_lock(fws); 1588 - brcmf_fws_txs_process(fws, flags, hslot, genbit, seq); 1579 + brcmf_fws_txs_process(fws, flags, hslot, genbit, seq, compcnt); 1589 1580 brcmf_fws_unlock(fws); 1590 1581 return BRCMF_FWS_RET_OK_NOSCHEDULE; 1591 1582 } ··· 1620 1595 brcmf_err("event payload too small (%d)\n", e->datalen); 1621 1596 return -EINVAL; 1622 1597 } 1623 - if (fws->creditmap_received) 1624 - return 0; 1625 1598 1626 1599 fws->creditmap_received = true; 1627 1600 1628 1601 brcmf_dbg(TRACE, "enter: credits %pM\n", credits); 1629 1602 brcmf_fws_lock(fws); 1630 1603 for (i = 0; i < ARRAY_SIZE(fws->fifo_credit); i++) { 1631 - if (*credits) 1604 + fws->fifo_credit[i] += credits[i] - fws->init_fifo_credit[i]; 1605 + fws->init_fifo_credit[i] = credits[i]; 1606 + if (fws->fifo_credit[i] > 0) 1632 1607 fws->fifo_credit_map |= 1 << i; 1633 1608 else 1634 1609 fws->fifo_credit_map &= ~(1 << i); 1635 - fws->fifo_credit[i] = *credits++; 1610 + WARN_ONCE(fws->fifo_credit[i] < 0, 1611 + "fifo_credit[%d] is negative(%d)\n", i, 1612 + fws->fifo_credit[i]); 1636 1613 } 1637 1614 brcmf_fws_schedule_deq(fws); 1638 1615 brcmf_fws_unlock(fws); ··· 1909 1882 1910 1883 err = BRCMF_FWS_RET_OK_NOSCHEDULE; 1911 1884 switch (type) { 1912 - case BRCMF_FWS_TYPE_COMP_TXSTATUS: 1913 - break; 1914 1885 case BRCMF_FWS_TYPE_HOST_REORDER_RXPKTS: 1915 1886 rd = (struct brcmf_skb_reorder_data *)skb->cb; 1916 1887 rd->reorder = data; ··· 1931 1906 err = brcmf_fws_request_indicate(fws, type, data); 1932 1907 break; 1933 1908 case BRCMF_FWS_TYPE_TXSTATUS: 1934 - brcmf_fws_txstatus_indicate(fws, data); 1909 + case BRCMF_FWS_TYPE_COMP_TXSTATUS: 1910 + brcmf_fws_txstatus_indicate(fws, type, data); 1935 1911 break; 1936 1912 case BRCMF_FWS_TYPE_FIFO_CREDITBACK: 1937 1913 err = brcmf_fws_fifocreditback_indicate(fws, data); ··· 2021 1995 fws->stats.rollback_failed++; 2022 1996 hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); 2023 1997 brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, 2024 - hslot, 0, 0); 1998 + hslot, 0, 0, 1); 2025 1999 } else { 2026 2000 fws->stats.rollback_success++; 2027 2001 brcmf_fws_return_credits(fws, fifo, 1); ··· 2039 2013 } 2040 2014 2041 2015 for (lender_ac = 0; lender_ac <= BRCMF_FWS_FIFO_AC_VO; lender_ac++) { 2042 - if (fws->fifo_credit[lender_ac]) { 2016 + if (fws->fifo_credit[lender_ac] > 0) { 2043 2017 fws->credits_borrowed[lender_ac]++; 2044 2018 fws->fifo_credit[lender_ac]--; 2045 2019 if (fws->fifo_credit[lender_ac] == 0) ··· 2236 2210 } 2237 2211 continue; 2238 2212 } 2239 - while ((fws->fifo_credit[fifo]) || ((!fws->bcmc_credit_check) && 2240 - (fifo == BRCMF_FWS_FIFO_BCMC))) { 2213 + while ((fws->fifo_credit[fifo] > 0) || 2214 + ((!fws->bcmc_credit_check) && 2215 + (fifo == BRCMF_FWS_FIFO_BCMC))) { 2241 2216 skb = brcmf_fws_deq(fws, fifo); 2242 2217 if (!skb) 2243 2218 break; ··· 2249 2222 break; 2250 2223 } 2251 2224 if ((fifo == BRCMF_FWS_FIFO_AC_BE) && 2252 - (fws->fifo_credit[fifo] == 0) && 2225 + (fws->fifo_credit[fifo] <= 0) && 2253 2226 (!fws->bus_flow_blocked)) { 2254 2227 while (brcmf_fws_borrow_credit(fws) == 0) { 2255 2228 skb = brcmf_fws_deq(fws, fifo); ··· 2482 2455 } 2483 2456 brcmf_fws_lock(fws); 2484 2457 hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); 2485 - brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0, 0); 2458 + brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0, 0, 2459 + 1); 2486 2460 brcmf_fws_unlock(fws); 2487 2461 } 2488 2462
+1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
··· 2019 2019 static const struct pci_device_id brcmf_pcie_devid_table[] = { 2020 2020 BRCMF_PCIE_DEVICE(BRCM_PCIE_4350_DEVICE_ID), 2021 2021 BRCMF_PCIE_DEVICE_SUB(0x4355, BRCM_PCIE_VENDOR_ID_BROADCOM, 0x4355), 2022 + BRCMF_PCIE_DEVICE(BRCM_PCIE_4354_RAW_DEVICE_ID), 2022 2023 BRCMF_PCIE_DEVICE(BRCM_PCIE_4356_DEVICE_ID), 2023 2024 BRCMF_PCIE_DEVICE(BRCM_PCIE_43567_DEVICE_ID), 2024 2025 BRCMF_PCIE_DEVICE(BRCM_PCIE_43570_DEVICE_ID),
+105 -14
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
··· 49 49 #define DCMD_RESP_TIMEOUT msecs_to_jiffies(2500) 50 50 #define CTL_DONE_TIMEOUT msecs_to_jiffies(2500) 51 51 52 + /* watermark expressed in number of words */ 53 + #define DEFAULT_F2_WATERMARK 0x8 54 + #define CY_4373_F2_WATERMARK 0x40 55 + #define CY_43012_F2_WATERMARK 0x60 56 + 52 57 #ifdef DEBUG 53 58 54 59 #define BRCMF_TRAP_INFO_SIZE 80 ··· 143 138 /* 1: isolate internal sdio signals, put external pads in tri-state; requires 144 139 * sdio bus power cycle to clear (rev 9) */ 145 140 #define SBSDIO_DEVCTL_PADS_ISO 0x08 141 + /* 1: enable F2 Watermark */ 142 + #define SBSDIO_DEVCTL_F2WM_ENAB 0x10 146 143 /* Force SD->SB reset mapping (rev 11) */ 147 144 #define SBSDIO_DEVCTL_SB_RST_CTL 0x30 148 145 /* Determined by CoreControl bit */ ··· 625 618 BRCMF_FW_DEF(4354, "brcmfmac4354-sdio"); 626 619 BRCMF_FW_DEF(4356, "brcmfmac4356-sdio"); 627 620 BRCMF_FW_DEF(4373, "brcmfmac4373-sdio"); 621 + BRCMF_FW_DEF(43012, "brcmfmac43012-sdio"); 628 622 629 623 static const struct brcmf_firmware_mapping brcmf_sdio_fwnames[] = { 630 624 BRCMF_FW_ENTRY(BRCM_CC_43143_CHIP_ID, 0xFFFFFFFF, 43143), ··· 645 637 BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFFFFFFC0, 43455), 646 638 BRCMF_FW_ENTRY(BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, 4354), 647 639 BRCMF_FW_ENTRY(BRCM_CC_4356_CHIP_ID, 0xFFFFFFFF, 4356), 648 - BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373) 640 + BRCMF_FW_ENTRY(CY_CC_4373_CHIP_ID, 0xFFFFFFFF, 4373), 641 + BRCMF_FW_ENTRY(CY_CC_43012_CHIP_ID, 0xFFFFFFFF, 43012) 649 642 }; 650 643 651 644 static void pkt_align(struct sk_buff *p, int len, int align) ··· 679 670 wr_val = (on << SBSDIO_FUNC1_SLEEPCSR_KSO_SHIFT); 680 671 /* 1st KSO write goes to AOS wake up core if device is asleep */ 681 672 brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, wr_val, &err); 673 + 674 + /* In case of 43012 chip, the chip could go down immediately after 675 + * KSO bit is cleared. So the further reads of KSO register could 676 + * fail. Thereby just bailing out immediately after clearing KSO 677 + * bit, to avoid polling of KSO bit. 678 + */ 679 + if (!on && bus->ci->chip == CY_CC_43012_CHIP_ID) 680 + return err; 682 681 683 682 if (on) { 684 683 /* device WAKEUP through KSO: ··· 2413 2396 return ret; 2414 2397 } 2415 2398 2399 + static bool brcmf_chip_is_ulp(struct brcmf_chip *ci) 2400 + { 2401 + if (ci->chip == CY_CC_43012_CHIP_ID) 2402 + return true; 2403 + else 2404 + return false; 2405 + } 2406 + 2416 2407 static void brcmf_sdio_bus_stop(struct device *dev) 2417 2408 { 2418 2409 struct brcmf_bus *bus_if = dev_get_drvdata(dev); ··· 2428 2403 struct brcmf_sdio *bus = sdiodev->bus; 2429 2404 struct brcmf_core *core = bus->sdio_core; 2430 2405 u32 local_hostintmask; 2431 - u8 saveclk; 2406 + u8 saveclk, bpreq; 2432 2407 int err; 2433 2408 2434 2409 brcmf_dbg(TRACE, "Enter\n"); ··· 2455 2430 /* Force backplane clocks to assure F2 interrupt propagates */ 2456 2431 saveclk = brcmf_sdiod_readb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 2457 2432 &err); 2458 - if (!err) 2459 - brcmf_sdiod_writeb(sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 2460 - (saveclk | SBSDIO_FORCE_HT), &err); 2433 + if (!err) { 2434 + bpreq = saveclk; 2435 + bpreq |= brcmf_chip_is_ulp(bus->ci) ? 2436 + SBSDIO_HT_AVAIL_REQ : SBSDIO_FORCE_HT; 2437 + brcmf_sdiod_writeb(sdiodev, 2438 + SBSDIO_FUNC1_CHIPCLKCSR, 2439 + bpreq, &err); 2440 + } 2461 2441 if (err) 2462 2442 brcmf_err("Failed to force clock for F2: err %d\n", 2463 2443 err); ··· 3352 3322 return bcmerror; 3353 3323 } 3354 3324 3325 + static bool brcmf_sdio_aos_no_decode(struct brcmf_sdio *bus) 3326 + { 3327 + if (bus->ci->chip == CY_CC_43012_CHIP_ID || 3328 + bus->ci->chip == CY_CC_4373_CHIP_ID || 3329 + bus->ci->chip == BRCM_CC_4339_CHIP_ID || 3330 + bus->ci->chip == BRCM_CC_4345_CHIP_ID || 3331 + bus->ci->chip == BRCM_CC_4354_CHIP_ID) 3332 + return true; 3333 + else 3334 + return false; 3335 + } 3336 + 3355 3337 static void brcmf_sdio_sr_init(struct brcmf_sdio *bus) 3356 3338 { 3357 3339 int err = 0; 3358 3340 u8 val; 3341 + u8 wakeupctrl; 3342 + u8 cardcap; 3343 + u8 chipclkcsr; 3359 3344 3360 3345 brcmf_dbg(TRACE, "Enter\n"); 3346 + 3347 + if (brcmf_chip_is_ulp(bus->ci)) { 3348 + wakeupctrl = SBSDIO_FUNC1_WCTRL_ALPWAIT_SHIFT; 3349 + chipclkcsr = SBSDIO_HT_AVAIL_REQ; 3350 + } else { 3351 + wakeupctrl = SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT; 3352 + chipclkcsr = SBSDIO_FORCE_HT; 3353 + } 3354 + 3355 + if (brcmf_sdio_aos_no_decode(bus)) { 3356 + cardcap = SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC; 3357 + } else { 3358 + cardcap = (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT | 3359 + SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT); 3360 + } 3361 3361 3362 3362 val = brcmf_sdiod_readb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, &err); 3363 3363 if (err) { 3364 3364 brcmf_err("error reading SBSDIO_FUNC1_WAKEUPCTRL\n"); 3365 3365 return; 3366 3366 } 3367 - 3368 - val |= 1 << SBSDIO_FUNC1_WCTRL_HTWAIT_SHIFT; 3367 + val |= 1 << wakeupctrl; 3369 3368 brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, val, &err); 3370 3369 if (err) { 3371 3370 brcmf_err("error writing SBSDIO_FUNC1_WAKEUPCTRL\n"); ··· 3403 3344 3404 3345 /* Add CMD14 Support */ 3405 3346 brcmf_sdiod_func0_wb(bus->sdiodev, SDIO_CCCR_BRCM_CARDCAP, 3406 - (SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT | 3407 - SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT), 3347 + cardcap, 3408 3348 &err); 3409 3349 if (err) { 3410 3350 brcmf_err("error writing SDIO_CCCR_BRCM_CARDCAP\n"); ··· 3411 3353 } 3412 3354 3413 3355 brcmf_sdiod_writeb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 3414 - SBSDIO_FORCE_HT, &err); 3356 + chipclkcsr, &err); 3415 3357 if (err) { 3416 3358 brcmf_err("error writing SBSDIO_FUNC1_CHIPCLKCSR\n"); 3417 3359 return; ··· 4103 4045 const struct firmware *code; 4104 4046 void *nvram; 4105 4047 u32 nvram_len; 4106 - u8 saveclk; 4048 + u8 saveclk, bpreq; 4049 + u8 devctl; 4107 4050 4108 4051 brcmf_dbg(TRACE, "Enter: dev=%s, err=%d\n", dev_name(dev), err); 4109 4052 ··· 4137 4078 /* Force clocks on backplane to be sure F2 interrupt propagates */ 4138 4079 saveclk = brcmf_sdiod_readb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, &err); 4139 4080 if (!err) { 4081 + bpreq = saveclk; 4082 + bpreq |= brcmf_chip_is_ulp(bus->ci) ? 4083 + SBSDIO_HT_AVAIL_REQ : SBSDIO_FORCE_HT; 4140 4084 brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_CHIPCLKCSR, 4141 - (saveclk | SBSDIO_FORCE_HT), &err); 4085 + bpreq, &err); 4142 4086 } 4143 4087 if (err) { 4144 4088 brcmf_err("Failed to force clock for F2: err %d\n", err); ··· 4163 4101 brcmf_sdiod_writel(sdiod, core->base + SD_REG(hostintmask), 4164 4102 bus->hostintmask, NULL); 4165 4103 4166 - 4167 - brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 8, &err); 4104 + switch (sdiod->func1->device) { 4105 + case SDIO_DEVICE_ID_CYPRESS_4373: 4106 + brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n", 4107 + CY_4373_F2_WATERMARK); 4108 + brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 4109 + CY_4373_F2_WATERMARK, &err); 4110 + devctl = brcmf_sdiod_readb(sdiod, SBSDIO_DEVICE_CTL, 4111 + &err); 4112 + devctl |= SBSDIO_DEVCTL_F2WM_ENAB; 4113 + brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl, 4114 + &err); 4115 + brcmf_sdiod_writeb(sdiod, SBSDIO_FUNC1_MESBUSYCTRL, 4116 + CY_4373_F2_WATERMARK | 4117 + SBSDIO_MESBUSYCTRL_ENAB, &err); 4118 + break; 4119 + case SDIO_DEVICE_ID_CYPRESS_43012: 4120 + brcmf_dbg(INFO, "set F2 watermark to 0x%x*4 bytes\n", 4121 + CY_43012_F2_WATERMARK); 4122 + brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 4123 + CY_43012_F2_WATERMARK, &err); 4124 + devctl = brcmf_sdiod_readb(sdiod, SBSDIO_DEVICE_CTL, 4125 + &err); 4126 + devctl |= SBSDIO_DEVCTL_F2WM_ENAB; 4127 + brcmf_sdiod_writeb(sdiod, SBSDIO_DEVICE_CTL, devctl, 4128 + &err); 4129 + break; 4130 + default: 4131 + brcmf_sdiod_writeb(sdiod, SBSDIO_WATERMARK, 4132 + DEFAULT_F2_WATERMARK, &err); 4133 + break; 4134 + } 4168 4135 } else { 4169 4136 /* Disable F2 again */ 4170 4137 sdio_disable_func(sdiod->func2);
+8 -1
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.h
··· 77 77 #define SBSDIO_GPIO_OUT 0x10006 78 78 /* gpio enable */ 79 79 #define SBSDIO_GPIO_EN 0x10007 80 - /* rev < 7, watermark for sdio device */ 80 + /* rev < 7, watermark for sdio device TX path */ 81 81 #define SBSDIO_WATERMARK 0x10008 82 82 /* control busy signal generation */ 83 83 #define SBSDIO_DEVICE_CTL 0x10009 ··· 104 104 #define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C 105 105 /* MesBusyCtl (rev 11) */ 106 106 #define SBSDIO_FUNC1_MESBUSYCTRL 0x1001D 107 + /* Watermark for sdio device RX path */ 108 + #define SBSDIO_MESBUSY_RXFIFO_WM_MASK 0x7F 109 + #define SBSDIO_MESBUSY_RXFIFO_WM_SHIFT 0 110 + /* Enable busy capability for MES access */ 111 + #define SBSDIO_MESBUSYCTRL_ENAB 0x80 112 + #define SBSDIO_MESBUSYCTRL_ENAB_SHIFT 7 113 + 107 114 /* Sdio Core Rev 12 */ 108 115 #define SBSDIO_FUNC1_WAKEUPCTRL 0x1001E 109 116 #define SBSDIO_FUNC1_WCTRL_ALPWAIT_MASK 0x1
+2
drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h
··· 60 60 #define BRCM_CC_43664_CHIP_ID 43664 61 61 #define BRCM_CC_4371_CHIP_ID 0x4371 62 62 #define CY_CC_4373_CHIP_ID 0x4373 63 + #define CY_CC_43012_CHIP_ID 43012 63 64 64 65 /* USB Device IDs */ 65 66 #define BRCM_USB_43143_DEVICE_ID 0xbd1e ··· 75 74 /* PCIE Device IDs */ 76 75 #define BRCM_PCIE_4350_DEVICE_ID 0x43a3 77 76 #define BRCM_PCIE_4354_DEVICE_ID 0x43df 77 + #define BRCM_PCIE_4354_RAW_DEVICE_ID 0x4354 78 78 #define BRCM_PCIE_4356_DEVICE_ID 0x43ec 79 79 #define BRCM_PCIE_43567_DEVICE_ID 0x43d3 80 80 #define BRCM_PCIE_43570_DEVICE_ID 0x43d9
+19
drivers/net/wireless/broadcom/brcm80211/include/chipcommon.h
··· 269 269 /* GSIO (spi/i2c) present, rev >= 37 */ 270 270 #define CC_CAP2_GSIO 0x00000002 271 271 272 + /* sr_control0, rev >= 48 */ 273 + #define CC_SR_CTL0_ENABLE_MASK BIT(0) 274 + #define CC_SR_CTL0_ENABLE_SHIFT 0 275 + #define CC_SR_CTL0_EN_SR_ENG_CLK_SHIFT 1 /* sr_clk to sr_memory enable */ 276 + #define CC_SR_CTL0_RSRC_TRIGGER_SHIFT 2 /* Rising edge resource trigger 0 to 277 + * sr_engine 278 + */ 279 + #define CC_SR_CTL0_MIN_DIV_SHIFT 6 /* Min division value for fast clk 280 + * in sr_engine 281 + */ 282 + #define CC_SR_CTL0_EN_SBC_STBY_SHIFT 16 283 + #define CC_SR_CTL0_EN_SR_ALP_CLK_MASK_SHIFT 18 284 + #define CC_SR_CTL0_EN_SR_HT_CLK_SHIFT 19 285 + #define CC_SR_CTL0_ALLOW_PIC_SHIFT 20 /* Allow pic to separate power 286 + * domains 287 + */ 288 + #define CC_SR_CTL0_MAX_SR_LQ_CLK_CNT_SHIFT 25 289 + #define CC_SR_CTL0_EN_MEM_DISABLE_FOR_SLEEP 30 290 + 272 291 /* pmucapabilities */ 273 292 #define PCAP_REV_MASK 0x000000ff 274 293 #define PCAP_RC_MASK 0x00001f00
+2 -6
drivers/net/wireless/intel/ipw2x00/ipw2100.c
··· 5603 5603 5604 5604 if ((sec->flags & SEC_ACTIVE_KEY) && 5605 5605 priv->ieee->sec.active_key != sec->active_key) { 5606 - if (sec->active_key <= 3) { 5607 - priv->ieee->sec.active_key = sec->active_key; 5608 - priv->ieee->sec.flags |= SEC_ACTIVE_KEY; 5609 - } else 5610 - priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; 5611 - 5606 + priv->ieee->sec.active_key = sec->active_key; 5607 + priv->ieee->sec.flags |= SEC_ACTIVE_KEY; 5612 5608 priv->status |= STATUS_SECURITY_UPDATED; 5613 5609 } 5614 5610
+2 -5
drivers/net/wireless/intel/ipw2x00/ipw2200.c
··· 10722 10722 } 10723 10723 10724 10724 if (sec->flags & SEC_ACTIVE_KEY) { 10725 - if (sec->active_key <= 3) { 10726 - priv->ieee->sec.active_key = sec->active_key; 10727 - priv->ieee->sec.flags |= SEC_ACTIVE_KEY; 10728 - } else 10729 - priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY; 10725 + priv->ieee->sec.active_key = sec->active_key; 10726 + priv->ieee->sec.flags |= SEC_ACTIVE_KEY; 10730 10727 priv->status |= STATUS_SECURITY_UPDATED; 10731 10728 } else 10732 10729 priv->ieee->sec.flags &= ~SEC_ACTIVE_KEY;
+3 -1
drivers/net/wireless/intel/iwlwifi/Kconfig
··· 1 1 config IWLWIFI 2 2 tristate "Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi) " 3 - depends on PCI && MAC80211 && HAS_IOMEM 3 + depends on PCI && HAS_IOMEM 4 4 select FW_LOADER 5 5 ---help--- 6 6 Select to build the driver supporting the: ··· 53 53 54 54 config IWLDVM 55 55 tristate "Intel Wireless WiFi DVM Firmware support" 56 + depends on MAC80211 56 57 help 57 58 This is the driver that supports the DVM firmware. The list 58 59 of the devices that use this firmware is available here: ··· 62 61 config IWLMVM 63 62 tristate "Intel Wireless WiFi MVM Firmware support" 64 63 select WANT_DEV_COREDUMP 64 + depends on MAC80211 65 65 help 66 66 This is the driver that supports the MVM firmware. The list 67 67 of the devices that use this firmware is available here:
+1 -1
drivers/net/wireless/intel/iwlwifi/cfg/1000.c
··· 48 48 static const struct iwl_base_params iwl1000_base_params = { 49 49 .num_of_queues = IWLAGN_NUM_QUEUES, 50 50 .max_tfd_queue_size = 256, 51 - .eeprom_size = OTP_LOW_IMAGE_SIZE, 51 + .eeprom_size = OTP_LOW_IMAGE_SIZE_2K, 52 52 .pll_cfg = true, 53 53 .max_ll_items = OTP_MAX_LL_ITEMS_1000, 54 54 .shadow_ram_support = false,
+2 -2
drivers/net/wireless/intel/iwlwifi/cfg/2000.c
··· 57 57 #define IWL135_MODULE_FIRMWARE(api) IWL135_FW_PRE __stringify(api) ".ucode" 58 58 59 59 static const struct iwl_base_params iwl2000_base_params = { 60 - .eeprom_size = OTP_LOW_IMAGE_SIZE, 60 + .eeprom_size = OTP_LOW_IMAGE_SIZE_2K, 61 61 .num_of_queues = IWLAGN_NUM_QUEUES, 62 62 .max_tfd_queue_size = 256, 63 63 .max_ll_items = OTP_MAX_LL_ITEMS_2x00, ··· 71 71 72 72 73 73 static const struct iwl_base_params iwl2030_base_params = { 74 - .eeprom_size = OTP_LOW_IMAGE_SIZE, 74 + .eeprom_size = OTP_LOW_IMAGE_SIZE_2K, 75 75 .num_of_queues = IWLAGN_NUM_QUEUES, 76 76 .max_tfd_queue_size = 256, 77 77 .max_ll_items = OTP_MAX_LL_ITEMS_2x00,
+4 -8
drivers/net/wireless/intel/iwlwifi/cfg/22000.c
··· 56 56 #include "iwl-config.h" 57 57 58 58 /* Highest firmware API version supported */ 59 - #define IWL_22000_UCODE_API_MAX 41 59 + #define IWL_22000_UCODE_API_MAX 43 60 60 61 61 /* Lowest firmware API version supported */ 62 62 #define IWL_22000_UCODE_API_MIN 39 63 63 64 64 /* NVM versions */ 65 65 #define IWL_22000_NVM_VERSION 0x0a1d 66 - #define IWL_22000_TX_POWER_VERSION 0xffff /* meaningless */ 67 66 68 67 /* Memory offsets and lengths */ 69 68 #define IWL_22000_DCCM_OFFSET 0x800000 /* LMAC1 */ ··· 105 106 #define IWL_QU_B_JF_B_MODULE_FIRMWARE(api) \ 106 107 IWL_QU_B_JF_B_FW_PRE __stringify(api) ".ucode" 107 108 108 - #define NVM_HW_SECTION_NUM_FAMILY_22000 10 109 - 110 109 static const struct iwl_base_params iwl_22000_base_params = { 111 - .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_22000, 110 + .eeprom_size = OTP_LOW_IMAGE_SIZE_32K, 112 111 .num_of_queues = 512, 113 112 .max_tfd_queue_size = 256, 114 113 .shadow_ram_support = true, ··· 118 121 }; 119 122 120 123 static const struct iwl_base_params iwl_22560_base_params = { 121 - .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_22000, 124 + .eeprom_size = OTP_LOW_IMAGE_SIZE_32K, 122 125 .num_of_queues = 512, 123 126 .max_tfd_queue_size = 65536, 124 127 .shadow_ram_support = true, ··· 139 142 .ucode_api_max = IWL_22000_UCODE_API_MAX, \ 140 143 .ucode_api_min = IWL_22000_UCODE_API_MIN, \ 141 144 .led_mode = IWL_LED_RF_STATE, \ 142 - .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_22000, \ 145 + .nvm_hw_section_num = 10, \ 143 146 .non_shared_ant = ANT_B, \ 144 147 .dccm_offset = IWL_22000_DCCM_OFFSET, \ 145 148 .dccm_len = IWL_22000_DCCM_LEN, \ ··· 154 157 .mac_addr_from_csr = true, \ 155 158 .ht_params = &iwl_22000_ht_params, \ 156 159 .nvm_ver = IWL_22000_NVM_VERSION, \ 157 - .nvm_calib_ver = IWL_22000_TX_POWER_VERSION, \ 158 160 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \ 159 161 .use_tfh = true, \ 160 162 .rf_id = true, \
+3 -3
drivers/net/wireless/intel/iwlwifi/cfg/6000.c
··· 66 66 #define IWL6030_MODULE_FIRMWARE(api) IWL6030_FW_PRE __stringify(api) ".ucode" 67 67 68 68 static const struct iwl_base_params iwl6000_base_params = { 69 - .eeprom_size = OTP_LOW_IMAGE_SIZE, 69 + .eeprom_size = OTP_LOW_IMAGE_SIZE_2K, 70 70 .num_of_queues = IWLAGN_NUM_QUEUES, 71 71 .max_tfd_queue_size = 256, 72 72 .max_ll_items = OTP_MAX_LL_ITEMS_6x00, ··· 79 79 }; 80 80 81 81 static const struct iwl_base_params iwl6050_base_params = { 82 - .eeprom_size = OTP_LOW_IMAGE_SIZE, 82 + .eeprom_size = OTP_LOW_IMAGE_SIZE_2K, 83 83 .num_of_queues = IWLAGN_NUM_QUEUES, 84 84 .max_tfd_queue_size = 256, 85 85 .max_ll_items = OTP_MAX_LL_ITEMS_6x50, ··· 92 92 }; 93 93 94 94 static const struct iwl_base_params iwl6000_g2_base_params = { 95 - .eeprom_size = OTP_LOW_IMAGE_SIZE, 95 + .eeprom_size = OTP_LOW_IMAGE_SIZE_2K, 96 96 .num_of_queues = IWLAGN_NUM_QUEUES, 97 97 .max_tfd_queue_size = 256, 98 98 .max_ll_items = OTP_MAX_LL_ITEMS_6x00,
+2 -25
drivers/net/wireless/intel/iwlwifi/cfg/7000.c
··· 80 80 81 81 /* NVM versions */ 82 82 #define IWL7260_NVM_VERSION 0x0a1d 83 - #define IWL7260_TX_POWER_VERSION 0xffff /* meaningless */ 84 83 #define IWL3160_NVM_VERSION 0x709 85 - #define IWL3160_TX_POWER_VERSION 0xffff /* meaningless */ 86 84 #define IWL3165_NVM_VERSION 0x709 87 - #define IWL3165_TX_POWER_VERSION 0xffff /* meaningless */ 88 85 #define IWL3168_NVM_VERSION 0xd01 89 - #define IWL3168_TX_POWER_VERSION 0xffff /* meaningless */ 90 86 #define IWL7265_NVM_VERSION 0x0a1d 91 - #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ 92 87 #define IWL7265D_NVM_VERSION 0x0c11 93 - #define IWL7265_TX_POWER_VERSION 0xffff /* meaningless */ 94 88 95 89 /* DCCM offsets and lengths */ 96 90 #define IWL7000_DCCM_OFFSET 0x800000 ··· 107 113 #define IWL7265D_FW_PRE "iwlwifi-7265D-" 108 114 #define IWL7265D_MODULE_FIRMWARE(api) IWL7265D_FW_PRE __stringify(api) ".ucode" 109 115 110 - #define NVM_HW_SECTION_NUM_FAMILY_7000 0 111 - 112 116 static const struct iwl_base_params iwl7000_base_params = { 113 - .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_7000, 117 + .eeprom_size = OTP_LOW_IMAGE_SIZE_16K, 114 118 .num_of_queues = 31, 115 119 .max_tfd_queue_size = 256, 116 120 .shadow_ram_support = true, ··· 151 159 .device_family = IWL_DEVICE_FAMILY_7000, \ 152 160 .base_params = &iwl7000_base_params, \ 153 161 .led_mode = IWL_LED_RF_STATE, \ 154 - .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_7000, \ 162 + .nvm_hw_section_num = 0, \ 155 163 .non_shared_ant = ANT_A, \ 156 164 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, \ 157 165 .dccm_offset = IWL7000_DCCM_OFFSET, \ ··· 183 191 IWL_DEVICE_7000, 184 192 .ht_params = &iwl7000_ht_params, 185 193 .nvm_ver = IWL7260_NVM_VERSION, 186 - .nvm_calib_ver = IWL7260_TX_POWER_VERSION, 187 194 .host_interrupt_operation_mode = true, 188 195 .lp_xtal_workaround = true, 189 196 .dccm_len = IWL7260_DCCM_LEN, ··· 194 203 IWL_DEVICE_7000, 195 204 .ht_params = &iwl7000_ht_params, 196 205 .nvm_ver = IWL7260_NVM_VERSION, 197 - .nvm_calib_ver = IWL7260_TX_POWER_VERSION, 198 206 .high_temp = true, 199 207 .host_interrupt_operation_mode = true, 200 208 .lp_xtal_workaround = true, ··· 207 217 IWL_DEVICE_7000, 208 218 .ht_params = &iwl7000_ht_params, 209 219 .nvm_ver = IWL7260_NVM_VERSION, 210 - .nvm_calib_ver = IWL7260_TX_POWER_VERSION, 211 220 .host_interrupt_operation_mode = true, 212 221 .lp_xtal_workaround = true, 213 222 .dccm_len = IWL7260_DCCM_LEN, ··· 218 229 IWL_DEVICE_7000, 219 230 .ht_params = &iwl7000_ht_params, 220 231 .nvm_ver = IWL7260_NVM_VERSION, 221 - .nvm_calib_ver = IWL7260_TX_POWER_VERSION, 222 232 .host_interrupt_operation_mode = true, 223 233 .lp_xtal_workaround = true, 224 234 .dccm_len = IWL7260_DCCM_LEN, ··· 229 241 IWL_DEVICE_7000, 230 242 .ht_params = &iwl7000_ht_params, 231 243 .nvm_ver = IWL3160_NVM_VERSION, 232 - .nvm_calib_ver = IWL3160_TX_POWER_VERSION, 233 244 .host_interrupt_operation_mode = true, 234 245 .dccm_len = IWL3160_DCCM_LEN, 235 246 }; ··· 239 252 IWL_DEVICE_7000, 240 253 .ht_params = &iwl7000_ht_params, 241 254 .nvm_ver = IWL3160_NVM_VERSION, 242 - .nvm_calib_ver = IWL3160_TX_POWER_VERSION, 243 255 .host_interrupt_operation_mode = true, 244 256 .dccm_len = IWL3160_DCCM_LEN, 245 257 }; ··· 249 263 IWL_DEVICE_7000, 250 264 .ht_params = &iwl7000_ht_params, 251 265 .nvm_ver = IWL3160_NVM_VERSION, 252 - .nvm_calib_ver = IWL3160_TX_POWER_VERSION, 253 266 .host_interrupt_operation_mode = true, 254 267 .dccm_len = IWL3160_DCCM_LEN, 255 268 }; ··· 276 291 IWL_DEVICE_7005D, 277 292 .ht_params = &iwl7000_ht_params, 278 293 .nvm_ver = IWL3165_NVM_VERSION, 279 - .nvm_calib_ver = IWL3165_TX_POWER_VERSION, 280 294 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 281 295 .dccm_len = IWL7265_DCCM_LEN, 282 296 }; ··· 286 302 IWL_DEVICE_3008, 287 303 .ht_params = &iwl7000_ht_params, 288 304 .nvm_ver = IWL3168_NVM_VERSION, 289 - .nvm_calib_ver = IWL3168_TX_POWER_VERSION, 290 305 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 291 306 .dccm_len = IWL7265_DCCM_LEN, 292 307 .nvm_type = IWL_NVM_SDP, ··· 297 314 IWL_DEVICE_7005, 298 315 .ht_params = &iwl7265_ht_params, 299 316 .nvm_ver = IWL7265_NVM_VERSION, 300 - .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 301 317 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 302 318 .dccm_len = IWL7265_DCCM_LEN, 303 319 }; ··· 307 325 IWL_DEVICE_7005, 308 326 .ht_params = &iwl7265_ht_params, 309 327 .nvm_ver = IWL7265_NVM_VERSION, 310 - .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 311 328 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 312 329 .dccm_len = IWL7265_DCCM_LEN, 313 330 }; ··· 317 336 IWL_DEVICE_7005, 318 337 .ht_params = &iwl7265_ht_params, 319 338 .nvm_ver = IWL7265_NVM_VERSION, 320 - .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 321 339 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 322 340 .dccm_len = IWL7265_DCCM_LEN, 323 341 }; ··· 327 347 IWL_DEVICE_7005D, 328 348 .ht_params = &iwl7265_ht_params, 329 349 .nvm_ver = IWL7265D_NVM_VERSION, 330 - .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 331 350 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 332 351 .dccm_len = IWL7265_DCCM_LEN, 333 352 }; ··· 337 358 IWL_DEVICE_7005D, 338 359 .ht_params = &iwl7265_ht_params, 339 360 .nvm_ver = IWL7265D_NVM_VERSION, 340 - .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 341 361 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 342 362 .dccm_len = IWL7265_DCCM_LEN, 343 363 }; ··· 347 369 IWL_DEVICE_7005D, 348 370 .ht_params = &iwl7265_ht_params, 349 371 .nvm_ver = IWL7265D_NVM_VERSION, 350 - .nvm_calib_ver = IWL7265_TX_POWER_VERSION, 351 372 .pwr_tx_backoffs = iwl7265_pwr_tx_backoffs, 352 373 .dccm_len = IWL7265_DCCM_LEN, 353 374 };
+2 -9
drivers/net/wireless/intel/iwlwifi/cfg/8000.c
··· 75 75 76 76 /* NVM versions */ 77 77 #define IWL8000_NVM_VERSION 0x0a1d 78 - #define IWL8000_TX_POWER_VERSION 0xffff /* meaningless */ 79 78 80 79 /* Memory offsets and lengths */ 81 80 #define IWL8260_DCCM_OFFSET 0x800000 ··· 92 93 #define IWL8265_MODULE_FIRMWARE(api) \ 93 94 IWL8265_FW_PRE __stringify(api) ".ucode" 94 95 95 - #define NVM_HW_SECTION_NUM_FAMILY_8000 10 96 96 #define DEFAULT_NVM_FILE_FAMILY_8000C "nvmData-8000C" 97 97 98 98 static const struct iwl_base_params iwl8000_base_params = { 99 - .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_8000, 99 + .eeprom_size = OTP_LOW_IMAGE_SIZE_32K, 100 100 .num_of_queues = 31, 101 101 .max_tfd_queue_size = 256, 102 102 .shadow_ram_support = true, ··· 137 139 .device_family = IWL_DEVICE_FAMILY_8000, \ 138 140 .base_params = &iwl8000_base_params, \ 139 141 .led_mode = IWL_LED_RF_STATE, \ 140 - .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_8000, \ 142 + .nvm_hw_section_num = 10, \ 141 143 .features = NETIF_F_RXCSUM, \ 142 144 .non_shared_ant = ANT_A, \ 143 145 .dccm_offset = IWL8260_DCCM_OFFSET, \ ··· 175 177 IWL_DEVICE_8260, 176 178 .ht_params = &iwl8000_ht_params, 177 179 .nvm_ver = IWL8000_NVM_VERSION, 178 - .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 179 180 }; 180 181 181 182 const struct iwl_cfg iwl8260_2ac_cfg = { ··· 183 186 IWL_DEVICE_8260, 184 187 .ht_params = &iwl8000_ht_params, 185 188 .nvm_ver = IWL8000_NVM_VERSION, 186 - .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 187 189 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 188 190 }; 189 191 ··· 192 196 IWL_DEVICE_8265, 193 197 .ht_params = &iwl8000_ht_params, 194 198 .nvm_ver = IWL8000_NVM_VERSION, 195 - .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 196 199 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 197 200 .vht_mu_mimo_supported = true, 198 201 }; ··· 202 207 IWL_DEVICE_8265, 203 208 .ht_params = &iwl8000_ht_params, 204 209 .nvm_ver = IWL8000_NVM_VERSION, 205 - .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 206 210 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 207 211 .vht_mu_mimo_supported = true, 208 212 }; ··· 212 218 IWL_DEVICE_8000, 213 219 .ht_params = &iwl8000_ht_params, 214 220 .nvm_ver = IWL8000_NVM_VERSION, 215 - .nvm_calib_ver = IWL8000_TX_POWER_VERSION, 216 221 .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 217 222 }; 218 223
+8 -79
drivers/net/wireless/intel/iwlwifi/cfg/9000.c
··· 57 57 #include "fw/file.h" 58 58 59 59 /* Highest firmware API version supported */ 60 - #define IWL9000_UCODE_API_MAX 41 60 + #define IWL9000_UCODE_API_MAX 43 61 61 62 62 /* Lowest firmware API version supported */ 63 63 #define IWL9000_UCODE_API_MIN 30 64 64 65 65 /* NVM versions */ 66 66 #define IWL9000_NVM_VERSION 0x0a1d 67 - #define IWL9000_TX_POWER_VERSION 0xffff /* meaningless */ 68 67 69 68 /* Memory offsets and lengths */ 70 69 #define IWL9000_DCCM_OFFSET 0x800000 ··· 89 90 #define IWL9260B_MODULE_FIRMWARE(api) \ 90 91 IWL9260B_FW_PRE __stringify(api) ".ucode" 91 92 92 - #define NVM_HW_SECTION_NUM_FAMILY_9000 10 93 - 94 93 static const struct iwl_base_params iwl9000_base_params = { 95 - .eeprom_size = OTP_LOW_IMAGE_SIZE_FAMILY_9000, 94 + .eeprom_size = OTP_LOW_IMAGE_SIZE_32K, 96 95 .num_of_queues = 31, 97 96 .max_tfd_queue_size = 256, 98 97 .shadow_ram_support = true, ··· 134 137 .device_family = IWL_DEVICE_FAMILY_9000, \ 135 138 .base_params = &iwl9000_base_params, \ 136 139 .led_mode = IWL_LED_RF_STATE, \ 137 - .nvm_hw_section_num = NVM_HW_SECTION_NUM_FAMILY_9000, \ 140 + .nvm_hw_section_num = 10, \ 138 141 .non_shared_ant = ANT_B, \ 139 142 .dccm_offset = IWL9000_DCCM_OFFSET, \ 140 143 .dccm_len = IWL9000_DCCM_LEN, \ ··· 154 157 .min_umac_error_event_table = 0x800000, \ 155 158 .csr = &iwl_csr_v1, \ 156 159 .d3_debug_data_base_addr = 0x401000, \ 157 - .d3_debug_data_length = 92 * 1024 160 + .d3_debug_data_length = 92 * 1024, \ 161 + .ht_params = &iwl9000_ht_params, \ 162 + .nvm_ver = IWL9000_NVM_VERSION, \ 163 + .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K 164 + 158 165 159 166 const struct iwl_cfg iwl9160_2ac_cfg = { 160 167 .name = "Intel(R) Dual Band Wireless AC 9160", 161 168 .fw_name_pre = IWL9260A_FW_PRE, 162 169 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE, 163 170 IWL_DEVICE_9000, 164 - .ht_params = &iwl9000_ht_params, 165 - .nvm_ver = IWL9000_NVM_VERSION, 166 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 167 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 168 171 }; 169 172 170 173 const struct iwl_cfg iwl9260_2ac_cfg = { ··· 172 175 .fw_name_pre = IWL9260A_FW_PRE, 173 176 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE, 174 177 IWL_DEVICE_9000, 175 - .ht_params = &iwl9000_ht_params, 176 - .nvm_ver = IWL9000_NVM_VERSION, 177 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 178 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 179 178 }; 180 179 181 180 const struct iwl_cfg iwl9260_killer_2ac_cfg = { ··· 179 186 .fw_name_pre = IWL9260A_FW_PRE, 180 187 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE, 181 188 IWL_DEVICE_9000, 182 - .ht_params = &iwl9000_ht_params, 183 - .nvm_ver = IWL9000_NVM_VERSION, 184 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 185 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 186 189 }; 187 190 188 191 const struct iwl_cfg iwl9270_2ac_cfg = { ··· 186 197 .fw_name_pre = IWL9260A_FW_PRE, 187 198 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE, 188 199 IWL_DEVICE_9000, 189 - .ht_params = &iwl9000_ht_params, 190 - .nvm_ver = IWL9000_NVM_VERSION, 191 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 192 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 193 200 }; 194 201 195 202 const struct iwl_cfg iwl9460_2ac_cfg = { ··· 193 208 .fw_name_pre = IWL9260A_FW_PRE, 194 209 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE, 195 210 IWL_DEVICE_9000, 196 - .ht_params = &iwl9000_ht_params, 197 - .nvm_ver = IWL9000_NVM_VERSION, 198 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 199 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 200 211 }; 201 212 202 213 const struct iwl_cfg iwl9460_2ac_cfg_soc = { ··· 201 220 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 202 221 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 203 222 IWL_DEVICE_9000, 204 - .ht_params = &iwl9000_ht_params, 205 - .nvm_ver = IWL9000_NVM_VERSION, 206 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 207 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 208 223 .integrated = true, 209 224 .soc_latency = 5000, 210 225 }; ··· 211 234 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 212 235 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 213 236 IWL_DEVICE_9000, 214 - .ht_params = &iwl9000_ht_params, 215 - .nvm_ver = IWL9000_NVM_VERSION, 216 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 217 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 218 237 .integrated = true, 219 238 .soc_latency = 5000, 220 239 }; ··· 221 248 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 222 249 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 223 250 IWL_DEVICE_9000, 224 - .ht_params = &iwl9000_ht_params, 225 - .nvm_ver = IWL9000_NVM_VERSION, 226 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 227 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 228 251 .integrated = true, 229 252 .soc_latency = 5000, 230 253 }; ··· 230 261 .fw_name_pre = IWL9260A_FW_PRE, 231 262 .fw_name_pre_b_or_c_step = IWL9260B_FW_PRE, 232 263 IWL_DEVICE_9000, 233 - .ht_params = &iwl9000_ht_params, 234 - .nvm_ver = IWL9000_NVM_VERSION, 235 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 236 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 237 264 }; 238 265 239 266 const struct iwl_cfg iwl9560_2ac_cfg_soc = { ··· 238 273 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 239 274 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 240 275 IWL_DEVICE_9000, 241 - .ht_params = &iwl9000_ht_params, 242 - .nvm_ver = IWL9000_NVM_VERSION, 243 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 244 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 245 276 .integrated = true, 246 277 .soc_latency = 5000, 247 278 }; ··· 248 287 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 249 288 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 250 289 IWL_DEVICE_9000, 251 - .ht_params = &iwl9000_ht_params, 252 - .nvm_ver = IWL9000_NVM_VERSION, 253 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 254 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 255 290 .integrated = true, 256 291 .soc_latency = 5000, 257 292 }; ··· 258 301 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 259 302 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 260 303 IWL_DEVICE_9000, 261 - .ht_params = &iwl9000_ht_params, 262 - .nvm_ver = IWL9000_NVM_VERSION, 263 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 264 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 265 304 .integrated = true, 266 305 .soc_latency = 5000, 267 306 }; ··· 268 315 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 269 316 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 270 317 IWL_DEVICE_9000, 271 - .ht_params = &iwl9000_ht_params, 272 - .nvm_ver = IWL9000_NVM_VERSION, 273 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 274 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 275 318 .integrated = true, 276 319 .soc_latency = 5000, 277 320 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK ··· 279 330 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 280 331 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 281 332 IWL_DEVICE_9000, 282 - .ht_params = &iwl9000_ht_params, 283 - .nvm_ver = IWL9000_NVM_VERSION, 284 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 285 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 286 333 .integrated = true, 287 334 .soc_latency = 5000, 288 335 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK ··· 290 345 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 291 346 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 292 347 IWL_DEVICE_9000, 293 - .ht_params = &iwl9000_ht_params, 294 - .nvm_ver = IWL9000_NVM_VERSION, 295 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 296 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 297 348 .integrated = true, 298 349 .soc_latency = 5000, 299 350 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK ··· 301 360 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 302 361 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 303 362 IWL_DEVICE_9000, 304 - .ht_params = &iwl9000_ht_params, 305 - .nvm_ver = IWL9000_NVM_VERSION, 306 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 307 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 308 363 .integrated = true, 309 364 .soc_latency = 5000, 310 365 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK ··· 312 375 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 313 376 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 314 377 IWL_DEVICE_9000, 315 - .ht_params = &iwl9000_ht_params, 316 - .nvm_ver = IWL9000_NVM_VERSION, 317 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 318 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 319 378 .integrated = true, 320 379 .soc_latency = 5000, 321 380 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK ··· 323 390 .fw_name_pre_b_or_c_step = IWL9000B_FW_PRE, 324 391 .fw_name_pre_rf_next_step = IWL9000RFB_FW_PRE, 325 392 IWL_DEVICE_9000, 326 - .ht_params = &iwl9000_ht_params, 327 - .nvm_ver = IWL9000_NVM_VERSION, 328 - .nvm_calib_ver = IWL9000_TX_POWER_VERSION, 329 - .max_ht_ampdu_exponent = IEEE80211_HT_MAX_AMPDU_64K, 330 393 .integrated = true, 331 394 .soc_latency = 5000, 332 395 .extra_phy_cfg_flags = FW_PHY_CFG_SHARED_CLK
+17
drivers/net/wireless/intel/iwlwifi/dvm/main.c
··· 1224 1224 return 0; 1225 1225 } 1226 1226 1227 + static int iwl_nvm_check_version(struct iwl_nvm_data *data, 1228 + struct iwl_trans *trans) 1229 + { 1230 + if (data->nvm_version >= trans->cfg->nvm_ver || 1231 + data->calib_version >= trans->cfg->nvm_calib_ver) { 1232 + IWL_DEBUG_INFO(trans, "device EEPROM VER=0x%x, CALIB=0x%x\n", 1233 + data->nvm_version, data->calib_version); 1234 + return 0; 1235 + } 1236 + 1237 + IWL_ERR(trans, 1238 + "Unsupported (too old) EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", 1239 + data->nvm_version, trans->cfg->nvm_ver, 1240 + data->calib_version, trans->cfg->nvm_calib_ver); 1241 + return -EINVAL; 1242 + } 1243 + 1227 1244 static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans, 1228 1245 const struct iwl_cfg *cfg, 1229 1246 const struct iwl_fw *fw,
+2 -11
drivers/net/wireless/intel/iwlwifi/fw/api/config.h
··· 8 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 9 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 10 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 11 + * Copyright (C) 2018 Intel Corporation 11 12 * 12 13 * This program is free software; you can redistribute it and/or modify 13 14 * it under the terms of version 2 of the GNU General Public License as ··· 31 30 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 32 31 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 33 32 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 33 + * Copyright (C) 2018 Intel Corporation 34 34 * All rights reserved. 35 35 * 36 36 * Redistribution and use in source and binary forms, with or without ··· 128 126 __le32 phy_cfg; 129 127 struct iwl_calib_ctrl calib_control; 130 128 } __packed; 131 - 132 - #define PHY_CFG_RADIO_TYPE (BIT(0) | BIT(1)) 133 - #define PHY_CFG_RADIO_STEP (BIT(2) | BIT(3)) 134 - #define PHY_CFG_RADIO_DASH (BIT(4) | BIT(5)) 135 - #define PHY_CFG_PRODUCT_NUMBER (BIT(6) | BIT(7)) 136 - #define PHY_CFG_TX_CHAIN_A BIT(8) 137 - #define PHY_CFG_TX_CHAIN_B BIT(9) 138 - #define PHY_CFG_TX_CHAIN_C BIT(10) 139 - #define PHY_CFG_RX_CHAIN_A BIT(12) 140 - #define PHY_CFG_RX_CHAIN_B BIT(13) 141 - #define PHY_CFG_RX_CHAIN_C BIT(14) 142 129 143 130 /* 144 131 * enum iwl_dc2dc_config_id - flag ids
+5
drivers/net/wireless/intel/iwlwifi/fw/api/datapath.h
··· 105 105 HE_AIR_SNIFFER_CONFIG_CMD = 0x13, 106 106 107 107 /** 108 + * @RX_NO_DATA_NOTIF: &struct iwl_rx_no_data 109 + */ 110 + RX_NO_DATA_NOTIF = 0xF5, 111 + 112 + /** 108 113 * @TLC_MNG_UPDATE_NOTIF: &struct iwl_tlc_update_notif 109 114 */ 110 115 TLC_MNG_UPDATE_NOTIF = 0xF7,
+1 -1
drivers/net/wireless/intel/iwlwifi/fw/api/mac.h
··· 443 443 * Support for Nss x BW (or RU) matrix: 444 444 * (0=SISO, 1=MIMO2) x (0-20MHz, 1-40MHz, 2-80MHz, 3-160MHz) 445 445 * Each entry contains 2 QAM thresholds for 8us and 16us: 446 - * 0=BPSK, 1=QPSK, 2=16QAM, 3=64QAM, 4=256QAM, 5=1024QAM, 6/7=RES 446 + * 0=BPSK, 1=QPSK, 2=16QAM, 3=64QAM, 4=256QAM, 5=1024QAM, 6=RES, 7=NONE 447 447 * i.e. QAM_th1 < QAM_th2 such if TX uses QAM_tx: 448 448 * QAM_tx < QAM_th1 --> PPE=0us 449 449 * QAM_th1 <= QAM_tx < QAM_th2 --> PPE=8us
+166 -71
drivers/net/wireless/intel/iwlwifi/fw/api/rx.h
··· 345 345 IWL_RX_MPDU_PHY_PHY_INDEX_MASK = 0xf0, 346 346 }; 347 347 348 - /* 349 - * enum iwl_rx_he_phy - HE PHY data 350 - */ 351 - enum iwl_rx_he_phy { 352 - IWL_RX_HE_PHY_BEAM_CHNG = BIT(0), 353 - IWL_RX_HE_PHY_UPLINK = BIT(1), 354 - IWL_RX_HE_PHY_BSS_COLOR_MASK = 0xfc, 355 - IWL_RX_HE_PHY_SPATIAL_REUSE_MASK = 0xf00, 356 - IWL_RX_HE_PHY_SU_EXT_BW10 = BIT(12), 357 - IWL_RX_HE_PHY_TXOP_DUR_MASK = 0xfe000, 358 - IWL_RX_HE_PHY_LDPC_EXT_SYM = BIT(20), 359 - IWL_RX_HE_PHY_PRE_FEC_PAD_MASK = 0x600000, 360 - IWL_RX_HE_PHY_PE_DISAMBIG = BIT(23), 361 - IWL_RX_HE_PHY_DOPPLER = BIT(24), 348 + /* TSF overload low dword */ 349 + enum iwl_rx_phy_data0 { 350 + /* info type: HE any */ 351 + IWL_RX_PHY_DATA0_HE_BEAM_CHNG = 0x00000001, 352 + IWL_RX_PHY_DATA0_HE_UPLINK = 0x00000002, 353 + IWL_RX_PHY_DATA0_HE_BSS_COLOR_MASK = 0x000000fc, 354 + IWL_RX_PHY_DATA0_HE_SPATIAL_REUSE_MASK = 0x00000f00, 355 + /* 1 bit reserved */ 356 + IWL_RX_PHY_DATA0_HE_TXOP_DUR_MASK = 0x000fe000, 357 + IWL_RX_PHY_DATA0_HE_LDPC_EXT_SYM = 0x00100000, 358 + IWL_RX_PHY_DATA0_HE_PRE_FEC_PAD_MASK = 0x00600000, 359 + IWL_RX_PHY_DATA0_HE_PE_DISAMBIG = 0x00800000, 360 + IWL_RX_PHY_DATA0_HE_DOPPLER = 0x01000000, 362 361 /* 6 bits reserved */ 363 - IWL_RX_HE_PHY_DELIM_EOF = BIT(31), 362 + IWL_RX_PHY_DATA0_HE_DELIM_EOF = 0x80000000, 363 + }; 364 364 365 - /* second dword - common data */ 366 - IWL_RX_HE_PHY_HE_LTF_NUM_MASK = 0xe000000000ULL, 367 - IWL_RX_HE_PHY_RU_ALLOC_SEC80 = BIT_ULL(32 + 8), 365 + enum iwl_rx_phy_info_type { 366 + IWL_RX_PHY_INFO_TYPE_NONE = 0, 367 + IWL_RX_PHY_INFO_TYPE_CCK = 1, 368 + IWL_RX_PHY_INFO_TYPE_OFDM_LGCY = 2, 369 + IWL_RX_PHY_INFO_TYPE_HT = 3, 370 + IWL_RX_PHY_INFO_TYPE_VHT_SU = 4, 371 + IWL_RX_PHY_INFO_TYPE_VHT_MU = 5, 372 + IWL_RX_PHY_INFO_TYPE_HE_SU = 6, 373 + IWL_RX_PHY_INFO_TYPE_HE_MU = 7, 374 + IWL_RX_PHY_INFO_TYPE_HE_TB = 8, 375 + IWL_RX_PHY_INFO_TYPE_HE_MU_EXT = 9, 376 + IWL_RX_PHY_INFO_TYPE_HE_TB_EXT = 10, 377 + }; 378 + 379 + /* TSF overload high dword */ 380 + enum iwl_rx_phy_data1 { 381 + /* 382 + * check this first - if TSF overload is set, 383 + * see &enum iwl_rx_phy_info_type 384 + */ 385 + IWL_RX_PHY_DATA1_INFO_TYPE_MASK = 0xf0000000, 386 + 387 + /* info type: HT/VHT/HE any */ 388 + IWL_RX_PHY_DATA1_LSIG_LEN_MASK = 0x0fff0000, 389 + 390 + /* info type: HE MU/MU-EXT */ 391 + IWL_RX_PHY_DATA1_HE_MU_SIGB_COMPRESSION = 0x00000001, 392 + IWL_RX_PHY_DATA1_HE_MU_SIBG_SYM_OR_USER_NUM_MASK = 0x0000001e, 393 + 394 + /* info type: HE any */ 395 + IWL_RX_PHY_DATA1_HE_LTF_NUM_MASK = 0x000000e0, 396 + IWL_RX_PHY_DATA1_HE_RU_ALLOC_SEC80 = 0x00000100, 368 397 /* trigger encoded */ 369 - IWL_RX_HE_PHY_RU_ALLOC_MASK = 0xfe0000000000ULL, 370 - IWL_RX_HE_PHY_INFO_TYPE_MASK = 0xf000000000000000ULL, 371 - IWL_RX_HE_PHY_INFO_TYPE_SU = 0x0, /* TSF low valid (first DW) */ 372 - IWL_RX_HE_PHY_INFO_TYPE_MU = 0x1, /* TSF low/high valid (both DWs) */ 373 - IWL_RX_HE_PHY_INFO_TYPE_MU_EXT_INFO = 0x2, /* same + SIGB-common0/1/2 valid */ 374 - IWL_RX_HE_PHY_INFO_TYPE_TB = 0x3, /* TSF low/high valid (both DWs) */ 398 + IWL_RX_PHY_DATA1_HE_RU_ALLOC_MASK = 0x0000fe00, 375 399 376 - /* second dword - MU data */ 377 - IWL_RX_HE_PHY_MU_SIGB_COMPRESSION = BIT_ULL(32 + 0), 378 - IWL_RX_HE_PHY_MU_SIBG_SYM_OR_USER_NUM_MASK = 0x1e00000000ULL, 379 - IWL_RX_HE_PHY_MU_SIGB_MCS_MASK = 0xf000000000000ULL, 380 - IWL_RX_HE_PHY_MU_SIGB_DCM = BIT_ULL(32 + 21), 381 - IWL_RX_HE_PHY_MU_PREAMBLE_PUNC_TYPE_MASK = 0xc0000000000000ULL, 382 - 383 - /* second dword - TB data */ 384 - IWL_RX_HE_PHY_TB_PILOT_TYPE = BIT_ULL(32 + 0), 385 - IWL_RX_HE_PHY_TB_LOW_SS_MASK = 0xe00000000ULL 400 + /* info type: HE TB/TX-EXT */ 401 + IWL_RX_PHY_DATA1_HE_TB_PILOT_TYPE = 0x00000001, 402 + IWL_RX_PHY_DATA1_HE_TB_LOW_SS_MASK = 0x0000000e, 386 403 }; 387 404 388 - enum iwl_rx_he_sigb_common0 { 405 + /* goes into Metadata DW 7 */ 406 + enum iwl_rx_phy_data2 { 407 + /* info type: HE MU-EXT */ 389 408 /* the a1/a2/... is what the PHY/firmware calls the values */ 390 - IWL_RX_HE_SIGB_COMMON0_CH1_RU0 = 0x000000ff, /* a1 */ 391 - IWL_RX_HE_SIGB_COMMON0_CH1_RU2 = 0x0000ff00, /* a2 */ 392 - IWL_RX_HE_SIGB_COMMON0_CH2_RU0 = 0x00ff0000, /* b1 */ 393 - IWL_RX_HE_SIGB_COMMON0_CH2_RU2 = 0xff000000, /* b2 */ 409 + IWL_RX_PHY_DATA2_HE_MU_EXT_CH1_RU0 = 0x000000ff, /* a1 */ 410 + IWL_RX_PHY_DATA2_HE_MU_EXT_CH1_RU2 = 0x0000ff00, /* a2 */ 411 + IWL_RX_PHY_DATA2_HE_MU_EXT_CH2_RU0 = 0x00ff0000, /* b1 */ 412 + IWL_RX_PHY_DATA2_HE_MU_EXT_CH2_RU2 = 0xff000000, /* b2 */ 413 + 414 + /* info type: HE TB-EXT */ 415 + IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE1 = 0x0000000f, 416 + IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE2 = 0x000000f0, 417 + IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE3 = 0x00000f00, 418 + IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE4 = 0x0000f000, 394 419 }; 395 420 396 - enum iwl_rx_he_sigb_common1 { 397 - IWL_RX_HE_SIGB_COMMON1_CH1_RU1 = 0x000000ff, /* c1 */ 398 - IWL_RX_HE_SIGB_COMMON1_CH1_RU3 = 0x0000ff00, /* c2 */ 399 - IWL_RX_HE_SIGB_COMMON1_CH2_RU1 = 0x00ff0000, /* d1 */ 400 - IWL_RX_HE_SIGB_COMMON1_CH2_RU3 = 0xff000000, /* d2 */ 421 + /* goes into Metadata DW 8 */ 422 + enum iwl_rx_phy_data3 { 423 + /* info type: HE MU-EXT */ 424 + IWL_RX_PHY_DATA3_HE_MU_EXT_CH1_RU1 = 0x000000ff, /* c1 */ 425 + IWL_RX_PHY_DATA3_HE_MU_EXT_CH1_RU3 = 0x0000ff00, /* c2 */ 426 + IWL_RX_PHY_DATA3_HE_MU_EXT_CH2_RU1 = 0x00ff0000, /* d1 */ 427 + IWL_RX_PHY_DATA3_HE_MU_EXT_CH2_RU3 = 0xff000000, /* d2 */ 401 428 }; 402 429 403 - enum iwl_rx_he_sigb_common2 { 404 - IWL_RX_HE_SIGB_COMMON2_CH1_CTR_RU = 0x0001, 405 - IWL_RX_HE_SIGB_COMMON2_CH2_CTR_RU = 0x0002, 406 - IWL_RX_HE_SIGB_COMMON2_CH1_CRC_OK = 0x0004, 407 - IWL_RX_HE_SIGB_COMMON2_CH2_CRC_OK = 0x0008, 430 + /* goes into Metadata DW 4 high 16 bits */ 431 + enum iwl_rx_phy_data4 { 432 + /* info type: HE MU-EXT */ 433 + IWL_RX_PHY_DATA4_HE_MU_EXT_CH1_CTR_RU = 0x0001, 434 + IWL_RX_PHY_DATA4_HE_MU_EXT_CH2_CTR_RU = 0x0002, 435 + IWL_RX_PHY_DATA4_HE_MU_EXT_CH1_CRC_OK = 0x0004, 436 + IWL_RX_PHY_DATA4_HE_MU_EXT_CH2_CRC_OK = 0x0008, 437 + IWL_RX_PHY_DATA4_HE_MU_EXT_SIGB_MCS_MASK = 0x00f0, 438 + IWL_RX_PHY_DATA4_HE_MU_EXT_SIGB_DCM = 0x0100, 439 + IWL_RX_PHY_DATA4_HE_MU_EXT_PREAMBLE_PUNC_TYPE_MASK = 0x0600, 408 440 }; 409 441 410 442 /** ··· 451 419 __le32 rss_hash; 452 420 453 421 /** 454 - * @sigb_common0: for HE sniffer, HE-SIG-B common part 0 422 + * @phy_data2: depends on info type (see @phy_data1) 455 423 */ 456 - __le32 sigb_common0; 424 + __le32 phy_data2; 457 425 }; 458 426 459 427 /* DW8 - carries filter_match only when rpa_en == 1 */ ··· 464 432 __le32 filter_match; 465 433 466 434 /** 467 - * @sigb_common1: for HE sniffer, HE-SIG-B common part 1 435 + * @phy_data3: depends on info type (see @phy_data1) 468 436 */ 469 - __le32 sigb_common1; 437 + __le32 phy_data3; 470 438 }; 471 439 472 440 /* DW9 */ ··· 504 472 * %IWL_RX_MPDU_PHY_TSF_OVERLOAD isn't set 505 473 */ 506 474 __le64 tsf_on_air_rise; 507 - /** 508 - * @he_phy_data: 509 - * HE PHY data, see &enum iwl_rx_he_phy, valid 510 - * only if %IWL_RX_MPDU_PHY_TSF_OVERLOAD is set 511 - */ 512 - __le64 he_phy_data; 475 + 476 + struct { 477 + /** 478 + * @phy_data0: depends on info_type, see @phy_data1 479 + */ 480 + __le32 phy_data0; 481 + /** 482 + * @phy_data1: valid only if 483 + * %IWL_RX_MPDU_PHY_TSF_OVERLOAD is set, 484 + * see &enum iwl_rx_phy_data1. 485 + */ 486 + __le32 phy_data1; 487 + }; 513 488 }; 514 489 } __packed; 515 490 ··· 532 493 __le32 filter_match; 533 494 534 495 /** 535 - * @sigb_common0: for HE sniffer, HE-SIG-B common part 0 496 + * @phy_data2: depends on info type (see @phy_data1) 536 497 */ 537 - __le32 sigb_common0; 498 + __le32 phy_data2; 538 499 }; 539 500 540 501 /* DW8 - carries rss_hash only when rpa_en == 1 */ ··· 545 506 __le32 rss_hash; 546 507 547 508 /** 548 - * @sigb_common1: for HE sniffer, HE-SIG-B common part 1 509 + * @phy_data3: depends on info type (see @phy_data1) 549 510 */ 550 - __le32 sigb_common1; 511 + __le32 phy_data3; 551 512 }; 552 513 /* DW9 */ 553 514 /** ··· 595 556 * %IWL_RX_MPDU_PHY_TSF_OVERLOAD isn't set 596 557 */ 597 558 __le64 tsf_on_air_rise; 598 - /** 599 - * @he_phy_data: 600 - * HE PHY data, see &enum iwl_rx_he_phy, valid 601 - * only if %IWL_RX_MPDU_PHY_TSF_OVERLOAD is set 602 - */ 603 - __le64 he_phy_data; 559 + 560 + struct { 561 + /** 562 + * @phy_data0: depends on info_type, see @phy_data1 563 + */ 564 + __le32 phy_data0; 565 + /** 566 + * @phy_data1: valid only if 567 + * %IWL_RX_MPDU_PHY_TSF_OVERLOAD is set, 568 + * see &enum iwl_rx_phy_data1. 569 + */ 570 + __le32 phy_data1; 571 + }; 604 572 }; 605 573 /* DW16 & DW17 */ 606 574 /** ··· 659 613 __le16 l3l4_flags; 660 614 661 615 /** 662 - * @sigb_common2: for HE sniffer, HE-SIG-B common part 2 616 + * @phy_data4: depends on info type, see phy_data1 663 617 */ 664 - __le16 sigb_common2; 618 + __le16 phy_data4; 665 619 }; 666 620 /* DW5 */ 667 621 /** ··· 696 650 #define IWL_CD_STTS_TRANSFER_STATUS_MSK 0x0E 697 651 #define IWL_CD_STTS_WIFI_STATUS_POS 4 698 652 #define IWL_CD_STTS_WIFI_STATUS_MSK 0xF0 653 + 654 + #define RX_NO_DATA_CHAIN_A_POS 0 655 + #define RX_NO_DATA_CHAIN_A_MSK (0xff << RX_NO_DATA_CHAIN_A_POS) 656 + #define RX_NO_DATA_CHAIN_B_POS 8 657 + #define RX_NO_DATA_CHAIN_B_MSK (0xff << RX_NO_DATA_CHAIN_B_POS) 658 + #define RX_NO_DATA_CHANNEL_POS 16 659 + #define RX_NO_DATA_CHANNEL_MSK (0xff << RX_NO_DATA_CHANNEL_POS) 660 + 661 + #define RX_NO_DATA_INFO_TYPE_POS 0 662 + #define RX_NO_DATA_INFO_TYPE_MSK (0xff << RX_NO_DATA_INFO_TYPE_POS) 663 + #define RX_NO_DATA_INFO_TYPE_NONE 0 664 + #define RX_NO_DATA_INFO_TYPE_RX_ERR 1 665 + #define RX_NO_DATA_INFO_TYPE_NDP 2 666 + #define RX_NO_DATA_INFO_TYPE_MU_UNMATCHED 3 667 + #define RX_NO_DATA_INFO_TYPE_HE_TB_UNMATCHED 4 668 + 669 + #define RX_NO_DATA_INFO_ERR_POS 8 670 + #define RX_NO_DATA_INFO_ERR_MSK (0xff << RX_NO_DATA_INFO_ERR_POS) 671 + #define RX_NO_DATA_INFO_ERR_NONE 0 672 + #define RX_NO_DATA_INFO_ERR_BAD_PLCP 1 673 + #define RX_NO_DATA_INFO_ERR_UNSUPPORTED_RATE 2 674 + #define RX_NO_DATA_INFO_ERR_NO_DELIM 3 675 + #define RX_NO_DATA_INFO_ERR_BAD_MAC_HDR 4 676 + 677 + #define RX_NO_DATA_FRAME_TIME_POS 0 678 + #define RX_NO_DATA_FRAME_TIME_MSK (0xfffff << RX_NO_DATA_FRAME_TIME_POS) 679 + 680 + /** 681 + * struct iwl_rx_no_data - RX no data descriptor 682 + * @info: 7:0 frame type, 15:8 RX error type 683 + * @rssi: 7:0 energy chain-A, 684 + * 15:8 chain-B, measured at FINA time (FINA_ENERGY), 16:23 channel 685 + * @on_air_rise_time: GP2 during on air rise 686 + * @fr_time: frame time 687 + * @rate: rate/mcs of frame 688 + * @phy_info: &enum iwl_rx_phy_data0 and &enum iwl_rx_phy_info_type 689 + * @rx_vec: DW-12:9 raw RX vectors from DSP according to modulation type. 690 + * for VHT: OFDM_RX_VECTOR_SIGA1_OUT, OFDM_RX_VECTOR_SIGA2_OUT 691 + * for HE: OFDM_RX_VECTOR_HE_SIGA1_OUT, OFDM_RX_VECTOR_HE_SIGA2_OUT 692 + */ 693 + struct iwl_rx_no_data { 694 + __le32 info; 695 + __le32 rssi; 696 + __le32 on_air_rise_time; 697 + __le32 fr_time; 698 + __le32 rate; 699 + __le32 phy_info[2]; 700 + __le32 rx_vec[3]; 701 + } __packed; /* RX_NO_DATA_NTFY_API_S_VER_1 */ 699 702 700 703 /** 701 704 * enum iwl_completion_desc_transfer_status - transfer status (bits 1-3)
+317 -9
drivers/net/wireless/intel/iwlwifi/fw/dbg.c
··· 605 605 IWL_DEBUG_INFO(fwrt, "WRT memory dump. Type=%u\n", dump_mem->type); 606 606 } 607 607 608 + static void iwl_fw_dump_named_mem(struct iwl_fw_runtime *fwrt, 609 + struct iwl_fw_error_dump_data **dump_data, 610 + u32 len, u32 ofs, u8 *name, u8 name_len) 611 + { 612 + struct iwl_fw_error_dump_named_mem *dump_mem; 613 + 614 + if (!len) 615 + return; 616 + 617 + (*dump_data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_MEM); 618 + (*dump_data)->len = cpu_to_le32(len + sizeof(*dump_mem)); 619 + dump_mem = (void *)(*dump_data)->data; 620 + dump_mem->type = cpu_to_le32(IWL_FW_ERROR_DUMP_MEM_NAMED_MEM); 621 + dump_mem->offset = cpu_to_le32(ofs); 622 + dump_mem->name_len = name_len; 623 + memcpy(dump_mem->name, name, name_len); 624 + iwl_trans_read_mem_bytes(fwrt->trans, ofs, dump_mem->data, len); 625 + *dump_data = iwl_fw_error_next_data(*dump_data); 626 + 627 + IWL_DEBUG_INFO(fwrt, "WRT memory dump. Type=%u\n", dump_mem->type); 628 + } 629 + 608 630 #define ADD_LEN(len, item_len, const_len) \ 609 631 do {size_t item = item_len; len += (!!item) * const_len + item; } \ 610 632 while (0) ··· 828 806 sizeof(dump_info->dev_human_readable) - 1); 829 807 strncpy(dump_info->bus_human_readable, fwrt->dev->bus->name, 830 808 sizeof(dump_info->bus_human_readable) - 1); 809 + dump_info->rt_status = cpu_to_le32(fwrt->dump.rt_status); 831 810 832 811 dump_data = iwl_fw_error_next_data(dump_data); 833 812 } ··· 951 928 return dump_file; 952 929 } 953 930 931 + static void iwl_dump_prph_ini(struct iwl_trans *trans, 932 + struct iwl_fw_error_dump_data **data, 933 + struct iwl_fw_ini_region_cfg *reg) 934 + { 935 + struct iwl_fw_error_dump_prph *prph; 936 + unsigned long flags; 937 + u32 i, size = le32_to_cpu(reg->num_regions); 938 + 939 + IWL_DEBUG_INFO(trans, "WRT PRPH dump\n"); 940 + 941 + if (!iwl_trans_grab_nic_access(trans, &flags)) 942 + return; 943 + 944 + for (i = 0; i < size; i++) { 945 + (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_PRPH); 946 + (*data)->len = cpu_to_le32(le32_to_cpu(reg->size) + 947 + sizeof(*prph)); 948 + prph = (void *)(*data)->data; 949 + prph->prph_start = reg->start_addr[i]; 950 + prph->data[0] = cpu_to_le32(iwl_read_prph_no_grab(trans, 951 + le32_to_cpu(prph->prph_start))); 952 + *data = iwl_fw_error_next_data(*data); 953 + } 954 + iwl_trans_release_nic_access(trans, &flags); 955 + } 956 + 957 + static void iwl_dump_csr_ini(struct iwl_trans *trans, 958 + struct iwl_fw_error_dump_data **data, 959 + struct iwl_fw_ini_region_cfg *reg) 960 + { 961 + int i, num = le32_to_cpu(reg->num_regions); 962 + u32 size = le32_to_cpu(reg->size); 963 + 964 + IWL_DEBUG_INFO(trans, "WRT CSR dump\n"); 965 + 966 + for (i = 0; i < num; i++) { 967 + u32 add = le32_to_cpu(reg->start_addr[i]); 968 + __le32 *val; 969 + int j; 970 + 971 + (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_CSR); 972 + (*data)->len = cpu_to_le32(size); 973 + val = (void *)(*data)->data; 974 + 975 + for (j = 0; j < size; j += 4) 976 + *val++ = cpu_to_le32(iwl_trans_read32(trans, j + add)); 977 + 978 + *data = iwl_fw_error_next_data(*data); 979 + } 980 + } 981 + 982 + static int iwl_fw_ini_get_trigger_len(struct iwl_fw_runtime *fwrt, 983 + struct iwl_fw_ini_trigger *trigger) 984 + { 985 + int i, num, size = 0, hdr_len = sizeof(struct iwl_fw_error_dump_data); 986 + 987 + if (!trigger || !trigger->num_regions) 988 + return 0; 989 + 990 + num = le32_to_cpu(trigger->num_regions); 991 + for (i = 0; i < num; i++) { 992 + u32 reg_id = le32_to_cpu(trigger->data[i]); 993 + struct iwl_fw_ini_region_cfg *reg; 994 + enum iwl_fw_ini_region_type type; 995 + u32 num_entries; 996 + 997 + if (WARN_ON(reg_id >= ARRAY_SIZE(fwrt->dump.active_regs))) 998 + continue; 999 + 1000 + reg = fwrt->dump.active_regs[reg_id].reg; 1001 + if (WARN(!reg, "Unassigned region %d\n", reg_id)) 1002 + continue; 1003 + 1004 + type = le32_to_cpu(reg->region_type); 1005 + num_entries = le32_to_cpu(reg->num_regions); 1006 + 1007 + switch (type) { 1008 + case IWL_FW_INI_REGION_DEVICE_MEMORY: 1009 + size += hdr_len + 1010 + sizeof(struct iwl_fw_error_dump_named_mem) + 1011 + le32_to_cpu(reg->size); 1012 + break; 1013 + case IWL_FW_INI_REGION_PERIPHERY_MAC: 1014 + case IWL_FW_INI_REGION_PERIPHERY_PHY: 1015 + case IWL_FW_INI_REGION_PERIPHERY_AUX: 1016 + size += num_entries * 1017 + (hdr_len + 1018 + sizeof(struct iwl_fw_error_dump_prph) + 1019 + sizeof(u32)); 1020 + break; 1021 + case IWL_FW_INI_REGION_TXF: 1022 + size += iwl_fw_txf_len(fwrt, &fwrt->smem_cfg); 1023 + break; 1024 + case IWL_FW_INI_REGION_RXF: 1025 + size += iwl_fw_rxf_len(fwrt, &fwrt->smem_cfg); 1026 + break; 1027 + case IWL_FW_INI_REGION_PAGING: 1028 + if (!iwl_fw_dbg_is_paging_enabled(fwrt)) 1029 + break; 1030 + size += fwrt->num_of_paging_blk * 1031 + (hdr_len + 1032 + sizeof(struct iwl_fw_error_dump_paging) + 1033 + PAGING_BLOCK_SIZE); 1034 + break; 1035 + case IWL_FW_INI_REGION_CSR: 1036 + size += num_entries * 1037 + (hdr_len + le32_to_cpu(reg->size)); 1038 + break; 1039 + case IWL_FW_INI_REGION_DRAM_BUFFER: 1040 + /* Transport takes care of DRAM dumping */ 1041 + case IWL_FW_INI_REGION_INTERNAL_BUFFER: 1042 + case IWL_FW_INI_REGION_DRAM_IMR: 1043 + /* Undefined yet */ 1044 + default: 1045 + break; 1046 + } 1047 + } 1048 + return size; 1049 + } 1050 + 1051 + static void iwl_fw_ini_dump_trigger(struct iwl_fw_runtime *fwrt, 1052 + struct iwl_fw_ini_trigger *trigger, 1053 + struct iwl_fw_error_dump_data **data, 1054 + u32 *dump_mask) 1055 + { 1056 + int i, num = le32_to_cpu(trigger->num_regions); 1057 + 1058 + for (i = 0; i < num; i++) { 1059 + u32 reg_id = le32_to_cpu(trigger->data[i]); 1060 + enum iwl_fw_ini_region_type type; 1061 + struct iwl_fw_ini_region_cfg *reg; 1062 + 1063 + if (reg_id >= ARRAY_SIZE(fwrt->dump.active_regs)) 1064 + continue; 1065 + 1066 + reg = fwrt->dump.active_regs[reg_id].reg; 1067 + /* Don't warn, get_trigger_len already warned */ 1068 + if (!reg) 1069 + continue; 1070 + 1071 + type = le32_to_cpu(reg->region_type); 1072 + switch (type) { 1073 + case IWL_FW_INI_REGION_DEVICE_MEMORY: 1074 + if (WARN_ON(le32_to_cpu(reg->num_regions) > 1)) 1075 + continue; 1076 + iwl_fw_dump_named_mem(fwrt, data, 1077 + le32_to_cpu(reg->size), 1078 + le32_to_cpu(reg->start_addr[0]), 1079 + reg->name, 1080 + le32_to_cpu(reg->name_len)); 1081 + break; 1082 + case IWL_FW_INI_REGION_PERIPHERY_MAC: 1083 + case IWL_FW_INI_REGION_PERIPHERY_PHY: 1084 + case IWL_FW_INI_REGION_PERIPHERY_AUX: 1085 + iwl_dump_prph_ini(fwrt->trans, data, reg); 1086 + break; 1087 + case IWL_FW_INI_REGION_DRAM_BUFFER: 1088 + *dump_mask |= IWL_FW_ERROR_DUMP_FW_MONITOR; 1089 + break; 1090 + case IWL_FW_INI_REGION_PAGING: 1091 + if (iwl_fw_dbg_is_paging_enabled(fwrt)) 1092 + iwl_dump_paging(fwrt, data); 1093 + else 1094 + *dump_mask |= IWL_FW_ERROR_DUMP_PAGING; 1095 + break; 1096 + case IWL_FW_INI_REGION_TXF: 1097 + iwl_fw_dump_txf(fwrt, data); 1098 + break; 1099 + case IWL_FW_INI_REGION_RXF: 1100 + iwl_fw_dump_rxf(fwrt, data); 1101 + break; 1102 + case IWL_FW_INI_REGION_CSR: 1103 + iwl_dump_csr_ini(fwrt->trans, data, reg); 1104 + break; 1105 + case IWL_FW_INI_REGION_DRAM_IMR: 1106 + case IWL_FW_INI_REGION_INTERNAL_BUFFER: 1107 + /* This is undefined yet */ 1108 + default: 1109 + break; 1110 + } 1111 + } 1112 + } 1113 + 1114 + static struct iwl_fw_error_dump_file * 1115 + _iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt, 1116 + struct iwl_fw_dump_ptrs *fw_error_dump, 1117 + u32 *dump_mask) 1118 + { 1119 + int size, id = le32_to_cpu(fwrt->dump.desc->trig_desc.type); 1120 + struct iwl_fw_error_dump_data *dump_data; 1121 + struct iwl_fw_error_dump_file *dump_file; 1122 + struct iwl_fw_ini_trigger *trigger, *ext; 1123 + 1124 + if (id == FW_DBG_TRIGGER_FW_ASSERT) 1125 + id = IWL_FW_TRIGGER_ID_FW_ASSERT; 1126 + else if (id == FW_DBG_TRIGGER_USER) 1127 + id = IWL_FW_TRIGGER_ID_USER_TRIGGER; 1128 + else if (id < FW_DBG_TRIGGER_MAX) 1129 + return NULL; 1130 + 1131 + if (WARN_ON(id >= ARRAY_SIZE(fwrt->dump.active_trigs))) 1132 + return NULL; 1133 + 1134 + trigger = fwrt->dump.active_trigs[id].conf; 1135 + ext = fwrt->dump.active_trigs[id].conf_ext; 1136 + 1137 + size = sizeof(*dump_file); 1138 + size += iwl_fw_ini_get_trigger_len(fwrt, trigger); 1139 + size += iwl_fw_ini_get_trigger_len(fwrt, ext); 1140 + 1141 + if (!size) 1142 + return NULL; 1143 + 1144 + dump_file = vzalloc(size); 1145 + if (!dump_file) 1146 + return NULL; 1147 + 1148 + fw_error_dump->fwrt_ptr = dump_file; 1149 + 1150 + dump_file->barker = cpu_to_le32(IWL_FW_ERROR_DUMP_BARKER); 1151 + dump_data = (void *)dump_file->data; 1152 + dump_file->file_len = cpu_to_le32(size); 1153 + 1154 + *dump_mask = 0; 1155 + if (trigger) 1156 + iwl_fw_ini_dump_trigger(fwrt, trigger, &dump_data, dump_mask); 1157 + if (ext) 1158 + iwl_fw_ini_dump_trigger(fwrt, ext, &dump_data, dump_mask); 1159 + 1160 + return dump_file; 1161 + } 1162 + 954 1163 void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt) 955 1164 { 956 1165 struct iwl_fw_dump_ptrs *fw_error_dump; ··· 1203 948 if (!fw_error_dump) 1204 949 goto out; 1205 950 1206 - dump_file = _iwl_fw_error_dump(fwrt, fw_error_dump); 951 + if (fwrt->trans->ini_valid) 952 + dump_file = _iwl_fw_error_ini_dump(fwrt, fw_error_dump, 953 + &dump_mask); 954 + else 955 + dump_file = _iwl_fw_error_dump(fwrt, fw_error_dump); 956 + 1207 957 if (!dump_file) { 1208 958 kfree(fw_error_dump); 1209 959 goto out; 1210 960 } 1211 961 1212 - if (fwrt->dump.monitor_only) 962 + if (!fwrt->trans->ini_valid && fwrt->dump.monitor_only) 1213 963 dump_mask &= IWL_FW_ERROR_DUMP_FW_MONITOR; 1214 964 1215 965 fw_error_dump->trans_ptr = iwl_trans_dump_data(fwrt->trans, dump_mask); ··· 1330 1070 } 1331 1071 IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect_desc); 1332 1072 1333 - int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, 1334 - enum iwl_fw_dbg_trigger trig, 1335 - const char *str, size_t len, 1336 - struct iwl_fw_dbg_trigger_tlv *trigger) 1073 + int _iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, 1074 + enum iwl_fw_dbg_trigger trig, 1075 + const char *str, size_t len, 1076 + struct iwl_fw_dbg_trigger_tlv *trigger) 1337 1077 { 1338 1078 struct iwl_fw_dump_desc *desc; 1339 1079 unsigned int delay = 0; ··· 1368 1108 1369 1109 return iwl_fw_dbg_collect_desc(fwrt, desc, monitor_only, delay); 1370 1110 } 1111 + IWL_EXPORT_SYMBOL(_iwl_fw_dbg_collect); 1112 + 1113 + int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, 1114 + u32 id, const char *str, size_t len) 1115 + { 1116 + struct iwl_fw_dump_desc *desc; 1117 + u32 occur, delay; 1118 + 1119 + if (!fwrt->trans->ini_valid) 1120 + return _iwl_fw_dbg_collect(fwrt, id, str, len, NULL); 1121 + 1122 + if (id == FW_DBG_TRIGGER_USER) 1123 + id = IWL_FW_TRIGGER_ID_USER_TRIGGER; 1124 + 1125 + if (WARN_ON(!fwrt->dump.active_trigs[id].active)) 1126 + return -EINVAL; 1127 + 1128 + delay = le32_to_cpu(fwrt->dump.active_trigs[id].conf->ignore_consec); 1129 + occur = le32_to_cpu(fwrt->dump.active_trigs[id].conf->occurrences); 1130 + if (!occur) 1131 + return 0; 1132 + 1133 + if (le32_to_cpu(fwrt->dump.active_trigs[id].conf->force_restart)) { 1134 + IWL_WARN(fwrt, "Force restart: trigger %d fired.\n", id); 1135 + iwl_force_nmi(fwrt->trans); 1136 + return 0; 1137 + } 1138 + 1139 + desc = kzalloc(sizeof(*desc) + len, GFP_ATOMIC); 1140 + if (!desc) 1141 + return -ENOMEM; 1142 + 1143 + occur--; 1144 + fwrt->dump.active_trigs[id].conf->occurrences = cpu_to_le32(occur); 1145 + 1146 + desc->len = len; 1147 + desc->trig_desc.type = cpu_to_le32(id); 1148 + memcpy(desc->trig_desc.data, str, len); 1149 + 1150 + return iwl_fw_dbg_collect_desc(fwrt, desc, true, delay); 1151 + } 1371 1152 IWL_EXPORT_SYMBOL(iwl_fw_dbg_collect); 1372 1153 1373 1154 int iwl_fw_dbg_collect_trig(struct iwl_fw_runtime *fwrt, ··· 1437 1136 len = strlen(buf) + 1; 1438 1137 } 1439 1138 1440 - ret = iwl_fw_dbg_collect(fwrt, le32_to_cpu(trigger->id), buf, len, 1441 - trigger); 1139 + ret = _iwl_fw_dbg_collect(fwrt, le32_to_cpu(trigger->id), buf, len, 1140 + trigger); 1442 1141 1443 1142 if (ret) 1444 1143 return ret; ··· 1647 1346 int id = le32_to_cpu(reg->region_id); 1648 1347 struct iwl_fw_ini_active_regs *active; 1649 1348 1650 - if (WARN_ON(id >= ARRAY_SIZE(fwrt->dump.active_regs))) 1349 + if (WARN(id >= ARRAY_SIZE(fwrt->dump.active_regs), 1350 + "Invalid region id %d for apply point %d\n", id, pnt)) 1651 1351 break; 1652 1352 1653 1353 active = &fwrt->dump.active_regs[id]; ··· 1710 1408 } else { 1711 1409 active->conf = trig; 1712 1410 } 1411 + 1412 + /* Since zero means infinity - just set to -1 */ 1413 + if (!le32_to_cpu(trig->occurrences)) 1414 + trig->occurrences = cpu_to_le32(-1); 1415 + if (!le32_to_cpu(trig->ignore_consec)) 1416 + trig->ignore_consec = cpu_to_le32(-1); 1713 1417 1714 1418 iter += sizeof(*trig) + 1715 1419 le32_to_cpu(trig->num_regions) * sizeof(__le32);
+38 -4
drivers/net/wireless/intel/iwlwifi/fw/dbg.h
··· 102 102 if (fwrt->dump.desc != &iwl_dump_desc_assert) 103 103 kfree(fwrt->dump.desc); 104 104 fwrt->dump.desc = NULL; 105 + fwrt->dump.rt_status = 0; 105 106 } 106 107 107 108 void iwl_fw_error_dump(struct iwl_fw_runtime *fwrt); 108 109 int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt, 109 110 const struct iwl_fw_dump_desc *desc, 110 111 bool monitor_only, unsigned int delay); 112 + int _iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, 113 + enum iwl_fw_dbg_trigger trig, 114 + const char *str, size_t len, 115 + struct iwl_fw_dbg_trigger_tlv *trigger); 111 116 int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt, 112 - enum iwl_fw_dbg_trigger trig, 113 - const char *str, size_t len, 114 - struct iwl_fw_dbg_trigger_tlv *trigger); 117 + u32 id, const char *str, size_t len); 115 118 int iwl_fw_dbg_collect_trig(struct iwl_fw_runtime *fwrt, 116 119 struct iwl_fw_dbg_trigger_tlv *trigger, 117 120 const char *fmt, ...) __printf(3, 4); ··· 214 211 BUILD_BUG_ON(!__builtin_constant_p(id)); \ 215 212 BUILD_BUG_ON((id) >= FW_DBG_TRIGGER_MAX); \ 216 213 _iwl_fw_dbg_trigger_on((fwrt), (wdev), (id)); \ 214 + }) 215 + 216 + static inline bool 217 + _iwl_fw_ini_trigger_on(struct iwl_fw_runtime *fwrt, 218 + const enum iwl_fw_dbg_trigger id) 219 + { 220 + struct iwl_fw_ini_active_triggers *trig = &fwrt->dump.active_trigs[id]; 221 + u32 ms; 222 + 223 + if (!fwrt->trans->ini_valid) 224 + return false; 225 + 226 + if (!trig || !trig->active) 227 + return false; 228 + 229 + ms = le32_to_cpu(trig->conf->ignore_consec); 230 + if (ms) 231 + ms /= USEC_PER_MSEC; 232 + 233 + if (iwl_fw_dbg_no_trig_window(fwrt, id, ms)) { 234 + IWL_WARN(fwrt, "Trigger %d fired in no-collect window\n", id); 235 + return false; 236 + } 237 + 238 + return true; 239 + } 240 + 241 + #define iwl_fw_ini_trigger_on(fwrt, wdev, id) ({ \ 242 + BUILD_BUG_ON(!__builtin_constant_p(id)); \ 243 + BUILD_BUG_ON((id) >= IWL_FW_TRIGGER_ID_NUM); \ 244 + _iwl_fw_ini_trigger_on((fwrt), (wdev), (id)); \ 217 245 }) 218 246 219 247 static inline void ··· 363 329 364 330 static inline bool iwl_fw_dbg_type_on(struct iwl_fw_runtime *fwrt, u32 type) 365 331 { 366 - return (fwrt->fw->dbg.dump_mask & BIT(type)); 332 + return (fwrt->fw->dbg.dump_mask & BIT(type) || fwrt->trans->ini_valid); 367 333 } 368 334 369 335 static inline bool iwl_fw_dbg_is_d3_debug_enabled(struct iwl_fw_runtime *fwrt)
+20
drivers/net/wireless/intel/iwlwifi/fw/error-dump.h
··· 187 187 * @fw_human_readable: human readable FW version 188 188 * @dev_human_readable: name of the device 189 189 * @bus_human_readable: name of the bus used 190 + * @rt_status: the error_id/rt_status that that triggered the latest dump 191 + * if the dump collection was not initiated by an assert, the value is 0 190 192 */ 191 193 struct iwl_fw_error_dump_info { 192 194 __le32 device_family; ··· 196 194 u8 fw_human_readable[FW_VER_HUMAN_READABLE_SZ]; 197 195 u8 dev_human_readable[64]; 198 196 u8 bus_human_readable[8]; 197 + __le32 rt_status; 199 198 } __packed; 200 199 201 200 /** ··· 252 249 enum iwl_fw_error_dump_mem_type { 253 250 IWL_FW_ERROR_DUMP_MEM_SRAM, 254 251 IWL_FW_ERROR_DUMP_MEM_SMEM, 252 + IWL_FW_ERROR_DUMP_MEM_NAMED_MEM = 10, 255 253 }; 256 254 257 255 /** ··· 264 260 struct iwl_fw_error_dump_mem { 265 261 __le32 type; 266 262 __le32 offset; 263 + u8 data[]; 264 + }; 265 + 266 + /** 267 + * struct iwl_fw_error_dump_named_mem - chunk of memory 268 + * @type: &enum iwl_fw_error_dump_mem_type 269 + * @offset: the offset from which the memory was read 270 + * @name_len: name length 271 + * @name: file name 272 + * @data: the content of the memory 273 + */ 274 + struct iwl_fw_error_dump_named_mem { 275 + __le32 type; 276 + __le32 offset; 277 + u8 name_len; 278 + u8 name[32]; 267 279 u8 data[]; 268 280 }; 269 281
+2 -1
drivers/net/wireless/intel/iwlwifi/fw/runtime.h
··· 138 138 u8 conf; 139 139 140 140 /* ts of the beginning of a non-collect fw dbg data period */ 141 - unsigned long non_collect_ts_start[FW_DBG_TRIGGER_MAX - 1]; 141 + unsigned long non_collect_ts_start[IWL_FW_TRIGGER_ID_NUM - 1]; 142 142 u32 *d3_debug_data; 143 143 struct iwl_fw_ini_active_regs active_regs[IWL_FW_INI_MAX_REGION_ID]; 144 144 struct iwl_fw_ini_active_triggers active_trigs[IWL_FW_TRIGGER_ID_NUM]; 145 + u32 rt_status; 145 146 } dump; 146 147 #ifdef CONFIG_IWLWIFI_DEBUGFS 147 148 struct {
+3 -5
drivers/net/wireless/intel/iwlwifi/iwl-config.h
··· 265 265 #define EEPROM_REGULATORY_BAND_NO_HT40 0 266 266 267 267 /* lower blocks contain EEPROM image and calibration data */ 268 - #define OTP_LOW_IMAGE_SIZE (2 * 512 * sizeof(u16)) /* 2 KB */ 269 - #define OTP_LOW_IMAGE_SIZE_FAMILY_7000 (16 * 512 * sizeof(u16)) /* 16 KB */ 270 - #define OTP_LOW_IMAGE_SIZE_FAMILY_8000 (32 * 512 * sizeof(u16)) /* 32 KB */ 271 - #define OTP_LOW_IMAGE_SIZE_FAMILY_9000 OTP_LOW_IMAGE_SIZE_FAMILY_8000 272 - #define OTP_LOW_IMAGE_SIZE_FAMILY_22000 OTP_LOW_IMAGE_SIZE_FAMILY_9000 268 + #define OTP_LOW_IMAGE_SIZE_2K (2 * 512 * sizeof(u16)) /* 2 KB */ 269 + #define OTP_LOW_IMAGE_SIZE_16K (16 * 512 * sizeof(u16)) /* 16 KB */ 270 + #define OTP_LOW_IMAGE_SIZE_32K (32 * 512 * sizeof(u16)) /* 32 KB */ 273 271 274 272 struct iwl_eeprom_params { 275 273 const u8 regulatory_bands[7];
+1
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c
··· 201 201 case IWL_UCODE_TLV_TYPE_TRIGGERS: 202 202 case IWL_UCODE_TLV_TYPE_DEBUG_FLOW: 203 203 iwl_fw_dbg_copy_tlv(trans, tlv, true); 204 + break; 204 205 default: 205 206 WARN_ONCE(1, "Invalid TLV %x\n", tlv_type); 206 207 break;
+1
drivers/net/wireless/intel/iwlwifi/iwl-drv.c
··· 1097 1097 case IWL_UCODE_TLV_TYPE_DEBUG_FLOW: 1098 1098 if (iwlwifi_mod_params.enable_ini) 1099 1099 iwl_fw_dbg_copy_tlv(drv->trans, tlv, false); 1100 + break; 1100 1101 default: 1101 1102 IWL_DEBUG_INFO(drv, "unknown TLV: %d\n", tlv_type); 1102 1103 break;
-19
drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.c
··· 927 927 return NULL; 928 928 } 929 929 IWL_EXPORT_SYMBOL(iwl_parse_eeprom_data); 930 - 931 - /* helper functions */ 932 - int iwl_nvm_check_version(struct iwl_nvm_data *data, 933 - struct iwl_trans *trans) 934 - { 935 - if (data->nvm_version >= trans->cfg->nvm_ver || 936 - data->calib_version >= trans->cfg->nvm_calib_ver) { 937 - IWL_DEBUG_INFO(trans, "device EEPROM VER=0x%x, CALIB=0x%x\n", 938 - data->nvm_version, data->calib_version); 939 - return 0; 940 - } 941 - 942 - IWL_ERR(trans, 943 - "Unsupported (too old) EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", 944 - data->nvm_version, trans->cfg->nvm_ver, 945 - data->calib_version, trans->cfg->nvm_calib_ver); 946 - return -EINVAL; 947 - } 948 - IWL_EXPORT_SYMBOL(iwl_nvm_check_version);
+2 -3
drivers/net/wireless/intel/iwlwifi/iwl-eeprom-parse.h
··· 7 7 * 8 8 * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. 9 9 * Copyright(c) 2015 Intel Mobile Communications GmbH 10 + * Copyright (C) 2018 Intel Corporation 10 11 * 11 12 * This program is free software; you can redistribute it and/or modify 12 13 * it under the terms of version 2 of the GNU General Public License as ··· 29 28 * 30 29 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 31 30 * Copyright(c) 2015 Intel Mobile Communications GmbH 31 + * Copyright (C) 2018 Intel Corporation 32 32 * All rights reserved. 33 33 * 34 34 * Redistribution and use in source and binary forms, with or without ··· 118 116 struct iwl_nvm_data * 119 117 iwl_parse_eeprom_data(struct device *dev, const struct iwl_cfg *cfg, 120 118 const u8 *eeprom, size_t eeprom_size); 121 - 122 - int iwl_nvm_check_version(struct iwl_nvm_data *data, 123 - struct iwl_trans *trans); 124 119 125 120 int iwl_init_sband_channels(struct iwl_nvm_data *data, 126 121 struct ieee80211_supported_band *sband,
+189 -101
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
··· 465 465 vht_cap->vht_mcs.tx_mcs_map = vht_cap->vht_mcs.rx_mcs_map; 466 466 } 467 467 468 - static struct ieee80211_sband_iftype_data iwl_he_capa = { 469 - .types_mask = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP), 470 - .he_cap = { 471 - .has_he = true, 472 - .he_cap_elem = { 473 - .mac_cap_info[0] = 474 - IEEE80211_HE_MAC_CAP0_HTC_HE | 475 - IEEE80211_HE_MAC_CAP0_TWT_REQ, 476 - .mac_cap_info[1] = 477 - IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | 478 - IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, 479 - .mac_cap_info[2] = 480 - IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP | 481 - IEEE80211_HE_MAC_CAP2_MU_CASCADING | 482 - IEEE80211_HE_MAC_CAP2_ACK_EN, 483 - .mac_cap_info[3] = 484 - IEEE80211_HE_MAC_CAP3_OMI_CONTROL | 485 - IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, 486 - .mac_cap_info[4] = 487 - IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU | 488 - IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39, 489 - .mac_cap_info[5] = 490 - IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 | 491 - IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 | 492 - IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU, 493 - .phy_cap_info[0] = 494 - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G | 495 - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | 496 - IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G, 497 - .phy_cap_info[1] = 498 - IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | 499 - IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | 500 - IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD | 501 - IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS, 502 - .phy_cap_info[2] = 503 - IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US | 504 - IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | 505 - IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ | 506 - IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO | 507 - IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO, 508 - .phy_cap_info[3] = 509 - IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK | 510 - IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 | 511 - IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK | 512 - IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1, 513 - .phy_cap_info[4] = 514 - IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE | 515 - IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 | 516 - IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8, 517 - .phy_cap_info[5] = 518 - IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 | 519 - IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 | 520 - IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK | 521 - IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK, 522 - .phy_cap_info[6] = 523 - IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU | 524 - IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU | 525 - IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB | 526 - IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB | 527 - IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB | 528 - IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO | 529 - IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT, 530 - .phy_cap_info[7] = 531 - IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | 532 - IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI | 533 - IEEE80211_HE_PHY_CAP7_MAX_NC_1, 534 - .phy_cap_info[8] = 535 - IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI | 536 - IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | 537 - IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU | 538 - IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU | 539 - IEEE80211_HE_PHY_CAP8_DCM_MAX_BW_160_OR_80P80_MHZ, 540 - .phy_cap_info[9] = 541 - IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK | 542 - IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB | 543 - IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB, 468 + static struct ieee80211_sband_iftype_data iwl_he_capa[] = { 469 + { 470 + .types_mask = BIT(NL80211_IFTYPE_STATION), 471 + .he_cap = { 472 + .has_he = true, 473 + .he_cap_elem = { 474 + .mac_cap_info[0] = 475 + IEEE80211_HE_MAC_CAP0_HTC_HE | 476 + IEEE80211_HE_MAC_CAP0_TWT_REQ, 477 + .mac_cap_info[1] = 478 + IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | 479 + IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, 480 + .mac_cap_info[2] = 481 + IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP | 482 + IEEE80211_HE_MAC_CAP2_MU_CASCADING | 483 + IEEE80211_HE_MAC_CAP2_ACK_EN, 484 + .mac_cap_info[3] = 485 + IEEE80211_HE_MAC_CAP3_OMI_CONTROL | 486 + IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, 487 + .mac_cap_info[4] = 488 + IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU | 489 + IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39, 490 + .mac_cap_info[5] = 491 + IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 | 492 + IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 | 493 + IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU, 494 + .phy_cap_info[0] = 495 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G | 496 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | 497 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G, 498 + .phy_cap_info[1] = 499 + IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK | 500 + IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A | 501 + IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD | 502 + IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS, 503 + .phy_cap_info[2] = 504 + IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US | 505 + IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | 506 + IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ | 507 + IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO | 508 + IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO, 509 + .phy_cap_info[3] = 510 + IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK | 511 + IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 | 512 + IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK | 513 + IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1, 514 + .phy_cap_info[4] = 515 + IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE | 516 + IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 | 517 + IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8, 518 + .phy_cap_info[5] = 519 + IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 | 520 + IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 | 521 + IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK | 522 + IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK, 523 + .phy_cap_info[6] = 524 + IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU | 525 + IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU | 526 + IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB | 527 + IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB | 528 + IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB | 529 + IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO | 530 + IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT, 531 + .phy_cap_info[7] = 532 + IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR | 533 + IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI | 534 + IEEE80211_HE_PHY_CAP7_MAX_NC_1, 535 + .phy_cap_info[8] = 536 + IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI | 537 + IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | 538 + IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU | 539 + IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU | 540 + IEEE80211_HE_PHY_CAP8_DCM_MAX_BW_160_OR_80P80_MHZ, 541 + .phy_cap_info[9] = 542 + IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK | 543 + IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB | 544 + IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB, 545 + }, 546 + /* 547 + * Set default Tx/Rx HE MCS NSS Support field. 548 + * Indicate support for up to 2 spatial streams and all 549 + * MCS, without any special cases 550 + */ 551 + .he_mcs_nss_supp = { 552 + .rx_mcs_80 = cpu_to_le16(0xfffa), 553 + .tx_mcs_80 = cpu_to_le16(0xfffa), 554 + .rx_mcs_160 = cpu_to_le16(0xfffa), 555 + .tx_mcs_160 = cpu_to_le16(0xfffa), 556 + .rx_mcs_80p80 = cpu_to_le16(0xffff), 557 + .tx_mcs_80p80 = cpu_to_le16(0xffff), 558 + }, 559 + /* 560 + * Set default PPE thresholds, with PPET16 set to 0, 561 + * PPET8 set to 7 562 + */ 563 + .ppe_thres = {0x61, 0x1c, 0xc7, 0x71}, 544 564 }, 545 - /* 546 - * Set default Tx/Rx HE MCS NSS Support field. Indicate support 547 - * for up to 2 spatial streams and all MCS, without any special 548 - * cases 549 - */ 550 - .he_mcs_nss_supp = { 551 - .rx_mcs_80 = cpu_to_le16(0xfffa), 552 - .tx_mcs_80 = cpu_to_le16(0xfffa), 553 - .rx_mcs_160 = cpu_to_le16(0xfffa), 554 - .tx_mcs_160 = cpu_to_le16(0xfffa), 555 - .rx_mcs_80p80 = cpu_to_le16(0xffff), 556 - .tx_mcs_80p80 = cpu_to_le16(0xffff), 565 + }, 566 + { 567 + .types_mask = BIT(NL80211_IFTYPE_AP), 568 + .he_cap = { 569 + .has_he = true, 570 + .he_cap_elem = { 571 + .mac_cap_info[0] = 572 + IEEE80211_HE_MAC_CAP0_HTC_HE | 573 + IEEE80211_HE_MAC_CAP0_TWT_RES, 574 + .mac_cap_info[1] = 575 + IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US | 576 + IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8, 577 + .mac_cap_info[2] = 578 + IEEE80211_HE_MAC_CAP2_BSR | 579 + IEEE80211_HE_MAC_CAP2_MU_CASCADING | 580 + IEEE80211_HE_MAC_CAP2_ACK_EN, 581 + .mac_cap_info[3] = 582 + IEEE80211_HE_MAC_CAP3_OMI_CONTROL | 583 + IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2, 584 + .mac_cap_info[4] = 585 + IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU, 586 + .phy_cap_info[0] = 587 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G | 588 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | 589 + IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G, 590 + .phy_cap_info[1] = 591 + IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD | 592 + IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS, 593 + .phy_cap_info[2] = 594 + IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US | 595 + IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | 596 + IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ, 597 + .phy_cap_info[3] = 598 + IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK | 599 + IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 | 600 + IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK | 601 + IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1, 602 + .phy_cap_info[4] = 603 + IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE | 604 + IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 | 605 + IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8, 606 + .phy_cap_info[5] = 607 + IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 | 608 + IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 | 609 + IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK | 610 + IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK, 611 + .phy_cap_info[6] = 612 + IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU | 613 + IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU | 614 + IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT, 615 + .phy_cap_info[7] = 616 + IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI | 617 + IEEE80211_HE_PHY_CAP7_MAX_NC_1, 618 + .phy_cap_info[8] = 619 + IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI | 620 + IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | 621 + IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU | 622 + IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU | 623 + IEEE80211_HE_PHY_CAP8_DCM_MAX_BW_160_OR_80P80_MHZ, 624 + .phy_cap_info[9] = 625 + IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB | 626 + IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB, 627 + }, 628 + /* 629 + * Set default Tx/Rx HE MCS NSS Support field. 630 + * Indicate support for up to 2 spatial streams and all 631 + * MCS, without any special cases 632 + */ 633 + .he_mcs_nss_supp = { 634 + .rx_mcs_80 = cpu_to_le16(0xfffa), 635 + .tx_mcs_80 = cpu_to_le16(0xfffa), 636 + .rx_mcs_160 = cpu_to_le16(0xfffa), 637 + .tx_mcs_160 = cpu_to_le16(0xfffa), 638 + .rx_mcs_80p80 = cpu_to_le16(0xffff), 639 + .tx_mcs_80p80 = cpu_to_le16(0xffff), 640 + }, 641 + /* 642 + * Set default PPE thresholds, with PPET16 set to 0, 643 + * PPET8 set to 7 644 + */ 645 + .ppe_thres = {0x61, 0x1c, 0xc7, 0x71}, 557 646 }, 558 - /* 559 - * Set default PPE thresholds, with PPET16 set to 0, PPET8 set 560 - * to 7 561 - */ 562 - .ppe_thres = {0x61, 0x1c, 0xc7, 0x71}, 563 647 }, 564 648 }; 565 649 ··· 652 568 { 653 569 if (sband->band == NL80211_BAND_2GHZ || 654 570 sband->band == NL80211_BAND_5GHZ) 655 - sband->iftype_data = &iwl_he_capa; 571 + sband->iftype_data = iwl_he_capa; 656 572 else 657 573 return; 658 574 659 - sband->n_iftype_data = 1; 575 + sband->n_iftype_data = ARRAY_SIZE(iwl_he_capa); 660 576 661 577 /* If not 2x2, we need to indicate 1x1 in the Midamble RX Max NSTS */ 662 578 if ((tx_chains & rx_chains) != ANT_AB) { 663 - iwl_he_capa.he_cap.he_cap_elem.phy_cap_info[1] &= 664 - ~IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS; 665 - iwl_he_capa.he_cap.he_cap_elem.phy_cap_info[2] &= 666 - ~IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS; 667 - iwl_he_capa.he_cap.he_cap_elem.phy_cap_info[7] &= 668 - ~IEEE80211_HE_PHY_CAP7_MAX_NC_MASK; 579 + int i; 580 + 581 + for (i = 0; i < sband->n_iftype_data; i++) { 582 + iwl_he_capa[i].he_cap.he_cap_elem.phy_cap_info[1] &= 583 + ~IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS; 584 + iwl_he_capa[i].he_cap.he_cap_elem.phy_cap_info[2] &= 585 + ~IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS; 586 + iwl_he_capa[i].he_cap.he_cap_elem.phy_cap_info[7] &= 587 + ~IEEE80211_HE_PHY_CAP7_MAX_NC_MASK; 588 + } 669 589 } 670 590 } 671 591
+6
drivers/net/wireless/intel/iwlwifi/iwl-prph.h
··· 362 362 #define MON_BUFF_END_ADDR (0xa03c40) 363 363 #define MON_BUFF_WRPTR (0xa03c44) 364 364 #define MON_BUFF_CYCLE_CNT (0xa03c48) 365 + /* FW monitor family 8000 and on */ 366 + #define MON_BUFF_BASE_ADDR_VER2 (0xa03c3c) 367 + #define MON_BUFF_END_ADDR_VER2 (0xa03c20) 368 + #define MON_BUFF_WRPTR_VER2 (0xa03c24) 369 + #define MON_BUFF_CYCLE_CNT_VER2 (0xa03c28) 370 + #define MON_BUFF_SHIFT_VER2 (0x8) 365 371 366 372 #define MON_DMARB_RD_CTL_ADDR (0xa03c60) 367 373 #define MON_DMARB_RD_DATA_ADDR (0xa03c5c)
+2 -4
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
··· 1811 1811 n_matches = 0; 1812 1812 } 1813 1813 1814 - net_detect = kzalloc(sizeof(*net_detect) + 1815 - (n_matches * sizeof(net_detect->matches[0])), 1814 + net_detect = kzalloc(struct_size(net_detect, matches, n_matches), 1816 1815 GFP_KERNEL); 1817 1816 if (!net_detect || !n_matches) 1818 1817 goto out_report_nd; ··· 1826 1827 for (j = 0; j < SCAN_OFFLOAD_MATCHING_CHANNELS_LEN; j++) 1827 1828 n_channels += hweight8(fw_match->matching_channels[j]); 1828 1829 1829 - match = kzalloc(sizeof(*match) + 1830 - (n_channels * sizeof(*match->channels)), 1830 + match = kzalloc(struct_size(match, channels, n_channels), 1831 1831 GFP_KERNEL); 1832 1832 if (!match) 1833 1833 goto out_report_nd;
+1 -1
drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
··· 1284 1284 return 0; 1285 1285 1286 1286 iwl_fw_dbg_collect(&mvm->fwrt, FW_DBG_TRIGGER_USER, buf, 1287 - (count - 1), NULL); 1287 + (count - 1)); 1288 1288 1289 1289 iwl_mvm_unref(mvm, IWL_MVM_REF_PRPH_WRITE); 1290 1290
+14 -6
drivers/net/wireless/intel/iwlwifi/mvm/fw.c
··· 547 547 if (mvm->nvm_file_name) 548 548 iwl_mvm_load_nvm_to_nic(mvm); 549 549 550 - WARN_ON(iwl_nvm_check_version(mvm->nvm_data, mvm->trans)); 550 + WARN_ONCE(mvm->nvm_data->nvm_version < mvm->trans->cfg->nvm_ver, 551 + "Too old NVM version (0x%0x, required = 0x%0x)", 552 + mvm->nvm_data->nvm_version, mvm->trans->cfg->nvm_ver); 551 553 552 554 /* 553 555 * abort after reading the nvm in case RF Kill is on, we will complete ··· 1029 1027 if (ret) 1030 1028 return ret; 1031 1029 1030 + iwl_fw_dbg_apply_point(&mvm->fwrt, IWL_FW_INI_APPLY_EARLY); 1031 + 1032 1032 ret = iwl_mvm_load_ucode_wait_alive(mvm, IWL_UCODE_REGULAR); 1033 1033 if (ret) 1034 1034 return ret; 1035 + 1036 + iwl_fw_dbg_apply_point(&mvm->fwrt, IWL_FW_INI_APPLY_AFTER_ALIVE); 1035 1037 1036 1038 return iwl_init_paging(&mvm->fwrt, mvm->fwrt.cur_fw_img); 1037 1039 } ··· 1065 1059 if (ret) 1066 1060 IWL_ERR(mvm, "Failed to initialize Smart Fifo\n"); 1067 1061 1068 - mvm->fwrt.dump.conf = FW_DBG_INVALID; 1069 - /* if we have a destination, assume EARLY START */ 1070 - if (mvm->fw->dbg.dest_tlv) 1071 - mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE; 1072 - iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE); 1062 + if (!mvm->trans->ini_valid) { 1063 + mvm->fwrt.dump.conf = FW_DBG_INVALID; 1064 + /* if we have a destination, assume EARLY START */ 1065 + if (mvm->fw->dbg.dest_tlv) 1066 + mvm->fwrt.dump.conf = FW_DBG_START_FROM_ALIVE; 1067 + iwl_fw_start_dbg_conf(&mvm->fwrt, FW_DBG_START_FROM_ALIVE); 1068 + } 1073 1069 1074 1070 ret = iwl_send_tx_ant_cfg(mvm, iwl_mvm_get_valid_tx_ant(mvm)); 1075 1071 if (ret)
+2
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c
··· 1532 1532 IEEE80211_IFACE_ITER_NORMAL, 1533 1533 iwl_mvm_beacon_loss_iterator, 1534 1534 mb); 1535 + 1536 + iwl_fw_dbg_apply_point(&mvm->fwrt, IWL_FW_INI_APPLY_MISSED_BEACONS); 1535 1537 } 1536 1538 1537 1539 void iwl_mvm_rx_stored_beacon_notif(struct iwl_mvm *mvm,
+10 -2
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 1129 1129 } 1130 1130 ret = iwl_mvm_up(mvm); 1131 1131 1132 + iwl_fw_dbg_apply_point(&mvm->fwrt, IWL_FW_INI_APPLY_POST_INIT); 1133 + 1132 1134 if (ret && test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { 1133 1135 /* Something went wrong - we need to finish some cleanup 1134 1136 * that normally iwl_mvm_mac_restart_complete() below ··· 2023 2021 if (sta->he_cap.he_cap_elem.mac_cap_info[4] & IEEE80211_HE_MAC_CAP4_BQR) 2024 2022 sta_ctxt_cmd.htc_flags |= cpu_to_le32(IWL_HE_HTC_BQR_SUPP); 2025 2023 2026 - /* If PPE Thresholds exist, parse them into a FW-familiar format */ 2024 + /* 2025 + * Initialize the PPE thresholds to "None" (7), as described in Table 2026 + * 9-262ac of 80211.ax/D3.0. 2027 + */ 2028 + memset(&sta_ctxt_cmd.pkt_ext, 7, sizeof(sta_ctxt_cmd.pkt_ext)); 2029 + 2030 + /* If PPE Thresholds exist, parse them into a FW-familiar format. */ 2027 2031 if (sta->he_cap.he_cap_elem.phy_cap_info[6] & 2028 2032 IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT) { 2029 2033 u8 nss = (sta->he_cap.ppe_thres[0] & ··· 3394 3386 resp = (void *)pkt->data; 3395 3387 3396 3388 IWL_DEBUG_TE(mvm, 3397 - "Aux ROC: Recieved response from ucode: status=%d uid=%d\n", 3389 + "Aux ROC: Received response from ucode: status=%d uid=%d\n", 3398 3390 resp->status, resp->event_unique_id); 3399 3391 3400 3392 te_data->uid = le32_to_cpu(resp->event_unique_id);
+2
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
··· 1556 1556 struct iwl_rx_cmd_buffer *rxb); 1557 1557 void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi, 1558 1558 struct iwl_rx_cmd_buffer *rxb, int queue); 1559 + void iwl_mvm_rx_monitor_ndp(struct iwl_mvm *mvm, struct napi_struct *napi, 1560 + struct iwl_rx_cmd_buffer *rxb, int queue); 1559 1561 void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, 1560 1562 struct iwl_rx_cmd_buffer *rxb, int queue); 1561 1563 int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask,
+2
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
··· 1073 1073 iwl_mvm_rx_queue_notif(mvm, rxb, 0); 1074 1074 else if (cmd == WIDE_ID(LEGACY_GROUP, FRAME_RELEASE)) 1075 1075 iwl_mvm_rx_frame_release(mvm, napi, rxb, 0); 1076 + else if (cmd == WIDE_ID(DATA_PATH_GROUP, RX_NO_DATA_NOTIF)) 1077 + iwl_mvm_rx_monitor_ndp(mvm, napi, rxb, 0); 1076 1078 else 1077 1079 iwl_mvm_rx_common(mvm, rxb, pkt); 1078 1080 }
+15 -18
drivers/net/wireless/intel/iwlwifi/mvm/rx.c
··· 593 593 int hyst = vif->bss_conf.cqm_rssi_hyst; 594 594 u16 id = le32_to_cpu(data->mac_id); 595 595 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 596 + u16 vif_id = mvmvif->id; 596 597 597 598 /* This doesn't need the MAC ID check since it's not taking the 598 599 * data copied into the "data" struct, but rather the data from 599 600 * the notification directly. 600 601 */ 601 - if (data->general) { 602 - u16 vif_id = mvmvif->id; 602 + if (iwl_mvm_is_cdb_supported(mvm)) { 603 + struct mvm_statistics_general_cdb *general = 604 + data->general; 603 605 604 - if (iwl_mvm_is_cdb_supported(mvm)) { 605 - struct mvm_statistics_general_cdb *general = 606 - data->general; 606 + mvmvif->beacon_stats.num_beacons = 607 + le32_to_cpu(general->beacon_counter[vif_id]); 608 + mvmvif->beacon_stats.avg_signal = 609 + -general->beacon_average_energy[vif_id]; 610 + } else { 611 + struct mvm_statistics_general_v8 *general = 612 + data->general; 607 613 608 - mvmvif->beacon_stats.num_beacons = 609 - le32_to_cpu(general->beacon_counter[vif_id]); 610 - mvmvif->beacon_stats.avg_signal = 611 - -general->beacon_average_energy[vif_id]; 612 - } else { 613 - struct mvm_statistics_general_v8 *general = 614 - data->general; 615 - 616 - mvmvif->beacon_stats.num_beacons = 617 - le32_to_cpu(general->beacon_counter[vif_id]); 618 - mvmvif->beacon_stats.avg_signal = 619 - -general->beacon_average_energy[vif_id]; 620 - } 614 + mvmvif->beacon_stats.num_beacons = 615 + le32_to_cpu(general->beacon_counter[vif_id]); 616 + mvmvif->beacon_stats.avg_signal = 617 + -general->beacon_average_energy[vif_id]; 621 618 } 622 619 623 620 if (mvmvif->id != id)
+333 -193
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
··· 200 200 { 201 201 struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); 202 202 203 - if (iwl_mvm_check_pn(mvm, skb, queue, sta)) { 203 + if (!(rx_status->flag & RX_FLAG_NO_PSDU) && 204 + iwl_mvm_check_pn(mvm, skb, queue, sta)) { 204 205 kfree_skb(skb); 205 206 } else { 206 207 unsigned int radiotap_len = 0; ··· 864 863 ether_addr_copy(addr, mac_addr); 865 864 } 866 865 867 - static void iwl_mvm_decode_he_sigb(struct iwl_mvm *mvm, 868 - struct iwl_rx_mpdu_desc *desc, 869 - u32 rate_n_flags, 870 - struct ieee80211_radiotap_he_mu *he_mu) 866 + struct iwl_mvm_rx_phy_data { 867 + enum iwl_rx_phy_info_type info_type; 868 + __le32 d0, d1, d2, d3; 869 + __le16 d4; 870 + }; 871 + 872 + static void iwl_mvm_decode_he_mu_ext(struct iwl_mvm *mvm, 873 + struct iwl_mvm_rx_phy_data *phy_data, 874 + u32 rate_n_flags, 875 + struct ieee80211_radiotap_he_mu *he_mu) 871 876 { 872 - u32 sigb0, sigb1; 873 - u16 sigb2; 877 + u32 phy_data2 = le32_to_cpu(phy_data->d2); 878 + u32 phy_data3 = le32_to_cpu(phy_data->d3); 879 + u16 phy_data4 = le16_to_cpu(phy_data->d4); 874 880 875 - if (mvm->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) { 876 - sigb0 = le32_to_cpu(desc->v3.sigb_common0); 877 - sigb1 = le32_to_cpu(desc->v3.sigb_common1); 878 - } else { 879 - sigb0 = le32_to_cpu(desc->v1.sigb_common0); 880 - sigb1 = le32_to_cpu(desc->v1.sigb_common1); 881 - } 882 - 883 - sigb2 = le16_to_cpu(desc->sigb_common2); 884 - 885 - if (FIELD_GET(IWL_RX_HE_SIGB_COMMON2_CH1_CRC_OK, sigb2)) { 881 + if (FIELD_GET(IWL_RX_PHY_DATA4_HE_MU_EXT_CH1_CRC_OK, phy_data4)) { 886 882 he_mu->flags1 |= 887 883 cpu_to_le16(IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_RU_KNOWN | 888 884 IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU_KNOWN); 889 885 890 886 he_mu->flags1 |= 891 - le16_encode_bits(FIELD_GET(IWL_RX_HE_SIGB_COMMON2_CH1_CTR_RU, 892 - sigb2), 887 + le16_encode_bits(FIELD_GET(IWL_RX_PHY_DATA4_HE_MU_EXT_CH1_CTR_RU, 888 + phy_data4), 893 889 IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH1_CTR_26T_RU); 894 890 895 - he_mu->ru_ch1[0] = FIELD_GET(IWL_RX_HE_SIGB_COMMON0_CH1_RU0, 896 - sigb0); 897 - he_mu->ru_ch1[1] = FIELD_GET(IWL_RX_HE_SIGB_COMMON1_CH1_RU1, 898 - sigb1); 899 - he_mu->ru_ch1[2] = FIELD_GET(IWL_RX_HE_SIGB_COMMON0_CH1_RU2, 900 - sigb0); 901 - he_mu->ru_ch1[3] = FIELD_GET(IWL_RX_HE_SIGB_COMMON1_CH1_RU3, 902 - sigb1); 891 + he_mu->ru_ch1[0] = FIELD_GET(IWL_RX_PHY_DATA2_HE_MU_EXT_CH1_RU0, 892 + phy_data2); 893 + he_mu->ru_ch1[1] = FIELD_GET(IWL_RX_PHY_DATA3_HE_MU_EXT_CH1_RU1, 894 + phy_data3); 895 + he_mu->ru_ch1[2] = FIELD_GET(IWL_RX_PHY_DATA2_HE_MU_EXT_CH1_RU2, 896 + phy_data2); 897 + he_mu->ru_ch1[3] = FIELD_GET(IWL_RX_PHY_DATA3_HE_MU_EXT_CH1_RU3, 898 + phy_data3); 903 899 } 904 900 905 - if (FIELD_GET(IWL_RX_HE_SIGB_COMMON2_CH2_CRC_OK, sigb2) && 901 + if (FIELD_GET(IWL_RX_PHY_DATA4_HE_MU_EXT_CH2_CRC_OK, phy_data4) && 906 902 (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) != RATE_MCS_CHAN_WIDTH_20) { 907 903 he_mu->flags1 |= 908 904 cpu_to_le16(IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_RU_KNOWN | 909 905 IEEE80211_RADIOTAP_HE_MU_FLAGS1_CH2_CTR_26T_RU_KNOWN); 910 906 911 907 he_mu->flags2 |= 912 - le16_encode_bits(FIELD_GET(IWL_RX_HE_SIGB_COMMON2_CH2_CTR_RU, 913 - sigb2), 908 + le16_encode_bits(FIELD_GET(IWL_RX_PHY_DATA4_HE_MU_EXT_CH2_CTR_RU, 909 + phy_data4), 914 910 IEEE80211_RADIOTAP_HE_MU_FLAGS2_CH2_CTR_26T_RU); 915 911 916 - he_mu->ru_ch2[0] = FIELD_GET(IWL_RX_HE_SIGB_COMMON0_CH2_RU0, 917 - sigb0); 918 - he_mu->ru_ch2[1] = FIELD_GET(IWL_RX_HE_SIGB_COMMON1_CH2_RU1, 919 - sigb1); 920 - he_mu->ru_ch2[2] = FIELD_GET(IWL_RX_HE_SIGB_COMMON0_CH2_RU2, 921 - sigb0); 922 - he_mu->ru_ch2[3] = FIELD_GET(IWL_RX_HE_SIGB_COMMON1_CH2_RU3, 923 - sigb1); 912 + he_mu->ru_ch2[0] = FIELD_GET(IWL_RX_PHY_DATA2_HE_MU_EXT_CH2_RU0, 913 + phy_data2); 914 + he_mu->ru_ch2[1] = FIELD_GET(IWL_RX_PHY_DATA3_HE_MU_EXT_CH2_RU1, 915 + phy_data3); 916 + he_mu->ru_ch2[2] = FIELD_GET(IWL_RX_PHY_DATA2_HE_MU_EXT_CH2_RU2, 917 + phy_data2); 918 + he_mu->ru_ch2[3] = FIELD_GET(IWL_RX_PHY_DATA3_HE_MU_EXT_CH2_RU3, 919 + phy_data3); 924 920 } 925 921 } 926 922 927 923 static void 928 - iwl_mvm_decode_he_phy_ru_alloc(u64 he_phy_data, u32 rate_n_flags, 924 + iwl_mvm_decode_he_phy_ru_alloc(struct iwl_mvm_rx_phy_data *phy_data, 925 + u32 rate_n_flags, 929 926 struct ieee80211_radiotap_he *he, 930 927 struct ieee80211_radiotap_he_mu *he_mu, 931 928 struct ieee80211_rx_status *rx_status) ··· 936 937 * happen though as management frames where we need 937 938 * the TSF/timers are not be transmitted in HE-MU. 938 939 */ 939 - u8 ru = FIELD_GET(IWL_RX_HE_PHY_RU_ALLOC_MASK, he_phy_data); 940 + u8 ru = le32_get_bits(phy_data->d1, IWL_RX_PHY_DATA1_HE_RU_ALLOC_MASK); 940 941 u8 offs = 0; 941 942 942 943 rx_status->bw = RATE_INFO_BW_HE_RU; ··· 975 976 IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET); 976 977 he->data2 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_KNOWN | 977 978 IEEE80211_RADIOTAP_HE_DATA2_RU_OFFSET_KNOWN); 978 - if (he_phy_data & IWL_RX_HE_PHY_RU_ALLOC_SEC80) 979 + if (phy_data->d1 & cpu_to_le32(IWL_RX_PHY_DATA1_HE_RU_ALLOC_SEC80)) 979 980 he->data2 |= 980 981 cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRISEC_80_SEC); 981 982 ··· 995 996 } 996 997 997 998 static void iwl_mvm_decode_he_phy_data(struct iwl_mvm *mvm, 998 - struct iwl_rx_mpdu_desc *desc, 999 + struct iwl_mvm_rx_phy_data *phy_data, 999 1000 struct ieee80211_radiotap_he *he, 1000 1001 struct ieee80211_radiotap_he_mu *he_mu, 1001 1002 struct ieee80211_rx_status *rx_status, 1002 - u64 he_phy_data, u32 rate_n_flags, 1003 - int queue) 1003 + u32 rate_n_flags, int queue) 1004 1004 { 1005 - u32 he_type = rate_n_flags & RATE_MCS_HE_TYPE_MSK; 1006 - bool sigb_data; 1007 - u16 d1known = IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN | 1008 - IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN | 1009 - IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN | 1010 - IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN | 1011 - IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN; 1012 - u16 d2known = IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN | 1013 - IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN | 1014 - IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN; 1015 - 1016 - he->data1 |= cpu_to_le16(d1known); 1017 - he->data2 |= cpu_to_le16(d2known); 1018 - he->data3 |= le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_BSS_COLOR_MASK, 1019 - he_phy_data), 1020 - IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR); 1021 - he->data3 |= le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_UPLINK, 1022 - he_phy_data), 1023 - IEEE80211_RADIOTAP_HE_DATA3_UL_DL); 1024 - he->data3 |= le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_LDPC_EXT_SYM, 1025 - he_phy_data), 1026 - IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG); 1027 - he->data4 |= le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_SPATIAL_REUSE_MASK, 1028 - he_phy_data), 1029 - IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE); 1030 - he->data5 |= le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_PRE_FEC_PAD_MASK, 1031 - he_phy_data), 1032 - IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD); 1033 - he->data5 |= le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_PE_DISAMBIG, 1034 - he_phy_data), 1035 - IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG); 1036 - he->data6 |= le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_TXOP_DUR_MASK, 1037 - he_phy_data), 1038 - IEEE80211_RADIOTAP_HE_DATA6_TXOP); 1039 - he->data6 |= le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_DOPPLER, 1040 - he_phy_data), 1041 - IEEE80211_RADIOTAP_HE_DATA6_DOPPLER); 1042 - 1043 - switch (he_type) { 1044 - case RATE_MCS_HE_TYPE_MU: 1045 - he_mu->flags1 |= 1046 - le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_MU_SIGB_DCM, 1047 - he_phy_data), 1048 - IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM); 1049 - he_mu->flags1 |= 1050 - le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_MU_SIGB_MCS_MASK, 1051 - he_phy_data), 1052 - IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS); 1053 - he_mu->flags2 |= 1054 - le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_MU_SIBG_SYM_OR_USER_NUM_MASK, 1055 - he_phy_data), 1056 - IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_SYMS_USERS); 1057 - he_mu->flags2 |= 1058 - le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_MU_SIGB_COMPRESSION, 1059 - he_phy_data), 1060 - IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_COMP); 1061 - he_mu->flags2 |= 1062 - le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_MU_PREAMBLE_PUNC_TYPE_MASK, 1063 - he_phy_data), 1064 - IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW); 1065 - 1066 - sigb_data = FIELD_GET(IWL_RX_HE_PHY_INFO_TYPE_MASK, 1067 - he_phy_data) == 1068 - IWL_RX_HE_PHY_INFO_TYPE_MU_EXT_INFO; 1069 - if (sigb_data) 1070 - iwl_mvm_decode_he_sigb(mvm, desc, rate_n_flags, he_mu); 1005 + switch (phy_data->info_type) { 1006 + case IWL_RX_PHY_INFO_TYPE_NONE: 1007 + case IWL_RX_PHY_INFO_TYPE_CCK: 1008 + case IWL_RX_PHY_INFO_TYPE_OFDM_LGCY: 1009 + case IWL_RX_PHY_INFO_TYPE_HT: 1010 + case IWL_RX_PHY_INFO_TYPE_VHT_SU: 1011 + case IWL_RX_PHY_INFO_TYPE_VHT_MU: 1012 + return; 1013 + case IWL_RX_PHY_INFO_TYPE_HE_TB_EXT: 1014 + he->data1 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN | 1015 + IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE2_KNOWN | 1016 + IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE3_KNOWN | 1017 + IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE4_KNOWN); 1018 + he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1019 + IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE1), 1020 + IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE1); 1021 + he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1022 + IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE2), 1023 + IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE2); 1024 + he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1025 + IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE3), 1026 + IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE3); 1027 + he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1028 + IWL_RX_PHY_DATA2_HE_TB_EXT_SPTL_REUSE4), 1029 + IEEE80211_RADIOTAP_HE_DATA4_TB_SPTL_REUSE4); 1071 1030 /* fall through */ 1072 - case RATE_MCS_HE_TYPE_TRIG: 1073 - he->data2 |= 1074 - cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN); 1075 - he->data5 |= 1076 - le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_HE_LTF_NUM_MASK, 1077 - he_phy_data), 1078 - IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS); 1079 - break; 1080 - case RATE_MCS_HE_TYPE_SU: 1081 - case RATE_MCS_HE_TYPE_EXT_SU: 1082 - he->data1 |= 1083 - cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_BEAM_CHANGE_KNOWN); 1084 - he->data3 |= 1085 - le16_encode_bits(FIELD_GET(IWL_RX_HE_PHY_BEAM_CHNG, 1086 - he_phy_data), 1087 - IEEE80211_RADIOTAP_HE_DATA3_BEAM_CHANGE); 1031 + case IWL_RX_PHY_INFO_TYPE_HE_SU: 1032 + case IWL_RX_PHY_INFO_TYPE_HE_MU: 1033 + case IWL_RX_PHY_INFO_TYPE_HE_MU_EXT: 1034 + case IWL_RX_PHY_INFO_TYPE_HE_TB: 1035 + /* HE common */ 1036 + he->data1 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_LDPC_XSYMSEG_KNOWN | 1037 + IEEE80211_RADIOTAP_HE_DATA1_SPTL_REUSE_KNOWN | 1038 + IEEE80211_RADIOTAP_HE_DATA1_DOPPLER_KNOWN | 1039 + IEEE80211_RADIOTAP_HE_DATA1_BSS_COLOR_KNOWN); 1040 + he->data2 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_PRE_FEC_PAD_KNOWN | 1041 + IEEE80211_RADIOTAP_HE_DATA2_PE_DISAMBIG_KNOWN | 1042 + IEEE80211_RADIOTAP_HE_DATA2_TXOP_KNOWN | 1043 + IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN); 1044 + he->data3 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1045 + IWL_RX_PHY_DATA0_HE_BSS_COLOR_MASK), 1046 + IEEE80211_RADIOTAP_HE_DATA3_BSS_COLOR); 1047 + if (phy_data->info_type != IWL_RX_PHY_INFO_TYPE_HE_TB && 1048 + phy_data->info_type != IWL_RX_PHY_INFO_TYPE_HE_TB_EXT) { 1049 + he->data1 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_UL_DL_KNOWN); 1050 + he->data3 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1051 + IWL_RX_PHY_DATA0_HE_UPLINK), 1052 + IEEE80211_RADIOTAP_HE_DATA3_UL_DL); 1053 + } 1054 + he->data3 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1055 + IWL_RX_PHY_DATA0_HE_LDPC_EXT_SYM), 1056 + IEEE80211_RADIOTAP_HE_DATA3_LDPC_XSYMSEG); 1057 + he->data4 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1058 + IWL_RX_PHY_DATA0_HE_SPATIAL_REUSE_MASK), 1059 + IEEE80211_RADIOTAP_HE_DATA4_SU_MU_SPTL_REUSE); 1060 + he->data5 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1061 + IWL_RX_PHY_DATA0_HE_PRE_FEC_PAD_MASK), 1062 + IEEE80211_RADIOTAP_HE_DATA5_PRE_FEC_PAD); 1063 + he->data5 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1064 + IWL_RX_PHY_DATA0_HE_PE_DISAMBIG), 1065 + IEEE80211_RADIOTAP_HE_DATA5_PE_DISAMBIG); 1066 + he->data5 |= le16_encode_bits(le32_get_bits(phy_data->d1, 1067 + IWL_RX_PHY_DATA1_HE_LTF_NUM_MASK), 1068 + IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS); 1069 + he->data6 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1070 + IWL_RX_PHY_DATA0_HE_TXOP_DUR_MASK), 1071 + IEEE80211_RADIOTAP_HE_DATA6_TXOP); 1072 + he->data6 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1073 + IWL_RX_PHY_DATA0_HE_DOPPLER), 1074 + IEEE80211_RADIOTAP_HE_DATA6_DOPPLER); 1088 1075 break; 1089 1076 } 1090 1077 1091 - switch (FIELD_GET(IWL_RX_HE_PHY_INFO_TYPE_MASK, he_phy_data)) { 1092 - case IWL_RX_HE_PHY_INFO_TYPE_MU: 1093 - case IWL_RX_HE_PHY_INFO_TYPE_MU_EXT_INFO: 1094 - case IWL_RX_HE_PHY_INFO_TYPE_TB: 1095 - iwl_mvm_decode_he_phy_ru_alloc(he_phy_data, rate_n_flags, 1078 + switch (phy_data->info_type) { 1079 + case IWL_RX_PHY_INFO_TYPE_HE_MU_EXT: 1080 + he_mu->flags1 |= 1081 + le16_encode_bits(le16_get_bits(phy_data->d4, 1082 + IWL_RX_PHY_DATA4_HE_MU_EXT_SIGB_DCM), 1083 + IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_DCM); 1084 + he_mu->flags1 |= 1085 + le16_encode_bits(le16_get_bits(phy_data->d4, 1086 + IWL_RX_PHY_DATA4_HE_MU_EXT_SIGB_MCS_MASK), 1087 + IEEE80211_RADIOTAP_HE_MU_FLAGS1_SIG_B_MCS); 1088 + he_mu->flags2 |= 1089 + le16_encode_bits(le16_get_bits(phy_data->d4, 1090 + IWL_RX_PHY_DATA4_HE_MU_EXT_PREAMBLE_PUNC_TYPE_MASK), 1091 + IEEE80211_RADIOTAP_HE_MU_FLAGS2_PUNC_FROM_SIG_A_BW); 1092 + iwl_mvm_decode_he_mu_ext(mvm, phy_data, rate_n_flags, he_mu); 1093 + /* fall through */ 1094 + case IWL_RX_PHY_INFO_TYPE_HE_MU: 1095 + he_mu->flags2 |= 1096 + le16_encode_bits(le32_get_bits(phy_data->d1, 1097 + IWL_RX_PHY_DATA1_HE_MU_SIBG_SYM_OR_USER_NUM_MASK), 1098 + IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_SYMS_USERS); 1099 + he_mu->flags2 |= 1100 + le16_encode_bits(le32_get_bits(phy_data->d1, 1101 + IWL_RX_PHY_DATA1_HE_MU_SIGB_COMPRESSION), 1102 + IEEE80211_RADIOTAP_HE_MU_FLAGS2_SIG_B_COMP); 1103 + /* fall through */ 1104 + case IWL_RX_PHY_INFO_TYPE_HE_TB: 1105 + case IWL_RX_PHY_INFO_TYPE_HE_TB_EXT: 1106 + iwl_mvm_decode_he_phy_ru_alloc(phy_data, rate_n_flags, 1096 1107 he, he_mu, rx_status); 1108 + break; 1109 + case IWL_RX_PHY_INFO_TYPE_HE_SU: 1110 + he->data1 |= cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_BEAM_CHANGE_KNOWN); 1111 + he->data3 |= le16_encode_bits(le32_get_bits(phy_data->d0, 1112 + IWL_RX_PHY_DATA0_HE_BEAM_CHNG), 1113 + IEEE80211_RADIOTAP_HE_DATA3_BEAM_CHANGE); 1097 1114 break; 1098 1115 default: 1099 1116 /* nothing */ ··· 1118 1103 } 1119 1104 1120 1105 static void iwl_mvm_rx_he(struct iwl_mvm *mvm, struct sk_buff *skb, 1121 - struct iwl_rx_mpdu_desc *desc, 1106 + struct iwl_mvm_rx_phy_data *phy_data, 1122 1107 u32 rate_n_flags, u16 phy_info, int queue) 1123 1108 { 1124 1109 struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); 1125 - /* this is invalid e.g. because puncture type doesn't allow 0b11 */ 1126 - #define HE_PHY_DATA_INVAL ((u64)-1) 1127 - u64 he_phy_data = HE_PHY_DATA_INVAL; 1128 1110 struct ieee80211_radiotap_he *he = NULL; 1129 1111 struct ieee80211_radiotap_he_mu *he_mu = NULL; 1130 1112 u32 he_type = rate_n_flags & RATE_MCS_HE_TYPE_MSK; ··· 1148 1136 radiotap_len += sizeof(known); 1149 1137 rx_status->flag |= RX_FLAG_RADIOTAP_HE; 1150 1138 1151 - if (phy_info & IWL_RX_MPDU_PHY_TSF_OVERLOAD) { 1152 - if (mvm->trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) 1153 - he_phy_data = le64_to_cpu(desc->v3.he_phy_data); 1154 - else 1155 - he_phy_data = le64_to_cpu(desc->v1.he_phy_data); 1156 - 1157 - if (he_type == RATE_MCS_HE_TYPE_MU) { 1158 - he_mu = skb_put_data(skb, &mu_known, sizeof(mu_known)); 1159 - radiotap_len += sizeof(mu_known); 1160 - rx_status->flag |= RX_FLAG_RADIOTAP_HE_MU; 1161 - } 1139 + if (phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_MU || 1140 + phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_MU_EXT) { 1141 + he_mu = skb_put_data(skb, &mu_known, sizeof(mu_known)); 1142 + radiotap_len += sizeof(mu_known); 1143 + rx_status->flag |= RX_FLAG_RADIOTAP_HE_MU; 1162 1144 } 1163 1145 1164 1146 /* temporarily hide the radiotap data */ 1165 1147 __skb_pull(skb, radiotap_len); 1166 1148 1167 - if (he_phy_data != HE_PHY_DATA_INVAL && 1168 - he_type == RATE_MCS_HE_TYPE_SU) { 1149 + if (phy_data->info_type == IWL_RX_PHY_INFO_TYPE_HE_SU) { 1169 1150 /* report the AMPDU-EOF bit on single frames */ 1170 1151 if (!queue && !(phy_info & IWL_RX_MPDU_PHY_AMPDU)) { 1171 1152 rx_status->flag |= RX_FLAG_AMPDU_DETAILS; 1172 1153 rx_status->flag |= RX_FLAG_AMPDU_EOF_BIT_KNOWN; 1173 - if (FIELD_GET(IWL_RX_HE_PHY_DELIM_EOF, he_phy_data)) 1154 + if (phy_data->d0 & cpu_to_le32(IWL_RX_PHY_DATA0_HE_DELIM_EOF)) 1174 1155 rx_status->flag |= RX_FLAG_AMPDU_EOF_BIT; 1175 1156 } 1176 1157 } 1177 1158 1178 - if (he_phy_data != HE_PHY_DATA_INVAL) 1179 - iwl_mvm_decode_he_phy_data(mvm, desc, he, he_mu, rx_status, 1180 - he_phy_data, rate_n_flags, queue); 1159 + if (phy_info & IWL_RX_MPDU_PHY_TSF_OVERLOAD) 1160 + iwl_mvm_decode_he_phy_data(mvm, phy_data, he, he_mu, rx_status, 1161 + rate_n_flags, queue); 1181 1162 1182 1163 /* update aggregation data for monitor sake on default queue */ 1183 - if (!queue && (phy_info & IWL_RX_MPDU_PHY_AMPDU)) { 1164 + if (!queue && (phy_info & IWL_RX_MPDU_PHY_TSF_OVERLOAD) && 1165 + (phy_info & IWL_RX_MPDU_PHY_AMPDU)) { 1184 1166 bool toggle_bit = phy_info & IWL_RX_MPDU_PHY_AMPDU_TOGGLE; 1185 1167 1186 1168 /* toggle is switched whenever new aggregation starts */ 1187 1169 if (toggle_bit != mvm->ampdu_toggle && 1188 - he_phy_data != HE_PHY_DATA_INVAL && 1189 1170 (he_type == RATE_MCS_HE_TYPE_MU || 1190 1171 he_type == RATE_MCS_HE_TYPE_SU)) { 1191 1172 rx_status->flag |= RX_FLAG_AMPDU_EOF_BIT_KNOWN; 1192 - if (FIELD_GET(IWL_RX_HE_PHY_DELIM_EOF, 1193 - he_phy_data)) 1173 + if (phy_data->d0 & cpu_to_le32(IWL_RX_PHY_DATA0_HE_DELIM_EOF)) 1194 1174 rx_status->flag |= RX_FLAG_AMPDU_EOF_BIT; 1195 1175 } 1196 1176 } ··· 1265 1261 break; 1266 1262 } 1267 1263 1268 - he->data5 |= le16_encode_bits(ltf, IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE); 1264 + he->data5 |= le16_encode_bits(ltf, 1265 + IEEE80211_RADIOTAP_HE_DATA5_LTF_SIZE); 1266 + } 1269 1267 1270 - if (he_type == RATE_MCS_HE_TYPE_SU || 1271 - he_type == RATE_MCS_HE_TYPE_EXT_SU) { 1272 - u16 val; 1268 + static void iwl_mvm_decode_lsig(struct sk_buff *skb, 1269 + struct iwl_mvm_rx_phy_data *phy_data) 1270 + { 1271 + struct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb); 1272 + struct ieee80211_radiotap_lsig *lsig; 1273 1273 1274 - /* LTF syms correspond to streams */ 1275 - he->data2 |= 1276 - cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_NUM_LTF_SYMS_KNOWN); 1277 - switch (rx_status->nss) { 1278 - case 1: 1279 - val = 0; 1280 - break; 1281 - case 2: 1282 - val = 1; 1283 - break; 1284 - case 3: 1285 - case 4: 1286 - val = 2; 1287 - break; 1288 - case 5: 1289 - case 6: 1290 - val = 3; 1291 - break; 1292 - case 7: 1293 - case 8: 1294 - val = 4; 1295 - break; 1296 - default: 1297 - WARN_ONCE(1, "invalid nss: %d\n", 1298 - rx_status->nss); 1299 - val = 0; 1300 - } 1301 - 1302 - he->data5 |= 1303 - le16_encode_bits(val, 1304 - IEEE80211_RADIOTAP_HE_DATA5_NUM_LTF_SYMS); 1274 + switch (phy_data->info_type) { 1275 + case IWL_RX_PHY_INFO_TYPE_HT: 1276 + case IWL_RX_PHY_INFO_TYPE_VHT_SU: 1277 + case IWL_RX_PHY_INFO_TYPE_VHT_MU: 1278 + case IWL_RX_PHY_INFO_TYPE_HE_TB_EXT: 1279 + case IWL_RX_PHY_INFO_TYPE_HE_SU: 1280 + case IWL_RX_PHY_INFO_TYPE_HE_MU: 1281 + case IWL_RX_PHY_INFO_TYPE_HE_MU_EXT: 1282 + case IWL_RX_PHY_INFO_TYPE_HE_TB: 1283 + lsig = skb_put(skb, sizeof(*lsig)); 1284 + lsig->data1 = cpu_to_le16(IEEE80211_RADIOTAP_LSIG_DATA1_LENGTH_KNOWN); 1285 + lsig->data2 = le16_encode_bits(le32_get_bits(phy_data->d1, 1286 + IWL_RX_PHY_DATA1_LSIG_LEN_MASK), 1287 + IEEE80211_RADIOTAP_LSIG_DATA2_LENGTH); 1288 + rx_status->flag |= RX_FLAG_RADIOTAP_LSIG; 1289 + break; 1290 + default: 1291 + break; 1305 1292 } 1306 1293 } 1307 1294 ··· 1310 1315 struct sk_buff *skb; 1311 1316 u8 crypt_len = 0, channel, energy_a, energy_b; 1312 1317 size_t desc_size; 1318 + struct iwl_mvm_rx_phy_data phy_data = { 1319 + .d4 = desc->phy_data4, 1320 + .info_type = IWL_RX_PHY_INFO_TYPE_NONE, 1321 + }; 1313 1322 1314 1323 if (unlikely(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))) 1315 1324 return; ··· 1325 1326 energy_a = desc->v3.energy_a; 1326 1327 energy_b = desc->v3.energy_b; 1327 1328 desc_size = sizeof(*desc); 1329 + 1330 + phy_data.d0 = desc->v3.phy_data0; 1331 + phy_data.d1 = desc->v3.phy_data1; 1332 + phy_data.d2 = desc->v3.phy_data2; 1333 + phy_data.d3 = desc->v3.phy_data3; 1328 1334 } else { 1329 1335 rate_n_flags = le32_to_cpu(desc->v1.rate_n_flags); 1330 1336 channel = desc->v1.channel; ··· 1337 1333 energy_a = desc->v1.energy_a; 1338 1334 energy_b = desc->v1.energy_b; 1339 1335 desc_size = IWL_RX_DESC_SIZE_V1; 1336 + 1337 + phy_data.d0 = desc->v1.phy_data0; 1338 + phy_data.d1 = desc->v1.phy_data1; 1339 + phy_data.d2 = desc->v1.phy_data2; 1340 + phy_data.d3 = desc->v1.phy_data3; 1340 1341 } 1342 + 1343 + if (phy_info & IWL_RX_MPDU_PHY_TSF_OVERLOAD) 1344 + phy_data.info_type = 1345 + le32_get_bits(phy_data.d1, 1346 + IWL_RX_PHY_DATA1_INFO_TYPE_MASK); 1341 1347 1342 1348 hdr = (void *)(pkt->data + desc_size); 1343 1349 /* Dont use dev_alloc_skb(), we'll have enough headroom once ··· 1387 1373 } 1388 1374 1389 1375 if (rate_n_flags & RATE_MCS_HE_MSK) 1390 - iwl_mvm_rx_he(mvm, skb, desc, rate_n_flags, phy_info, queue); 1376 + iwl_mvm_rx_he(mvm, skb, &phy_data, rate_n_flags, 1377 + phy_info, queue); 1378 + 1379 + iwl_mvm_decode_lsig(skb, &phy_data); 1391 1380 1392 1381 rx_status = IEEE80211_SKB_RXCB(skb); 1393 1382 ··· 1607 1590 rcu_read_unlock(); 1608 1591 } 1609 1592 1593 + void iwl_mvm_rx_monitor_ndp(struct iwl_mvm *mvm, struct napi_struct *napi, 1594 + struct iwl_rx_cmd_buffer *rxb, int queue) 1595 + { 1596 + struct ieee80211_rx_status *rx_status; 1597 + struct iwl_rx_packet *pkt = rxb_addr(rxb); 1598 + struct iwl_rx_no_data *desc = (void *)pkt->data; 1599 + u32 rate_n_flags = le32_to_cpu(desc->rate); 1600 + u32 gp2_on_air_rise = le32_to_cpu(desc->on_air_rise_time); 1601 + u32 rssi = le32_to_cpu(desc->rssi); 1602 + u32 info_type = le32_to_cpu(desc->info) & RX_NO_DATA_INFO_TYPE_MSK; 1603 + u16 phy_info = IWL_RX_MPDU_PHY_TSF_OVERLOAD; 1604 + struct ieee80211_sta *sta = NULL; 1605 + struct sk_buff *skb; 1606 + u8 channel, energy_a, energy_b; 1607 + struct iwl_mvm_rx_phy_data phy_data = { 1608 + .d0 = desc->phy_info[0], 1609 + .info_type = IWL_RX_PHY_INFO_TYPE_NONE, 1610 + }; 1611 + 1612 + if (unlikely(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))) 1613 + return; 1614 + 1615 + /* Currently only NDP type is supported */ 1616 + if (info_type != RX_NO_DATA_INFO_TYPE_NDP) 1617 + return; 1618 + 1619 + energy_a = (rssi & RX_NO_DATA_CHAIN_A_MSK) >> RX_NO_DATA_CHAIN_A_POS; 1620 + energy_b = (rssi & RX_NO_DATA_CHAIN_B_MSK) >> RX_NO_DATA_CHAIN_B_POS; 1621 + channel = (rssi & RX_NO_DATA_CHANNEL_MSK) >> RX_NO_DATA_CHANNEL_POS; 1622 + 1623 + phy_data.info_type = 1624 + le32_get_bits(desc->phy_info[1], 1625 + IWL_RX_PHY_DATA1_INFO_TYPE_MASK); 1626 + 1627 + /* Dont use dev_alloc_skb(), we'll have enough headroom once 1628 + * ieee80211_hdr pulled. 1629 + */ 1630 + skb = alloc_skb(128, GFP_ATOMIC); 1631 + if (!skb) { 1632 + IWL_ERR(mvm, "alloc_skb failed\n"); 1633 + return; 1634 + } 1635 + 1636 + rx_status = IEEE80211_SKB_RXCB(skb); 1637 + 1638 + /* 0-length PSDU */ 1639 + rx_status->flag |= RX_FLAG_NO_PSDU; 1640 + /* currently this is the only type for which we get this notif */ 1641 + rx_status->zero_length_psdu_type = 1642 + IEEE80211_RADIOTAP_ZERO_LEN_PSDU_SOUNDING; 1643 + 1644 + /* This may be overridden by iwl_mvm_rx_he() to HE_RU */ 1645 + switch (rate_n_flags & RATE_MCS_CHAN_WIDTH_MSK) { 1646 + case RATE_MCS_CHAN_WIDTH_20: 1647 + break; 1648 + case RATE_MCS_CHAN_WIDTH_40: 1649 + rx_status->bw = RATE_INFO_BW_40; 1650 + break; 1651 + case RATE_MCS_CHAN_WIDTH_80: 1652 + rx_status->bw = RATE_INFO_BW_80; 1653 + break; 1654 + case RATE_MCS_CHAN_WIDTH_160: 1655 + rx_status->bw = RATE_INFO_BW_160; 1656 + break; 1657 + } 1658 + 1659 + if (rate_n_flags & RATE_MCS_HE_MSK) 1660 + iwl_mvm_rx_he(mvm, skb, &phy_data, rate_n_flags, 1661 + phy_info, queue); 1662 + 1663 + iwl_mvm_decode_lsig(skb, &phy_data); 1664 + 1665 + rx_status->device_timestamp = gp2_on_air_rise; 1666 + rx_status->band = channel > 14 ? NL80211_BAND_5GHZ : 1667 + NL80211_BAND_2GHZ; 1668 + rx_status->freq = ieee80211_channel_to_frequency(channel, 1669 + rx_status->band); 1670 + iwl_mvm_get_signal_strength(mvm, rx_status, rate_n_flags, energy_a, 1671 + energy_b); 1672 + 1673 + rcu_read_lock(); 1674 + 1675 + if (!(rate_n_flags & RATE_MCS_CCK_MSK) && 1676 + rate_n_flags & RATE_MCS_SGI_MSK) 1677 + rx_status->enc_flags |= RX_ENC_FLAG_SHORT_GI; 1678 + if (rate_n_flags & RATE_HT_MCS_GF_MSK) 1679 + rx_status->enc_flags |= RX_ENC_FLAG_HT_GF; 1680 + if (rate_n_flags & RATE_MCS_LDPC_MSK) 1681 + rx_status->enc_flags |= RX_ENC_FLAG_LDPC; 1682 + if (rate_n_flags & RATE_MCS_HT_MSK) { 1683 + u8 stbc = (rate_n_flags & RATE_MCS_STBC_MSK) >> 1684 + RATE_MCS_STBC_POS; 1685 + rx_status->encoding = RX_ENC_HT; 1686 + rx_status->rate_idx = rate_n_flags & RATE_HT_MCS_INDEX_MSK; 1687 + rx_status->enc_flags |= stbc << RX_ENC_FLAG_STBC_SHIFT; 1688 + } else if (rate_n_flags & RATE_MCS_VHT_MSK) { 1689 + u8 stbc = (rate_n_flags & RATE_MCS_STBC_MSK) >> 1690 + RATE_MCS_STBC_POS; 1691 + rx_status->nss = 1692 + ((rate_n_flags & RATE_VHT_MCS_NSS_MSK) >> 1693 + RATE_VHT_MCS_NSS_POS) + 1; 1694 + rx_status->rate_idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK; 1695 + rx_status->encoding = RX_ENC_VHT; 1696 + rx_status->enc_flags |= stbc << RX_ENC_FLAG_STBC_SHIFT; 1697 + if (rate_n_flags & RATE_MCS_BF_MSK) 1698 + rx_status->enc_flags |= RX_ENC_FLAG_BF; 1699 + } else if (!(rate_n_flags & RATE_MCS_HE_MSK)) { 1700 + int rate = iwl_mvm_legacy_rate_to_mac80211_idx(rate_n_flags, 1701 + rx_status->band); 1702 + 1703 + if (WARN(rate < 0 || rate > 0xFF, 1704 + "Invalid rate flags 0x%x, band %d,\n", 1705 + rate_n_flags, rx_status->band)) { 1706 + kfree_skb(skb); 1707 + goto out; 1708 + } 1709 + rx_status->rate_idx = rate; 1710 + } 1711 + 1712 + iwl_mvm_pass_packet_to_mac80211(mvm, napi, skb, queue, sta); 1713 + out: 1714 + rcu_read_unlock(); 1715 + } 1610 1716 void iwl_mvm_rx_frame_release(struct iwl_mvm *mvm, struct napi_struct *napi, 1611 1717 struct iwl_rx_cmd_buffer *rxb, int queue) 1612 1718 {
+2
drivers/net/wireless/intel/iwlwifi/mvm/scan.c
··· 1893 1893 mvm->last_ebs_successful = false; 1894 1894 1895 1895 mvm->scan_uid_status[uid] = 0; 1896 + 1897 + iwl_fw_dbg_apply_point(&mvm->fwrt, IWL_FW_INI_APPLY_SCAN_COMPLETE); 1896 1898 } 1897 1899 1898 1900 void iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
+4 -6
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 1254 1254 1255 1255 spin_lock_bh(&mvmsta->lock); 1256 1256 tfd_queue_mask = mvmsta->tfd_queue_msk; 1257 + ssn = IEEE80211_SEQ_TO_SN(mvmsta->tid_data[tid].seq_number); 1257 1258 spin_unlock_bh(&mvmsta->lock); 1258 1259 1259 1260 /* ··· 1341 1340 } 1342 1341 } 1343 1342 1344 - ssn = IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)); 1345 1343 inc_ssn = iwl_mvm_enable_txq(mvm, queue, mac_queue, 1346 1344 ssn, &cfg, wdg_timeout); 1347 - if (inc_ssn) { 1348 - ssn = (ssn + 1) & IEEE80211_SCTL_SEQ; 1349 - le16_add_cpu(&hdr->seq_ctrl, 0x10); 1350 - } 1351 1345 1352 1346 /* 1353 1347 * Mark queue as shared in transport if shared ··· 1359 1363 * this ra/tid in our Tx path since we stop the Qdisc when we 1360 1364 * need to allocate a new TFD queue. 1361 1365 */ 1362 - if (inc_ssn) 1366 + if (inc_ssn) { 1363 1367 mvmsta->tid_data[tid].seq_number += 0x10; 1368 + ssn = (ssn + 1) & IEEE80211_SCTL_SEQ; 1369 + } 1364 1370 mvmsta->tid_data[tid].txq_id = queue; 1365 1371 mvmsta->tfd_queue_msk |= BIT(queue); 1366 1372 queue_state = mvmsta->tid_data[tid].state;
+19 -37
drivers/net/wireless/intel/iwlwifi/mvm/tx.c
··· 708 708 int iwl_mvm_tx_skb_non_sta(struct iwl_mvm *mvm, struct sk_buff *skb) 709 709 { 710 710 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 711 - struct ieee80211_tx_info *skb_info = IEEE80211_SKB_CB(skb); 712 711 struct ieee80211_tx_info info; 713 712 struct iwl_device_cmd *dev_cmd; 714 713 u8 sta_id; 715 714 int hdrlen = ieee80211_hdrlen(hdr->frame_control); 716 715 __le16 fc = hdr->frame_control; 717 - int queue; 718 - 719 - /* IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets that can be used 720 - * in 2 different types of vifs, P2P & STATION. P2P uses the offchannel 721 - * queue. STATION (HS2.0) uses the auxiliary context of the FW, 722 - * and hence needs to be sent on the aux queue 723 - */ 724 - if (skb_info->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && 725 - skb_info->control.vif->type == NL80211_IFTYPE_STATION) 726 - skb_info->hw_queue = mvm->aux_queue; 716 + int queue = -1; 727 717 728 718 memcpy(&info, skb->cb, sizeof(info)); 729 719 ··· 725 735 info.hw_queue != info.control.vif->cab_queue))) 726 736 return -1; 727 737 728 - queue = info.hw_queue; 729 - 730 - /* 731 - * If the interface on which the frame is sent is the P2P_DEVICE 732 - * or an AP/GO interface use the broadcast station associated 733 - * with it; otherwise if the interface is a managed interface 734 - * use the AP station associated with it for multicast traffic 735 - * (this is not possible for unicast packets as a TLDS discovery 736 - * response are sent without a station entry); otherwise use the 737 - * AUX station. 738 - */ 739 - sta_id = mvm->aux_sta.sta_id; 740 738 if (info.control.vif) { 741 739 struct iwl_mvm_vif *mvmvif = 742 740 iwl_mvm_vif_from_mac80211(info.control.vif); ··· 739 761 740 762 queue = iwl_mvm_get_ctrl_vif_queue(mvm, &info, 741 763 hdr->frame_control); 742 - if (queue < 0) 743 - return -1; 744 - } else if (info.control.vif->type == NL80211_IFTYPE_STATION && 745 - is_multicast_ether_addr(hdr->addr1)) { 746 - u8 ap_sta_id = READ_ONCE(mvmvif->ap_sta_id); 747 764 748 - if (ap_sta_id != IWL_MVM_INVALID_STA) 749 - sta_id = ap_sta_id; 750 765 } else if (info.control.vif->type == NL80211_IFTYPE_MONITOR) { 751 766 queue = mvm->snif_queue; 752 767 sta_id = mvm->snif_sta.sta_id; 768 + } else if (info.control.vif->type == NL80211_IFTYPE_STATION && 769 + info.hw_queue == IWL_MVM_OFFCHANNEL_QUEUE) { 770 + /* 771 + * IWL_MVM_OFFCHANNEL_QUEUE is used for ROC packets 772 + * that can be used in 2 different types of vifs, P2P & 773 + * STATION. 774 + * P2P uses the offchannel queue. 775 + * STATION (HS2.0) uses the auxiliary context of the FW, 776 + * and hence needs to be sent on the aux queue. 777 + */ 778 + sta_id = mvm->aux_sta.sta_id; 779 + queue = mvm->aux_queue; 753 780 } 754 781 } 782 + 783 + if (queue < 0) 784 + return -1; 755 785 756 786 if (unlikely(ieee80211_is_probe_resp(fc))) 757 787 iwl_mvm_probe_resp_set_noa(mvm, skb); ··· 1464 1478 iwl_mvm_get_agg_status(mvm, tx_resp); 1465 1479 u32 status = le16_to_cpu(agg_status->status); 1466 1480 u16 ssn = iwl_mvm_get_scd_ssn(mvm, tx_resp); 1467 - struct iwl_mvm_sta *mvmsta; 1468 1481 struct sk_buff_head skbs; 1469 1482 u8 skb_freed = 0; 1470 1483 u8 lq_color; ··· 1611 1626 goto out; 1612 1627 1613 1628 if (!IS_ERR(sta)) { 1614 - mvmsta = iwl_mvm_sta_from_mac80211(sta); 1629 + struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 1615 1630 1616 1631 iwl_mvm_tx_airtime(mvm, mvmsta, 1617 1632 le16_to_cpu(tx_resp->wireless_media_time)); ··· 1674 1689 mvmsta->next_status_eosp = false; 1675 1690 ieee80211_sta_eosp(sta); 1676 1691 } 1677 - } else { 1678 - mvmsta = NULL; 1679 1692 } 1680 - 1681 1693 out: 1682 1694 rcu_read_unlock(); 1683 1695 } ··· 1817 1835 return; 1818 1836 } 1819 1837 1820 - spin_lock_bh(&mvmsta->lock); 1821 - 1822 1838 __skb_queue_head_init(&reclaimed_skbs); 1823 1839 1824 1840 /* ··· 1825 1845 * transmitted ... if not, it's too late anyway). 1826 1846 */ 1827 1847 iwl_trans_reclaim(mvm->trans, txq, index, &reclaimed_skbs); 1848 + 1849 + spin_lock_bh(&mvmsta->lock); 1828 1850 1829 1851 tid_data->next_reclaimed = index; 1830 1852
+17
drivers/net/wireless/intel/iwlwifi/mvm/utils.c
··· 540 540 541 541 iwl_trans_read_mem_bytes(trans, base, &table, sizeof(table)); 542 542 543 + if (table.valid) 544 + mvm->fwrt.dump.rt_status = table.error_id; 545 + 543 546 if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) { 544 547 IWL_ERR(trans, "Start IWL Error Log Dump:\n"); 545 548 IWL_ERR(trans, "Status: 0x%08lX, count: %d\n", ··· 1381 1378 void iwl_mvm_resume_tcm(struct iwl_mvm *mvm) 1382 1379 { 1383 1380 int mac; 1381 + bool low_latency = false; 1384 1382 1385 1383 spin_lock_bh(&mvm->tcm.lock); 1386 1384 mvm->tcm.ts = jiffies; ··· 1393 1389 memset(&mdata->tx.pkts, 0, sizeof(mdata->tx.pkts)); 1394 1390 memset(&mdata->rx.airtime, 0, sizeof(mdata->rx.airtime)); 1395 1391 memset(&mdata->tx.airtime, 0, sizeof(mdata->tx.airtime)); 1392 + 1393 + if (mvm->tcm.result.low_latency[mac]) 1394 + low_latency = true; 1396 1395 } 1397 1396 /* The TCM data needs to be reset before "paused" flag changes */ 1398 1397 smp_mb(); 1399 1398 mvm->tcm.paused = false; 1399 + 1400 + /* 1401 + * if the current load is not low or low latency is active, force 1402 + * re-evaluation to cover the case of no traffic. 1403 + */ 1404 + if (mvm->tcm.result.global_load > IWL_MVM_TRAFFIC_LOW) 1405 + schedule_delayed_work(&mvm->tcm.work, MVM_TCM_PERIOD); 1406 + else if (low_latency) 1407 + schedule_delayed_work(&mvm->tcm.work, MVM_LL_PERIOD); 1408 + 1400 1409 spin_unlock_bh(&mvm->tcm.lock); 1401 1410 } 1402 1411
+8 -5
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info-gen3.c
··· 94 94 cpu_to_le64(trans_pcie->rxq->bd_dma); 95 95 96 96 /* Configure debug, for integration */ 97 - iwl_pcie_alloc_fw_monitor(trans, 0); 98 - prph_sc_ctrl->hwm_cfg.hwm_base_addr = 99 - cpu_to_le64(trans->fw_mon[0].physical); 100 - prph_sc_ctrl->hwm_cfg.hwm_size = 101 - cpu_to_le32(trans->fw_mon[0].size); 97 + if (!trans->ini_valid) 98 + iwl_pcie_alloc_fw_monitor(trans, 0); 99 + if (trans->num_blocks) { 100 + prph_sc_ctrl->hwm_cfg.hwm_base_addr = 101 + cpu_to_le64(trans->fw_mon[0].physical); 102 + prph_sc_ctrl->hwm_cfg.hwm_size = 103 + cpu_to_le32(trans->fw_mon[0].size); 104 + } 102 105 103 106 /* allocate ucode sections in dram and set addresses */ 104 107 ret = iwl_pcie_init_fw_sec(trans, fw, &prph_scratch->dram);
+1 -1
drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c
··· 227 227 iwl_enable_interrupts(trans); 228 228 229 229 /* Configure debug, if exists */ 230 - if (trans->dbg_dest_tlv) 230 + if (iwl_pcie_dbg_on(trans)) 231 231 iwl_pcie_apply_destination(trans); 232 232 233 233 /* kick FW self load */
+5
drivers/net/wireless/intel/iwlwifi/pcie/internal.h
··· 1009 1009 __iwl_trans_pcie_set_bits_mask(trans, reg, mask, mask); 1010 1010 } 1011 1011 1012 + static inline bool iwl_pcie_dbg_on(struct iwl_trans *trans) 1013 + { 1014 + return (trans->dbg_dest_tlv || trans->ini_valid); 1015 + } 1016 + 1012 1017 void iwl_trans_pcie_rf_kill(struct iwl_trans *trans, bool state); 1013 1018 void iwl_trans_pcie_dump_regs(struct iwl_trans *trans); 1014 1019
+49 -22
drivers/net/wireless/intel/iwlwifi/pcie/trans.c
··· 924 924 const struct iwl_fw_dbg_dest_tlv_v1 *dest = trans->dbg_dest_tlv; 925 925 int i; 926 926 927 + if (trans->ini_valid) { 928 + if (!trans->num_blocks) 929 + return; 930 + 931 + iwl_write_prph(trans, MON_BUFF_BASE_ADDR_VER2, 932 + trans->fw_mon[0].physical >> 933 + MON_BUFF_SHIFT_VER2); 934 + iwl_write_prph(trans, MON_BUFF_END_ADDR_VER2, 935 + (trans->fw_mon[0].physical + 936 + trans->fw_mon[0].size - 256) >> 937 + MON_BUFF_SHIFT_VER2); 938 + return; 939 + } 940 + 927 941 IWL_INFO(trans, "Applying debug destination %s\n", 928 942 get_fw_dbg_mode_string(dest->monitor_mode)); 929 943 ··· 1040 1026 (trans->fw_mon[0].physical + 1041 1027 trans->fw_mon[0].size) >> 4); 1042 1028 } 1043 - } else if (trans->dbg_dest_tlv) { 1029 + } else if (iwl_pcie_dbg_on(trans)) { 1044 1030 iwl_pcie_apply_destination(trans); 1045 1031 } 1046 1032 ··· 1061 1047 IWL_DEBUG_FW(trans, "working with %s CPU\n", 1062 1048 image->is_dual_cpus ? "Dual" : "Single"); 1063 1049 1064 - if (trans->dbg_dest_tlv) 1050 + if (iwl_pcie_dbg_on(trans)) 1065 1051 iwl_pcie_apply_destination(trans); 1066 1052 1067 1053 IWL_DEBUG_POWER(trans, "Original WFPM value = 0x%08X\n", ··· 3029 3015 return monitor_len; 3030 3016 } 3031 3017 3018 + static void 3019 + iwl_trans_pcie_dump_pointers(struct iwl_trans *trans, 3020 + struct iwl_fw_error_dump_fw_mon *fw_mon_data) 3021 + { 3022 + u32 base, write_ptr, wrap_cnt; 3023 + 3024 + /* If there was a dest TLV - use the values from there */ 3025 + if (trans->ini_valid) { 3026 + base = MON_BUFF_BASE_ADDR_VER2; 3027 + write_ptr = MON_BUFF_WRPTR_VER2; 3028 + wrap_cnt = MON_BUFF_CYCLE_CNT_VER2; 3029 + } else if (trans->dbg_dest_tlv) { 3030 + write_ptr = le32_to_cpu(trans->dbg_dest_tlv->write_ptr_reg); 3031 + wrap_cnt = le32_to_cpu(trans->dbg_dest_tlv->wrap_count); 3032 + base = le32_to_cpu(trans->dbg_dest_tlv->base_reg); 3033 + } else { 3034 + base = MON_BUFF_BASE_ADDR; 3035 + write_ptr = MON_BUFF_WRPTR; 3036 + wrap_cnt = MON_BUFF_CYCLE_CNT; 3037 + } 3038 + fw_mon_data->fw_mon_wr_ptr = 3039 + cpu_to_le32(iwl_read_prph(trans, write_ptr)); 3040 + fw_mon_data->fw_mon_cycle_cnt = 3041 + cpu_to_le32(iwl_read_prph(trans, wrap_cnt)); 3042 + fw_mon_data->fw_mon_base_ptr = 3043 + cpu_to_le32(iwl_read_prph(trans, base)); 3044 + } 3045 + 3032 3046 static u32 3033 3047 iwl_trans_pcie_dump_monitor(struct iwl_trans *trans, 3034 3048 struct iwl_fw_error_dump_data **data, ··· 3066 3024 3067 3025 if ((trans->num_blocks && 3068 3026 trans->cfg->device_family == IWL_DEVICE_FAMILY_7000) || 3069 - trans->dbg_dest_tlv) { 3027 + (trans->dbg_dest_tlv && !trans->ini_valid) || 3028 + (trans->ini_valid && trans->num_blocks)) { 3070 3029 struct iwl_fw_error_dump_fw_mon *fw_mon_data; 3071 - u32 base, write_ptr, wrap_cnt; 3072 - 3073 - /* If there was a dest TLV - use the values from there */ 3074 - if (trans->dbg_dest_tlv) { 3075 - write_ptr = 3076 - le32_to_cpu(trans->dbg_dest_tlv->write_ptr_reg); 3077 - wrap_cnt = le32_to_cpu(trans->dbg_dest_tlv->wrap_count); 3078 - base = le32_to_cpu(trans->dbg_dest_tlv->base_reg); 3079 - } else { 3080 - base = MON_BUFF_BASE_ADDR; 3081 - write_ptr = MON_BUFF_WRPTR; 3082 - wrap_cnt = MON_BUFF_CYCLE_CNT; 3083 - } 3084 3030 3085 3031 (*data)->type = cpu_to_le32(IWL_FW_ERROR_DUMP_FW_MONITOR); 3086 3032 fw_mon_data = (void *)(*data)->data; 3087 - fw_mon_data->fw_mon_wr_ptr = 3088 - cpu_to_le32(iwl_read_prph(trans, write_ptr)); 3089 - fw_mon_data->fw_mon_cycle_cnt = 3090 - cpu_to_le32(iwl_read_prph(trans, wrap_cnt)); 3091 - fw_mon_data->fw_mon_base_ptr = 3092 - cpu_to_le32(iwl_read_prph(trans, base)); 3033 + 3034 + iwl_trans_pcie_dump_pointers(trans, fw_mon_data); 3093 3035 3094 3036 len += sizeof(**data) + sizeof(*fw_mon_data); 3095 3037 if (trans->num_blocks) { ··· 3083 3057 3084 3058 monitor_len = trans->fw_mon[0].size; 3085 3059 } else if (trans->dbg_dest_tlv->monitor_mode == SMEM_MODE) { 3060 + u32 base = le32_to_cpu(fw_mon_data->fw_mon_base_ptr); 3086 3061 /* 3087 3062 * Update pointers to reflect actual values after 3088 3063 * shifting
+13 -13
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
··· 238 238 { 239 239 #ifdef CONFIG_INET 240 240 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 241 - struct iwl_tx_cmd *tx_cmd = (void *)dev_cmd->payload; 241 + struct iwl_tx_cmd_gen2 *tx_cmd = (void *)dev_cmd->payload; 242 242 struct ieee80211_hdr *hdr = (void *)skb->data; 243 243 unsigned int snap_ip_tcp_hdrlen, ip_hdrlen, total_len, hdr_room; 244 244 unsigned int mss = skb_shinfo(skb)->gso_size; ··· 583 583 584 584 spin_lock(&txq->lock); 585 585 586 - if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) { 587 - struct iwl_tx_cmd_gen3 *tx_cmd_gen3 = 588 - (void *)dev_cmd->payload; 589 - 590 - cmd_len = le16_to_cpu(tx_cmd_gen3->len); 591 - } else { 592 - struct iwl_tx_cmd_gen2 *tx_cmd_gen2 = 593 - (void *)dev_cmd->payload; 594 - 595 - cmd_len = le16_to_cpu(tx_cmd_gen2->len); 596 - } 597 - 598 586 if (iwl_queue_space(trans, txq) < txq->high_mark) { 599 587 iwl_stop_queue(trans, txq); 600 588 ··· 618 630 if (!tfd) { 619 631 spin_unlock(&txq->lock); 620 632 return -1; 633 + } 634 + 635 + if (trans->cfg->device_family >= IWL_DEVICE_FAMILY_22560) { 636 + struct iwl_tx_cmd_gen3 *tx_cmd_gen3 = 637 + (void *)dev_cmd->payload; 638 + 639 + cmd_len = le16_to_cpu(tx_cmd_gen3->len); 640 + } else { 641 + struct iwl_tx_cmd_gen2 *tx_cmd_gen2 = 642 + (void *)dev_cmd->payload; 643 + 644 + cmd_len = le16_to_cpu(tx_cmd_gen2->len); 621 645 } 622 646 623 647 /* Set up entry for this TFD in Tx byte-count array */
+7 -6
drivers/net/wireless/intel/iwlwifi/pcie/tx.c
··· 1160 1160 */ 1161 1161 iwl_trans_tx(trans, skb, dev_cmd_ptr, txq_id); 1162 1162 } 1163 - spin_lock_bh(&txq->lock); 1164 1163 1165 1164 if (iwl_queue_space(trans, txq) > txq->low_mark) 1166 1165 iwl_wake_queue(trans, txq); 1166 + 1167 + spin_lock_bh(&txq->lock); 1167 1168 } 1168 1169 1169 1170 if (txq->read_ptr == txq->write_ptr) { ··· 1246 1245 1247 1246 if (idx >= trans->cfg->base_params->max_tfd_queue_size || 1248 1247 (!iwl_queue_used(txq, idx))) { 1249 - IWL_ERR(trans, 1250 - "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", 1251 - __func__, txq_id, idx, 1252 - trans->cfg->base_params->max_tfd_queue_size, 1253 - txq->write_ptr, txq->read_ptr); 1248 + WARN_ONCE(test_bit(txq_id, trans_pcie->queue_used), 1249 + "%s: Read index for DMA queue txq id (%d), index %d is out of range [0-%d] %d %d.\n", 1250 + __func__, txq_id, idx, 1251 + trans->cfg->base_params->max_tfd_queue_size, 1252 + txq->write_ptr, txq->read_ptr); 1254 1253 return; 1255 1254 } 1256 1255
+45 -17
drivers/net/wireless/marvell/mwifiex/cfg80211.c
··· 1275 1275 } 1276 1276 1277 1277 static void 1278 - mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 tx_htinfo, 1278 + mwifiex_parse_htinfo(struct mwifiex_private *priv, u8 rateinfo, u8 htinfo, 1279 1279 struct rate_info *rate) 1280 1280 { 1281 1281 struct mwifiex_adapter *adapter = priv->adapter; 1282 1282 1283 1283 if (adapter->is_hw_11ac_capable) { 1284 1284 /* bit[1-0]: 00=LG 01=HT 10=VHT */ 1285 - if (tx_htinfo & BIT(0)) { 1285 + if (htinfo & BIT(0)) { 1286 1286 /* HT */ 1287 - rate->mcs = priv->tx_rate; 1287 + rate->mcs = rateinfo; 1288 1288 rate->flags |= RATE_INFO_FLAGS_MCS; 1289 1289 } 1290 - if (tx_htinfo & BIT(1)) { 1290 + if (htinfo & BIT(1)) { 1291 1291 /* VHT */ 1292 - rate->mcs = priv->tx_rate & 0x0F; 1292 + rate->mcs = rateinfo & 0x0F; 1293 1293 rate->flags |= RATE_INFO_FLAGS_VHT_MCS; 1294 1294 } 1295 1295 1296 - if (tx_htinfo & (BIT(1) | BIT(0))) { 1296 + if (htinfo & (BIT(1) | BIT(0))) { 1297 1297 /* HT or VHT */ 1298 - switch (tx_htinfo & (BIT(3) | BIT(2))) { 1298 + switch (htinfo & (BIT(3) | BIT(2))) { 1299 1299 case 0: 1300 1300 rate->bw = RATE_INFO_BW_20; 1301 1301 break; ··· 1310 1310 break; 1311 1311 } 1312 1312 1313 - if (tx_htinfo & BIT(4)) 1313 + if (htinfo & BIT(4)) 1314 1314 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; 1315 1315 1316 - if ((priv->tx_rate >> 4) == 1) 1316 + if ((rateinfo >> 4) == 1) 1317 1317 rate->nss = 2; 1318 1318 else 1319 1319 rate->nss = 1; 1320 1320 } 1321 1321 } else { 1322 1322 /* 1323 - * Bit 0 in tx_htinfo indicates that current Tx rate 1324 - * is 11n rate. Valid MCS index values for us are 0 to 15. 1323 + * Bit 0 in htinfo indicates that current rate is 11n. Valid 1324 + * MCS index values for us are 0 to 15. 1325 1325 */ 1326 - if ((tx_htinfo & BIT(0)) && (priv->tx_rate < 16)) { 1327 - rate->mcs = priv->tx_rate; 1326 + if ((htinfo & BIT(0)) && (rateinfo < 16)) { 1327 + rate->mcs = rateinfo; 1328 1328 rate->flags |= RATE_INFO_FLAGS_MCS; 1329 1329 rate->bw = RATE_INFO_BW_20; 1330 - if (tx_htinfo & BIT(1)) 1330 + if (htinfo & BIT(1)) 1331 1331 rate->bw = RATE_INFO_BW_40; 1332 - if (tx_htinfo & BIT(2)) 1332 + if (htinfo & BIT(2)) 1333 1333 rate->flags |= RATE_INFO_FLAGS_SHORT_GI; 1334 1334 } 1335 + } 1336 + 1337 + /* Decode legacy rates for non-HT. */ 1338 + if (!(htinfo & (BIT(0) | BIT(1)))) { 1339 + /* Bitrates in multiples of 100kb/s. */ 1340 + static const int legacy_rates[] = { 1341 + [0] = 10, 1342 + [1] = 20, 1343 + [2] = 55, 1344 + [3] = 110, 1345 + [4] = 60, /* MWIFIEX_RATE_INDEX_OFDM0 */ 1346 + [5] = 60, 1347 + [6] = 90, 1348 + [7] = 120, 1349 + [8] = 180, 1350 + [9] = 240, 1351 + [10] = 360, 1352 + [11] = 480, 1353 + [12] = 540, 1354 + }; 1355 + if (rateinfo < ARRAY_SIZE(legacy_rates)) 1356 + rate->legacy = legacy_rates[rateinfo]; 1335 1357 } 1336 1358 } 1337 1359 ··· 1397 1375 sinfo->tx_packets = node->stats.tx_packets; 1398 1376 sinfo->tx_failed = node->stats.tx_failed; 1399 1377 1400 - mwifiex_parse_htinfo(priv, node->stats.last_tx_htinfo, 1378 + mwifiex_parse_htinfo(priv, priv->tx_rate, 1379 + node->stats.last_tx_htinfo, 1401 1380 &sinfo->txrate); 1402 1381 sinfo->txrate.legacy = node->stats.last_tx_rate * 5; 1403 1382 ··· 1424 1401 HostCmd_ACT_GEN_GET, DTIM_PERIOD_I, 1425 1402 &priv->dtim_period, true); 1426 1403 1427 - mwifiex_parse_htinfo(priv, priv->tx_htinfo, &sinfo->txrate); 1404 + mwifiex_parse_htinfo(priv, priv->tx_rate, priv->tx_htinfo, 1405 + &sinfo->txrate); 1428 1406 1429 1407 sinfo->signal_avg = priv->bcn_rssi_avg; 1430 1408 sinfo->rx_bytes = priv->stats.rx_bytes; ··· 1435 1411 sinfo->signal = priv->bcn_rssi_avg; 1436 1412 /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */ 1437 1413 sinfo->txrate.legacy = rate * 5; 1414 + 1415 + sinfo->filled |= BIT(NL80211_STA_INFO_RX_BITRATE); 1416 + mwifiex_parse_htinfo(priv, priv->rxpd_rate, priv->rxpd_htinfo, 1417 + &sinfo->rxrate); 1438 1418 1439 1419 if (priv->bss_mode == NL80211_IFTYPE_STATION) { 1440 1420 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_BSS_PARAM);
+6 -8
drivers/net/wireless/marvell/mwifiex/debugfs.c
··· 273 273 "total samples = %d\n", 274 274 atomic_read(&phist_data->num_samples)); 275 275 276 - p += sprintf(p, "rx rates (in Mbps): 0=1M 1=2M"); 277 - p += sprintf(p, "2=5.5M 3=11M 4=6M 5=9M 6=12M\n"); 278 - p += sprintf(p, "7=18M 8=24M 9=36M 10=48M 11=54M"); 279 - p += sprintf(p, "12-27=MCS0-15(BW20) 28-43=MCS0-15(BW40)\n"); 276 + p += sprintf(p, 277 + "rx rates (in Mbps): 0=1M 1=2M 2=5.5M 3=11M 4=6M 5=9M 6=12M\n" 278 + "7=18M 8=24M 9=36M 10=48M 11=54M 12-27=MCS0-15(BW20) 28-43=MCS0-15(BW40)\n"); 280 279 281 280 if (ISSUPP_11ACENABLED(priv->adapter->fw_cap_info)) { 282 - p += sprintf(p, "44-53=MCS0-9(VHT:BW20)"); 283 - p += sprintf(p, "54-63=MCS0-9(VHT:BW40)"); 284 - p += sprintf(p, "64-73=MCS0-9(VHT:BW80)\n\n"); 281 + p += sprintf(p, 282 + "44-53=MCS0-9(VHT:BW20) 54-63=MCS0-9(VHT:BW40) 64-73=MCS0-9(VHT:BW80)\n\n"); 285 283 } else { 286 284 p += sprintf(p, "\n"); 287 285 } ··· 308 310 for (i = 0; i < MWIFIEX_MAX_NOISE_FLR; i++) { 309 311 value = atomic_read(&phist_data->noise_flr[i]); 310 312 if (value) 311 - p += sprintf(p, "noise_flr[-%02ddBm] = %d\n", 313 + p += sprintf(p, "noise_flr[%02ddBm] = %d\n", 312 314 (int)(i-128), value); 313 315 } 314 316 for (i = 0; i < MWIFIEX_MAX_SIG_STRENGTH; i++) {
+10 -8
drivers/net/wireless/marvell/mwifiex/scan.c
··· 1882 1882 ETH_ALEN)) 1883 1883 mwifiex_update_curr_bss_params(priv, 1884 1884 bss); 1885 - cfg80211_put_bss(priv->wdev.wiphy, bss); 1886 - } 1887 1885 1888 - if ((chan->flags & IEEE80211_CHAN_RADAR) || 1889 - (chan->flags & IEEE80211_CHAN_NO_IR)) { 1890 - mwifiex_dbg(adapter, INFO, 1891 - "radar or passive channel %d\n", 1892 - channel); 1893 - mwifiex_save_hidden_ssid_channels(priv, bss); 1886 + if ((chan->flags & IEEE80211_CHAN_RADAR) || 1887 + (chan->flags & IEEE80211_CHAN_NO_IR)) { 1888 + mwifiex_dbg(adapter, INFO, 1889 + "radar or passive channel %d\n", 1890 + channel); 1891 + mwifiex_save_hidden_ssid_channels(priv, 1892 + bss); 1893 + } 1894 + 1895 + cfg80211_put_bss(priv->wdev.wiphy, bss); 1894 1896 } 1895 1897 } 1896 1898 } else {
+8 -5
drivers/net/wireless/marvell/mwifiex/sta_rx.c
··· 152 152 mwifiex_process_tdls_action_frame(priv, offset, rx_pkt_len); 153 153 } 154 154 155 - priv->rxpd_rate = local_rx_pd->rx_rate; 156 - 157 - priv->rxpd_htinfo = local_rx_pd->ht_info; 155 + /* Only stash RX bitrate for unicast packets. */ 156 + if (likely(!is_multicast_ether_addr(rx_pkt_hdr->eth803_hdr.h_dest))) { 157 + priv->rxpd_rate = local_rx_pd->rx_rate; 158 + priv->rxpd_htinfo = local_rx_pd->ht_info; 159 + } 158 160 159 161 if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA || 160 162 GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_UAP) { 161 - adj_rx_rate = mwifiex_adjust_data_rate(priv, priv->rxpd_rate, 162 - priv->rxpd_htinfo); 163 + adj_rx_rate = mwifiex_adjust_data_rate(priv, 164 + local_rx_pd->rx_rate, 165 + local_rx_pd->ht_info); 163 166 mwifiex_hist_data_add(priv, adj_rx_rate, local_rx_pd->snr, 164 167 local_rx_pd->nf); 165 168 }
+2 -1
drivers/net/wireless/mediatek/mt76/Makefile
··· 14 14 15 15 mt76x02-lib-y := mt76x02_util.o mt76x02_mac.o mt76x02_mcu.o \ 16 16 mt76x02_eeprom.o mt76x02_phy.o mt76x02_mmio.o \ 17 - mt76x02_txrx.o mt76x02_trace.o 17 + mt76x02_txrx.o mt76x02_trace.o mt76x02_debugfs.o \ 18 + mt76x02_dfs.o 18 19 19 20 mt76x02-usb-y := mt76x02_usb_mcu.o mt76x02_usb_core.o 20 21
+9 -5
drivers/net/wireless/mediatek/mt76/dma.c
··· 157 157 if (entry.schedule) 158 158 q->swq_queued--; 159 159 160 - if (entry.skb) 160 + q->tail = (q->tail + 1) % q->ndesc; 161 + q->queued--; 162 + 163 + if (entry.skb) { 164 + spin_unlock_bh(&q->lock); 161 165 dev->drv->tx_complete_skb(dev, q, &entry, flush); 166 + spin_lock_bh(&q->lock); 167 + } 162 168 163 169 if (entry.txwi) { 164 170 mt76_put_txwi(dev, entry.txwi); 165 - wake = true; 171 + wake = !flush; 166 172 } 167 - 168 - q->tail = (q->tail + 1) % q->ndesc; 169 - q->queued--; 170 173 171 174 if (!flush && q->tail == last) 172 175 last = ioread32(&q->regs->dma_idx); ··· 261 258 return -ENOMEM; 262 259 } 263 260 261 + skb->prev = skb->next = NULL; 264 262 dma_sync_single_for_cpu(dev->dev, t->dma_addr, sizeof(t->txwi), 265 263 DMA_TO_DEVICE); 266 264 ret = dev->drv->tx_prepare_skb(dev, &t->txwi, skb, q, wcid, sta,
+80
drivers/net/wireless/mediatek/mt76/mac80211.c
··· 285 285 spin_lock_init(&dev->cc_lock); 286 286 mutex_init(&dev->mutex); 287 287 init_waitqueue_head(&dev->tx_wait); 288 + skb_queue_head_init(&dev->status_list); 288 289 289 290 return dev; 290 291 } ··· 327 326 ieee80211_hw_set(hw, TX_FRAG_LIST); 328 327 ieee80211_hw_set(hw, MFP_CAPABLE); 329 328 ieee80211_hw_set(hw, AP_LINK_PS); 329 + ieee80211_hw_set(hw, REPORTS_TX_ACK_STATUS); 330 330 331 331 wiphy->flags |= WIPHY_FLAG_IBSS_RSN; 332 332 ··· 361 359 { 362 360 struct ieee80211_hw *hw = dev->hw; 363 361 362 + mt76_tx_status_check(dev, NULL, true); 364 363 ieee80211_unregister_hw(hw); 365 364 mt76_tx_free(dev); 366 365 } ··· 632 629 mt76_rx_complete(dev, &frames, napi); 633 630 } 634 631 EXPORT_SYMBOL_GPL(mt76_rx_poll_complete); 632 + 633 + static int 634 + mt76_sta_add(struct mt76_dev *dev, struct ieee80211_vif *vif, 635 + struct ieee80211_sta *sta) 636 + { 637 + struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; 638 + int ret; 639 + int i; 640 + 641 + mutex_lock(&dev->mutex); 642 + 643 + ret = dev->drv->sta_add(dev, vif, sta); 644 + if (ret) 645 + goto out; 646 + 647 + for (i = 0; i < ARRAY_SIZE(sta->txq); i++) { 648 + struct mt76_txq *mtxq; 649 + 650 + if (!sta->txq[i]) 651 + continue; 652 + 653 + mtxq = (struct mt76_txq *)sta->txq[i]->drv_priv; 654 + mtxq->wcid = wcid; 655 + 656 + mt76_txq_init(dev, sta->txq[i]); 657 + } 658 + 659 + rcu_assign_pointer(dev->wcid[wcid->idx], wcid); 660 + 661 + out: 662 + mutex_unlock(&dev->mutex); 663 + 664 + return ret; 665 + } 666 + 667 + static void 668 + mt76_sta_remove(struct mt76_dev *dev, struct ieee80211_vif *vif, 669 + struct ieee80211_sta *sta) 670 + { 671 + struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; 672 + int idx = wcid->idx; 673 + int i; 674 + 675 + rcu_assign_pointer(dev->wcid[idx], NULL); 676 + synchronize_rcu(); 677 + 678 + mutex_lock(&dev->mutex); 679 + 680 + if (dev->drv->sta_remove) 681 + dev->drv->sta_remove(dev, vif, sta); 682 + 683 + mt76_tx_status_check(dev, wcid, true); 684 + for (i = 0; i < ARRAY_SIZE(sta->txq); i++) 685 + mt76_txq_remove(dev, sta->txq[i]); 686 + mt76_wcid_free(dev->wcid_mask, idx); 687 + 688 + mutex_unlock(&dev->mutex); 689 + } 690 + 691 + int mt76_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 692 + struct ieee80211_sta *sta, 693 + enum ieee80211_sta_state old_state, 694 + enum ieee80211_sta_state new_state) 695 + { 696 + struct mt76_dev *dev = hw->priv; 697 + 698 + if (old_state == IEEE80211_STA_NOTEXIST && 699 + new_state == IEEE80211_STA_NONE) 700 + return mt76_sta_add(dev, vif, sta); 701 + 702 + if (old_state == IEEE80211_STA_NONE && 703 + new_state == IEEE80211_STA_NOTEXIST) 704 + mt76_sta_remove(dev, vif, sta); 705 + 706 + return 0; 707 + } 708 + EXPORT_SYMBOL_GPL(mt76_sta_state);
+54 -6
drivers/net/wireless/mediatek/mt76/mt76.h
··· 135 135 }; 136 136 137 137 struct mt76_mcu_ops { 138 - struct sk_buff *(*mcu_msg_alloc)(const void *data, int len); 139 - int (*mcu_send_msg)(struct mt76_dev *dev, struct sk_buff *skb, 140 - int cmd, bool wait_resp); 138 + int (*mcu_send_msg)(struct mt76_dev *dev, int cmd, const void *data, 139 + int len, bool wait_resp); 141 140 int (*mcu_wr_rp)(struct mt76_dev *dev, u32 base, 142 141 const struct mt76_reg_pair *rp, int len); 143 142 int (*mcu_rd_rp)(struct mt76_dev *dev, u32 base, ··· 194 195 u8 tx_rate_nss; 195 196 s8 max_txpwr_adj; 196 197 bool sw_iv; 198 + 199 + u8 packet_id; 197 200 }; 198 201 199 202 struct mt76_txq { ··· 232 231 u8 started:1, stopped:1, timer_pending:1; 233 232 234 233 struct sk_buff *reorder_buf[]; 234 + }; 235 + 236 + #define MT_TX_CB_DMA_DONE BIT(0) 237 + #define MT_TX_CB_TXS_DONE BIT(1) 238 + #define MT_TX_CB_TXS_FAILED BIT(2) 239 + 240 + #define MT_PACKET_ID_MASK GENMASK(7, 0) 241 + #define MT_PACKET_ID_NO_ACK MT_PACKET_ID_MASK 242 + 243 + #define MT_TX_STATUS_SKB_TIMEOUT HZ 244 + 245 + struct mt76_tx_cb { 246 + unsigned long jiffies; 247 + u8 wcid; 248 + u8 pktid; 249 + u8 flags; 235 250 }; 236 251 237 252 enum { ··· 288 271 289 272 void (*sta_ps)(struct mt76_dev *dev, struct ieee80211_sta *sta, 290 273 bool ps); 274 + 275 + int (*sta_add)(struct mt76_dev *dev, struct ieee80211_vif *vif, 276 + struct ieee80211_sta *sta); 277 + 278 + void (*sta_remove)(struct mt76_dev *dev, struct ieee80211_vif *vif, 279 + struct ieee80211_sta *sta); 291 280 }; 292 281 293 282 struct mt76_channel_state { ··· 423 400 const struct mt76_queue_ops *queue_ops; 424 401 425 402 wait_queue_head_t tx_wait; 403 + struct sk_buff_head status_list; 426 404 427 405 unsigned long wcid_mask[MT76_N_WCIDS / BITS_PER_LONG]; 428 406 ··· 508 484 #define mt76_wr_rp(dev, ...) (dev)->mt76.bus->wr_rp(&((dev)->mt76), __VA_ARGS__) 509 485 #define mt76_rd_rp(dev, ...) (dev)->mt76.bus->rd_rp(&((dev)->mt76), __VA_ARGS__) 510 486 511 - #define mt76_mcu_msg_alloc(dev, ...) (dev)->mt76.mcu_ops->mcu_msg_alloc(__VA_ARGS__) 512 487 #define mt76_mcu_send_msg(dev, ...) (dev)->mt76.mcu_ops->mcu_send_msg(&((dev)->mt76), __VA_ARGS__) 513 488 514 489 #define mt76_set(dev, offset, val) mt76_rmw(dev, offset, 0, val) ··· 617 594 return container_of(ptr, struct ieee80211_sta, drv_priv); 618 595 } 619 596 597 + static inline struct mt76_tx_cb *mt76_tx_skb_cb(struct sk_buff *skb) 598 + { 599 + BUILD_BUG_ON(sizeof(struct mt76_tx_cb) > 600 + sizeof(IEEE80211_SKB_CB(skb)->status.status_driver_data)); 601 + return ((void *) IEEE80211_SKB_CB(skb)->status.status_driver_data); 602 + } 603 + 620 604 int mt76_dma_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, 621 605 struct sk_buff *skb, struct mt76_wcid *wcid, 622 606 struct ieee80211_sta *sta); ··· 654 624 655 625 void mt76_wcid_key_setup(struct mt76_dev *dev, struct mt76_wcid *wcid, 656 626 struct ieee80211_key_conf *key); 627 + 628 + void mt76_tx_status_lock(struct mt76_dev *dev, struct sk_buff_head *list) 629 + __acquires(&dev->status_list.lock); 630 + void mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list) 631 + __releases(&dev->status_list.lock); 632 + 633 + int mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid, 634 + struct sk_buff *skb); 635 + struct sk_buff *mt76_tx_status_skb_get(struct mt76_dev *dev, 636 + struct mt76_wcid *wcid, int pktid, 637 + struct sk_buff_head *list); 638 + void mt76_tx_status_skb_done(struct mt76_dev *dev, struct sk_buff *skb, 639 + struct sk_buff_head *list); 640 + void mt76_tx_complete_skb(struct mt76_dev *dev, struct sk_buff *skb); 641 + void mt76_tx_status_check(struct mt76_dev *dev, struct mt76_wcid *wcid, 642 + bool flush); 643 + int mt76_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 644 + struct ieee80211_sta *sta, 645 + enum ieee80211_sta_state old_state, 646 + enum ieee80211_sta_state new_state); 657 647 658 648 struct ieee80211_sta *mt76_rx_convert(struct sk_buff *skb); 659 649 ··· 718 668 void *buf, size_t len); 719 669 void mt76u_single_wr(struct mt76_dev *dev, const u8 req, 720 670 const u16 offset, const u32 val); 721 - u32 mt76u_rr(struct mt76_dev *dev, u32 addr); 722 - void mt76u_wr(struct mt76_dev *dev, u32 addr, u32 val); 723 671 int mt76u_init(struct mt76_dev *dev, struct usb_interface *intf); 724 672 void mt76u_deinit(struct mt76_dev *dev); 725 673 int mt76u_buf_alloc(struct mt76_dev *dev, struct mt76u_buf *buf,
+2 -4
drivers/net/wireless/mediatek/mt76/mt76x0/Makefile
··· 2 2 obj-$(CONFIG_MT76x0E) += mt76x0e.o 3 3 obj-$(CONFIG_MT76x0_COMMON) += mt76x0-common.o 4 4 5 - mt76x0-common-y := \ 6 - init.o main.o trace.o eeprom.o phy.o \ 7 - mac.o debugfs.o 5 + mt76x0-common-y := init.o main.o eeprom.o phy.o 6 + 8 7 mt76x0u-y := usb.o usb_mcu.o 9 8 mt76x0e-y := pci.o pci_mcu.o 10 9 11 10 # ccflags-y := -DDEBUG 12 - CFLAGS_trace.o := -I$(src)
-87
drivers/net/wireless/mediatek/mt76/mt76x0/debugfs.c
··· 1 - /* 2 - * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org> 3 - * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl> 4 - * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 8 - * as published by the Free Software Foundation 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - */ 15 - 16 - #include <linux/debugfs.h> 17 - 18 - #include "mt76x0.h" 19 - #include "eeprom.h" 20 - 21 - static int 22 - mt76x0_ampdu_stat_read(struct seq_file *file, void *data) 23 - { 24 - struct mt76x02_dev *dev = file->private; 25 - int i, j; 26 - 27 - #define stat_printf(grp, off, name) \ 28 - seq_printf(file, #name ":\t%llu\n", dev->stats.grp[off]) 29 - 30 - stat_printf(rx_stat, 0, rx_crc_err); 31 - stat_printf(rx_stat, 1, rx_phy_err); 32 - stat_printf(rx_stat, 2, rx_false_cca); 33 - stat_printf(rx_stat, 3, rx_plcp_err); 34 - stat_printf(rx_stat, 4, rx_fifo_overflow); 35 - stat_printf(rx_stat, 5, rx_duplicate); 36 - 37 - stat_printf(tx_stat, 0, tx_fail_cnt); 38 - stat_printf(tx_stat, 1, tx_bcn_cnt); 39 - stat_printf(tx_stat, 2, tx_success); 40 - stat_printf(tx_stat, 3, tx_retransmit); 41 - stat_printf(tx_stat, 4, tx_zero_len); 42 - stat_printf(tx_stat, 5, tx_underflow); 43 - 44 - stat_printf(aggr_stat, 0, non_aggr_tx); 45 - stat_printf(aggr_stat, 1, aggr_tx); 46 - 47 - stat_printf(zero_len_del, 0, tx_zero_len_del); 48 - stat_printf(zero_len_del, 1, rx_zero_len_del); 49 - #undef stat_printf 50 - 51 - seq_puts(file, "Aggregations stats:\n"); 52 - for (i = 0; i < 4; i++) { 53 - for (j = 0; j < 8; j++) 54 - seq_printf(file, "%08llx ", 55 - dev->stats.aggr_n[i * 8 + j]); 56 - seq_putc(file, '\n'); 57 - } 58 - 59 - seq_printf(file, "recent average AMPDU len: %d\n", 60 - atomic_read(&dev->avg_ampdu_len)); 61 - 62 - return 0; 63 - } 64 - 65 - static int 66 - mt76x0_ampdu_stat_open(struct inode *inode, struct file *f) 67 - { 68 - return single_open(f, mt76x0_ampdu_stat_read, inode->i_private); 69 - } 70 - 71 - static const struct file_operations fops_ampdu_stat = { 72 - .open = mt76x0_ampdu_stat_open, 73 - .read = seq_read, 74 - .llseek = seq_lseek, 75 - .release = single_release, 76 - }; 77 - 78 - void mt76x0_init_debugfs(struct mt76x02_dev *dev) 79 - { 80 - struct dentry *dir; 81 - 82 - dir = mt76_register_debugfs(&dev->mt76); 83 - if (!dir) 84 - return; 85 - 86 - debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat); 87 - }
+16 -6
drivers/net/wireless/mediatek/mt76/mt76x0/eeprom.c
··· 135 135 struct cfg80211_chan_def *chandef = &dev->mt76.chandef; 136 136 u8 val; 137 137 138 - if (mt76x0_tssi_enabled(dev)) 139 - return 0; 140 - 141 138 if (chandef->width == NL80211_CHAN_WIDTH_80) { 142 139 val = mt76x02_eeprom_get(dev, MT_EE_5G_TARGET_POWER) >> 8; 143 140 } else if (chandef->width == NL80211_CHAN_WIDTH_40) { ··· 157 160 struct ieee80211_channel *chan = dev->mt76.chandef.chan; 158 161 bool is_2ghz = chan->band == NL80211_BAND_2GHZ; 159 162 struct mt76_rate_power *t = &dev->mt76.rate_power; 160 - s8 delta = mt76x0_get_delta(dev); 161 163 u16 val, addr; 164 + s8 delta; 162 165 163 166 memset(t, 0, sizeof(*t)); 164 167 ··· 208 211 t->vht[7] = s6_to_s8(val); 209 212 t->vht[8] = s6_to_s8(val >> 8); 210 213 214 + delta = mt76x0_tssi_enabled(dev) ? 0 : mt76x0_get_delta(dev); 211 215 mt76x02_add_rate_power_offset(t, delta); 212 216 } 213 217 ··· 230 232 u8 offset, addr; 231 233 u16 data; 232 234 int i; 235 + 236 + if (mt76x0_tssi_enabled(dev)) { 237 + s8 target_power; 238 + 239 + if (chan->band == NL80211_BAND_5GHZ) 240 + data = mt76x02_eeprom_get(dev, MT_EE_5G_TARGET_POWER); 241 + else 242 + data = mt76x02_eeprom_get(dev, MT_EE_2G_TARGET_POWER); 243 + target_power = (data & 0xff) - dev->mt76.rate_power.ofdm[7]; 244 + info[0] = target_power + mt76x0_get_delta(dev); 245 + info[1] = 0; 246 + 247 + return; 248 + } 233 249 234 250 for (i = 0; i < ARRAY_SIZE(chan_map); i++) { 235 251 if (chan_map[i].chan <= chan->hw_value) { ··· 351 339 mt76x0_set_chip_cap(dev); 352 340 mt76x0_set_freq_offset(dev); 353 341 mt76x0_set_temp_offset(dev); 354 - 355 - dev->mt76.chainmask = 0x0101; 356 342 357 343 return 0; 358 344 }
+24 -113
drivers/net/wireless/mediatek/mt76/mt76x0/init.c
··· 16 16 17 17 #include "mt76x0.h" 18 18 #include "eeprom.h" 19 - #include "trace.h" 20 19 #include "mcu.h" 21 20 #include "initvals.h" 22 21 ··· 112 113 { 113 114 int ret, i; 114 115 115 - ret = mt76x0_wait_bbp_ready(dev); 116 + ret = mt76x0_phy_wait_bbp_ready(dev); 116 117 if (ret) 117 118 return ret; 118 119 ··· 133 134 134 135 static void mt76x0_init_mac_registers(struct mt76x02_dev *dev) 135 136 { 136 - u32 reg; 137 - 138 137 RANDOM_WRITE(dev, common_mac_reg_table); 139 - 140 - mt76x02_set_beacon_offsets(dev); 141 138 142 139 /* Enable PBF and MAC clock SYS_CTRL[11:10] = 0x3 */ 143 140 RANDOM_WRITE(dev, mt76x0_mac_reg_table); 144 141 145 142 /* Release BBP and MAC reset MAC_SYS_CTRL[1:0] = 0x0 */ 146 - reg = mt76_rr(dev, MT_MAC_SYS_CTRL); 147 - reg &= ~0x3; 148 - mt76_wr(dev, MT_MAC_SYS_CTRL, reg); 143 + mt76_clear(dev, MT_MAC_SYS_CTRL, 0x3); 149 144 150 145 /* Set 0x141C[15:12]=0xF */ 151 - reg = mt76_rr(dev, MT_EXT_CCA_CFG); 152 - reg |= 0x0000F000; 153 - mt76_wr(dev, MT_EXT_CCA_CFG, reg); 146 + mt76_set(dev, MT_EXT_CCA_CFG, 0xf000); 154 147 155 148 mt76_clear(dev, MT_FCE_L2_STUFF, MT_FCE_L2_STUFF_WR_MPDU_LEN_EN); 156 149 157 150 /* 158 - TxRing 9 is for Mgmt frame. 159 - TxRing 8 is for In-band command frame. 160 - WMM_RG0_TXQMA: This register setting is for FCE to define the rule of TxRing 9. 161 - WMM_RG1_TXQMA: This register setting is for FCE to define the rule of TxRing 8. 162 - */ 163 - reg = mt76_rr(dev, MT_WMM_CTRL); 164 - reg &= ~0x000003FF; 165 - reg |= 0x00000201; 166 - mt76_wr(dev, MT_WMM_CTRL, reg); 167 - } 168 - 169 - static int mt76x0_init_wcid_mem(struct mt76x02_dev *dev) 170 - { 171 - u32 *vals; 172 - int i; 173 - 174 - vals = kmalloc(sizeof(*vals) * MT76_N_WCIDS * 2, GFP_KERNEL); 175 - if (!vals) 176 - return -ENOMEM; 177 - 178 - for (i = 0; i < MT76_N_WCIDS; i++) { 179 - vals[i * 2] = 0xffffffff; 180 - vals[i * 2 + 1] = 0x00ffffff; 181 - } 182 - 183 - mt76_wr_copy(dev, MT_WCID_ADDR_BASE, vals, MT76_N_WCIDS * 2); 184 - kfree(vals); 185 - return 0; 186 - } 187 - 188 - static void mt76x0_init_key_mem(struct mt76x02_dev *dev) 189 - { 190 - u32 vals[4] = {}; 191 - 192 - mt76_wr_copy(dev, MT_SKEY_MODE_BASE_0, vals, ARRAY_SIZE(vals)); 193 - } 194 - 195 - static int mt76x0_init_wcid_attr_mem(struct mt76x02_dev *dev) 196 - { 197 - u32 *vals; 198 - int i; 199 - 200 - vals = kmalloc(sizeof(*vals) * MT76_N_WCIDS * 2, GFP_KERNEL); 201 - if (!vals) 202 - return -ENOMEM; 203 - 204 - for (i = 0; i < MT76_N_WCIDS * 2; i++) 205 - vals[i] = 1; 206 - 207 - mt76_wr_copy(dev, MT_WCID_ATTR_BASE, vals, MT76_N_WCIDS * 2); 208 - kfree(vals); 209 - return 0; 151 + * tx_ring 9 is for mgmt frame 152 + * tx_ring 8 is for in-band command frame. 153 + * WMM_RG0_TXQMA: this register setting is for FCE to 154 + * define the rule of tx_ring 9 155 + * WMM_RG1_TXQMA: this register setting is for FCE to 156 + * define the rule of tx_ring 8 157 + */ 158 + mt76_rmw(dev, MT_WMM_CTRL, 0x3ff, 0x201); 210 159 } 211 160 212 161 static void mt76x0_reset_counters(struct mt76x02_dev *dev) ··· 217 270 218 271 int mt76x0_init_hardware(struct mt76x02_dev *dev) 219 272 { 220 - int ret; 273 + int ret, i, k; 221 274 222 275 if (!mt76x02_wait_for_wpdma(&dev->mt76, 1000)) 223 276 return -EIO; ··· 227 280 return -ETIMEDOUT; 228 281 229 282 mt76x0_reset_csr_bbp(dev); 230 - ret = mt76x02_mcu_function_select(dev, Q_SELECT, 1, false); 283 + ret = mt76x02_mcu_function_select(dev, Q_SELECT, 1); 231 284 if (ret) 232 285 return ret; 233 286 ··· 242 295 243 296 dev->mt76.rxfilter = mt76_rr(dev, MT_RX_FILTR_CFG); 244 297 245 - ret = mt76x0_init_wcid_mem(dev); 246 - if (ret) 247 - return ret; 298 + for (i = 0; i < 16; i++) 299 + for (k = 0; k < 4; k++) 300 + mt76x02_mac_shared_key_setup(dev, i, k, NULL); 248 301 249 - mt76x0_init_key_mem(dev); 250 - 251 - ret = mt76x0_init_wcid_attr_mem(dev); 252 - if (ret) 253 - return ret; 254 - 255 - mt76_clear(dev, MT_BEACON_TIME_CFG, (MT_BEACON_TIME_CFG_TIMER_EN | 256 - MT_BEACON_TIME_CFG_SYNC_MODE | 257 - MT_BEACON_TIME_CFG_TBTT_EN | 258 - MT_BEACON_TIME_CFG_BEACON_TX)); 302 + for (i = 0; i < 256; i++) 303 + mt76x02_mac_wcid_setup(dev, i, 0, NULL); 259 304 260 305 mt76x0_reset_counters(dev); 261 306 ··· 256 317 return ret; 257 318 258 319 mt76x0_phy_init(dev); 320 + mt76x02_init_beacon_config(dev); 259 321 260 322 return 0; 261 323 } ··· 279 339 280 340 dev = container_of(mdev, struct mt76x02_dev, mt76); 281 341 mutex_init(&dev->phy_mutex); 282 - atomic_set(&dev->avg_ampdu_len, 1); 283 342 284 343 return dev; 285 344 } ··· 286 347 287 348 int mt76x0_register_device(struct mt76x02_dev *dev) 288 349 { 289 - struct mt76_dev *mdev = &dev->mt76; 290 - struct ieee80211_hw *hw = mdev->hw; 291 - struct wiphy *wiphy = hw->wiphy; 292 350 int ret; 293 351 294 - /* Reserve WCID 0 for mcast - thanks to this APs WCID will go to 295 - * entry no. 1 like it does in the vendor driver. 296 - */ 297 - mdev->wcid_mask[0] |= 1; 352 + mt76x02_init_device(dev); 353 + mt76x02_config_mac_addr_list(dev); 298 354 299 - /* init fake wcid for monitor interfaces */ 300 - mdev->global_wcid.idx = 0xff; 301 - mdev->global_wcid.hw_key_idx = -1; 302 - 303 - /* init antenna configuration */ 304 - mdev->antenna_mask = 1; 305 - 306 - hw->queues = 4; 307 - hw->max_rates = 1; 308 - hw->max_report_rates = 7; 309 - hw->max_rate_tries = 1; 310 - hw->extra_tx_headroom = 2; 311 - if (mt76_is_usb(dev)) 312 - hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) + 313 - MT_DMA_HDR_LEN; 314 - 315 - hw->sta_data_size = sizeof(struct mt76x02_sta); 316 - hw->vif_data_size = sizeof(struct mt76x02_vif); 317 - 318 - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 319 - 320 - INIT_DELAYED_WORK(&dev->mac_work, mt76x0_mac_work); 321 - 322 - ret = mt76_register_device(mdev, true, mt76x02_rates, 355 + ret = mt76_register_device(&dev->mt76, true, mt76x02_rates, 323 356 ARRAY_SIZE(mt76x02_rates)); 324 357 if (ret) 325 358 return ret; 326 359 327 360 /* overwrite unsupported features */ 328 - if (mdev->cap.has_5ghz) 361 + if (dev->mt76.cap.has_5ghz) 329 362 mt76x0_vht_cap_mask(&dev->mt76.sband_5g.sband); 330 363 331 - mt76x0_init_debugfs(dev); 364 + mt76x02_init_debugfs(dev); 332 365 333 366 return 0; 334 367 }
+9 -6
drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h
··· 37 37 { MT_PBF_RX_MAX_PCNT, 0x0000fe9f }, 38 38 { MT_TX_RETRY_CFG, 0x47d01f0f }, 39 39 { MT_AUTO_RSP_CFG, 0x00000013 }, 40 - { MT_CCK_PROT_CFG, 0x05740003 }, 41 - { MT_OFDM_PROT_CFG, 0x05740003 }, 40 + { MT_CCK_PROT_CFG, 0x07f40003 }, 41 + { MT_OFDM_PROT_CFG, 0x07f42004 }, 42 42 { MT_PBF_CFG, 0x00f40006 }, 43 43 { MT_WPDMA_GLO_CFG, 0x00000030 }, 44 - { MT_GF20_PROT_CFG, 0x01744004 }, 45 - { MT_GF40_PROT_CFG, 0x03f44084 }, 46 - { MT_MM20_PROT_CFG, 0x01744004 }, 47 - { MT_MM40_PROT_CFG, 0x03f54084 }, 44 + { MT_GF20_PROT_CFG, 0x01742004 }, 45 + { MT_GF40_PROT_CFG, 0x03f42084 }, 46 + { MT_MM20_PROT_CFG, 0x01742004 }, 47 + { MT_MM40_PROT_CFG, 0x03f42084 }, 48 48 { MT_TXOP_CTRL_CFG, 0x0000583f }, 49 49 { MT_TX_RTS_CFG, 0x00092b20 }, 50 50 { MT_EXP_ACK_TIME, 0x002400ca }, ··· 85 85 { MT_HT_CTRL_CFG, 0x000001FF }, 86 86 { MT_TXOP_HLDR_ET, 0x00000000 }, 87 87 { MT_PN_PAD_MODE, 0x00000003 }, 88 + { MT_TX_PROT_CFG6, 0xe3f42004 }, 89 + { MT_TX_PROT_CFG7, 0xe3f42084 }, 90 + { MT_TX_PROT_CFG8, 0xe3f42104 }, 88 91 }; 89 92 90 93 static const struct mt76_reg_pair mt76x0_bbp_init_tab[] = {
+591 -722
drivers/net/wireless/mediatek/mt76/mt76x0/initvals_phy.h
··· 16 16 #ifndef __MT76X0U_PHY_INITVALS_H 17 17 #define __MT76X0U_PHY_INITVALS_H 18 18 19 - #define RF_REG_PAIR(bank, reg, value) \ 20 - { (bank) << 16 | (reg), value } 21 - 22 - 23 19 static const struct mt76_reg_pair mt76x0_rf_central_tab[] = { 24 - /* 25 - Bank 0 - For central blocks: BG, PLL, XTAL, LO, ADC/DAC 26 - */ 27 - { MT_RF(0, 1), 0x01}, 28 - { MT_RF(0, 2), 0x11}, 29 - 30 - /* 31 - R3 ~ R7: VCO Cal. 32 - */ 33 - { MT_RF(0, 3), 0x73}, /* VCO Freq Cal - No Bypass, VCO Amp Cal - No Bypass */ 34 - { MT_RF(0, 4), 0x30}, /* R4 b<7>=1, VCO cal */ 35 - { MT_RF(0, 5), 0x00}, 36 - { MT_RF(0, 6), 0x41}, /* Set the open loop amplitude to middle since bypassing amplitude calibration */ 37 - { MT_RF(0, 7), 0x00}, 38 - 39 - /* 40 - XO 41 - */ 42 - { MT_RF(0, 8), 0x00}, 43 - { MT_RF(0, 9), 0x00}, 44 - { MT_RF(0, 10), 0x0C}, 45 - { MT_RF(0, 11), 0x00}, 46 - { MT_RF(0, 12), 0x00}, 47 - 48 - /* 49 - BG 50 - */ 51 - { MT_RF(0, 13), 0x00}, 52 - { MT_RF(0, 14), 0x00}, 53 - { MT_RF(0, 15), 0x00}, 54 - 55 - /* 56 - LDO 57 - */ 58 - { MT_RF(0, 19), 0x20}, 59 - /* 60 - XO 61 - */ 62 - { MT_RF(0, 20), 0x22}, 63 - { MT_RF(0, 21), 0x12}, 64 - { MT_RF(0, 23), 0x00}, 65 - { MT_RF(0, 24), 0x33}, /* See band selection for R24<1:0> */ 66 - { MT_RF(0, 25), 0x00}, 67 - 68 - /* 69 - PLL, See Freq Selection 70 - */ 71 - { MT_RF(0, 26), 0x00}, 72 - { MT_RF(0, 27), 0x00}, 73 - { MT_RF(0, 28), 0x00}, 74 - { MT_RF(0, 29), 0x00}, 75 - { MT_RF(0, 30), 0x00}, 76 - { MT_RF(0, 31), 0x00}, 77 - { MT_RF(0, 32), 0x00}, 78 - { MT_RF(0, 33), 0x00}, 79 - { MT_RF(0, 34), 0x00}, 80 - { MT_RF(0, 35), 0x00}, 81 - { MT_RF(0, 36), 0x00}, 82 - { MT_RF(0, 37), 0x00}, 83 - 84 - /* 85 - LO Buffer 86 - */ 87 - { MT_RF(0, 38), 0x2F}, 88 - 89 - /* 90 - Test Ports 91 - */ 92 - { MT_RF(0, 64), 0x00}, 93 - { MT_RF(0, 65), 0x80}, 94 - { MT_RF(0, 66), 0x01}, 95 - { MT_RF(0, 67), 0x04}, 96 - 97 - /* 98 - ADC/DAC 99 - */ 100 - { MT_RF(0, 68), 0x00}, 101 - { MT_RF(0, 69), 0x08}, 102 - { MT_RF(0, 70), 0x08}, 103 - { MT_RF(0, 71), 0x40}, 104 - { MT_RF(0, 72), 0xD0}, 105 - { MT_RF(0, 73), 0x93}, 20 + { MT_RF(0, 1), 0x01 }, 21 + { MT_RF(0, 2), 0x11 }, 22 + /* R3 ~ R7: VCO Cal */ 23 + { MT_RF(0, 3), 0x73 }, /* VCO Freq Cal */ 24 + { MT_RF(0, 4), 0x30 }, /* R4 b<7>=1, VCO cal */ 25 + { MT_RF(0, 5), 0x00 }, 26 + { MT_RF(0, 6), 0x41 }, 27 + { MT_RF(0, 7), 0x00 }, 28 + { MT_RF(0, 8), 0x00 }, 29 + { MT_RF(0, 9), 0x00 }, 30 + { MT_RF(0, 10), 0x0C }, 31 + { MT_RF(0, 11), 0x00 }, 32 + { MT_RF(0, 12), 0x00 }, 33 + /* BG */ 34 + { MT_RF(0, 13), 0x00 }, 35 + { MT_RF(0, 14), 0x00 }, 36 + { MT_RF(0, 15), 0x00 }, 37 + /* LDO */ 38 + { MT_RF(0, 19), 0x20 }, 39 + { MT_RF(0, 20), 0x22 }, 40 + { MT_RF(0, 21), 0x12 }, 41 + { MT_RF(0, 23), 0x00 }, 42 + { MT_RF(0, 24), 0x33 }, 43 + { MT_RF(0, 25), 0x00 }, 44 + /* PLL */ 45 + { MT_RF(0, 26), 0x00 }, 46 + { MT_RF(0, 27), 0x00 }, 47 + { MT_RF(0, 28), 0x00 }, 48 + { MT_RF(0, 29), 0x00 }, 49 + { MT_RF(0, 30), 0x00 }, 50 + { MT_RF(0, 31), 0x00 }, 51 + { MT_RF(0, 32), 0x00 }, 52 + { MT_RF(0, 33), 0x00 }, 53 + { MT_RF(0, 34), 0x00 }, 54 + { MT_RF(0, 35), 0x00 }, 55 + { MT_RF(0, 36), 0x00 }, 56 + { MT_RF(0, 37), 0x00 }, 57 + /* LO Buffer */ 58 + { MT_RF(0, 38), 0x2F }, 59 + /* Test Ports */ 60 + { MT_RF(0, 64), 0x00 }, 61 + { MT_RF(0, 65), 0x80 }, 62 + { MT_RF(0, 66), 0x01 }, 63 + { MT_RF(0, 67), 0x04 }, 64 + /* ADC-DAC */ 65 + { MT_RF(0, 68), 0x00 }, 66 + { MT_RF(0, 69), 0x08 }, 67 + { MT_RF(0, 70), 0x08 }, 68 + { MT_RF(0, 71), 0x40 }, 69 + { MT_RF(0, 72), 0xD0 }, 70 + { MT_RF(0, 73), 0x93 }, 106 71 }; 107 72 108 73 static const struct mt76_reg_pair mt76x0_rf_2g_channel_0_tab[] = { 109 - /* 110 - Bank 5 - Channel 0 2G RF registers 111 - */ 112 - /* 113 - RX logic operation 114 - */ 115 - /* RF_R00 Change in SelectBand6590 */ 116 - 117 - { MT_RF(5, 2), 0x0C}, /* 5G+2G (MT7610U) */ 118 - { MT_RF(5, 3), 0x00}, 119 - 120 - /* 121 - TX logic operation 122 - */ 123 - { MT_RF(5, 4), 0x00}, 124 - { MT_RF(5, 5), 0x84}, 125 - { MT_RF(5, 6), 0x02}, 126 - 127 - /* 128 - LDO 129 - */ 130 - { MT_RF(5, 7), 0x00}, 131 - { MT_RF(5, 8), 0x00}, 132 - { MT_RF(5, 9), 0x00}, 133 - 134 - /* 135 - RX 136 - */ 137 - { MT_RF(5, 10), 0x51}, 138 - { MT_RF(5, 11), 0x22}, 139 - { MT_RF(5, 12), 0x22}, 140 - { MT_RF(5, 13), 0x0F}, 141 - { MT_RF(5, 14), 0x47}, /* Increase mixer current for more gain */ 142 - { MT_RF(5, 15), 0x25}, 143 - { MT_RF(5, 16), 0xC7}, /* Tune LNA2 tank */ 144 - { MT_RF(5, 17), 0x00}, 145 - { MT_RF(5, 18), 0x00}, 146 - { MT_RF(5, 19), 0x30}, /* Improve max Pin */ 147 - { MT_RF(5, 20), 0x33}, 148 - { MT_RF(5, 21), 0x02}, 149 - { MT_RF(5, 22), 0x32}, /* Tune LNA1 tank */ 150 - { MT_RF(5, 23), 0x00}, 151 - { MT_RF(5, 24), 0x25}, 152 - { MT_RF(5, 26), 0x00}, 153 - { MT_RF(5, 27), 0x12}, 154 - { MT_RF(5, 28), 0x0F}, 155 - { MT_RF(5, 29), 0x00}, 156 - 157 - /* 158 - LOGEN 159 - */ 160 - { MT_RF(5, 30), 0x51}, /* Tune LOGEN tank */ 161 - { MT_RF(5, 31), 0x35}, 162 - { MT_RF(5, 32), 0x31}, 163 - { MT_RF(5, 33), 0x31}, 164 - { MT_RF(5, 34), 0x34}, 165 - { MT_RF(5, 35), 0x03}, 166 - { MT_RF(5, 36), 0x00}, 167 - 168 - /* 169 - TX 170 - */ 171 - { MT_RF(5, 37), 0xDD}, /* Improve 3.2GHz spur */ 172 - { MT_RF(5, 38), 0xB3}, 173 - { MT_RF(5, 39), 0x33}, 174 - { MT_RF(5, 40), 0xB1}, 175 - { MT_RF(5, 41), 0x71}, 176 - { MT_RF(5, 42), 0xF2}, 177 - { MT_RF(5, 43), 0x47}, 178 - { MT_RF(5, 44), 0x77}, 179 - { MT_RF(5, 45), 0x0E}, 180 - { MT_RF(5, 46), 0x10}, 181 - { MT_RF(5, 47), 0x00}, 182 - { MT_RF(5, 48), 0x53}, 183 - { MT_RF(5, 49), 0x03}, 184 - { MT_RF(5, 50), 0xEF}, 185 - { MT_RF(5, 51), 0xC7}, 186 - { MT_RF(5, 52), 0x62}, 187 - { MT_RF(5, 53), 0x62}, 188 - { MT_RF(5, 54), 0x00}, 189 - { MT_RF(5, 55), 0x00}, 190 - { MT_RF(5, 56), 0x0F}, 191 - { MT_RF(5, 57), 0x0F}, 192 - { MT_RF(5, 58), 0x16}, 193 - { MT_RF(5, 59), 0x16}, 194 - { MT_RF(5, 60), 0x10}, 195 - { MT_RF(5, 61), 0x10}, 196 - { MT_RF(5, 62), 0xD0}, 197 - { MT_RF(5, 63), 0x6C}, 198 - { MT_RF(5, 64), 0x58}, 199 - { MT_RF(5, 65), 0x58}, 200 - { MT_RF(5, 66), 0xF2}, 201 - { MT_RF(5, 67), 0xE8}, 202 - { MT_RF(5, 68), 0xF0}, 203 - { MT_RF(5, 69), 0xF0}, 204 - { MT_RF(5, 127), 0x04}, 74 + /* RX logic operation */ 75 + { MT_RF(5, 2), 0x0C }, /* 5G+2G */ 76 + { MT_RF(5, 3), 0x00 }, 77 + /* TX logic operation */ 78 + { MT_RF(5, 4), 0x00 }, 79 + { MT_RF(5, 5), 0x84 }, 80 + { MT_RF(5, 6), 0x02 }, 81 + /* LDO */ 82 + { MT_RF(5, 7), 0x00 }, 83 + { MT_RF(5, 8), 0x00 }, 84 + { MT_RF(5, 9), 0x00 }, 85 + /* RX */ 86 + { MT_RF(5, 10), 0x51 }, 87 + { MT_RF(5, 11), 0x22 }, 88 + { MT_RF(5, 12), 0x22 }, 89 + { MT_RF(5, 13), 0x0F }, 90 + { MT_RF(5, 14), 0x47 }, 91 + { MT_RF(5, 15), 0x25 }, 92 + { MT_RF(5, 16), 0xC7 }, 93 + { MT_RF(5, 17), 0x00 }, 94 + { MT_RF(5, 18), 0x00 }, 95 + { MT_RF(5, 19), 0x30 }, 96 + { MT_RF(5, 20), 0x33 }, 97 + { MT_RF(5, 21), 0x02 }, 98 + { MT_RF(5, 22), 0x32 }, 99 + { MT_RF(5, 23), 0x00 }, 100 + { MT_RF(5, 24), 0x25 }, 101 + { MT_RF(5, 26), 0x00 }, 102 + { MT_RF(5, 27), 0x12 }, 103 + { MT_RF(5, 28), 0x0F }, 104 + { MT_RF(5, 29), 0x00 }, 105 + /* LOGEN */ 106 + { MT_RF(5, 30), 0x51 }, 107 + { MT_RF(5, 31), 0x35 }, 108 + { MT_RF(5, 32), 0x31 }, 109 + { MT_RF(5, 33), 0x31 }, 110 + { MT_RF(5, 34), 0x34 }, 111 + { MT_RF(5, 35), 0x03 }, 112 + { MT_RF(5, 36), 0x00 }, 113 + /* TX */ 114 + { MT_RF(5, 37), 0xDD }, 115 + { MT_RF(5, 38), 0xB3 }, 116 + { MT_RF(5, 39), 0x33 }, 117 + { MT_RF(5, 40), 0xB1 }, 118 + { MT_RF(5, 41), 0x71 }, 119 + { MT_RF(5, 42), 0xF2 }, 120 + { MT_RF(5, 43), 0x47 }, 121 + { MT_RF(5, 44), 0x77 }, 122 + { MT_RF(5, 45), 0x0E }, 123 + { MT_RF(5, 46), 0x10 }, 124 + { MT_RF(5, 47), 0x00 }, 125 + { MT_RF(5, 48), 0x53 }, 126 + { MT_RF(5, 49), 0x03 }, 127 + { MT_RF(5, 50), 0xEF }, 128 + { MT_RF(5, 51), 0xC7 }, 129 + { MT_RF(5, 52), 0x62 }, 130 + { MT_RF(5, 53), 0x62 }, 131 + { MT_RF(5, 54), 0x00 }, 132 + { MT_RF(5, 55), 0x00 }, 133 + { MT_RF(5, 56), 0x0F }, 134 + { MT_RF(5, 57), 0x0F }, 135 + { MT_RF(5, 58), 0x16 }, 136 + { MT_RF(5, 59), 0x16 }, 137 + { MT_RF(5, 60), 0x10 }, 138 + { MT_RF(5, 61), 0x10 }, 139 + { MT_RF(5, 62), 0xD0 }, 140 + { MT_RF(5, 63), 0x6C }, 141 + { MT_RF(5, 64), 0x58 }, 142 + { MT_RF(5, 65), 0x58 }, 143 + { MT_RF(5, 66), 0xF2 }, 144 + { MT_RF(5, 67), 0xE8 }, 145 + { MT_RF(5, 68), 0xF0 }, 146 + { MT_RF(5, 69), 0xF0 }, 147 + { MT_RF(5, 127), 0x04 }, 205 148 }; 206 149 207 150 static const struct mt76_reg_pair mt76x0_rf_5g_channel_0_tab[] = { 208 - /* 209 - Bank 6 - Channel 0 5G RF registers 210 - */ 211 - /* 212 - RX logic operation 213 - */ 214 - /* RF_R00 Change in SelectBandmt76x0 */ 215 - 216 - { MT_RF(6, 2), 0x0C}, 217 - { MT_RF(6, 3), 0x00}, 218 - 219 - /* 220 - TX logic operation 221 - */ 222 - { MT_RF(6, 4), 0x00}, 223 - { MT_RF(6, 5), 0x84}, 224 - { MT_RF(6, 6), 0x02}, 225 - 226 - /* 227 - LDO 228 - */ 229 - { MT_RF(6, 7), 0x00}, 230 - { MT_RF(6, 8), 0x00}, 231 - { MT_RF(6, 9), 0x00}, 232 - 233 - /* 234 - RX 235 - */ 236 - { MT_RF(6, 10), 0x00}, 237 - { MT_RF(6, 11), 0x01}, 238 - 239 - { MT_RF(6, 13), 0x23}, 240 - { MT_RF(6, 14), 0x00}, 241 - { MT_RF(6, 15), 0x04}, 242 - { MT_RF(6, 16), 0x22}, 243 - 244 - { MT_RF(6, 18), 0x08}, 245 - { MT_RF(6, 19), 0x00}, 246 - { MT_RF(6, 20), 0x00}, 247 - { MT_RF(6, 21), 0x00}, 248 - { MT_RF(6, 22), 0xFB}, 249 - 250 - /* 251 - LOGEN5G 252 - */ 253 - { MT_RF(6, 25), 0x76}, 254 - { MT_RF(6, 26), 0x24}, 255 - { MT_RF(6, 27), 0x04}, 256 - { MT_RF(6, 28), 0x00}, 257 - { MT_RF(6, 29), 0x00}, 258 - 259 - /* 260 - TX 261 - */ 262 - { MT_RF(6, 37), 0xBB}, 263 - { MT_RF(6, 38), 0xB3}, 264 - 265 - { MT_RF(6, 40), 0x33}, 266 - { MT_RF(6, 41), 0x33}, 267 - 268 - { MT_RF(6, 43), 0x03}, 269 - { MT_RF(6, 44), 0xB3}, 270 - 271 - { MT_RF(6, 46), 0x17}, 272 - { MT_RF(6, 47), 0x0E}, 273 - { MT_RF(6, 48), 0x10}, 274 - { MT_RF(6, 49), 0x07}, 275 - 276 - { MT_RF(6, 62), 0x00}, 277 - { MT_RF(6, 63), 0x00}, 278 - { MT_RF(6, 64), 0xF1}, 279 - { MT_RF(6, 65), 0x0F}, 151 + /* RX logic operation */ 152 + { MT_RF(6, 2), 0x0C }, 153 + { MT_RF(6, 3), 0x00 }, 154 + /* TX logic operation */ 155 + { MT_RF(6, 4), 0x00 }, 156 + { MT_RF(6, 5), 0x84 }, 157 + { MT_RF(6, 6), 0x02 }, 158 + /* LDO */ 159 + { MT_RF(6, 7), 0x00 }, 160 + { MT_RF(6, 8), 0x00 }, 161 + { MT_RF(6, 9), 0x00 }, 162 + /* RX */ 163 + { MT_RF(6, 10), 0x00 }, 164 + { MT_RF(6, 11), 0x01 }, 165 + { MT_RF(6, 13), 0x23 }, 166 + { MT_RF(6, 14), 0x00 }, 167 + { MT_RF(6, 15), 0x04 }, 168 + { MT_RF(6, 16), 0x22 }, 169 + { MT_RF(6, 18), 0x08 }, 170 + { MT_RF(6, 19), 0x00 }, 171 + { MT_RF(6, 20), 0x00 }, 172 + { MT_RF(6, 21), 0x00 }, 173 + { MT_RF(6, 22), 0xFB }, 174 + /* LOGEN5G */ 175 + { MT_RF(6, 25), 0x76 }, 176 + { MT_RF(6, 26), 0x24 }, 177 + { MT_RF(6, 27), 0x04 }, 178 + { MT_RF(6, 28), 0x00 }, 179 + { MT_RF(6, 29), 0x00 }, 180 + /* TX */ 181 + { MT_RF(6, 37), 0xBB }, 182 + { MT_RF(6, 38), 0xB3 }, 183 + { MT_RF(6, 40), 0x33 }, 184 + { MT_RF(6, 41), 0x33 }, 185 + { MT_RF(6, 43), 0x03 }, 186 + { MT_RF(6, 44), 0xB3 }, 187 + { MT_RF(6, 46), 0x17 }, 188 + { MT_RF(6, 47), 0x0E }, 189 + { MT_RF(6, 48), 0x10 }, 190 + { MT_RF(6, 49), 0x07 }, 191 + { MT_RF(6, 62), 0x00 }, 192 + { MT_RF(6, 63), 0x00 }, 193 + { MT_RF(6, 64), 0xF1 }, 194 + { MT_RF(6, 65), 0x0F }, 280 195 }; 281 196 282 197 static const struct mt76_reg_pair mt76x0_rf_vga_channel_0_tab[] = { 283 - /* 284 - Bank 7 - Channel 0 VGA RF registers 285 - */ 286 198 /* E3 CR */ 287 - { MT_RF(7, 0), 0x47}, /* Allow BBP/MAC to do calibration */ 288 - { MT_RF(7, 1), 0x00}, 289 - { MT_RF(7, 2), 0x00}, 290 - { MT_RF(7, 3), 0x00}, 291 - { MT_RF(7, 4), 0x00}, 292 - 293 - { MT_RF(7, 10), 0x13}, 294 - { MT_RF(7, 11), 0x0F}, 295 - { MT_RF(7, 12), 0x13}, /* For dcoc */ 296 - { MT_RF(7, 13), 0x13}, /* For dcoc */ 297 - { MT_RF(7, 14), 0x13}, /* For dcoc */ 298 - { MT_RF(7, 15), 0x20}, /* For dcoc */ 299 - { MT_RF(7, 16), 0x22}, /* For dcoc */ 300 - 301 - { MT_RF(7, 17), 0x7C}, 302 - 303 - { MT_RF(7, 18), 0x00}, 304 - { MT_RF(7, 19), 0x00}, 305 - { MT_RF(7, 20), 0x00}, 306 - { MT_RF(7, 21), 0xF1}, 307 - { MT_RF(7, 22), 0x11}, 308 - { MT_RF(7, 23), 0xC2}, 309 - { MT_RF(7, 24), 0x41}, 310 - { MT_RF(7, 25), 0x20}, 311 - { MT_RF(7, 26), 0x40}, 312 - { MT_RF(7, 27), 0xD7}, 313 - { MT_RF(7, 28), 0xA2}, 314 - { MT_RF(7, 29), 0x60}, 315 - { MT_RF(7, 30), 0x49}, 316 - { MT_RF(7, 31), 0x20}, 317 - { MT_RF(7, 32), 0x44}, 318 - { MT_RF(7, 33), 0xC1}, 319 - { MT_RF(7, 34), 0x60}, 320 - { MT_RF(7, 35), 0xC0}, 321 - 322 - { MT_RF(7, 61), 0x01}, 323 - 324 - { MT_RF(7, 72), 0x3C}, 325 - { MT_RF(7, 73), 0x34}, 326 - { MT_RF(7, 74), 0x00}, 199 + { MT_RF(7, 0), 0x47 }, 200 + { MT_RF(7, 1), 0x00 }, 201 + { MT_RF(7, 2), 0x00 }, 202 + { MT_RF(7, 3), 0x00 }, 203 + { MT_RF(7, 4), 0x00 }, 204 + { MT_RF(7, 10), 0x13 }, 205 + { MT_RF(7, 11), 0x0F }, 206 + { MT_RF(7, 12), 0x13 }, 207 + { MT_RF(7, 13), 0x13 }, 208 + { MT_RF(7, 14), 0x13 }, 209 + { MT_RF(7, 15), 0x20 }, 210 + { MT_RF(7, 16), 0x22 }, 211 + { MT_RF(7, 17), 0x7C }, 212 + { MT_RF(7, 18), 0x00 }, 213 + { MT_RF(7, 19), 0x00 }, 214 + { MT_RF(7, 20), 0x00 }, 215 + { MT_RF(7, 21), 0xF1 }, 216 + { MT_RF(7, 22), 0x11 }, 217 + { MT_RF(7, 23), 0xC2 }, 218 + { MT_RF(7, 24), 0x41 }, 219 + { MT_RF(7, 25), 0x20 }, 220 + { MT_RF(7, 26), 0x40 }, 221 + { MT_RF(7, 27), 0xD7 }, 222 + { MT_RF(7, 28), 0xA2 }, 223 + { MT_RF(7, 29), 0x60 }, 224 + { MT_RF(7, 30), 0x49 }, 225 + { MT_RF(7, 31), 0x20 }, 226 + { MT_RF(7, 32), 0x44 }, 227 + { MT_RF(7, 33), 0xC1 }, 228 + { MT_RF(7, 34), 0x60 }, 229 + { MT_RF(7, 35), 0xC0 }, 230 + { MT_RF(7, 61), 0x01 }, 231 + { MT_RF(7, 72), 0x3C }, 232 + { MT_RF(7, 73), 0x34 }, 233 + { MT_RF(7, 74), 0x00 }, 327 234 }; 328 235 329 236 static const struct mt76x0_rf_switch_item mt76x0_rf_bw_switch_tab[] = { 330 - /* Bank, Register, Bw/Band, Value */ 331 - { MT_RF(0, 17), RF_G_BAND | RF_BW_20, 0x00}, 332 - { MT_RF(0, 17), RF_G_BAND | RF_BW_40, 0x00}, 333 - { MT_RF(0, 17), RF_A_BAND | RF_BW_20, 0x00}, 334 - { MT_RF(0, 17), RF_A_BAND | RF_BW_40, 0x00}, 335 - { MT_RF(0, 17), RF_A_BAND | RF_BW_80, 0x00}, 336 - 337 - /* TODO: need to check B7.R6 & B7.R7 setting for 2.4G again @20121112 */ 338 - { MT_RF(7, 6), RF_G_BAND | RF_BW_20, 0x40}, 339 - { MT_RF(7, 6), RF_G_BAND | RF_BW_40, 0x1C}, 340 - { MT_RF(7, 6), RF_A_BAND | RF_BW_20, 0x40}, 341 - { MT_RF(7, 6), RF_A_BAND | RF_BW_40, 0x20}, 342 - { MT_RF(7, 6), RF_A_BAND | RF_BW_80, 0x10}, 343 - 344 - { MT_RF(7, 7), RF_G_BAND | RF_BW_20, 0x40}, 345 - { MT_RF(7, 7), RF_G_BAND | RF_BW_40, 0x20}, 346 - { MT_RF(7, 7), RF_A_BAND | RF_BW_20, 0x40}, 347 - { MT_RF(7, 7), RF_A_BAND | RF_BW_40, 0x20}, 348 - { MT_RF(7, 7), RF_A_BAND | RF_BW_80, 0x10}, 349 - 350 - { MT_RF(7, 8), RF_G_BAND | RF_BW_20, 0x03}, 351 - { MT_RF(7, 8), RF_G_BAND | RF_BW_40, 0x01}, 352 - { MT_RF(7, 8), RF_A_BAND | RF_BW_20, 0x03}, 353 - { MT_RF(7, 8), RF_A_BAND | RF_BW_40, 0x01}, 354 - { MT_RF(7, 8), RF_A_BAND | RF_BW_80, 0x00}, 355 - 356 - /* TODO: need to check B7.R58 & B7.R59 setting for 2.4G again @20121112 */ 357 - { MT_RF(7, 58), RF_G_BAND | RF_BW_20, 0x40}, 358 - { MT_RF(7, 58), RF_G_BAND | RF_BW_40, 0x40}, 359 - { MT_RF(7, 58), RF_A_BAND | RF_BW_20, 0x40}, 360 - { MT_RF(7, 58), RF_A_BAND | RF_BW_40, 0x40}, 361 - { MT_RF(7, 58), RF_A_BAND | RF_BW_80, 0x10}, 362 - 363 - { MT_RF(7, 59), RF_G_BAND | RF_BW_20, 0x40}, 364 - { MT_RF(7, 59), RF_G_BAND | RF_BW_40, 0x40}, 365 - { MT_RF(7, 59), RF_A_BAND | RF_BW_20, 0x40}, 366 - { MT_RF(7, 59), RF_A_BAND | RF_BW_40, 0x40}, 367 - { MT_RF(7, 59), RF_A_BAND | RF_BW_80, 0x10}, 368 - 369 - { MT_RF(7, 60), RF_G_BAND | RF_BW_20, 0xAA}, 370 - { MT_RF(7, 60), RF_G_BAND | RF_BW_40, 0xAA}, 371 - { MT_RF(7, 60), RF_A_BAND | RF_BW_20, 0xAA}, 372 - { MT_RF(7, 60), RF_A_BAND | RF_BW_40, 0xAA}, 373 - { MT_RF(7, 60), RF_A_BAND | RF_BW_80, 0xAA}, 374 - 375 - { MT_RF(7, 76), RF_BW_20, 0x40}, 376 - { MT_RF(7, 76), RF_BW_40, 0x40}, 377 - { MT_RF(7, 76), RF_BW_80, 0x10}, 378 - 379 - { MT_RF(7, 77), RF_BW_20, 0x40}, 380 - { MT_RF(7, 77), RF_BW_40, 0x40}, 381 - { MT_RF(7, 77), RF_BW_80, 0x10}, 237 + /* bank, reg bw/band value */ 238 + { MT_RF(0, 17), RF_G_BAND | RF_BW_20, 0x00 }, 239 + { MT_RF(0, 17), RF_G_BAND | RF_BW_40, 0x00 }, 240 + { MT_RF(0, 17), RF_A_BAND | RF_BW_20, 0x00 }, 241 + { MT_RF(0, 17), RF_A_BAND | RF_BW_40, 0x00 }, 242 + { MT_RF(0, 17), RF_A_BAND | RF_BW_80, 0x00 }, 243 + { MT_RF(7, 6), RF_G_BAND | RF_BW_20, 0x40 }, 244 + { MT_RF(7, 6), RF_G_BAND | RF_BW_40, 0x1C }, 245 + { MT_RF(7, 6), RF_A_BAND | RF_BW_20, 0x40 }, 246 + { MT_RF(7, 6), RF_A_BAND | RF_BW_40, 0x20 }, 247 + { MT_RF(7, 6), RF_A_BAND | RF_BW_80, 0x10 }, 248 + { MT_RF(7, 7), RF_G_BAND | RF_BW_20, 0x40 }, 249 + { MT_RF(7, 7), RF_G_BAND | RF_BW_40, 0x20 }, 250 + { MT_RF(7, 7), RF_A_BAND | RF_BW_20, 0x40 }, 251 + { MT_RF(7, 7), RF_A_BAND | RF_BW_40, 0x20 }, 252 + { MT_RF(7, 7), RF_A_BAND | RF_BW_80, 0x10 }, 253 + { MT_RF(7, 8), RF_G_BAND | RF_BW_20, 0x03 }, 254 + { MT_RF(7, 8), RF_G_BAND | RF_BW_40, 0x01 }, 255 + { MT_RF(7, 8), RF_A_BAND | RF_BW_20, 0x03 }, 256 + { MT_RF(7, 8), RF_A_BAND | RF_BW_40, 0x01 }, 257 + { MT_RF(7, 8), RF_A_BAND | RF_BW_80, 0x00 }, 258 + { MT_RF(7, 58), RF_G_BAND | RF_BW_20, 0x40 }, 259 + { MT_RF(7, 58), RF_G_BAND | RF_BW_40, 0x40 }, 260 + { MT_RF(7, 58), RF_A_BAND | RF_BW_20, 0x40 }, 261 + { MT_RF(7, 58), RF_A_BAND | RF_BW_40, 0x40 }, 262 + { MT_RF(7, 58), RF_A_BAND | RF_BW_80, 0x10 }, 263 + { MT_RF(7, 59), RF_G_BAND | RF_BW_20, 0x40 }, 264 + { MT_RF(7, 59), RF_G_BAND | RF_BW_40, 0x40 }, 265 + { MT_RF(7, 59), RF_A_BAND | RF_BW_20, 0x40 }, 266 + { MT_RF(7, 59), RF_A_BAND | RF_BW_40, 0x40 }, 267 + { MT_RF(7, 59), RF_A_BAND | RF_BW_80, 0x10 }, 268 + { MT_RF(7, 60), RF_G_BAND | RF_BW_20, 0xAA }, 269 + { MT_RF(7, 60), RF_G_BAND | RF_BW_40, 0xAA }, 270 + { MT_RF(7, 60), RF_A_BAND | RF_BW_20, 0xAA }, 271 + { MT_RF(7, 60), RF_A_BAND | RF_BW_40, 0xAA }, 272 + { MT_RF(7, 60), RF_A_BAND | RF_BW_80, 0xAA }, 273 + { MT_RF(7, 76), RF_BW_20, 0x40 }, 274 + { MT_RF(7, 76), RF_BW_40, 0x40 }, 275 + { MT_RF(7, 76), RF_BW_80, 0x10 }, 276 + { MT_RF(7, 77), RF_BW_20, 0x40 }, 277 + { MT_RF(7, 77), RF_BW_40, 0x40 }, 278 + { MT_RF(7, 77), RF_BW_80, 0x10 }, 382 279 }; 383 280 384 281 static const struct mt76x0_rf_switch_item mt76x0_rf_band_switch_tab[] = { 385 - /* Bank, Register, Bw/Band, Value */ 386 - { MT_RF(0, 16), RF_G_BAND, 0x20}, 387 - { MT_RF(0, 16), RF_A_BAND, 0x20}, 388 - 389 - { MT_RF(0, 18), RF_G_BAND, 0x00}, 390 - { MT_RF(0, 18), RF_A_BAND, 0x00}, 391 - 392 - { MT_RF(0, 39), RF_G_BAND, 0x36}, 393 - { MT_RF(0, 39), RF_A_BAND_LB, 0x34}, 394 - { MT_RF(0, 39), RF_A_BAND_MB, 0x33}, 395 - { MT_RF(0, 39), RF_A_BAND_HB, 0x31}, 396 - { MT_RF(0, 39), RF_A_BAND_11J, 0x36}, 397 - 398 - { MT_RF(6, 12), RF_A_BAND_LB, 0x44}, 399 - { MT_RF(6, 12), RF_A_BAND_MB, 0x44}, 400 - { MT_RF(6, 12), RF_A_BAND_HB, 0x55}, 401 - { MT_RF(6, 12), RF_A_BAND_11J, 0x44}, 402 - 403 - { MT_RF(6, 17), RF_A_BAND_LB, 0x02}, 404 - { MT_RF(6, 17), RF_A_BAND_MB, 0x00}, 405 - { MT_RF(6, 17), RF_A_BAND_HB, 0x00}, 406 - { MT_RF(6, 17), RF_A_BAND_11J, 0x05}, 407 - 408 - { MT_RF(6, 24), RF_A_BAND_LB, 0xA1}, 409 - { MT_RF(6, 24), RF_A_BAND_MB, 0x41}, 410 - { MT_RF(6, 24), RF_A_BAND_HB, 0x21}, 411 - { MT_RF(6, 24), RF_A_BAND_11J, 0xE1}, 412 - 413 - { MT_RF(6, 39), RF_A_BAND_LB, 0x36}, 414 - { MT_RF(6, 39), RF_A_BAND_MB, 0x34}, 415 - { MT_RF(6, 39), RF_A_BAND_HB, 0x32}, 416 - { MT_RF(6, 39), RF_A_BAND_11J, 0x37}, 417 - 418 - { MT_RF(6, 42), RF_A_BAND_LB, 0xFB}, 419 - { MT_RF(6, 42), RF_A_BAND_MB, 0xF3}, 420 - { MT_RF(6, 42), RF_A_BAND_HB, 0xEB}, 421 - { MT_RF(6, 42), RF_A_BAND_11J, 0xEB}, 422 - 423 - /* Move R6-R45, R50~R59 to mt76x0_RF_INT_PA_5G_Channel_0_RegTb/mt76x0_RF_EXT_PA_5G_Channel_0_RegTb */ 424 - 425 - { MT_RF(6, 127), RF_G_BAND, 0x84}, 426 - { MT_RF(6, 127), RF_A_BAND, 0x04}, 427 - 428 - { MT_RF(7, 5), RF_G_BAND, 0x40}, 429 - { MT_RF(7, 5), RF_A_BAND, 0x00}, 430 - 431 - { MT_RF(7, 9), RF_G_BAND, 0x00}, 432 - { MT_RF(7, 9), RF_A_BAND, 0x00}, 433 - 434 - { MT_RF(7, 70), RF_G_BAND, 0x00}, 435 - { MT_RF(7, 70), RF_A_BAND, 0x6D}, 436 - 437 - { MT_RF(7, 71), RF_G_BAND, 0x00}, 438 - { MT_RF(7, 71), RF_A_BAND, 0xB0}, 439 - 440 - { MT_RF(7, 78), RF_G_BAND, 0x00}, 441 - { MT_RF(7, 78), RF_A_BAND, 0x55}, 442 - 443 - { MT_RF(7, 79), RF_G_BAND, 0x00}, 444 - { MT_RF(7, 79), RF_A_BAND, 0x55}, 282 + /* bank, reg bw/band value */ 283 + { MT_RF(0, 16), RF_G_BAND, 0x20 }, 284 + { MT_RF(0, 16), RF_A_BAND, 0x20 }, 285 + { MT_RF(0, 18), RF_G_BAND, 0x00 }, 286 + { MT_RF(0, 18), RF_A_BAND, 0x00 }, 287 + { MT_RF(0, 39), RF_G_BAND, 0x36 }, 288 + { MT_RF(0, 39), RF_A_BAND_LB, 0x34 }, 289 + { MT_RF(0, 39), RF_A_BAND_MB, 0x33 }, 290 + { MT_RF(0, 39), RF_A_BAND_HB, 0x31 }, 291 + { MT_RF(0, 39), RF_A_BAND_11J, 0x36 }, 292 + { MT_RF(6, 12), RF_A_BAND_LB, 0x44 }, 293 + { MT_RF(6, 12), RF_A_BAND_MB, 0x44 }, 294 + { MT_RF(6, 12), RF_A_BAND_HB, 0x55 }, 295 + { MT_RF(6, 12), RF_A_BAND_11J, 0x44 }, 296 + { MT_RF(6, 17), RF_A_BAND_LB, 0x02 }, 297 + { MT_RF(6, 17), RF_A_BAND_MB, 0x00 }, 298 + { MT_RF(6, 17), RF_A_BAND_HB, 0x00 }, 299 + { MT_RF(6, 17), RF_A_BAND_11J, 0x05 }, 300 + { MT_RF(6, 24), RF_A_BAND_LB, 0xA1 }, 301 + { MT_RF(6, 24), RF_A_BAND_MB, 0x41 }, 302 + { MT_RF(6, 24), RF_A_BAND_HB, 0x21 }, 303 + { MT_RF(6, 24), RF_A_BAND_11J, 0xE1 }, 304 + { MT_RF(6, 39), RF_A_BAND_LB, 0x36 }, 305 + { MT_RF(6, 39), RF_A_BAND_MB, 0x34 }, 306 + { MT_RF(6, 39), RF_A_BAND_HB, 0x32 }, 307 + { MT_RF(6, 39), RF_A_BAND_11J, 0x37 }, 308 + { MT_RF(6, 42), RF_A_BAND_LB, 0xFB }, 309 + { MT_RF(6, 42), RF_A_BAND_MB, 0xF3 }, 310 + { MT_RF(6, 42), RF_A_BAND_HB, 0xEB }, 311 + { MT_RF(6, 42), RF_A_BAND_11J, 0xEB }, 312 + { MT_RF(6, 127), RF_G_BAND, 0x84 }, 313 + { MT_RF(6, 127), RF_A_BAND, 0x04 }, 314 + { MT_RF(7, 5), RF_G_BAND, 0x40 }, 315 + { MT_RF(7, 5), RF_A_BAND, 0x00 }, 316 + { MT_RF(7, 9), RF_G_BAND, 0x00 }, 317 + { MT_RF(7, 9), RF_A_BAND, 0x00 }, 318 + { MT_RF(7, 70), RF_G_BAND, 0x00 }, 319 + { MT_RF(7, 70), RF_A_BAND, 0x6D }, 320 + { MT_RF(7, 71), RF_G_BAND, 0x00 }, 321 + { MT_RF(7, 71), RF_A_BAND, 0xB0 }, 322 + { MT_RF(7, 78), RF_G_BAND, 0x00 }, 323 + { MT_RF(7, 78), RF_A_BAND, 0x55 }, 324 + { MT_RF(7, 79), RF_G_BAND, 0x00 }, 325 + { MT_RF(7, 79), RF_A_BAND, 0x55 }, 445 326 }; 446 327 447 328 static const struct mt76x0_freq_item mt76x0_frequency_plan[] = { 448 - {1, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xE2, 0x40, 0x02, 0x40, 0x02, 0, 0, 1, 0x28, 0, 0x30, 0, 0, 0x3}, /* Freq 2412 */ 449 - {2, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xE4, 0x40, 0x07, 0x40, 0x02, 0, 0, 1, 0xA1, 0, 0x30, 0, 0, 0x1}, /* Freq 2417 */ 450 - {3, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xE2, 0x40, 0x07, 0x40, 0x0B, 0, 0, 1, 0x50, 0, 0x30, 0, 0, 0x0}, /* Freq 2422 */ 451 - {4, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xD4, 0x40, 0x02, 0x40, 0x09, 0, 0, 1, 0x50, 0, 0x30, 0, 0, 0x0}, /* Freq 2427 */ 452 - {5, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x02, 0, 0, 1, 0xA2, 0, 0x30, 0, 0, 0x1}, /* Freq 2432 */ 453 - {6, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x07, 0, 0, 1, 0xA2, 0, 0x30, 0, 0, 0x1}, /* Freq 2437 */ 454 - {7, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xE2, 0x40, 0x02, 0x40, 0x07, 0, 0, 1, 0x28, 0, 0x30, 0, 0, 0x3}, /* Freq 2442 */ 455 - {8, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x02, 0, 0, 1, 0xA3, 0, 0x30, 0, 0, 0x1}, /* Freq 2447 */ 456 - {9, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xF2, 0x40, 0x07, 0x40, 0x0D, 0, 0, 1, 0x28, 0, 0x30, 0, 0, 0x3}, /* Freq 2452 */ 457 - {10, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xD4, 0x40, 0x02, 0x40, 0x09, 0, 0, 1, 0x51, 0, 0x30, 0, 0, 0x0}, /* Freq 2457 */ 458 - {11, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x02, 0, 0, 1, 0xA4, 0, 0x30, 0, 0, 0x1}, /* Freq 2462 */ 459 - {12, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x07, 0, 0, 1, 0xA4, 0, 0x30, 0, 0, 0x1}, /* Freq 2467 */ 460 - {13, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xF2, 0x40, 0x02, 0x40, 0x02, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 2472 */ 461 - {14, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xF2, 0x40, 0x02, 0x40, 0x04, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 2484 */ 462 - 463 - {183, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x28, 0, 0x30, 0, 0, 0x3}, /* Freq 4915 */ 464 - {184, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x00, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 4920 */ 465 - {185, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 4925 */ 466 - {187, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 4935 */ 467 - {188, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 4940 */ 468 - {189, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 4945 */ 469 - {192, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 4960 */ 470 - {196, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3}, /* Freq 4980 */ 471 - 472 - {36, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5180 */ 473 - {37, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5185 */ 474 - {38, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5190 */ 475 - {39, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5195 */ 476 - {40, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5200 */ 477 - {41, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x09, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5205 */ 478 - {42, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x05, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5210 */ 479 - {43, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0B, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5215 */ 480 - {44, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5220 */ 481 - {45, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0D, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5225 */ 482 - {46, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x07, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5230 */ 483 - {47, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0F, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5235 */ 484 - {48, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x08, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5240 */ 485 - {49, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x11, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5245 */ 486 - {50, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x09, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5250 */ 487 - {51, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x13, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5255 */ 488 - {52, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5260 */ 489 - {53, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5265 */ 490 - {54, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x0B, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5270 */ 491 - {55, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3}, /* Freq 5275 */ 492 - {56, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x00, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5280 */ 493 - {57, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5285 */ 494 - {58, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x01, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5290 */ 495 - {59, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5295 */ 496 - {60, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5300 */ 497 - {61, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5305 */ 498 - {62, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5310 */ 499 - {63, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5315 */ 500 - {64, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3}, /* Freq 5320 */ 501 - 502 - {100, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x2D, 0, 0x30, 0, 0, 0x3}, /* Freq 5500 */ 503 - {101, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x2D, 0, 0x30, 0, 0, 0x3}, /* Freq 5505 */ 504 - {102, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x0B, 0, 0, 1, 0x2D, 0, 0x30, 0, 0, 0x3}, /* Freq 5510 */ 505 - {103, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x2D, 0, 0x30, 0, 0, 0x3}, /* Freq 5515 */ 506 - {104, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x00, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5520 */ 507 - {105, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5525 */ 508 - {106, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x01, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5530 */ 509 - {107, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5535 */ 510 - {108, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5540 */ 511 - {109, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5545 */ 512 - {110, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5550 */ 513 - {111, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5555 */ 514 - {112, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5560 */ 515 - {113, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x09, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5565 */ 516 - {114, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x05, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5570 */ 517 - {115, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0B, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5575 */ 518 - {116, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5580 */ 519 - {117, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0D, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5585 */ 520 - {118, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x07, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5590 */ 521 - {119, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0F, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5595 */ 522 - {120, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x08, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5600 */ 523 - {121, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x11, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5605 */ 524 - {122, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x09, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5610 */ 525 - {123, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x13, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5615 */ 526 - {124, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5620 */ 527 - {125, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5625 */ 528 - {126, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x0B, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5630 */ 529 - {127, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3}, /* Freq 5635 */ 530 - {128, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x00, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5640 */ 531 - {129, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5645 */ 532 - {130, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x01, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5650 */ 533 - {131, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5655 */ 534 - {132, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5660 */ 535 - {133, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5665 */ 536 - {134, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5670 */ 537 - {135, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5675 */ 538 - {136, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5680 */ 539 - 540 - {137, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x09, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5685 */ 541 - {138, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x05, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5690 */ 542 - {139, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0B, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5695 */ 543 - {140, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5700 */ 544 - {141, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0D, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5705 */ 545 - {142, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x07, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5710 */ 546 - {143, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0F, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5715 */ 547 - {144, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x08, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5720 */ 548 - {145, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x11, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5725 */ 549 - {146, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x09, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5730 */ 550 - {147, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x13, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5735 */ 551 - {148, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5740 */ 552 - {149, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5745 */ 553 - {150, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x0B, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5750 */ 554 - {151, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3}, /* Freq 5755 */ 555 - {152, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x00, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5760 */ 556 - {153, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5765 */ 557 - {154, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x01, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5770 */ 558 - {155, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5775 */ 559 - {156, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5780 */ 560 - {157, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5785 */ 561 - {158, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5790 */ 562 - {159, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5795 */ 563 - {160, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5800 */ 564 - {161, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x09, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5805 */ 565 - {162, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x05, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5810 */ 566 - {163, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0B, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5815 */ 567 - {164, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5820 */ 568 - {165, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0D, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5825 */ 569 - {166, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x07, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5830 */ 570 - {167, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0F, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5835 */ 571 - {168, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x08, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5840 */ 572 - {169, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x11, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5845 */ 573 - {170, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x09, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5850 */ 574 - {171, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x13, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5855 */ 575 - {172, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5860 */ 576 - {173, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3}, /* Freq 5865 */ 329 + { 1, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xE2, 0x40, 0x02, 0x40, 0x02, 0, 0, 1, 0x28, 0, 0x30, 0, 0, 0x3 }, /* Freq 2412 */ 330 + { 2, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xE4, 0x40, 0x07, 0x40, 0x02, 0, 0, 1, 0xA1, 0, 0x30, 0, 0, 0x1 }, /* Freq 2417 */ 331 + { 3, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xE2, 0x40, 0x07, 0x40, 0x0B, 0, 0, 1, 0x50, 0, 0x30, 0, 0, 0x0 }, /* Freq 2422 */ 332 + { 4, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xD4, 0x40, 0x02, 0x40, 0x09, 0, 0, 1, 0x50, 0, 0x30, 0, 0, 0x0 }, /* Freq 2427 */ 333 + { 5, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x02, 0, 0, 1, 0xA2, 0, 0x30, 0, 0, 0x1 }, /* Freq 2432 */ 334 + { 6, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x07, 0, 0, 1, 0xA2, 0, 0x30, 0, 0, 0x1 }, /* Freq 2437 */ 335 + { 7, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xE2, 0x40, 0x02, 0x40, 0x07, 0, 0, 1, 0x28, 0, 0x30, 0, 0, 0x3 }, /* Freq 2442 */ 336 + { 8, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x02, 0, 0, 1, 0xA3, 0, 0x30, 0, 0, 0x1 }, /* Freq 2447 */ 337 + { 9, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xF2, 0x40, 0x07, 0x40, 0x0D, 0, 0, 1, 0x28, 0, 0x30, 0, 0, 0x3 }, /* Freq 2452 */ 338 + { 10, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xD4, 0x40, 0x02, 0x40, 0x09, 0, 0, 1, 0x51, 0, 0x30, 0, 0, 0x0 }, /* Freq 2457 */ 339 + { 11, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x02, 0, 0, 1, 0xA4, 0, 0x30, 0, 0, 0x1 }, /* Freq 2462 */ 340 + { 12, RF_G_BAND, 0x02, 0x3F, 0x3C, 0xDD, 0xD4, 0x40, 0x07, 0x40, 0x07, 0, 0, 1, 0xA4, 0, 0x30, 0, 0, 0x1 }, /* Freq 2467 */ 341 + { 13, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xF2, 0x40, 0x02, 0x40, 0x02, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 2472 */ 342 + { 14, RF_G_BAND, 0x02, 0x3F, 0x28, 0xDD, 0xF2, 0x40, 0x02, 0x40, 0x04, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 2484 */ 343 + { 183, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x28, 0, 0x30, 0, 0, 0x3 }, /* Freq 4915 */ 344 + { 184, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x00, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 4920 */ 345 + { 185, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 4925 */ 346 + { 187, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 4935 */ 347 + { 188, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 4940 */ 348 + { 189, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 4945 */ 349 + { 192, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 4960 */ 350 + { 196, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x29, 0, 0x30, 0, 0, 0x3 }, /* Freq 4980 */ 351 + { 36, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5180 */ 352 + { 37, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5185 */ 353 + { 38, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5190 */ 354 + { 39, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5195 */ 355 + { 40, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5200 */ 356 + { 41, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x09, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5205 */ 357 + { 42, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x05, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5210 */ 358 + { 43, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0B, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5215 */ 359 + { 44, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5220 */ 360 + { 45, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0D, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5225 */ 361 + { 46, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x07, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5230 */ 362 + { 47, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0F, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5235 */ 363 + { 48, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x08, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5240 */ 364 + { 49, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x11, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5245 */ 365 + { 50, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x09, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5250 */ 366 + { 51, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x13, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5255 */ 367 + { 52, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5260 */ 368 + { 53, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5265 */ 369 + { 54, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x0B, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5270 */ 370 + { 55, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x2B, 0, 0x30, 0, 0, 0x3 }, /* Freq 5275 */ 371 + { 56, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x00, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5280 */ 372 + { 57, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5285 */ 373 + { 58, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x01, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5290 */ 374 + { 59, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5295 */ 375 + { 60, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5300 */ 376 + { 61, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5305 */ 377 + { 62, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5310 */ 378 + { 63, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5315 */ 379 + { 64, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x2C, 0, 0x30, 0, 0, 0x3 }, /* Freq 5320 */ 380 + { 100, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x2D, 0, 0x30, 0, 0, 0x3 }, /* Freq 5500 */ 381 + { 101, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x2D, 0, 0x30, 0, 0, 0x3 }, /* Freq 5505 */ 382 + { 102, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x0B, 0, 0, 1, 0x2D, 0, 0x30, 0, 0, 0x3 }, /* Freq 5510 */ 383 + { 103, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x2D, 0, 0x30, 0, 0, 0x3 }, /* Freq 5515 */ 384 + { 104, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x00, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5520 */ 385 + { 105, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5525 */ 386 + { 106, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x01, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5530 */ 387 + { 107, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5535 */ 388 + { 108, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5540 */ 389 + { 109, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5545 */ 390 + { 110, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5550 */ 391 + { 111, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5555 */ 392 + { 112, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5560 */ 393 + { 113, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x09, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5565 */ 394 + { 114, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x05, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5570 */ 395 + { 115, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0B, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5575 */ 396 + { 116, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5580 */ 397 + { 117, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0D, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5585 */ 398 + { 118, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x07, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5590 */ 399 + { 119, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0F, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5595 */ 400 + { 120, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x08, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5600 */ 401 + { 121, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x11, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5605 */ 402 + { 122, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x09, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5610 */ 403 + { 123, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x13, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5615 */ 404 + { 124, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5620 */ 405 + { 125, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5625 */ 406 + { 126, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x0B, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5630 */ 407 + { 127, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x2E, 0, 0x30, 0, 0, 0x3 }, /* Freq 5635 */ 408 + { 128, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x00, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5640 */ 409 + { 129, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5645 */ 410 + { 130, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x01, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5650 */ 411 + { 131, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5655 */ 412 + { 132, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5660 */ 413 + { 133, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5665 */ 414 + { 134, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5670 */ 415 + { 135, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5675 */ 416 + { 136, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5680 */ 417 + { 137, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x09, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5685 */ 418 + { 138, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x05, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5690 */ 419 + { 139, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0B, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5695 */ 420 + { 140, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5700 */ 421 + { 141, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0D, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5705 */ 422 + { 142, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x07, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5710 */ 423 + { 143, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0F, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5715 */ 424 + { 144, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x08, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5720 */ 425 + { 145, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x11, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5725 */ 426 + { 146, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x09, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5730 */ 427 + { 147, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x13, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5735 */ 428 + { 148, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5740 */ 429 + { 149, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5745 */ 430 + { 150, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x0B, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5750 */ 431 + { 151, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x70, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x17, 0, 0, 1, 0x2F, 0, 0x30, 0, 0, 0x3 }, /* Freq 5755 */ 432 + { 152, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x00, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5760 */ 433 + { 153, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x01, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5765 */ 434 + { 154, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x01, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5770 */ 435 + { 155, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x03, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5775 */ 436 + { 156, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x02, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5780 */ 437 + { 157, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x05, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5785 */ 438 + { 158, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x03, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5790 */ 439 + { 159, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x07, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5795 */ 440 + { 160, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x04, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5800 */ 441 + { 161, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x09, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5805 */ 442 + { 162, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x05, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5810 */ 443 + { 163, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0B, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5815 */ 444 + { 164, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x06, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5820 */ 445 + { 165, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0D, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5825 */ 446 + { 166, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0xDD, 0xD2, 0x40, 0x04, 0x40, 0x07, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5830 */ 447 + { 167, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x0F, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5835 */ 448 + { 168, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x08, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5840 */ 449 + { 169, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x11, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5845 */ 450 + { 170, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x09, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5850 */ 451 + { 171, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x13, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5855 */ 452 + { 172, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x30, 0x97, 0xD2, 0x40, 0x04, 0x40, 0x0A, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5860 */ 453 + { 173, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x68, 0xDD, 0xD2, 0x40, 0x10, 0x40, 0x15, 0, 0, 1, 0x30, 0, 0x30, 0, 0, 0x3 }, /* Freq 5865 */ 577 454 }; 578 455 579 456 static const struct mt76x0_freq_item mt76x0_sdm_frequency_plan[] = { 580 - {1, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0xCCCC, 0x3}, /* Freq 2412 */ 581 - {2, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x12222, 0x3}, /* Freq 2417 */ 582 - {3, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x17777, 0x3}, /* Freq 2422 */ 583 - {4, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x1CCCC, 0x3}, /* Freq 2427 */ 584 - {5, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x22222, 0x3}, /* Freq 2432 */ 585 - {6, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x27777, 0x3}, /* Freq 2437 */ 586 - {7, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x2CCCC, 0x3}, /* Freq 2442 */ 587 - {8, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x32222, 0x3}, /* Freq 2447 */ 588 - {9, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x37777, 0x3}, /* Freq 2452 */ 589 - {10, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x3CCCC, 0x3}, /* Freq 2457 */ 590 - {11, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0x2222, 0x3}, /* Freq 2462 */ 591 - {12, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0x7777, 0x3}, /* Freq 2467 */ 592 - {13, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0xCCCC, 0x3}, /* Freq 2472 */ 593 - {14, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0x19999, 0x3}, /* Freq 2484 */ 594 - 595 - {183, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x28, 0, 0x0, 0x8, 0x3D555, 0x3}, /* Freq 4915 */ 596 - {184, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0x0, 0x3}, /* Freq 4920 */ 597 - {185, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0x2AAA, 0x3}, /* Freq 4925 */ 598 - {187, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0x8000, 0x3}, /* Freq 4935 */ 599 - {188, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0xAAAA, 0x3}, /* Freq 4940 */ 600 - {189, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0xD555, 0x3}, /* Freq 4945 */ 601 - {192, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0x15555, 0x3}, /* Freq 4960 */ 602 - {196, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x29, 0, 0x0, 0x8, 0x20000, 0x3}, /* Freq 4980 */ 603 - 604 - {36, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0xAAAA, 0x3}, /* Freq 5180 */ 605 - {37, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0xD555, 0x3}, /* Freq 5185 */ 606 - {38, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x10000, 0x3}, /* Freq 5190 */ 607 - {39, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x12AAA, 0x3}, /* Freq 5195 */ 608 - {40, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x15555, 0x3}, /* Freq 5200 */ 609 - {41, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x18000, 0x3}, /* Freq 5205 */ 610 - {42, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x1AAAA, 0x3}, /* Freq 5210 */ 611 - {43, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x1D555, 0x3}, /* Freq 5215 */ 612 - {44, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x20000, 0x3}, /* Freq 5220 */ 613 - {45, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x22AAA, 0x3}, /* Freq 5225 */ 614 - {46, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x25555, 0x3}, /* Freq 5230 */ 615 - {47, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x28000, 0x3}, /* Freq 5235 */ 616 - {48, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x2AAAA, 0x3}, /* Freq 5240 */ 617 - {49, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x2D555, 0x3}, /* Freq 5245 */ 618 - {50, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x30000, 0x3}, /* Freq 5250 */ 619 - {51, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x32AAA, 0x3}, /* Freq 5255 */ 620 - {52, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x35555, 0x3}, /* Freq 5260 */ 621 - {53, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x38000, 0x3}, /* Freq 5265 */ 622 - {54, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x3AAAA, 0x3}, /* Freq 5270 */ 623 - {55, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2B, 0, 0x0, 0x8, 0x3D555, 0x3}, /* Freq 5275 */ 624 - {56, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x00000, 0x3}, /* Freq 5280 */ 625 - {57, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x02AAA, 0x3}, /* Freq 5285 */ 626 - {58, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x05555, 0x3}, /* Freq 5290 */ 627 - {59, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x08000, 0x3}, /* Freq 5295 */ 628 - {60, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x0AAAA, 0x3}, /* Freq 5300 */ 629 - {61, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x0D555, 0x3}, /* Freq 5305 */ 630 - {62, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x10000, 0x3}, /* Freq 5310 */ 631 - {63, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x12AAA, 0x3}, /* Freq 5315 */ 632 - {64, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2C, 0, 0x0, 0x8, 0x15555, 0x3}, /* Freq 5320 */ 633 - 634 - {100, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2D, 0, 0x0, 0x8, 0x35555, 0x3}, /* Freq 5500 */ 635 - {101, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2D, 0, 0x0, 0x8, 0x38000, 0x3}, /* Freq 5505 */ 636 - {102, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2D, 0, 0x0, 0x8, 0x3AAAA, 0x3}, /* Freq 5510 */ 637 - {103, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2D, 0, 0x0, 0x8, 0x3D555, 0x3}, /* Freq 5515 */ 638 - {104, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x00000, 0x3}, /* Freq 5520 */ 639 - {105, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x02AAA, 0x3}, /* Freq 5525 */ 640 - {106, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x05555, 0x3}, /* Freq 5530 */ 641 - {107, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x08000, 0x3}, /* Freq 5535 */ 642 - {108, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x0AAAA, 0x3}, /* Freq 5540 */ 643 - {109, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x0D555, 0x3}, /* Freq 5545 */ 644 - {110, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x10000, 0x3}, /* Freq 5550 */ 645 - {111, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x12AAA, 0x3}, /* Freq 5555 */ 646 - {112, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x15555, 0x3}, /* Freq 5560 */ 647 - {113, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x18000, 0x3}, /* Freq 5565 */ 648 - {114, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x1AAAA, 0x3}, /* Freq 5570 */ 649 - {115, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x1D555, 0x3}, /* Freq 5575 */ 650 - {116, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x20000, 0x3}, /* Freq 5580 */ 651 - {117, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x22AAA, 0x3}, /* Freq 5585 */ 652 - {118, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x25555, 0x3}, /* Freq 5590 */ 653 - {119, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x28000, 0x3}, /* Freq 5595 */ 654 - {120, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x2AAAA, 0x3}, /* Freq 5600 */ 655 - {121, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x2D555, 0x3}, /* Freq 5605 */ 656 - {122, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x30000, 0x3}, /* Freq 5610 */ 657 - {123, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x32AAA, 0x3}, /* Freq 5615 */ 658 - {124, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x35555, 0x3}, /* Freq 5620 */ 659 - {125, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x38000, 0x3}, /* Freq 5625 */ 660 - {126, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x3AAAA, 0x3}, /* Freq 5630 */ 661 - {127, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2E, 0, 0x0, 0x8, 0x3D555, 0x3}, /* Freq 5635 */ 662 - {128, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x00000, 0x3}, /* Freq 5640 */ 663 - {129, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x02AAA, 0x3}, /* Freq 5645 */ 664 - {130, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x05555, 0x3}, /* Freq 5650 */ 665 - {131, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x08000, 0x3}, /* Freq 5655 */ 666 - {132, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x0AAAA, 0x3}, /* Freq 5660 */ 667 - {133, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x0D555, 0x3}, /* Freq 5665 */ 668 - {134, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x10000, 0x3}, /* Freq 5670 */ 669 - {135, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x12AAA, 0x3}, /* Freq 5675 */ 670 - {136, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x15555, 0x3}, /* Freq 5680 */ 671 - 672 - {137, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x18000, 0x3}, /* Freq 5685 */ 673 - {138, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x1AAAA, 0x3}, /* Freq 5690 */ 674 - {139, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x1D555, 0x3}, /* Freq 5695 */ 675 - {140, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x20000, 0x3}, /* Freq 5700 */ 676 - {141, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x22AAA, 0x3}, /* Freq 5705 */ 677 - {142, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x25555, 0x3}, /* Freq 5710 */ 678 - {143, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x28000, 0x3}, /* Freq 5715 */ 679 - {144, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x2AAAA, 0x3}, /* Freq 5720 */ 680 - {145, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x2D555, 0x3}, /* Freq 5725 */ 681 - {146, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x30000, 0x3}, /* Freq 5730 */ 682 - {147, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x32AAA, 0x3}, /* Freq 5735 */ 683 - {148, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x35555, 0x3}, /* Freq 5740 */ 684 - {149, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x38000, 0x3}, /* Freq 5745 */ 685 - {150, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x3AAAA, 0x3}, /* Freq 5750 */ 686 - {151, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x2F, 0, 0x0, 0x8, 0x3D555, 0x3}, /* Freq 5755 */ 687 - {152, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x00000, 0x3}, /* Freq 5760 */ 688 - {153, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x02AAA, 0x3}, /* Freq 5765 */ 689 - {154, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x05555, 0x3}, /* Freq 5770 */ 690 - {155, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x08000, 0x3}, /* Freq 5775 */ 691 - {156, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x0AAAA, 0x3}, /* Freq 5780 */ 692 - {157, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x0D555, 0x3}, /* Freq 5785 */ 693 - {158, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x10000, 0x3}, /* Freq 5790 */ 694 - {159, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x12AAA, 0x3}, /* Freq 5795 */ 695 - {160, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x15555, 0x3}, /* Freq 5800 */ 696 - {161, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x18000, 0x3}, /* Freq 5805 */ 697 - {162, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x1AAAA, 0x3}, /* Freq 5810 */ 698 - {163, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x1D555, 0x3}, /* Freq 5815 */ 699 - {164, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x20000, 0x3}, /* Freq 5820 */ 700 - {165, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x22AAA, 0x3}, /* Freq 5825 */ 701 - {166, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x25555, 0x3}, /* Freq 5830 */ 702 - {167, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x28000, 0x3}, /* Freq 5835 */ 703 - {168, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x2AAAA, 0x3}, /* Freq 5840 */ 704 - {169, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x2D555, 0x3}, /* Freq 5845 */ 705 - {170, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x30000, 0x3}, /* Freq 5850 */ 706 - {171, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x32AAA, 0x3}, /* Freq 5855 */ 707 - {172, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x35555, 0x3}, /* Freq 5860 */ 708 - {173, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0/*0 -> 1*/, 0, 0, 0x30, 0, 0x0, 0x8, 0x38000, 0x3}, /* Freq 5865 */ 457 + { 1, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x0CCCC, 0x3 }, /* Freq 2412 */ 458 + { 2, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x12222, 0x3 }, /* Freq 2417 */ 459 + { 3, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x17777, 0x3 }, /* Freq 2422 */ 460 + { 4, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x1CCCC, 0x3 }, /* Freq 2427 */ 461 + { 5, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x22222, 0x3 }, /* Freq 2432 */ 462 + { 6, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x27777, 0x3 }, /* Freq 2437 */ 463 + { 7, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x2CCCC, 0x3 }, /* Freq 2442 */ 464 + { 8, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x32222, 0x3 }, /* Freq 2447 */ 465 + { 9, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x37777, 0x3 }, /* Freq 2452 */ 466 + { 10, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x3CCCC, 0x3 }, /* Freq 2457 */ 467 + { 11, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x02222, 0x3 }, /* Freq 2462 */ 468 + { 12, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x07777, 0x3 }, /* Freq 2467 */ 469 + { 13, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x0CCCC, 0x3 }, /* Freq 2472 */ 470 + { 14, RF_G_BAND, 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x19999, 0x3 }, /* Freq 2484 */ 471 + { 183, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x28, 0, 0x0, 0x8, 0x3D555, 0x3 }, /* Freq 4915 */ 472 + { 184, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x00000, 0x3 }, /* Freq 4920 */ 473 + { 185, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x02AAA, 0x3 }, /* Freq 4925 */ 474 + { 187, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x08000, 0x3 }, /* Freq 4935 */ 475 + { 188, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x0AAAA, 0x3 }, /* Freq 4940 */ 476 + { 189, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x0D555, 0x3 }, /* Freq 4945 */ 477 + { 192, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x15555, 0x3 }, /* Freq 4960 */ 478 + { 196, (RF_A_BAND | RF_A_BAND_11J), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x29, 0, 0x0, 0x8, 0x20000, 0x3 }, /* Freq 4980 */ 479 + { 36, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x0AAAA, 0x3 }, /* Freq 5180 */ 480 + { 37, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x0D555, 0x3 }, /* Freq 5185 */ 481 + { 38, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x10000, 0x3 }, /* Freq 5190 */ 482 + { 39, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x12AAA, 0x3 }, /* Freq 5195 */ 483 + { 40, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x15555, 0x3 }, /* Freq 5200 */ 484 + { 41, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x18000, 0x3 }, /* Freq 5205 */ 485 + { 42, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x1AAAA, 0x3 }, /* Freq 5210 */ 486 + { 43, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x1D555, 0x3 }, /* Freq 5215 */ 487 + { 44, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x20000, 0x3 }, /* Freq 5220 */ 488 + { 45, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x22AAA, 0x3 }, /* Freq 5225 */ 489 + { 46, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x25555, 0x3 }, /* Freq 5230 */ 490 + { 47, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x28000, 0x3 }, /* Freq 5235 */ 491 + { 48, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x2AAAA, 0x3 }, /* Freq 5240 */ 492 + { 49, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x2D555, 0x3 }, /* Freq 5245 */ 493 + { 50, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x30000, 0x3 }, /* Freq 5250 */ 494 + { 51, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x32AAA, 0x3 }, /* Freq 5255 */ 495 + { 52, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x35555, 0x3 }, /* Freq 5260 */ 496 + { 53, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x38000, 0x3 }, /* Freq 5265 */ 497 + { 54, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x3AAAA, 0x3 }, /* Freq 5270 */ 498 + { 55, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2B, 0, 0x0, 0x8, 0x3D555, 0x3 }, /* Freq 5275 */ 499 + { 56, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x00000, 0x3 }, /* Freq 5280 */ 500 + { 57, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x02AAA, 0x3 }, /* Freq 5285 */ 501 + { 58, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x05555, 0x3 }, /* Freq 5290 */ 502 + { 59, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x08000, 0x3 }, /* Freq 5295 */ 503 + { 60, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x0AAAA, 0x3 }, /* Freq 5300 */ 504 + { 61, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x0D555, 0x3 }, /* Freq 5305 */ 505 + { 62, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x10000, 0x3 }, /* Freq 5310 */ 506 + { 63, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x12AAA, 0x3 }, /* Freq 5315 */ 507 + { 64, (RF_A_BAND | RF_A_BAND_LB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2C, 0, 0x0, 0x8, 0x15555, 0x3 }, /* Freq 5320 */ 508 + { 100, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2D, 0, 0x0, 0x8, 0x35555, 0x3 }, /* Freq 5500 */ 509 + { 101, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2D, 0, 0x0, 0x8, 0x38000, 0x3 }, /* Freq 5505 */ 510 + { 102, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2D, 0, 0x0, 0x8, 0x3AAAA, 0x3 }, /* Freq 5510 */ 511 + { 103, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2D, 0, 0x0, 0x8, 0x3D555, 0x3 }, /* Freq 5515 */ 512 + { 104, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x00000, 0x3 }, /* Freq 5520 */ 513 + { 105, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x02AAA, 0x3 }, /* Freq 5525 */ 514 + { 106, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x05555, 0x3 }, /* Freq 5530 */ 515 + { 107, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x08000, 0x3 }, /* Freq 5535 */ 516 + { 108, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x0AAAA, 0x3 }, /* Freq 5540 */ 517 + { 109, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x0D555, 0x3 }, /* Freq 5545 */ 518 + { 110, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x10000, 0x3 }, /* Freq 5550 */ 519 + { 111, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x12AAA, 0x3 }, /* Freq 5555 */ 520 + { 112, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x15555, 0x3 }, /* Freq 5560 */ 521 + { 113, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x18000, 0x3 }, /* Freq 5565 */ 522 + { 114, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x1AAAA, 0x3 }, /* Freq 5570 */ 523 + { 115, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x1D555, 0x3 }, /* Freq 5575 */ 524 + { 116, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x20000, 0x3 }, /* Freq 5580 */ 525 + { 117, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x22AAA, 0x3 }, /* Freq 5585 */ 526 + { 118, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x25555, 0x3 }, /* Freq 5590 */ 527 + { 119, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x28000, 0x3 }, /* Freq 5595 */ 528 + { 120, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x2AAAA, 0x3 }, /* Freq 5600 */ 529 + { 121, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x2D555, 0x3 }, /* Freq 5605 */ 530 + { 122, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x30000, 0x3 }, /* Freq 5610 */ 531 + { 123, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x32AAA, 0x3 }, /* Freq 5615 */ 532 + { 124, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x35555, 0x3 }, /* Freq 5620 */ 533 + { 125, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x38000, 0x3 }, /* Freq 5625 */ 534 + { 126, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x3AAAA, 0x3 }, /* Freq 5630 */ 535 + { 127, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2E, 0, 0x0, 0x8, 0x3D555, 0x3 }, /* Freq 5635 */ 536 + { 128, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x00000, 0x3 }, /* Freq 5640 */ 537 + { 129, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x02AAA, 0x3 }, /* Freq 5645 */ 538 + { 130, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x05555, 0x3 }, /* Freq 5650 */ 539 + { 131, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x08000, 0x3 }, /* Freq 5655 */ 540 + { 132, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x0AAAA, 0x3 }, /* Freq 5660 */ 541 + { 133, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x0D555, 0x3 }, /* Freq 5665 */ 542 + { 134, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x10000, 0x3 }, /* Freq 5670 */ 543 + { 135, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x12AAA, 0x3 }, /* Freq 5675 */ 544 + { 136, (RF_A_BAND | RF_A_BAND_MB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x15555, 0x3 }, /* Freq 5680 */ 545 + { 137, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x18000, 0x3 }, /* Freq 5685 */ 546 + { 138, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x1AAAA, 0x3 }, /* Freq 5690 */ 547 + { 139, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x1D555, 0x3 }, /* Freq 5695 */ 548 + { 140, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x20000, 0x3 }, /* Freq 5700 */ 549 + { 141, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x22AAA, 0x3 }, /* Freq 5705 */ 550 + { 142, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x25555, 0x3 }, /* Freq 5710 */ 551 + { 143, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x28000, 0x3 }, /* Freq 5715 */ 552 + { 144, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x2AAAA, 0x3 }, /* Freq 5720 */ 553 + { 145, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x2D555, 0x3 }, /* Freq 5725 */ 554 + { 146, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x30000, 0x3 }, /* Freq 5730 */ 555 + { 147, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x32AAA, 0x3 }, /* Freq 5735 */ 556 + { 148, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x35555, 0x3 }, /* Freq 5740 */ 557 + { 149, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x38000, 0x3 }, /* Freq 5745 */ 558 + { 150, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x3AAAA, 0x3 }, /* Freq 5750 */ 559 + { 151, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x2F, 0, 0x0, 0x8, 0x3D555, 0x3 }, /* Freq 5755 */ 560 + { 152, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x00000, 0x3 }, /* Freq 5760 */ 561 + { 153, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x02AAA, 0x3 }, /* Freq 5765 */ 562 + { 154, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x05555, 0x3 }, /* Freq 5770 */ 563 + { 155, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x08000, 0x3 }, /* Freq 5775 */ 564 + { 156, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x0AAAA, 0x3 }, /* Freq 5780 */ 565 + { 157, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x0D555, 0x3 }, /* Freq 5785 */ 566 + { 158, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x10000, 0x3 }, /* Freq 5790 */ 567 + { 159, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x12AAA, 0x3 }, /* Freq 5795 */ 568 + { 160, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x15555, 0x3 }, /* Freq 5800 */ 569 + { 161, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x18000, 0x3 }, /* Freq 5805 */ 570 + { 162, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x1AAAA, 0x3 }, /* Freq 5810 */ 571 + { 163, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x1D555, 0x3 }, /* Freq 5815 */ 572 + { 164, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x20000, 0x3 }, /* Freq 5820 */ 573 + { 165, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x22AAA, 0x3 }, /* Freq 5825 */ 574 + { 166, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x25555, 0x3 }, /* Freq 5830 */ 575 + { 167, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x28000, 0x3 }, /* Freq 5835 */ 576 + { 168, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x2AAAA, 0x3 }, /* Freq 5840 */ 577 + { 169, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x2D555, 0x3 }, /* Freq 5845 */ 578 + { 170, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x30000, 0x3 }, /* Freq 5850 */ 579 + { 171, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x32AAA, 0x3 }, /* Freq 5855 */ 580 + { 172, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x35555, 0x3 }, /* Freq 5860 */ 581 + { 173, (RF_A_BAND | RF_A_BAND_HB), 0x02, 0x3F, 0x7F, 0xDD, 0xC3, 0x40, 0x0, 0x80, 0x0, 0, 0, 0, 0x30, 0, 0x0, 0x8, 0x38000, 0x3 }, /* Freq 5865 */ 709 582 }; 710 583 711 584 static const u8 mt76x0_sdm_channel[] = { 712 - 183, 185, 43, 45, 54, 55, 57, 58, 102, 103, 105, 106, 115, 117, 126, 127, 129, 130, 139, 141, 150, 151, 153, 154, 163, 165 585 + 183, 185, 43, 45, 586 + 54, 55, 57, 58, 587 + 102, 103, 105, 106, 588 + 115, 117, 126, 127, 589 + 129, 130, 139, 141, 590 + 150, 151, 153, 154, 591 + 163, 165 713 592 }; 714 593 715 594 static const struct mt76x0_rf_switch_item mt76x0_rf_ext_pa_tab[] = { 716 - { MT_RF(6, 45), RF_A_BAND_LB, 0x63}, 717 - { MT_RF(6, 45), RF_A_BAND_MB, 0x43}, 718 - { MT_RF(6, 45), RF_A_BAND_HB, 0x33}, 719 - { MT_RF(6, 45), RF_A_BAND_11J, 0x73}, 720 - 721 - { MT_RF(6, 50), RF_A_BAND_LB, 0x02}, 722 - { MT_RF(6, 50), RF_A_BAND_MB, 0x02}, 723 - { MT_RF(6, 50), RF_A_BAND_HB, 0x02}, 724 - { MT_RF(6, 50), RF_A_BAND_11J, 0x02}, 725 - 726 - { MT_RF(6, 51), RF_A_BAND_LB, 0x02}, 727 - { MT_RF(6, 51), RF_A_BAND_MB, 0x02}, 728 - { MT_RF(6, 51), RF_A_BAND_HB, 0x02}, 729 - { MT_RF(6, 51), RF_A_BAND_11J, 0x02}, 730 - 731 - { MT_RF(6, 52), RF_A_BAND_LB, 0x08}, 732 - { MT_RF(6, 52), RF_A_BAND_MB, 0x08}, 733 - { MT_RF(6, 52), RF_A_BAND_HB, 0x08}, 734 - { MT_RF(6, 52), RF_A_BAND_11J, 0x08}, 735 - 736 - { MT_RF(6, 53), RF_A_BAND_LB, 0x08}, 737 - { MT_RF(6, 53), RF_A_BAND_MB, 0x08}, 738 - { MT_RF(6, 53), RF_A_BAND_HB, 0x08}, 739 - { MT_RF(6, 53), RF_A_BAND_11J, 0x08}, 740 - 741 - { MT_RF(6, 54), RF_A_BAND_LB, 0x0A}, 742 - { MT_RF(6, 54), RF_A_BAND_MB, 0x0A}, 743 - { MT_RF(6, 54), RF_A_BAND_HB, 0x0A}, 744 - { MT_RF(6, 54), RF_A_BAND_11J, 0x0A}, 745 - 746 - { MT_RF(6, 55), RF_A_BAND_LB, 0x0A}, 747 - { MT_RF(6, 55), RF_A_BAND_MB, 0x0A}, 748 - { MT_RF(6, 55), RF_A_BAND_HB, 0x0A}, 749 - { MT_RF(6, 55), RF_A_BAND_11J, 0x0A}, 750 - 751 - { MT_RF(6, 56), RF_A_BAND_LB, 0x05}, 752 - { MT_RF(6, 56), RF_A_BAND_MB, 0x05}, 753 - { MT_RF(6, 56), RF_A_BAND_HB, 0x05}, 754 - { MT_RF(6, 56), RF_A_BAND_11J, 0x05}, 755 - 756 - { MT_RF(6, 57), RF_A_BAND_LB, 0x05}, 757 - { MT_RF(6, 57), RF_A_BAND_MB, 0x05}, 758 - { MT_RF(6, 57), RF_A_BAND_HB, 0x05}, 759 - { MT_RF(6, 57), RF_A_BAND_11J, 0x05}, 760 - 761 - { MT_RF(6, 58), RF_A_BAND_LB, 0x05}, 762 - { MT_RF(6, 58), RF_A_BAND_MB, 0x03}, 763 - { MT_RF(6, 58), RF_A_BAND_HB, 0x02}, 764 - { MT_RF(6, 58), RF_A_BAND_11J, 0x07}, 765 - 766 - { MT_RF(6, 59), RF_A_BAND_LB, 0x05}, 767 - { MT_RF(6, 59), RF_A_BAND_MB, 0x03}, 768 - { MT_RF(6, 59), RF_A_BAND_HB, 0x02}, 769 - { MT_RF(6, 59), RF_A_BAND_11J, 0x07}, 595 + { MT_RF(6, 45), RF_A_BAND_LB, 0x63 }, 596 + { MT_RF(6, 45), RF_A_BAND_MB, 0x43 }, 597 + { MT_RF(6, 45), RF_A_BAND_HB, 0x33 }, 598 + { MT_RF(6, 45), RF_A_BAND_11J, 0x73 }, 599 + { MT_RF(6, 50), RF_A_BAND_LB, 0x02 }, 600 + { MT_RF(6, 50), RF_A_BAND_MB, 0x02 }, 601 + { MT_RF(6, 50), RF_A_BAND_HB, 0x02 }, 602 + { MT_RF(6, 50), RF_A_BAND_11J, 0x02 }, 603 + { MT_RF(6, 51), RF_A_BAND_LB, 0x02 }, 604 + { MT_RF(6, 51), RF_A_BAND_MB, 0x02 }, 605 + { MT_RF(6, 51), RF_A_BAND_HB, 0x02 }, 606 + { MT_RF(6, 51), RF_A_BAND_11J, 0x02 }, 607 + { MT_RF(6, 52), RF_A_BAND_LB, 0x08 }, 608 + { MT_RF(6, 52), RF_A_BAND_MB, 0x08 }, 609 + { MT_RF(6, 52), RF_A_BAND_HB, 0x08 }, 610 + { MT_RF(6, 52), RF_A_BAND_11J, 0x08 }, 611 + { MT_RF(6, 53), RF_A_BAND_LB, 0x08 }, 612 + { MT_RF(6, 53), RF_A_BAND_MB, 0x08 }, 613 + { MT_RF(6, 53), RF_A_BAND_HB, 0x08 }, 614 + { MT_RF(6, 53), RF_A_BAND_11J, 0x08 }, 615 + { MT_RF(6, 54), RF_A_BAND_LB, 0x0A }, 616 + { MT_RF(6, 54), RF_A_BAND_MB, 0x0A }, 617 + { MT_RF(6, 54), RF_A_BAND_HB, 0x0A }, 618 + { MT_RF(6, 54), RF_A_BAND_11J, 0x0A }, 619 + { MT_RF(6, 55), RF_A_BAND_LB, 0x0A }, 620 + { MT_RF(6, 55), RF_A_BAND_MB, 0x0A }, 621 + { MT_RF(6, 55), RF_A_BAND_HB, 0x0A }, 622 + { MT_RF(6, 55), RF_A_BAND_11J, 0x0A }, 623 + { MT_RF(6, 56), RF_A_BAND_LB, 0x05 }, 624 + { MT_RF(6, 56), RF_A_BAND_MB, 0x05 }, 625 + { MT_RF(6, 56), RF_A_BAND_HB, 0x05 }, 626 + { MT_RF(6, 56), RF_A_BAND_11J, 0x05 }, 627 + { MT_RF(6, 57), RF_A_BAND_LB, 0x05 }, 628 + { MT_RF(6, 57), RF_A_BAND_MB, 0x05 }, 629 + { MT_RF(6, 57), RF_A_BAND_HB, 0x05 }, 630 + { MT_RF(6, 57), RF_A_BAND_11J, 0x05 }, 631 + { MT_RF(6, 58), RF_A_BAND_LB, 0x05 }, 632 + { MT_RF(6, 58), RF_A_BAND_MB, 0x03 }, 633 + { MT_RF(6, 58), RF_A_BAND_HB, 0x02 }, 634 + { MT_RF(6, 58), RF_A_BAND_11J, 0x07 }, 635 + { MT_RF(6, 59), RF_A_BAND_LB, 0x05 }, 636 + { MT_RF(6, 59), RF_A_BAND_MB, 0x03 }, 637 + { MT_RF(6, 59), RF_A_BAND_HB, 0x02 }, 638 + { MT_RF(6, 59), RF_A_BAND_11J, 0x07 }, 770 639 }; 771 640 772 641 #endif
-197
drivers/net/wireless/mediatek/mt76/mt76x0/mac.c
··· 1 - /* 2 - * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org> 3 - * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl> 4 - * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl> 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 8 - * as published by the Free Software Foundation 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - */ 15 - 16 - #include <linux/etherdevice.h> 17 - 18 - #include "mt76x0.h" 19 - #include "trace.h" 20 - 21 - void mt76x0_mac_set_protection(struct mt76x02_dev *dev, bool legacy_prot, 22 - int ht_mode) 23 - { 24 - int mode = ht_mode & IEEE80211_HT_OP_MODE_PROTECTION; 25 - bool non_gf = !!(ht_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); 26 - u32 prot[6]; 27 - bool ht_rts[4] = {}; 28 - int i; 29 - 30 - prot[0] = MT_PROT_NAV_SHORT | 31 - MT_PROT_TXOP_ALLOW_ALL | 32 - MT_PROT_RTS_THR_EN; 33 - prot[1] = prot[0]; 34 - if (legacy_prot) 35 - prot[1] |= MT_PROT_CTRL_CTS2SELF; 36 - 37 - prot[2] = prot[4] = MT_PROT_NAV_SHORT | MT_PROT_TXOP_ALLOW_BW20; 38 - prot[3] = prot[5] = MT_PROT_NAV_SHORT | MT_PROT_TXOP_ALLOW_ALL; 39 - 40 - if (legacy_prot) { 41 - prot[2] |= MT_PROT_RATE_CCK_11; 42 - prot[3] |= MT_PROT_RATE_CCK_11; 43 - prot[4] |= MT_PROT_RATE_CCK_11; 44 - prot[5] |= MT_PROT_RATE_CCK_11; 45 - } else { 46 - prot[2] |= MT_PROT_RATE_OFDM_24; 47 - prot[3] |= MT_PROT_RATE_DUP_OFDM_24; 48 - prot[4] |= MT_PROT_RATE_OFDM_24; 49 - prot[5] |= MT_PROT_RATE_DUP_OFDM_24; 50 - } 51 - 52 - switch (mode) { 53 - case IEEE80211_HT_OP_MODE_PROTECTION_NONE: 54 - break; 55 - 56 - case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: 57 - ht_rts[0] = ht_rts[1] = ht_rts[2] = ht_rts[3] = true; 58 - break; 59 - 60 - case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: 61 - ht_rts[1] = ht_rts[3] = true; 62 - break; 63 - 64 - case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: 65 - ht_rts[0] = ht_rts[1] = ht_rts[2] = ht_rts[3] = true; 66 - break; 67 - } 68 - 69 - if (non_gf) 70 - ht_rts[2] = ht_rts[3] = true; 71 - 72 - for (i = 0; i < 4; i++) 73 - if (ht_rts[i]) 74 - prot[i + 2] |= MT_PROT_CTRL_RTS_CTS; 75 - 76 - for (i = 0; i < 6; i++) 77 - mt76_wr(dev, MT_CCK_PROT_CFG + i * 4, prot[i]); 78 - } 79 - 80 - void mt76x0_mac_set_short_preamble(struct mt76x02_dev *dev, bool short_preamb) 81 - { 82 - if (short_preamb) 83 - mt76_set(dev, MT_AUTO_RSP_CFG, MT_AUTO_RSP_PREAMB_SHORT); 84 - else 85 - mt76_clear(dev, MT_AUTO_RSP_CFG, MT_AUTO_RSP_PREAMB_SHORT); 86 - } 87 - 88 - void mt76x0_mac_config_tsf(struct mt76x02_dev *dev, bool enable, int interval) 89 - { 90 - u32 val = mt76_rr(dev, MT_BEACON_TIME_CFG); 91 - 92 - val &= ~(MT_BEACON_TIME_CFG_TIMER_EN | 93 - MT_BEACON_TIME_CFG_SYNC_MODE | 94 - MT_BEACON_TIME_CFG_TBTT_EN); 95 - 96 - if (!enable) { 97 - mt76_wr(dev, MT_BEACON_TIME_CFG, val); 98 - return; 99 - } 100 - 101 - val &= ~MT_BEACON_TIME_CFG_INTVAL; 102 - val |= FIELD_PREP(MT_BEACON_TIME_CFG_INTVAL, interval << 4) | 103 - MT_BEACON_TIME_CFG_TIMER_EN | 104 - MT_BEACON_TIME_CFG_SYNC_MODE | 105 - MT_BEACON_TIME_CFG_TBTT_EN; 106 - } 107 - 108 - static void mt76x0_check_mac_err(struct mt76x02_dev *dev) 109 - { 110 - u32 val = mt76_rr(dev, 0x10f4); 111 - 112 - if (!(val & BIT(29)) || !(val & (BIT(7) | BIT(5)))) 113 - return; 114 - 115 - dev_err(dev->mt76.dev, "Error: MAC specific condition occurred\n"); 116 - 117 - mt76_set(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_RESET_CSR); 118 - udelay(10); 119 - mt76_clear(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_RESET_CSR); 120 - } 121 - void mt76x0_mac_work(struct work_struct *work) 122 - { 123 - struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev, 124 - mac_work.work); 125 - struct { 126 - u32 addr_base; 127 - u32 span; 128 - u64 *stat_base; 129 - } spans[] = { 130 - { MT_RX_STAT_0, 3, dev->stats.rx_stat }, 131 - { MT_TX_STA_0, 3, dev->stats.tx_stat }, 132 - { MT_TX_AGG_STAT, 1, dev->stats.aggr_stat }, 133 - { MT_MPDU_DENSITY_CNT, 1, dev->stats.zero_len_del }, 134 - { MT_TX_AGG_CNT_BASE0, 8, &dev->stats.aggr_n[0] }, 135 - { MT_TX_AGG_CNT_BASE1, 8, &dev->stats.aggr_n[16] }, 136 - }; 137 - u32 sum, n; 138 - int i, j, k; 139 - 140 - /* Note: using MCU_RANDOM_READ is actually slower then reading all the 141 - * registers by hand. MCU takes ca. 20ms to complete read of 24 142 - * registers while reading them one by one will takes roughly 143 - * 24*200us =~ 5ms. 144 - */ 145 - 146 - k = 0; 147 - n = 0; 148 - sum = 0; 149 - for (i = 0; i < ARRAY_SIZE(spans); i++) 150 - for (j = 0; j < spans[i].span; j++) { 151 - u32 val = mt76_rr(dev, spans[i].addr_base + j * 4); 152 - 153 - spans[i].stat_base[j * 2] += val & 0xffff; 154 - spans[i].stat_base[j * 2 + 1] += val >> 16; 155 - 156 - /* Calculate average AMPDU length */ 157 - if (spans[i].addr_base != MT_TX_AGG_CNT_BASE0 && 158 - spans[i].addr_base != MT_TX_AGG_CNT_BASE1) 159 - continue; 160 - 161 - n += (val >> 16) + (val & 0xffff); 162 - sum += (val & 0xffff) * (1 + k * 2) + 163 - (val >> 16) * (2 + k * 2); 164 - k++; 165 - } 166 - 167 - atomic_set(&dev->avg_ampdu_len, n ? DIV_ROUND_CLOSEST(sum, n) : 1); 168 - 169 - mt76x0_check_mac_err(dev); 170 - 171 - ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work, 10 * HZ); 172 - } 173 - 174 - void mt76x0_mac_set_ampdu_factor(struct mt76x02_dev *dev) 175 - { 176 - struct ieee80211_sta *sta; 177 - struct mt76_wcid *wcid; 178 - void *msta; 179 - u8 min_factor = 3; 180 - int i; 181 - 182 - rcu_read_lock(); 183 - for (i = 0; i < ARRAY_SIZE(dev->mt76.wcid); i++) { 184 - wcid = rcu_dereference(dev->mt76.wcid[i]); 185 - if (!wcid) 186 - continue; 187 - 188 - msta = container_of(wcid, struct mt76x02_sta, wcid); 189 - sta = container_of(msta, struct ieee80211_sta, drv_priv); 190 - 191 - min_factor = min(min_factor, sta->ht_cap.ampdu_factor); 192 - } 193 - rcu_read_unlock(); 194 - 195 - mt76_wr(dev, MT_MAX_LEN_CFG, 0xa0fff | 196 - FIELD_PREP(MT_MAX_LEN_CFG_AMPDU, min_factor)); 197 - }
+14 -86
drivers/net/wireless/mediatek/mt76/mt76x0/main.c
··· 22 22 int ret; 23 23 24 24 cancel_delayed_work_sync(&dev->cal_work); 25 + if (mt76_is_mmio(dev)) { 26 + tasklet_disable(&dev->pre_tbtt_tasklet); 27 + tasklet_disable(&dev->dfs_pd.dfs_tasklet); 28 + } 25 29 26 30 mt76_set_channel(&dev->mt76); 27 31 ret = mt76x0_phy_set_channel(dev, chandef); 32 + 33 + /* channel cycle counters read-and-clear */ 34 + mt76_rr(dev, MT_CH_IDLE); 35 + mt76_rr(dev, MT_CH_BUSY); 36 + 37 + if (mt76_is_mmio(dev)) { 38 + mt76x02_dfs_init_params(dev); 39 + tasklet_enable(&dev->pre_tbtt_tasklet); 40 + tasklet_enable(&dev->dfs_pd.dfs_tasklet); 41 + } 28 42 mt76_txq_schedule_all(&dev->mt76); 29 43 30 44 return ret; ··· 78 64 return ret; 79 65 } 80 66 EXPORT_SYMBOL_GPL(mt76x0_config); 81 - 82 - static void 83 - mt76x0_addr_wr(struct mt76x02_dev *dev, const u32 offset, const u8 *addr) 84 - { 85 - mt76_wr(dev, offset, get_unaligned_le32(addr)); 86 - mt76_wr(dev, offset + 4, addr[4] | addr[5] << 8); 87 - } 88 - 89 - void mt76x0_bss_info_changed(struct ieee80211_hw *hw, 90 - struct ieee80211_vif *vif, 91 - struct ieee80211_bss_conf *info, u32 changed) 92 - { 93 - struct mt76x02_dev *dev = hw->priv; 94 - 95 - mutex_lock(&dev->mt76.mutex); 96 - 97 - if (changed & BSS_CHANGED_BSSID) { 98 - mt76x0_addr_wr(dev, MT_MAC_BSSID_DW0, info->bssid); 99 - 100 - /* Note: this is a hack because beacon_int is not changed 101 - * on leave nor is any more appropriate event generated. 102 - * rt2x00 doesn't seem to be bothered though. 103 - */ 104 - if (is_zero_ether_addr(info->bssid)) 105 - mt76x0_mac_config_tsf(dev, false, 0); 106 - } 107 - 108 - if (changed & BSS_CHANGED_BASIC_RATES) { 109 - mt76_wr(dev, MT_LEGACY_BASIC_RATE, info->basic_rates); 110 - mt76_wr(dev, MT_VHT_HT_FBK_CFG0, 0x65432100); 111 - mt76_wr(dev, MT_VHT_HT_FBK_CFG1, 0xedcba980); 112 - mt76_wr(dev, MT_LG_FBK_CFG0, 0xedcba988); 113 - mt76_wr(dev, MT_LG_FBK_CFG1, 0x00002100); 114 - } 115 - 116 - if (changed & BSS_CHANGED_BEACON_INT) 117 - mt76x0_mac_config_tsf(dev, true, info->beacon_int); 118 - 119 - if (changed & BSS_CHANGED_HT || changed & BSS_CHANGED_ERP_CTS_PROT) 120 - mt76x0_mac_set_protection(dev, info->use_cts_prot, 121 - info->ht_operation_mode); 122 - 123 - if (changed & BSS_CHANGED_ERP_PREAMBLE) 124 - mt76x0_mac_set_short_preamble(dev, info->use_short_preamble); 125 - 126 - if (changed & BSS_CHANGED_ERP_SLOT) { 127 - int slottime = info->use_short_slot ? 9 : 20; 128 - 129 - mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, 130 - MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); 131 - } 132 - 133 - if (changed & BSS_CHANGED_ASSOC) 134 - mt76x0_phy_recalibrate_after_assoc(dev); 135 - 136 - mutex_unlock(&dev->mt76.mutex); 137 - } 138 - EXPORT_SYMBOL_GPL(mt76x0_bss_info_changed); 139 - 140 - void mt76x0_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 141 - const u8 *mac_addr) 142 - { 143 - struct mt76x02_dev *dev = hw->priv; 144 - 145 - set_bit(MT76_SCANNING, &dev->mt76.state); 146 - } 147 - EXPORT_SYMBOL_GPL(mt76x0_sw_scan); 148 - 149 - void mt76x0_sw_scan_complete(struct ieee80211_hw *hw, 150 - struct ieee80211_vif *vif) 151 - { 152 - struct mt76x02_dev *dev = hw->priv; 153 - 154 - clear_bit(MT76_SCANNING, &dev->mt76.state); 155 - } 156 - EXPORT_SYMBOL_GPL(mt76x0_sw_scan_complete); 157 - 158 - int mt76x0_set_rts_threshold(struct ieee80211_hw *hw, u32 value) 159 - { 160 - struct mt76x02_dev *dev = hw->priv; 161 - 162 - mt76_rmw_field(dev, MT_TX_RTS_CFG, MT_TX_RTS_CFG_THRESH, value); 163 - 164 - return 0; 165 - } 166 - EXPORT_SYMBOL_GPL(mt76x0_set_rts_threshold);
+13 -23
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
··· 28 28 #include "../mt76x02.h" 29 29 #include "eeprom.h" 30 30 31 - #define MT_CALIBRATE_INTERVAL (4 * HZ) 31 + #define MT7610E_FIRMWARE "mediatek/mt7610e.bin" 32 + #define MT7650E_FIRMWARE "mediatek/mt7650e.bin" 33 + 34 + #define MT7610U_FIRMWARE "mediatek/mt7610u.bin" 32 35 33 36 #define MT_USB_AGGR_SIZE_LIMIT 21 /* * 1024B */ 34 37 #define MT_USB_AGGR_TIMEOUT 0x80 /* * 33ns */ 35 38 36 39 static inline bool is_mt7610e(struct mt76x02_dev *dev) 37 40 { 38 - /* TODO */ 39 - return false; 41 + if (!mt76_is_mmio(dev)) 42 + return false; 43 + 44 + return mt76_chip(&dev->mt76) == 0x7610; 40 45 } 41 46 42 - void mt76x0_init_debugfs(struct mt76x02_dev *dev); 47 + static inline bool is_mt7630(struct mt76x02_dev *dev) 48 + { 49 + return mt76_chip(&dev->mt76) == 0x7630; 50 + } 43 51 44 52 /* Init */ 45 53 struct mt76x02_dev * ··· 62 54 void mt76x0_mac_stop(struct mt76x02_dev *dev); 63 55 64 56 int mt76x0_config(struct ieee80211_hw *hw, u32 changed); 65 - void mt76x0_bss_info_changed(struct ieee80211_hw *hw, 66 - struct ieee80211_vif *vif, 67 - struct ieee80211_bss_conf *info, u32 changed); 68 - void mt76x0_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 69 - const u8 *mac_addr); 70 - void mt76x0_sw_scan_complete(struct ieee80211_hw *hw, 71 - struct ieee80211_vif *vif); 72 - int mt76x0_set_rts_threshold(struct ieee80211_hw *hw, u32 value); 73 57 74 58 /* PHY */ 75 59 void mt76x0_phy_init(struct mt76x02_dev *dev); 76 - int mt76x0_wait_bbp_ready(struct mt76x02_dev *dev); 60 + int mt76x0_phy_wait_bbp_ready(struct mt76x02_dev *dev); 77 61 int mt76x0_phy_set_channel(struct mt76x02_dev *dev, 78 62 struct cfg80211_chan_def *chandef); 79 - void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev); 80 63 void mt76x0_phy_set_txpower(struct mt76x02_dev *dev); 81 64 void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on); 82 - 83 - /* MAC */ 84 - void mt76x0_mac_work(struct work_struct *work); 85 - void mt76x0_mac_set_protection(struct mt76x02_dev *dev, bool legacy_prot, 86 - int ht_mode); 87 - void mt76x0_mac_set_short_preamble(struct mt76x02_dev *dev, bool short_preamb); 88 - void mt76x0_mac_config_tsf(struct mt76x02_dev *dev, bool enable, int interval); 89 - void mt76x0_mac_set_ampdu_factor(struct mt76x02_dev *dev); 90 - 91 65 #endif
+31 -4
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
··· 68 68 mutex_unlock(&dev->mt76.mutex); 69 69 } 70 70 71 + static void 72 + mt76x0e_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 73 + u32 queues, bool drop) 74 + { 75 + } 76 + 77 + static int 78 + mt76x0e_set_tim(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 79 + bool set) 80 + { 81 + return 0; 82 + } 83 + 71 84 static const struct ieee80211_ops mt76x0e_ops = { 72 85 .tx = mt76x02_tx, 73 86 .start = mt76x0e_start, ··· 89 76 .remove_interface = mt76x02_remove_interface, 90 77 .config = mt76x0_config, 91 78 .configure_filter = mt76x02_configure_filter, 92 - .sta_add = mt76x02_sta_add, 93 - .sta_remove = mt76x02_sta_remove, 79 + .bss_info_changed = mt76x02_bss_info_changed, 80 + .sta_state = mt76_sta_state, 94 81 .set_key = mt76x02_set_key, 95 82 .conf_tx = mt76x02_conf_tx, 96 - .sw_scan_start = mt76x0_sw_scan, 97 - .sw_scan_complete = mt76x0_sw_scan_complete, 83 + .sw_scan_start = mt76x02_sw_scan, 84 + .sw_scan_complete = mt76x02_sw_scan_complete, 98 85 .ampdu_action = mt76x02_ampdu_action, 99 86 .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, 100 87 .wake_tx_queue = mt76_wake_tx_queue, 88 + .get_survey = mt76_get_survey, 89 + .get_txpower = mt76x02_get_txpower, 90 + .flush = mt76x0e_flush, 91 + .set_tim = mt76x0e_set_tim, 92 + .release_buffered_frames = mt76_release_buffered_frames, 93 + .set_coverage_class = mt76x02_set_coverage_class, 94 + .set_rts_threshold = mt76x02_set_rts_threshold, 101 95 }; 102 96 103 97 static int mt76x0e_register_device(struct mt76x02_dev *dev) ··· 155 135 { 156 136 static const struct mt76_driver_ops drv_ops = { 157 137 .txwi_size = sizeof(struct mt76x02_txwi), 138 + .update_survey = mt76x02_update_channel, 158 139 .tx_prepare_skb = mt76x02_tx_prepare_skb, 159 140 .tx_complete_skb = mt76x02_tx_complete_skb, 160 141 .rx_skb = mt76x02_queue_rx_skb, 161 142 .rx_poll_complete = mt76x02_rx_poll_complete, 143 + .sta_ps = mt76x02_sta_ps, 144 + .sta_add = mt76x02_sta_add, 145 + .sta_remove = mt76x02_sta_remove, 162 146 }; 163 147 struct mt76x02_dev *dev; 164 148 int ret; ··· 209 185 static void mt76x0e_cleanup(struct mt76x02_dev *dev) 210 186 { 211 187 clear_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); 188 + tasklet_disable(&dev->pre_tbtt_tasklet); 212 189 mt76x0_chip_onoff(dev, false, false); 213 190 mt76x0e_stop_hw(dev); 214 191 mt76x02_dma_cleanup(dev); ··· 234 209 }; 235 210 236 211 MODULE_DEVICE_TABLE(pci, mt76x0e_device_table); 212 + MODULE_FIRMWARE(MT7610E_FIRMWARE); 213 + MODULE_FIRMWARE(MT7650E_FIRMWARE); 237 214 MODULE_LICENSE("Dual BSD/GPL"); 238 215 239 216 static struct pci_driver mt76x0e_driver = {
-4
drivers/net/wireless/mediatek/mt76/mt76x0/pci_mcu.c
··· 19 19 #include "mt76x0.h" 20 20 #include "mcu.h" 21 21 22 - #define MT7610E_FIRMWARE "mediatek/mt7610e.bin" 23 - #define MT7650E_FIRMWARE "mediatek/mt7650e.bin" 24 - 25 22 #define MT_MCU_IVB_ADDR (MT_MCU_ILM_ADDR + 0x54000 - MT_MCU_IVB_SIZE) 26 23 27 24 static int mt76x0e_load_firmware(struct mt76x02_dev *dev) ··· 127 130 int mt76x0e_mcu_init(struct mt76x02_dev *dev) 128 131 { 129 132 static const struct mt76_mcu_ops mt76x0e_mcu_ops = { 130 - .mcu_msg_alloc = mt76x02_mcu_msg_alloc, 131 133 .mcu_send_msg = mt76x02_mcu_msg_send, 132 134 }; 133 135 int err;
+591 -303
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
··· 20 20 #include "mt76x0.h" 21 21 #include "mcu.h" 22 22 #include "eeprom.h" 23 - #include "trace.h" 24 23 #include "phy.h" 25 24 #include "initvals.h" 26 25 #include "initvals_phy.h" ··· 48 49 } 49 50 50 51 mt76_wr(dev, MT_RF_CSR_CFG, 51 - FIELD_PREP(MT_RF_CSR_CFG_DATA, value) | 52 - FIELD_PREP(MT_RF_CSR_CFG_REG_BANK, bank) | 53 - FIELD_PREP(MT_RF_CSR_CFG_REG_ID, reg) | 54 - MT_RF_CSR_CFG_WR | 55 - MT_RF_CSR_CFG_KICK); 56 - trace_mt76x0_rf_write(&dev->mt76, bank, offset, value); 52 + FIELD_PREP(MT_RF_CSR_CFG_DATA, value) | 53 + FIELD_PREP(MT_RF_CSR_CFG_REG_BANK, bank) | 54 + FIELD_PREP(MT_RF_CSR_CFG_REG_ID, reg) | 55 + MT_RF_CSR_CFG_WR | 56 + MT_RF_CSR_CFG_KICK); 57 + 57 58 out: 58 59 mutex_unlock(&dev->phy_mutex); 59 60 ··· 85 86 goto out; 86 87 87 88 mt76_wr(dev, MT_RF_CSR_CFG, 88 - FIELD_PREP(MT_RF_CSR_CFG_REG_BANK, bank) | 89 - FIELD_PREP(MT_RF_CSR_CFG_REG_ID, reg) | 90 - MT_RF_CSR_CFG_KICK); 89 + FIELD_PREP(MT_RF_CSR_CFG_REG_BANK, bank) | 90 + FIELD_PREP(MT_RF_CSR_CFG_REG_ID, reg) | 91 + MT_RF_CSR_CFG_KICK); 91 92 92 93 if (!mt76_poll(dev, MT_RF_CSR_CFG, MT_RF_CSR_CFG_KICK, 0, 100)) 93 94 goto out; 94 95 95 96 val = mt76_rr(dev, MT_RF_CSR_CFG); 96 97 if (FIELD_GET(MT_RF_CSR_CFG_REG_ID, val) == reg && 97 - FIELD_GET(MT_RF_CSR_CFG_REG_BANK, val) == bank) { 98 + FIELD_GET(MT_RF_CSR_CFG_REG_BANK, val) == bank) 98 99 ret = FIELD_GET(MT_RF_CSR_CFG_DATA, val); 99 - trace_mt76x0_rf_read(&dev->mt76, bank, offset, ret); 100 - } 100 + 101 101 out: 102 102 mutex_unlock(&dev->phy_mutex); 103 103 ··· 108 110 } 109 111 110 112 static int 111 - rf_wr(struct mt76x02_dev *dev, u32 offset, u8 val) 113 + mt76x0_rf_wr(struct mt76x02_dev *dev, u32 offset, u8 val) 112 114 { 113 115 if (mt76_is_usb(dev)) { 114 116 struct mt76_reg_pair pair = { ··· 124 126 } 125 127 } 126 128 127 - static int 128 - rf_rr(struct mt76x02_dev *dev, u32 offset) 129 + static int mt76x0_rf_rr(struct mt76x02_dev *dev, u32 offset) 129 130 { 130 131 int ret; 131 132 u32 val; ··· 146 149 } 147 150 148 151 static int 149 - rf_rmw(struct mt76x02_dev *dev, u32 offset, u8 mask, u8 val) 152 + mt76x0_rf_rmw(struct mt76x02_dev *dev, u32 offset, u8 mask, u8 val) 150 153 { 151 154 int ret; 152 155 153 - ret = rf_rr(dev, offset); 156 + ret = mt76x0_rf_rr(dev, offset); 154 157 if (ret < 0) 155 158 return ret; 159 + 156 160 val |= ret & ~mask; 157 - ret = rf_wr(dev, offset, val); 158 - if (ret) 159 - return ret; 160 161 161 - return val; 162 + ret = mt76x0_rf_wr(dev, offset, val); 163 + return ret ? ret : val; 162 164 } 163 165 164 166 static int 165 - rf_set(struct mt76x02_dev *dev, u32 offset, u8 val) 167 + mt76x0_rf_set(struct mt76x02_dev *dev, u32 offset, u8 val) 166 168 { 167 - return rf_rmw(dev, offset, 0, val); 169 + return mt76x0_rf_rmw(dev, offset, 0, val); 168 170 } 169 171 170 - #if 0 171 172 static int 172 - rf_clear(struct mt76x02_dev *dev, u32 offset, u8 mask) 173 + mt76x0_rf_clear(struct mt76x02_dev *dev, u32 offset, u8 mask) 173 174 { 174 - return rf_rmw(dev, offset, mask, 0); 175 + return mt76x0_rf_rmw(dev, offset, mask, 0); 175 176 } 176 - #endif 177 177 178 178 static void 179 - mt76x0_rf_csr_wr_rp(struct mt76x02_dev *dev, const struct mt76_reg_pair *data, 180 - int n) 179 + mt76x0_phy_rf_csr_wr_rp(struct mt76x02_dev *dev, 180 + const struct mt76_reg_pair *data, 181 + int n) 181 182 { 182 183 while (n-- > 0) { 183 184 mt76x0_rf_csr_wr(dev, data->reg, data->value); ··· 185 190 186 191 #define RF_RANDOM_WRITE(dev, tab) do { \ 187 192 if (mt76_is_mmio(dev)) \ 188 - mt76x0_rf_csr_wr_rp(dev, tab, ARRAY_SIZE(tab)); \ 193 + mt76x0_phy_rf_csr_wr_rp(dev, tab, ARRAY_SIZE(tab)); \ 189 194 else \ 190 195 mt76_wr_rp(dev, MT_MCU_MEMMAP_RF, tab, ARRAY_SIZE(tab));\ 191 196 } while (0) 192 197 193 - int mt76x0_wait_bbp_ready(struct mt76x02_dev *dev) 198 + int mt76x0_phy_wait_bbp_ready(struct mt76x02_dev *dev) 194 199 { 195 200 int i = 20; 196 201 u32 val; ··· 210 215 return 0; 211 216 } 212 217 213 - static void mt76x0_vco_cal(struct mt76x02_dev *dev, u8 channel) 214 - { 215 - u8 val; 216 - 217 - val = rf_rr(dev, MT_RF(0, 4)); 218 - if ((val & 0x70) != 0x30) 219 - return; 220 - 221 - /* 222 - * Calibration Mode - Open loop, closed loop, and amplitude: 223 - * B0.R06.[0]: 1 224 - * B0.R06.[3:1] bp_close_code: 100 225 - * B0.R05.[7:0] bp_open_code: 0x0 226 - * B0.R04.[2:0] cal_bits: 000 227 - * B0.R03.[2:0] startup_time: 011 228 - * B0.R03.[6:4] settle_time: 229 - * 80MHz channel: 110 230 - * 40MHz channel: 101 231 - * 20MHz channel: 100 232 - */ 233 - val = rf_rr(dev, MT_RF(0, 6)); 234 - val &= ~0xf; 235 - val |= 0x09; 236 - rf_wr(dev, MT_RF(0, 6), val); 237 - 238 - val = rf_rr(dev, MT_RF(0, 5)); 239 - if (val != 0) 240 - rf_wr(dev, MT_RF(0, 5), 0x0); 241 - 242 - val = rf_rr(dev, MT_RF(0, 4)); 243 - val &= ~0x07; 244 - rf_wr(dev, MT_RF(0, 4), val); 245 - 246 - val = rf_rr(dev, MT_RF(0, 3)); 247 - val &= ~0x77; 248 - if (channel == 1 || channel == 7 || channel == 9 || channel >= 13) { 249 - val |= 0x63; 250 - } else if (channel == 3 || channel == 4 || channel == 10) { 251 - val |= 0x53; 252 - } else if (channel == 2 || channel == 5 || channel == 6 || 253 - channel == 8 || channel == 11 || channel == 12) { 254 - val |= 0x43; 255 - } else { 256 - WARN(1, "Unknown channel %u\n", channel); 257 - return; 258 - } 259 - rf_wr(dev, MT_RF(0, 3), val); 260 - 261 - /* TODO replace by mt76x0_rf_set(dev, MT_RF(0, 4), BIT(7)); */ 262 - val = rf_rr(dev, MT_RF(0, 4)); 263 - val = ((val & ~(0x80)) | 0x80); 264 - rf_wr(dev, MT_RF(0, 4), val); 265 - 266 - msleep(2); 267 - } 268 - 269 218 static void 270 219 mt76x0_phy_set_band(struct mt76x02_dev *dev, enum nl80211_band band) 271 220 { ··· 217 278 case NL80211_BAND_2GHZ: 218 279 RF_RANDOM_WRITE(dev, mt76x0_rf_2g_channel_0_tab); 219 280 220 - rf_wr(dev, MT_RF(5, 0), 0x45); 221 - rf_wr(dev, MT_RF(6, 0), 0x44); 281 + mt76x0_rf_wr(dev, MT_RF(5, 0), 0x45); 282 + mt76x0_rf_wr(dev, MT_RF(6, 0), 0x44); 222 283 223 284 mt76_wr(dev, MT_TX_ALC_VGA3, 0x00050007); 224 285 mt76_wr(dev, MT_TX0_RF_GAIN_CORR, 0x003E0002); ··· 226 287 case NL80211_BAND_5GHZ: 227 288 RF_RANDOM_WRITE(dev, mt76x0_rf_5g_channel_0_tab); 228 289 229 - rf_wr(dev, MT_RF(5, 0), 0x44); 230 - rf_wr(dev, MT_RF(6, 0), 0x45); 290 + mt76x0_rf_wr(dev, MT_RF(5, 0), 0x44); 291 + mt76x0_rf_wr(dev, MT_RF(6, 0), 0x45); 231 292 232 293 mt76_wr(dev, MT_TX_ALC_VGA3, 0x00000005); 233 294 mt76_wr(dev, MT_TX0_RF_GAIN_CORR, 0x01010102); ··· 240 301 static void 241 302 mt76x0_phy_set_chan_rf_params(struct mt76x02_dev *dev, u8 channel, u16 rf_bw_band) 242 303 { 304 + const struct mt76x0_freq_item *freq_item; 243 305 u16 rf_band = rf_bw_band & 0xff00; 244 306 u16 rf_bw = rf_bw_band & 0x00ff; 245 307 enum nl80211_band band; 308 + bool b_sdm = false; 246 309 u32 mac_reg; 247 - u8 rf_val; 248 310 int i; 249 - bool bSDM = false; 250 - const struct mt76x0_freq_item *freq_item; 251 311 252 312 for (i = 0; i < ARRAY_SIZE(mt76x0_sdm_channel); i++) { 253 313 if (channel == mt76x0_sdm_channel[i]) { 254 - bSDM = true; 314 + b_sdm = true; 255 315 break; 256 316 } 257 317 } ··· 259 321 if (channel == mt76x0_frequency_plan[i].channel) { 260 322 rf_band = mt76x0_frequency_plan[i].band; 261 323 262 - if (bSDM) 324 + if (b_sdm) 263 325 freq_item = &(mt76x0_sdm_frequency_plan[i]); 264 326 else 265 327 freq_item = &(mt76x0_frequency_plan[i]); 266 328 267 - rf_wr(dev, MT_RF(0, 37), freq_item->pllR37); 268 - rf_wr(dev, MT_RF(0, 36), freq_item->pllR36); 269 - rf_wr(dev, MT_RF(0, 35), freq_item->pllR35); 270 - rf_wr(dev, MT_RF(0, 34), freq_item->pllR34); 271 - rf_wr(dev, MT_RF(0, 33), freq_item->pllR33); 329 + mt76x0_rf_wr(dev, MT_RF(0, 37), freq_item->pllR37); 330 + mt76x0_rf_wr(dev, MT_RF(0, 36), freq_item->pllR36); 331 + mt76x0_rf_wr(dev, MT_RF(0, 35), freq_item->pllR35); 332 + mt76x0_rf_wr(dev, MT_RF(0, 34), freq_item->pllR34); 333 + mt76x0_rf_wr(dev, MT_RF(0, 33), freq_item->pllR33); 272 334 273 - rf_val = rf_rr(dev, MT_RF(0, 32)); 274 - rf_val &= ~0xE0; 275 - rf_val |= freq_item->pllR32_b7b5; 276 - rf_wr(dev, MT_RF(0, 32), rf_val); 335 + mt76x0_rf_rmw(dev, MT_RF(0, 32), 0xe0, 336 + freq_item->pllR32_b7b5); 277 337 278 338 /* R32<4:0> pll_den: (Denomina - 8) */ 279 - rf_val = rf_rr(dev, MT_RF(0, 32)); 280 - rf_val &= ~0x1F; 281 - rf_val |= freq_item->pllR32_b4b0; 282 - rf_wr(dev, MT_RF(0, 32), rf_val); 339 + mt76x0_rf_rmw(dev, MT_RF(0, 32), MT_RF_PLL_DEN_MASK, 340 + freq_item->pllR32_b4b0); 283 341 284 342 /* R31<7:5> */ 285 - rf_val = rf_rr(dev, MT_RF(0, 31)); 286 - rf_val &= ~0xE0; 287 - rf_val |= freq_item->pllR31_b7b5; 288 - rf_wr(dev, MT_RF(0, 31), rf_val); 343 + mt76x0_rf_rmw(dev, MT_RF(0, 31), 0xe0, 344 + freq_item->pllR31_b7b5); 289 345 290 346 /* R31<4:0> pll_k(Nominator) */ 291 - rf_val = rf_rr(dev, MT_RF(0, 31)); 292 - rf_val &= ~0x1F; 293 - rf_val |= freq_item->pllR31_b4b0; 294 - rf_wr(dev, MT_RF(0, 31), rf_val); 347 + mt76x0_rf_rmw(dev, MT_RF(0, 31), MT_RF_PLL_K_MASK, 348 + freq_item->pllR31_b4b0); 295 349 296 350 /* R30<7> sdm_reset_n */ 297 - rf_val = rf_rr(dev, MT_RF(0, 30)); 298 - rf_val &= ~0x80; 299 - if (bSDM) { 300 - rf_wr(dev, MT_RF(0, 30), rf_val); 301 - rf_val |= 0x80; 302 - rf_wr(dev, MT_RF(0, 30), rf_val); 351 + if (b_sdm) { 352 + mt76x0_rf_clear(dev, MT_RF(0, 30), 353 + MT_RF_SDM_RESET_MASK); 354 + mt76x0_rf_set(dev, MT_RF(0, 30), 355 + MT_RF_SDM_RESET_MASK); 303 356 } else { 304 - rf_val |= freq_item->pllR30_b7; 305 - rf_wr(dev, MT_RF(0, 30), rf_val); 357 + mt76x0_rf_rmw(dev, MT_RF(0, 30), 358 + MT_RF_SDM_RESET_MASK, 359 + freq_item->pllR30_b7); 306 360 } 307 361 308 362 /* R30<6:2> sdmmash_prbs,sin */ 309 - rf_val = rf_rr(dev, MT_RF(0, 30)); 310 - rf_val &= ~0x7C; 311 - rf_val |= freq_item->pllR30_b6b2; 312 - rf_wr(dev, MT_RF(0, 30), rf_val); 363 + mt76x0_rf_rmw(dev, MT_RF(0, 30), 364 + MT_RF_SDM_MASH_PRBS_MASK, 365 + freq_item->pllR30_b6b2); 313 366 314 367 /* R30<1> sdm_bp */ 315 - rf_val = rf_rr(dev, MT_RF(0, 30)); 316 - rf_val &= ~0x02; 317 - rf_val |= (freq_item->pllR30_b1 << 1); 318 - rf_wr(dev, MT_RF(0, 30), rf_val); 368 + mt76x0_rf_rmw(dev, MT_RF(0, 30), MT_RF_SDM_BP_MASK, 369 + freq_item->pllR30_b1 << 1); 319 370 320 371 /* R30<0> R29<7:0> (hex) pll_n */ 321 - rf_val = freq_item->pll_n & 0x00FF; 322 - rf_wr(dev, MT_RF(0, 29), rf_val); 372 + mt76x0_rf_wr(dev, MT_RF(0, 29), 373 + freq_item->pll_n & 0xff); 323 374 324 - rf_val = rf_rr(dev, MT_RF(0, 30)); 325 - rf_val &= ~0x1; 326 - rf_val |= ((freq_item->pll_n >> 8) & 0x0001); 327 - rf_wr(dev, MT_RF(0, 30), rf_val); 375 + mt76x0_rf_rmw(dev, MT_RF(0, 30), 0x1, 376 + (freq_item->pll_n >> 8) & 0x1); 328 377 329 378 /* R28<7:6> isi_iso */ 330 - rf_val = rf_rr(dev, MT_RF(0, 28)); 331 - rf_val &= ~0xC0; 332 - rf_val |= freq_item->pllR28_b7b6; 333 - rf_wr(dev, MT_RF(0, 28), rf_val); 379 + mt76x0_rf_rmw(dev, MT_RF(0, 28), MT_RF_ISI_ISO_MASK, 380 + freq_item->pllR28_b7b6); 334 381 335 382 /* R28<5:4> pfd_dly */ 336 - rf_val = rf_rr(dev, MT_RF(0, 28)); 337 - rf_val &= ~0x30; 338 - rf_val |= freq_item->pllR28_b5b4; 339 - rf_wr(dev, MT_RF(0, 28), rf_val); 383 + mt76x0_rf_rmw(dev, MT_RF(0, 28), MT_RF_PFD_DLY_MASK, 384 + freq_item->pllR28_b5b4); 340 385 341 386 /* R28<3:2> clksel option */ 342 - rf_val = rf_rr(dev, MT_RF(0, 28)); 343 - rf_val &= ~0x0C; 344 - rf_val |= freq_item->pllR28_b3b2; 345 - rf_wr(dev, MT_RF(0, 28), rf_val); 387 + mt76x0_rf_rmw(dev, MT_RF(0, 28), MT_RF_CLK_SEL_MASK, 388 + freq_item->pllR28_b3b2); 346 389 347 390 /* R28<1:0> R27<7:0> R26<7:0> (hex) sdm_k */ 348 - rf_val = freq_item->pll_sdm_k & 0x000000FF; 349 - rf_wr(dev, MT_RF(0, 26), rf_val); 391 + mt76x0_rf_wr(dev, MT_RF(0, 26), 392 + freq_item->pll_sdm_k & 0xff); 393 + mt76x0_rf_wr(dev, MT_RF(0, 27), 394 + (freq_item->pll_sdm_k >> 8) & 0xff); 350 395 351 - rf_val = ((freq_item->pll_sdm_k >> 8) & 0x000000FF); 352 - rf_wr(dev, MT_RF(0, 27), rf_val); 353 - 354 - rf_val = rf_rr(dev, MT_RF(0, 28)); 355 - rf_val &= ~0x3; 356 - rf_val |= ((freq_item->pll_sdm_k >> 16) & 0x0003); 357 - rf_wr(dev, MT_RF(0, 28), rf_val); 396 + mt76x0_rf_rmw(dev, MT_RF(0, 28), 0x3, 397 + (freq_item->pll_sdm_k >> 16) & 0x3); 358 398 359 399 /* R24<1:0> xo_div */ 360 - rf_val = rf_rr(dev, MT_RF(0, 24)); 361 - rf_val &= ~0x3; 362 - rf_val |= freq_item->pllR24_b1b0; 363 - rf_wr(dev, MT_RF(0, 24), rf_val); 400 + mt76x0_rf_rmw(dev, MT_RF(0, 24), MT_RF_XO_DIV_MASK, 401 + freq_item->pllR24_b1b0); 364 402 365 403 break; 366 404 } ··· 344 430 345 431 for (i = 0; i < ARRAY_SIZE(mt76x0_rf_bw_switch_tab); i++) { 346 432 if (rf_bw == mt76x0_rf_bw_switch_tab[i].bw_band) { 347 - rf_wr(dev, mt76x0_rf_bw_switch_tab[i].rf_bank_reg, 348 - mt76x0_rf_bw_switch_tab[i].value); 433 + mt76x0_rf_wr(dev, 434 + mt76x0_rf_bw_switch_tab[i].rf_bank_reg, 435 + mt76x0_rf_bw_switch_tab[i].value); 349 436 } else if ((rf_bw == (mt76x0_rf_bw_switch_tab[i].bw_band & 0xFF)) && 350 437 (rf_band & mt76x0_rf_bw_switch_tab[i].bw_band)) { 351 - rf_wr(dev, mt76x0_rf_bw_switch_tab[i].rf_bank_reg, 352 - mt76x0_rf_bw_switch_tab[i].value); 438 + mt76x0_rf_wr(dev, 439 + mt76x0_rf_bw_switch_tab[i].rf_bank_reg, 440 + mt76x0_rf_bw_switch_tab[i].value); 353 441 } 354 442 } 355 443 356 444 for (i = 0; i < ARRAY_SIZE(mt76x0_rf_band_switch_tab); i++) { 357 445 if (mt76x0_rf_band_switch_tab[i].bw_band & rf_band) { 358 - rf_wr(dev, mt76x0_rf_band_switch_tab[i].rf_bank_reg, 359 - mt76x0_rf_band_switch_tab[i].value); 446 + mt76x0_rf_wr(dev, 447 + mt76x0_rf_band_switch_tab[i].rf_bank_reg, 448 + mt76x0_rf_band_switch_tab[i].value); 360 449 } 361 450 } 362 451 363 - mac_reg = mt76_rr(dev, MT_RF_MISC); 364 - mac_reg &= ~0xC; /* Clear 0x518[3:2] */ 365 - mt76_wr(dev, MT_RF_MISC, mac_reg); 452 + mt76_clear(dev, MT_RF_MISC, 0xc); 366 453 367 454 band = (rf_band & RF_G_BAND) ? NL80211_BAND_2GHZ : NL80211_BAND_5GHZ; 368 455 if (mt76x02_ext_pa_enabled(dev, band)) { ··· 372 457 [2]1'b1: enable external A band PA, 1'b0: disable external A band PA 373 458 [3]1'b1: enable external G band PA, 1'b0: disable external G band PA 374 459 */ 375 - if (rf_band & RF_A_BAND) { 376 - mac_reg = mt76_rr(dev, MT_RF_MISC); 377 - mac_reg |= 0x4; 378 - mt76_wr(dev, MT_RF_MISC, mac_reg); 379 - } else { 380 - mac_reg = mt76_rr(dev, MT_RF_MISC); 381 - mac_reg |= 0x8; 382 - mt76_wr(dev, MT_RF_MISC, mac_reg); 383 - } 460 + if (rf_band & RF_A_BAND) 461 + mt76_set(dev, MT_RF_MISC, BIT(2)); 462 + else 463 + mt76_set(dev, MT_RF_MISC, BIT(3)); 384 464 385 465 /* External PA */ 386 466 for (i = 0; i < ARRAY_SIZE(mt76x0_rf_ext_pa_tab); i++) 387 467 if (mt76x0_rf_ext_pa_tab[i].bw_band & rf_band) 388 - rf_wr(dev, mt76x0_rf_ext_pa_tab[i].rf_bank_reg, 389 - mt76x0_rf_ext_pa_tab[i].value); 468 + mt76x0_rf_wr(dev, 469 + mt76x0_rf_ext_pa_tab[i].rf_bank_reg, 470 + mt76x0_rf_ext_pa_tab[i].value); 390 471 } 391 472 392 473 if (rf_band & RF_G_BAND) { ··· 427 516 } 428 517 } 429 518 430 - static void mt76x0_ant_select(struct mt76x02_dev *dev) 519 + static void mt76x0_phy_ant_select(struct mt76x02_dev *dev) 431 520 { 432 - struct ieee80211_channel *chan = dev->mt76.chandef.chan; 521 + u16 ee_ant = mt76x02_eeprom_get(dev, MT_EE_ANTENNA); 522 + u16 nic_conf2 = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_2); 523 + u32 wlan, coex3, cmb; 524 + bool ant_div; 433 525 434 - /* single antenna mode */ 435 - if (chan->band == NL80211_BAND_2GHZ) { 436 - mt76_rmw(dev, MT_COEXCFG3, 437 - BIT(5) | BIT(4) | BIT(3) | BIT(2), BIT(1)); 438 - mt76_rmw(dev, MT_WLAN_FUN_CTRL, BIT(5), BIT(6)); 526 + wlan = mt76_rr(dev, MT_WLAN_FUN_CTRL); 527 + cmb = mt76_rr(dev, MT_CMB_CTRL); 528 + coex3 = mt76_rr(dev, MT_COEXCFG3); 529 + 530 + cmb &= ~(BIT(14) | BIT(12)); 531 + wlan &= ~(BIT(6) | BIT(5)); 532 + coex3 &= ~GENMASK(5, 2); 533 + 534 + if (ee_ant & MT_EE_ANTENNA_DUAL) { 535 + /* dual antenna mode */ 536 + ant_div = !(nic_conf2 & MT_EE_NIC_CONF_2_ANT_OPT) && 537 + (nic_conf2 & MT_EE_NIC_CONF_2_ANT_DIV); 538 + if (ant_div) 539 + cmb |= BIT(12); 540 + else 541 + coex3 |= BIT(4); 542 + coex3 |= BIT(3); 543 + if (dev->mt76.cap.has_2ghz) 544 + wlan |= BIT(6); 439 545 } else { 440 - mt76_rmw(dev, MT_COEXCFG3, BIT(5) | BIT(2), 441 - BIT(4) | BIT(3)); 442 - mt76_clear(dev, MT_WLAN_FUN_CTRL, 443 - BIT(6) | BIT(5)); 546 + /* sigle antenna mode */ 547 + if (dev->mt76.cap.has_5ghz) { 548 + coex3 |= BIT(3) | BIT(4); 549 + } else { 550 + wlan |= BIT(6); 551 + coex3 |= BIT(1); 552 + } 444 553 } 445 - mt76_clear(dev, MT_CMB_CTRL, BIT(14) | BIT(12)); 554 + 555 + if (is_mt7630(dev)) 556 + cmb |= BIT(14) | BIT(11); 557 + 558 + mt76_wr(dev, MT_WLAN_FUN_CTRL, wlan); 559 + mt76_wr(dev, MT_CMB_CTRL, cmb); 446 560 mt76_clear(dev, MT_COEXCFG0, BIT(2)); 561 + mt76_wr(dev, MT_COEXCFG3, coex3); 447 562 } 448 563 449 564 static void 450 - mt76x0_bbp_set_bw(struct mt76x02_dev *dev, enum nl80211_chan_width width) 565 + mt76x0_phy_bbp_set_bw(struct mt76x02_dev *dev, enum nl80211_chan_width width) 451 566 { 452 567 enum { BW_20 = 0, BW_40 = 1, BW_80 = 2, BW_10 = 4}; 453 568 int bw; ··· 500 563 return ; 501 564 } 502 565 503 - mt76x02_mcu_function_select(dev, BW_SETTING, bw, false); 566 + mt76x02_mcu_function_select(dev, BW_SETTING, bw); 567 + } 568 + 569 + static void mt76x0_phy_tssi_dc_calibrate(struct mt76x02_dev *dev) 570 + { 571 + struct ieee80211_channel *chan = dev->mt76.chandef.chan; 572 + u32 val; 573 + 574 + if (chan->band == NL80211_BAND_5GHZ) 575 + mt76x0_rf_clear(dev, MT_RF(0, 67), 0xf); 576 + 577 + /* bypass ADDA control */ 578 + mt76_wr(dev, MT_RF_SETTING_0, 0x60002237); 579 + mt76_wr(dev, MT_RF_BYPASS_0, 0xffffffff); 580 + 581 + /* bbp sw reset */ 582 + mt76_set(dev, MT_BBP(CORE, 4), BIT(0)); 583 + usleep_range(500, 1000); 584 + mt76_clear(dev, MT_BBP(CORE, 4), BIT(0)); 585 + 586 + val = (chan->band == NL80211_BAND_5GHZ) ? 0x80055 : 0x80050; 587 + mt76_wr(dev, MT_BBP(CORE, 34), val); 588 + 589 + /* enable TX with DAC0 input */ 590 + mt76_wr(dev, MT_BBP(TXBE, 6), BIT(31)); 591 + 592 + mt76_poll_msec(dev, MT_BBP(CORE, 34), BIT(4), 0, 200); 593 + dev->cal.tssi_dc = mt76_rr(dev, MT_BBP(CORE, 35)) & 0xff; 594 + 595 + /* stop bypass ADDA */ 596 + mt76_wr(dev, MT_RF_BYPASS_0, 0); 597 + /* stop TX */ 598 + mt76_wr(dev, MT_BBP(TXBE, 6), 0); 599 + /* bbp sw reset */ 600 + mt76_set(dev, MT_BBP(CORE, 4), BIT(0)); 601 + usleep_range(500, 1000); 602 + mt76_clear(dev, MT_BBP(CORE, 4), BIT(0)); 603 + 604 + if (chan->band == NL80211_BAND_5GHZ) 605 + mt76x0_rf_rmw(dev, MT_RF(0, 67), 0xf, 0x4); 606 + } 607 + 608 + static int 609 + mt76x0_phy_tssi_adc_calibrate(struct mt76x02_dev *dev, s16 *ltssi, 610 + u8 *info) 611 + { 612 + struct ieee80211_channel *chan = dev->mt76.chandef.chan; 613 + u32 val; 614 + 615 + val = (chan->band == NL80211_BAND_5GHZ) ? 0x80055 : 0x80050; 616 + mt76_wr(dev, MT_BBP(CORE, 34), val); 617 + 618 + if (!mt76_poll_msec(dev, MT_BBP(CORE, 34), BIT(4), 0, 200)) { 619 + mt76_clear(dev, MT_BBP(CORE, 34), BIT(4)); 620 + return -ETIMEDOUT; 621 + } 622 + 623 + *ltssi = mt76_rr(dev, MT_BBP(CORE, 35)) & 0xff; 624 + if (chan->band == NL80211_BAND_5GHZ) 625 + *ltssi += 128; 626 + 627 + /* set packet info#1 mode */ 628 + mt76_wr(dev, MT_BBP(CORE, 34), 0x80041); 629 + info[0] = mt76_rr(dev, MT_BBP(CORE, 35)) & 0xff; 630 + 631 + /* set packet info#2 mode */ 632 + mt76_wr(dev, MT_BBP(CORE, 34), 0x80042); 633 + info[1] = mt76_rr(dev, MT_BBP(CORE, 35)) & 0xff; 634 + 635 + /* set packet info#3 mode */ 636 + mt76_wr(dev, MT_BBP(CORE, 34), 0x80043); 637 + info[2] = mt76_rr(dev, MT_BBP(CORE, 35)) & 0xff; 638 + 639 + return 0; 640 + } 641 + 642 + static u8 mt76x0_phy_get_rf_pa_mode(struct mt76x02_dev *dev, 643 + int index, u8 tx_rate) 644 + { 645 + u32 val, reg; 646 + 647 + reg = (index == 1) ? MT_RF_PA_MODE_CFG1 : MT_RF_PA_MODE_CFG0; 648 + val = mt76_rr(dev, reg); 649 + return (val & (3 << (tx_rate * 2))) >> (tx_rate * 2); 650 + } 651 + 652 + static int 653 + mt76x0_phy_get_target_power(struct mt76x02_dev *dev, u8 tx_mode, 654 + u8 *info, s8 *target_power, 655 + s8 *target_pa_power) 656 + { 657 + u8 tx_rate, cur_power; 658 + 659 + cur_power = mt76_rr(dev, MT_TX_ALC_CFG_0) & MT_TX_ALC_CFG_0_CH_INIT_0; 660 + switch (tx_mode) { 661 + case 0: 662 + /* cck rates */ 663 + tx_rate = (info[0] & 0x60) >> 5; 664 + if (tx_rate > 3) 665 + return -EINVAL; 666 + 667 + *target_power = cur_power + dev->mt76.rate_power.cck[tx_rate]; 668 + *target_pa_power = mt76x0_phy_get_rf_pa_mode(dev, 0, tx_rate); 669 + break; 670 + case 1: { 671 + u8 index; 672 + 673 + /* ofdm rates */ 674 + tx_rate = (info[0] & 0xf0) >> 4; 675 + switch (tx_rate) { 676 + case 0xb: 677 + index = 0; 678 + break; 679 + case 0xf: 680 + index = 1; 681 + break; 682 + case 0xa: 683 + index = 2; 684 + break; 685 + case 0xe: 686 + index = 3; 687 + break; 688 + case 0x9: 689 + index = 4; 690 + break; 691 + case 0xd: 692 + index = 5; 693 + break; 694 + case 0x8: 695 + index = 6; 696 + break; 697 + case 0xc: 698 + index = 7; 699 + break; 700 + default: 701 + return -EINVAL; 702 + } 703 + 704 + *target_power = cur_power + dev->mt76.rate_power.ofdm[index]; 705 + *target_pa_power = mt76x0_phy_get_rf_pa_mode(dev, 0, index + 4); 706 + break; 707 + } 708 + case 4: 709 + /* vht rates */ 710 + tx_rate = info[1] & 0xf; 711 + if (tx_rate > 9) 712 + return -EINVAL; 713 + 714 + *target_power = cur_power + dev->mt76.rate_power.vht[tx_rate]; 715 + *target_pa_power = mt76x0_phy_get_rf_pa_mode(dev, 1, tx_rate); 716 + break; 717 + default: 718 + /* ht rates */ 719 + tx_rate = info[1] & 0x7f; 720 + if (tx_rate > 9) 721 + return -EINVAL; 722 + 723 + *target_power = cur_power + dev->mt76.rate_power.ht[tx_rate]; 724 + *target_pa_power = mt76x0_phy_get_rf_pa_mode(dev, 1, tx_rate); 725 + break; 726 + } 727 + 728 + return 0; 729 + } 730 + 731 + static s16 mt76x0_phy_lin2db(u16 val) 732 + { 733 + u32 mantissa = val << 4; 734 + int ret, data; 735 + s16 exp = -4; 736 + 737 + while (mantissa < BIT(15)) { 738 + mantissa <<= 1; 739 + if (--exp < -20) 740 + return -10000; 741 + } 742 + while (mantissa > 0xffff) { 743 + mantissa >>= 1; 744 + if (++exp > 20) 745 + return -10000; 746 + } 747 + 748 + /* s(15,0) */ 749 + if (mantissa <= 47104) 750 + data = mantissa + (mantissa >> 3) + (mantissa >> 4) - 38400; 751 + else 752 + data = mantissa - (mantissa >> 3) - (mantissa >> 6) - 23040; 753 + data = max_t(int, 0, data); 754 + 755 + ret = ((15 + exp) << 15) + data; 756 + ret = (ret << 2) + (ret << 1) + (ret >> 6) + (ret >> 7); 757 + return ret >> 10; 758 + } 759 + 760 + static int 761 + mt76x0_phy_get_delta_power(struct mt76x02_dev *dev, u8 tx_mode, 762 + s8 target_power, s8 target_pa_power, 763 + s16 ltssi) 764 + { 765 + struct ieee80211_channel *chan = dev->mt76.chandef.chan; 766 + int tssi_target = target_power << 12, tssi_slope; 767 + int tssi_offset, tssi_db, ret; 768 + u32 data; 769 + u16 val; 770 + 771 + if (chan->band == NL80211_BAND_5GHZ) { 772 + u8 bound[7]; 773 + int i, err; 774 + 775 + err = mt76x02_eeprom_copy(dev, MT_EE_TSSI_BOUND1, bound, 776 + sizeof(bound)); 777 + if (err < 0) 778 + return err; 779 + 780 + for (i = 0; i < ARRAY_SIZE(bound); i++) { 781 + if (chan->hw_value <= bound[i] || !bound[i]) 782 + break; 783 + } 784 + val = mt76x02_eeprom_get(dev, MT_EE_TSSI_SLOPE_5G + i * 2); 785 + 786 + tssi_offset = val >> 8; 787 + if ((tssi_offset >= 64 && tssi_offset <= 127) || 788 + (tssi_offset & BIT(7))) 789 + tssi_offset -= BIT(8); 790 + } else { 791 + val = mt76x02_eeprom_get(dev, MT_EE_TSSI_SLOPE_2G); 792 + 793 + tssi_offset = val >> 8; 794 + if (tssi_offset & BIT(7)) 795 + tssi_offset -= BIT(8); 796 + } 797 + tssi_slope = val & 0xff; 798 + 799 + switch (target_pa_power) { 800 + case 1: 801 + if (chan->band == NL80211_BAND_2GHZ) 802 + tssi_target += 29491; /* 3.6 * 8192 */ 803 + /* fall through */ 804 + case 0: 805 + break; 806 + default: 807 + tssi_target += 4424; /* 0.54 * 8192 */ 808 + break; 809 + } 810 + 811 + if (!tx_mode) { 812 + data = mt76_rr(dev, MT_BBP(CORE, 1)); 813 + if (is_mt7630(dev) && mt76_is_mmio(dev)) { 814 + int offset; 815 + 816 + /* 2.3 * 8192 or 1.5 * 8192 */ 817 + offset = (data & BIT(5)) ? 18841 : 12288; 818 + tssi_target += offset; 819 + } else if (data & BIT(5)) { 820 + /* 0.8 * 8192 */ 821 + tssi_target += 6554; 822 + } 823 + } 824 + 825 + data = mt76_rr(dev, MT_BBP(TXBE, 4)); 826 + switch (data & 0x3) { 827 + case 1: 828 + tssi_target -= 49152; /* -6db * 8192 */ 829 + break; 830 + case 2: 831 + tssi_target -= 98304; /* -12db * 8192 */ 832 + break; 833 + case 3: 834 + tssi_target += 49152; /* 6db * 8192 */ 835 + break; 836 + default: 837 + break; 838 + } 839 + 840 + tssi_db = mt76x0_phy_lin2db(ltssi - dev->cal.tssi_dc) * tssi_slope; 841 + if (chan->band == NL80211_BAND_5GHZ) { 842 + tssi_db += ((tssi_offset - 50) << 10); /* offset s4.3 */ 843 + tssi_target -= tssi_db; 844 + if (ltssi > 254 && tssi_target > 0) { 845 + /* upper saturate */ 846 + tssi_target = 0; 847 + } 848 + } else { 849 + tssi_db += (tssi_offset << 9); /* offset s3.4 */ 850 + tssi_target -= tssi_db; 851 + /* upper-lower saturate */ 852 + if ((ltssi > 126 && tssi_target > 0) || 853 + ((ltssi - dev->cal.tssi_dc) < 1 && tssi_target < 0)) { 854 + tssi_target = 0; 855 + } 856 + } 857 + 858 + if ((dev->cal.tssi_target ^ tssi_target) < 0 && 859 + dev->cal.tssi_target > -4096 && dev->cal.tssi_target < 4096 && 860 + tssi_target > -4096 && tssi_target < 4096) { 861 + if ((tssi_target < 0 && 862 + tssi_target + dev->cal.tssi_target > 0) || 863 + (tssi_target > 0 && 864 + tssi_target + dev->cal.tssi_target <= 0)) 865 + tssi_target = 0; 866 + else 867 + dev->cal.tssi_target = tssi_target; 868 + } else { 869 + dev->cal.tssi_target = tssi_target; 870 + } 871 + 872 + /* make the compensate value to the nearest compensate code */ 873 + if (tssi_target > 0) 874 + tssi_target += 2048; 875 + else 876 + tssi_target -= 2048; 877 + tssi_target >>= 12; 878 + 879 + ret = mt76_get_field(dev, MT_TX_ALC_CFG_1, MT_TX_ALC_CFG_1_TEMP_COMP); 880 + if (ret & BIT(5)) 881 + ret -= BIT(6); 882 + ret += tssi_target; 883 + 884 + ret = min_t(int, 31, ret); 885 + return max_t(int, -32, ret); 886 + } 887 + 888 + static void mt76x0_phy_tssi_calibrate(struct mt76x02_dev *dev) 889 + { 890 + s8 target_power, target_pa_power; 891 + u8 tssi_info[3], tx_mode; 892 + s16 ltssi; 893 + s8 val; 894 + 895 + if (mt76x0_phy_tssi_adc_calibrate(dev, &ltssi, tssi_info) < 0) 896 + return; 897 + 898 + tx_mode = tssi_info[0] & 0x7; 899 + if (mt76x0_phy_get_target_power(dev, tx_mode, tssi_info, 900 + &target_power, &target_pa_power) < 0) 901 + return; 902 + 903 + val = mt76x0_phy_get_delta_power(dev, tx_mode, target_power, 904 + target_pa_power, ltssi); 905 + mt76_rmw_field(dev, MT_TX_ALC_CFG_1, MT_TX_ALC_CFG_1_TEMP_COMP, val); 504 906 } 505 907 506 908 void mt76x0_phy_set_txpower(struct mt76x02_dev *dev) ··· 847 571 struct mt76_rate_power *t = &dev->mt76.rate_power; 848 572 u8 info[2]; 849 573 850 - mt76x0_get_power_info(dev, info); 851 574 mt76x0_get_tx_power_per_rate(dev); 575 + mt76x0_get_power_info(dev, info); 852 576 853 577 mt76x02_add_rate_power_offset(t, info[0]); 854 578 mt76x02_limit_rate_power(t, dev->mt76.txpower_conf); ··· 861 585 void mt76x0_phy_calibrate(struct mt76x02_dev *dev, bool power_on) 862 586 { 863 587 struct ieee80211_channel *chan = dev->mt76.chandef.chan; 588 + int is_5ghz = (chan->band == NL80211_BAND_5GHZ) ? 1 : 0; 864 589 u32 val, tx_alc, reg_val; 865 590 591 + if (is_mt7630(dev)) 592 + return; 593 + 866 594 if (power_on) { 867 - mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0, false); 868 - mt76x02_mcu_calibrate(dev, MCU_CAL_VCO, chan->hw_value, 869 - false); 595 + mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0); 596 + mt76x02_mcu_calibrate(dev, MCU_CAL_VCO, chan->hw_value); 870 597 usleep_range(10, 20); 871 - /* XXX: tssi */ 598 + 599 + if (mt76x0_tssi_enabled(dev)) { 600 + mt76_wr(dev, MT_MAC_SYS_CTRL, 601 + MT_MAC_SYS_CTRL_ENABLE_RX); 602 + mt76x0_phy_tssi_dc_calibrate(dev); 603 + mt76_wr(dev, MT_MAC_SYS_CTRL, 604 + MT_MAC_SYS_CTRL_ENABLE_TX | 605 + MT_MAC_SYS_CTRL_ENABLE_RX); 606 + } 872 607 } 873 608 874 609 tx_alc = mt76_rr(dev, MT_TX_ALC_CFG_0); ··· 889 602 reg_val = mt76_rr(dev, MT_BBP(IBI, 9)); 890 603 mt76_wr(dev, MT_BBP(IBI, 9), 0xffffff7e); 891 604 892 - if (chan->band == NL80211_BAND_5GHZ) { 605 + if (is_5ghz) { 893 606 if (chan->hw_value < 100) 894 607 val = 0x701; 895 608 else if (chan->hw_value < 140) ··· 900 613 val = 0x600; 901 614 } 902 615 903 - mt76x02_mcu_calibrate(dev, MCU_CAL_FULL, val, false); 616 + mt76x02_mcu_calibrate(dev, MCU_CAL_FULL, val); 904 617 msleep(350); 905 - mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 1, false); 618 + mt76x02_mcu_calibrate(dev, MCU_CAL_LC, is_5ghz); 906 619 usleep_range(15000, 20000); 907 620 908 621 mt76_wr(dev, MT_BBP(IBI, 9), reg_val); 909 622 mt76_wr(dev, MT_TX_ALC_CFG_0, tx_alc); 910 - mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1, false); 623 + mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1); 911 624 } 912 625 EXPORT_SYMBOL_GPL(mt76x0_phy_calibrate); 913 626 ··· 971 684 } 972 685 973 686 if (mt76_is_usb(dev)) { 974 - mt76x0_bbp_set_bw(dev, chandef->width); 687 + mt76x0_phy_bbp_set_bw(dev, chandef->width); 975 688 } else { 976 689 if (chandef->width == NL80211_CHAN_WIDTH_80 || 977 690 chandef->width == NL80211_CHAN_WIDTH_40) ··· 983 696 mt76x02_phy_set_bw(dev, chandef->width, ch_group_index); 984 697 mt76x02_phy_set_band(dev, chandef->chan->band, 985 698 ch_group_index & 1); 986 - mt76x0_ant_select(dev); 987 699 988 700 mt76_rmw(dev, MT_EXT_CCA_CFG, 989 701 (MT_EXT_CCA_CFG_CCA0 | ··· 996 710 mt76x0_phy_set_chan_rf_params(dev, channel, rf_bw_band); 997 711 998 712 /* set Japan Tx filter at channel 14 */ 999 - val = mt76_rr(dev, MT_BBP(CORE, 1)); 1000 713 if (channel == 14) 1001 - val |= 0x20; 714 + mt76_set(dev, MT_BBP(CORE, 1), 0x20); 1002 715 else 1003 - val &= ~0x20; 1004 - mt76_wr(dev, MT_BBP(CORE, 1), val); 716 + mt76_clear(dev, MT_BBP(CORE, 1), 0x20); 1005 717 1006 718 mt76x0_read_rx_gain(dev); 1007 719 mt76x0_phy_set_chan_bbp_params(dev, rf_bw_band); 1008 - mt76x02_init_agc_gain(dev); 1009 720 1010 - if (mt76_is_usb(dev)) { 1011 - mt76x0_vco_cal(dev, channel); 1012 - } else { 1013 - /* enable vco */ 1014 - rf_set(dev, MT_RF(0, 4), BIT(7)); 1015 - } 1016 - 721 + /* enable vco */ 722 + mt76x0_rf_set(dev, MT_RF(0, 4), BIT(7)); 1017 723 if (scan) 1018 724 return 0; 1019 725 1020 - if (mt76_is_mmio(dev)) 1021 - mt76x0_phy_calibrate(dev, false); 726 + mt76x02_init_agc_gain(dev); 727 + mt76x0_phy_calibrate(dev, false); 1022 728 mt76x0_phy_set_txpower(dev); 1023 729 1024 730 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, ··· 1019 741 return 0; 1020 742 } 1021 743 1022 - void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev) 1023 - { 1024 - u32 tx_alc, reg_val; 1025 - u8 channel = dev->mt76.chandef.chan->hw_value; 1026 - int is_5ghz = (dev->mt76.chandef.chan->band == NL80211_BAND_5GHZ) ? 1 : 0; 1027 - 1028 - mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0, false); 1029 - 1030 - mt76x0_vco_cal(dev, channel); 1031 - 1032 - tx_alc = mt76_rr(dev, MT_TX_ALC_CFG_0); 1033 - mt76_wr(dev, MT_TX_ALC_CFG_0, 0); 1034 - usleep_range(500, 700); 1035 - 1036 - reg_val = mt76_rr(dev, MT_BBP(IBI, 9)); 1037 - mt76_wr(dev, MT_BBP(IBI, 9), 0xffffff7e); 1038 - 1039 - mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 0, false); 1040 - 1041 - mt76x02_mcu_calibrate(dev, MCU_CAL_LC, is_5ghz, false); 1042 - mt76x02_mcu_calibrate(dev, MCU_CAL_LOFT, is_5ghz, false); 1043 - mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz, false); 1044 - mt76x02_mcu_calibrate(dev, MCU_CAL_TX_GROUP_DELAY, is_5ghz, false); 1045 - mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQ, is_5ghz, false); 1046 - mt76x02_mcu_calibrate(dev, MCU_CAL_RX_GROUP_DELAY, is_5ghz, false); 1047 - 1048 - mt76_wr(dev, MT_BBP(IBI, 9), reg_val); 1049 - mt76_wr(dev, MT_TX_ALC_CFG_0, tx_alc); 1050 - msleep(100); 1051 - 1052 - mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1, false); 1053 - } 1054 - 1055 - static void mt76x0_temp_sensor(struct mt76x02_dev *dev) 744 + static void mt76x0_phy_temp_sensor(struct mt76x02_dev *dev) 1056 745 { 1057 746 u8 rf_b7_73, rf_b0_66, rf_b0_67; 1058 747 s8 val; 1059 748 1060 - rf_b7_73 = rf_rr(dev, MT_RF(7, 73)); 1061 - rf_b0_66 = rf_rr(dev, MT_RF(0, 66)); 1062 - rf_b0_67 = rf_rr(dev, MT_RF(0, 67)); 749 + rf_b7_73 = mt76x0_rf_rr(dev, MT_RF(7, 73)); 750 + rf_b0_66 = mt76x0_rf_rr(dev, MT_RF(0, 66)); 751 + rf_b0_67 = mt76x0_rf_rr(dev, MT_RF(0, 67)); 1063 752 1064 - rf_wr(dev, MT_RF(7, 73), 0x02); 1065 - rf_wr(dev, MT_RF(0, 66), 0x23); 1066 - rf_wr(dev, MT_RF(0, 67), 0x01); 753 + mt76x0_rf_wr(dev, MT_RF(7, 73), 0x02); 754 + mt76x0_rf_wr(dev, MT_RF(0, 66), 0x23); 755 + mt76x0_rf_wr(dev, MT_RF(0, 67), 0x01); 1067 756 1068 757 mt76_wr(dev, MT_BBP(CORE, 34), 0x00080055); 1069 - 1070 - if (!mt76_poll(dev, MT_BBP(CORE, 34), BIT(4), 0, 2000)) { 758 + if (!mt76_poll_msec(dev, MT_BBP(CORE, 34), BIT(4), 0, 200)) { 1071 759 mt76_clear(dev, MT_BBP(CORE, 34), BIT(4)); 1072 760 goto done; 1073 761 } ··· 1043 799 1044 800 if (abs(val - dev->cal.temp_vco) > 20) { 1045 801 mt76x02_mcu_calibrate(dev, MCU_CAL_VCO, 1046 - dev->mt76.chandef.chan->hw_value, 1047 - false); 802 + dev->mt76.chandef.chan->hw_value); 1048 803 dev->cal.temp_vco = val; 1049 804 } 1050 805 if (abs(val - dev->cal.temp) > 30) { ··· 1052 809 } 1053 810 1054 811 done: 1055 - rf_wr(dev, MT_RF(7, 73), rf_b7_73); 1056 - rf_wr(dev, MT_RF(0, 66), rf_b0_66); 1057 - rf_wr(dev, MT_RF(0, 67), rf_b0_67); 812 + mt76x0_rf_wr(dev, MT_RF(7, 73), rf_b7_73); 813 + mt76x0_rf_wr(dev, MT_RF(0, 66), rf_b0_66); 814 + mt76x0_rf_wr(dev, MT_RF(0, 67), rf_b0_67); 1058 815 } 1059 816 1060 817 static void mt76x0_phy_set_gain_val(struct mt76x02_dev *dev) 1061 818 { 1062 819 u8 gain = dev->cal.agc_gain_cur[0] - dev->cal.agc_gain_adjust; 1063 - u32 val = 0x122c << 16 | 0xf2; 1064 820 1065 - mt76_wr(dev, MT_BBP(AGC, 8), 1066 - val | FIELD_PREP(MT_BBP_AGC_GAIN, gain)); 821 + mt76_rmw_field(dev, MT_BBP(AGC, 8), MT_BBP_AGC_GAIN, gain); 822 + 823 + if ((dev->mt76.chandef.chan->flags & IEEE80211_CHAN_RADAR) && 824 + !is_mt7630(dev)) 825 + mt76x02_phy_dfs_adjust_agc(dev); 1067 826 } 1068 827 1069 828 static void ··· 1080 835 low_gain = (dev->cal.avg_rssi_all > mt76x02_get_rssi_gain_thresh(dev)) + 1081 836 (dev->cal.avg_rssi_all > mt76x02_get_low_rssi_gain_thresh(dev)); 1082 837 1083 - gain_change = (dev->cal.low_gain & 2) ^ (low_gain & 2); 838 + gain_change = dev->cal.low_gain < 0 || 839 + (dev->cal.low_gain & 2) ^ (low_gain & 2); 1084 840 dev->cal.low_gain = low_gain; 1085 841 1086 842 if (!gain_change) { ··· 1106 860 cal_work.work); 1107 861 1108 862 mt76x0_phy_update_channel_gain(dev); 1109 - if (!mt76x0_tssi_enabled(dev)) 1110 - mt76x0_temp_sensor(dev); 863 + if (mt76x0_tssi_enabled(dev)) 864 + mt76x0_phy_tssi_calibrate(dev); 865 + else 866 + mt76x0_phy_temp_sensor(dev); 1111 867 1112 868 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, 1113 - MT_CALIBRATE_INTERVAL); 869 + 4 * MT_CALIBRATE_INTERVAL); 1114 870 } 1115 871 1116 - static void mt76x0_rf_init(struct mt76x02_dev *dev) 872 + static void mt76x0_rf_patch_reg_array(struct mt76x02_dev *dev, 873 + const struct mt76_reg_pair *rp, int len) 874 + { 875 + int i; 876 + 877 + for (i = 0; i < len; i++) { 878 + u32 reg = rp[i].reg; 879 + u8 val = rp[i].value; 880 + 881 + switch (reg) { 882 + case MT_RF(0, 3): 883 + if (mt76_is_mmio(dev)) { 884 + if (is_mt7630(dev)) 885 + val = 0x70; 886 + else 887 + val = 0x63; 888 + } else { 889 + val = 0x73; 890 + } 891 + break; 892 + case MT_RF(0, 21): 893 + if (is_mt7610e(dev)) 894 + val = 0x10; 895 + else 896 + val = 0x12; 897 + break; 898 + case MT_RF(5, 2): 899 + if (is_mt7630(dev)) 900 + val = 0x1d; 901 + else if (is_mt7610e(dev)) 902 + val = 0x00; 903 + else 904 + val = 0x0c; 905 + break; 906 + default: 907 + break; 908 + } 909 + mt76x0_rf_wr(dev, reg, val); 910 + } 911 + } 912 + 913 + static void mt76x0_phy_rf_init(struct mt76x02_dev *dev) 1117 914 { 1118 915 int i; 1119 916 u8 val; 1120 917 1121 - RF_RANDOM_WRITE(dev, mt76x0_rf_central_tab); 1122 - RF_RANDOM_WRITE(dev, mt76x0_rf_2g_channel_0_tab); 918 + mt76x0_rf_patch_reg_array(dev, mt76x0_rf_central_tab, 919 + ARRAY_SIZE(mt76x0_rf_central_tab)); 920 + mt76x0_rf_patch_reg_array(dev, mt76x0_rf_2g_channel_0_tab, 921 + ARRAY_SIZE(mt76x0_rf_2g_channel_0_tab)); 1123 922 RF_RANDOM_WRITE(dev, mt76x0_rf_5g_channel_0_tab); 1124 923 RF_RANDOM_WRITE(dev, mt76x0_rf_vga_channel_0_tab); 1125 924 ··· 1172 881 const struct mt76x0_rf_switch_item *item = &mt76x0_rf_bw_switch_tab[i]; 1173 882 1174 883 if (item->bw_band == RF_BW_20) 1175 - rf_wr(dev, item->rf_bank_reg, item->value); 884 + mt76x0_rf_wr(dev, item->rf_bank_reg, item->value); 1176 885 else if (((RF_G_BAND | RF_BW_20) & item->bw_band) == (RF_G_BAND | RF_BW_20)) 1177 - rf_wr(dev, item->rf_bank_reg, item->value); 886 + mt76x0_rf_wr(dev, item->rf_bank_reg, item->value); 1178 887 } 1179 888 1180 889 for (i = 0; i < ARRAY_SIZE(mt76x0_rf_band_switch_tab); i++) { 1181 890 if (mt76x0_rf_band_switch_tab[i].bw_band & RF_G_BAND) { 1182 - rf_wr(dev, 1183 - mt76x0_rf_band_switch_tab[i].rf_bank_reg, 1184 - mt76x0_rf_band_switch_tab[i].value); 891 + mt76x0_rf_wr(dev, 892 + mt76x0_rf_band_switch_tab[i].rf_bank_reg, 893 + mt76x0_rf_band_switch_tab[i].value); 1185 894 } 1186 895 } 1187 896 ··· 1190 899 E1: B0.R22<6:0>: xo_cxo<6:0> 1191 900 E2: B0.R21<0>: xo_cxo<0>, B0.R22<7:0>: xo_cxo<8:1> 1192 901 */ 1193 - rf_wr(dev, MT_RF(0, 22), 1194 - min_t(u8, dev->cal.rx.freq_offset, 0xbf)); 1195 - val = rf_rr(dev, MT_RF(0, 22)); 902 + mt76x0_rf_wr(dev, MT_RF(0, 22), 903 + min_t(u8, dev->cal.rx.freq_offset, 0xbf)); 904 + val = mt76x0_rf_rr(dev, MT_RF(0, 22)); 1196 905 1197 - /* 1198 - Reset the DAC (Set B0.R73<7>=1, then set B0.R73<7>=0, and then set B0.R73<7>) during power up. 906 + /* Reset procedure DAC during power-up: 907 + * - set B0.R73<7> 908 + * - clear B0.R73<7> 909 + * - set B0.R73<7> 1199 910 */ 1200 - val = rf_rr(dev, MT_RF(0, 73)); 1201 - val |= 0x80; 1202 - rf_wr(dev, MT_RF(0, 73), val); 1203 - val &= ~0x80; 1204 - rf_wr(dev, MT_RF(0, 73), val); 1205 - val |= 0x80; 1206 - rf_wr(dev, MT_RF(0, 73), val); 911 + mt76x0_rf_set(dev, MT_RF(0, 73), BIT(7)); 912 + mt76x0_rf_clear(dev, MT_RF(0, 73), BIT(7)); 913 + mt76x0_rf_set(dev, MT_RF(0, 73), BIT(7)); 1207 914 1208 - /* 1209 - vcocal_en (initiate VCO calibration (reset after completion)) - It should be at the end of RF configuration. 1210 - */ 1211 - rf_set(dev, MT_RF(0, 4), 0x80); 915 + /* vcocal_en: initiate VCO calibration (reset after completion)) */ 916 + mt76x0_rf_set(dev, MT_RF(0, 4), 0x80); 1212 917 } 1213 918 1214 919 void mt76x0_phy_init(struct mt76x02_dev *dev) 1215 920 { 1216 921 INIT_DELAYED_WORK(&dev->cal_work, mt76x0_phy_calibration_work); 1217 922 1218 - mt76x0_rf_init(dev); 923 + mt76x0_phy_ant_select(dev); 924 + mt76x0_phy_rf_init(dev); 1219 925 mt76x02_phy_set_rxpath(dev); 1220 926 mt76x02_phy_set_txdac(dev); 1221 927 }
+17
drivers/net/wireless/mediatek/mt76/mt76x0/phy.h
··· 30 30 #define MT_RF_BANK(offset) (offset >> 16) 31 31 #define MT_RF_REG(offset) (offset & 0xff) 32 32 33 + #define MT_RF_VCO_BP_CLOSE_LOOP BIT(3) 34 + #define MT_RF_VCO_BP_CLOSE_LOOP_MASK GENMASK(3, 0) 35 + #define MT_RF_VCO_CAL_MASK GENMASK(2, 0) 36 + #define MT_RF_START_TIME 0x3 37 + #define MT_RF_START_TIME_MASK GENMASK(2, 0) 38 + #define MT_RF_SETTLE_TIME_MASK GENMASK(6, 4) 39 + 40 + #define MT_RF_PLL_DEN_MASK GENMASK(4, 0) 41 + #define MT_RF_PLL_K_MASK GENMASK(4, 0) 42 + #define MT_RF_SDM_RESET_MASK BIT(7) 43 + #define MT_RF_SDM_MASH_PRBS_MASK GENMASK(6, 2) 44 + #define MT_RF_SDM_BP_MASK BIT(1) 45 + #define MT_RF_ISI_ISO_MASK GENMASK(7, 6) 46 + #define MT_RF_PFD_DLY_MASK GENMASK(5, 4) 47 + #define MT_RF_CLK_SEL_MASK GENMASK(3, 2) 48 + #define MT_RF_XO_DIV_MASK GENMASK(1, 0) 49 + 33 50 struct mt76x0_bbp_switch_item { 34 51 u16 bw_band; 35 52 struct mt76_reg_pair reg_pair;
-21
drivers/net/wireless/mediatek/mt76/mt76x0/trace.c
··· 1 - /* 2 - * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org> 3 - * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl> 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 7 - * as published by the Free Software Foundation 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - */ 14 - 15 - #include <linux/module.h> 16 - 17 - #ifndef __CHECKER__ 18 - #define CREATE_TRACE_POINTS 19 - #include "trace.h" 20 - 21 - #endif
-312
drivers/net/wireless/mediatek/mt76/mt76x0/trace.h
··· 1 - /* 2 - * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org> 3 - * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl> 4 - * 5 - * This program is free software; you can redistribute it and/or modify 6 - * it under the terms of the GNU General Public License version 2 7 - * as published by the Free Software Foundation 8 - * 9 - * This program is distributed in the hope that it will be useful, 10 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 - * GNU General Public License for more details. 13 - */ 14 - 15 - #if !defined(__MT76X0U_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 16 - #define __MT76X0U_TRACE_H 17 - 18 - #include <linux/tracepoint.h> 19 - #include "mt76x0.h" 20 - 21 - #undef TRACE_SYSTEM 22 - #define TRACE_SYSTEM mt76x0 23 - 24 - #define MAXNAME 32 25 - #define DEV_ENTRY __array(char, wiphy_name, 32) 26 - #define DEV_ASSIGN strlcpy(__entry->wiphy_name, \ 27 - wiphy_name(dev->hw->wiphy), MAXNAME) 28 - #define DEV_PR_FMT "%s " 29 - #define DEV_PR_ARG __entry->wiphy_name 30 - 31 - #define REG_ENTRY __field(u32, reg) __field(u32, val) 32 - #define REG_ASSIGN __entry->reg = reg; __entry->val = val 33 - #define REG_PR_FMT "%04x=%08x" 34 - #define REG_PR_ARG __entry->reg, __entry->val 35 - 36 - DECLARE_EVENT_CLASS(dev_reg_evt, 37 - TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val), 38 - TP_ARGS(dev, reg, val), 39 - TP_STRUCT__entry( 40 - DEV_ENTRY 41 - REG_ENTRY 42 - ), 43 - TP_fast_assign( 44 - DEV_ASSIGN; 45 - REG_ASSIGN; 46 - ), 47 - TP_printk( 48 - DEV_PR_FMT REG_PR_FMT, 49 - DEV_PR_ARG, REG_PR_ARG 50 - ) 51 - ); 52 - 53 - DEFINE_EVENT(dev_reg_evt, mt76x0_reg_read, 54 - TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val), 55 - TP_ARGS(dev, reg, val) 56 - ); 57 - 58 - DEFINE_EVENT(dev_reg_evt, mt76x0_reg_write, 59 - TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val), 60 - TP_ARGS(dev, reg, val) 61 - ); 62 - 63 - TRACE_EVENT(mt76x0_submit_urb, 64 - TP_PROTO(struct mt76_dev *dev, struct urb *u), 65 - TP_ARGS(dev, u), 66 - TP_STRUCT__entry( 67 - DEV_ENTRY __field(unsigned, pipe) __field(u32, len) 68 - ), 69 - TP_fast_assign( 70 - DEV_ASSIGN; 71 - __entry->pipe = u->pipe; 72 - __entry->len = u->transfer_buffer_length; 73 - ), 74 - TP_printk(DEV_PR_FMT "p:%08x len:%u", 75 - DEV_PR_ARG, __entry->pipe, __entry->len) 76 - ); 77 - 78 - #define trace_mt76x0_submit_urb_sync(__dev, __pipe, __len) ({ \ 79 - struct urb u; \ 80 - u.pipe = __pipe; \ 81 - u.transfer_buffer_length = __len; \ 82 - trace_mt76x0_submit_urb(__dev, &u); \ 83 - }) 84 - 85 - TRACE_EVENT(mt76x0_mcu_msg_send, 86 - TP_PROTO(struct mt76_dev *dev, 87 - struct sk_buff *skb, u32 csum, bool resp), 88 - TP_ARGS(dev, skb, csum, resp), 89 - TP_STRUCT__entry( 90 - DEV_ENTRY 91 - __field(u32, info) 92 - __field(u32, csum) 93 - __field(bool, resp) 94 - ), 95 - TP_fast_assign( 96 - DEV_ASSIGN; 97 - __entry->info = *(u32 *)skb->data; 98 - __entry->csum = csum; 99 - __entry->resp = resp; 100 - ), 101 - TP_printk(DEV_PR_FMT "i:%08x c:%08x r:%d", 102 - DEV_PR_ARG, __entry->info, __entry->csum, __entry->resp) 103 - ); 104 - 105 - TRACE_EVENT(mt76x0_vend_req, 106 - TP_PROTO(struct mt76_dev *dev, unsigned pipe, u8 req, u8 req_type, 107 - u16 val, u16 offset, void *buf, size_t buflen, int ret), 108 - TP_ARGS(dev, pipe, req, req_type, val, offset, buf, buflen, ret), 109 - TP_STRUCT__entry( 110 - DEV_ENTRY 111 - __field(unsigned, pipe) __field(u8, req) __field(u8, req_type) 112 - __field(u16, val) __field(u16, offset) __field(void*, buf) 113 - __field(int, buflen) __field(int, ret) 114 - ), 115 - TP_fast_assign( 116 - DEV_ASSIGN; 117 - __entry->pipe = pipe; 118 - __entry->req = req; 119 - __entry->req_type = req_type; 120 - __entry->val = val; 121 - __entry->offset = offset; 122 - __entry->buf = buf; 123 - __entry->buflen = buflen; 124 - __entry->ret = ret; 125 - ), 126 - TP_printk(DEV_PR_FMT 127 - "%d p:%08x req:%02hhx %02hhx val:%04hx %04hx buf:%d %d", 128 - DEV_PR_ARG, __entry->ret, __entry->pipe, __entry->req, 129 - __entry->req_type, __entry->val, __entry->offset, 130 - !!__entry->buf, __entry->buflen) 131 - ); 132 - 133 - DECLARE_EVENT_CLASS(dev_rf_reg_evt, 134 - TP_PROTO(struct mt76_dev *dev, u8 bank, u8 reg, u8 val), 135 - TP_ARGS(dev, bank, reg, val), 136 - TP_STRUCT__entry( 137 - DEV_ENTRY 138 - __field(u8, bank) 139 - __field(u8, reg) 140 - __field(u8, val) 141 - ), 142 - TP_fast_assign( 143 - DEV_ASSIGN; 144 - REG_ASSIGN; 145 - __entry->bank = bank; 146 - ), 147 - TP_printk( 148 - DEV_PR_FMT "%02hhx:%02hhx=%02hhx", 149 - DEV_PR_ARG, __entry->bank, __entry->reg, __entry->val 150 - ) 151 - ); 152 - 153 - DEFINE_EVENT(dev_rf_reg_evt, mt76x0_rf_read, 154 - TP_PROTO(struct mt76_dev *dev, u8 bank, u8 reg, u8 val), 155 - TP_ARGS(dev, bank, reg, val) 156 - ); 157 - 158 - DEFINE_EVENT(dev_rf_reg_evt, mt76x0_rf_write, 159 - TP_PROTO(struct mt76_dev *dev, u8 bank, u8 reg, u8 val), 160 - TP_ARGS(dev, bank, reg, val) 161 - ); 162 - 163 - DECLARE_EVENT_CLASS(dev_simple_evt, 164 - TP_PROTO(struct mt76_dev *dev, u8 val), 165 - TP_ARGS(dev, val), 166 - TP_STRUCT__entry( 167 - DEV_ENTRY 168 - __field(u8, val) 169 - ), 170 - TP_fast_assign( 171 - DEV_ASSIGN; 172 - __entry->val = val; 173 - ), 174 - TP_printk( 175 - DEV_PR_FMT "%02hhx", DEV_PR_ARG, __entry->val 176 - ) 177 - ); 178 - 179 - TRACE_EVENT(mt76x0_rx, 180 - TP_PROTO(struct mt76_dev *dev, struct mt76x02_rxwi *rxwi, u32 f), 181 - TP_ARGS(dev, rxwi, f), 182 - TP_STRUCT__entry( 183 - DEV_ENTRY 184 - __field_struct(struct mt76x02_rxwi, rxwi) 185 - __field(u32, fce_info) 186 - ), 187 - TP_fast_assign( 188 - DEV_ASSIGN; 189 - __entry->rxwi = *rxwi; 190 - __entry->fce_info = f; 191 - ), 192 - TP_printk(DEV_PR_FMT "rxi:%08x ctl:%08x", DEV_PR_ARG, 193 - le32_to_cpu(__entry->rxwi.rxinfo), 194 - le32_to_cpu(__entry->rxwi.ctl)) 195 - ); 196 - 197 - TRACE_EVENT(mt76x0_tx, 198 - TP_PROTO(struct mt76_dev *dev, struct sk_buff *skb, 199 - struct mt76x02_sta *sta, struct mt76x02_txwi *h), 200 - TP_ARGS(dev, skb, sta, h), 201 - TP_STRUCT__entry( 202 - DEV_ENTRY 203 - __field_struct(struct mt76x02_txwi, h) 204 - __field(struct sk_buff *, skb) 205 - __field(struct mt76x02_sta *, sta) 206 - ), 207 - TP_fast_assign( 208 - DEV_ASSIGN; 209 - __entry->h = *h; 210 - __entry->skb = skb; 211 - __entry->sta = sta; 212 - ), 213 - TP_printk(DEV_PR_FMT "skb:%p sta:%p flg:%04hx rate:%04hx " 214 - "ack:%02hhx wcid:%02hhx len_ctl:%05hx", DEV_PR_ARG, 215 - __entry->skb, __entry->sta, 216 - le16_to_cpu(__entry->h.flags), 217 - le16_to_cpu(__entry->h.rate), 218 - __entry->h.ack_ctl, __entry->h.wcid, 219 - le16_to_cpu(__entry->h.len_ctl)) 220 - ); 221 - 222 - TRACE_EVENT(mt76x0_tx_dma_done, 223 - TP_PROTO(struct mt76_dev *dev, struct sk_buff *skb), 224 - TP_ARGS(dev, skb), 225 - TP_STRUCT__entry( 226 - DEV_ENTRY 227 - __field(struct sk_buff *, skb) 228 - ), 229 - TP_fast_assign( 230 - DEV_ASSIGN; 231 - __entry->skb = skb; 232 - ), 233 - TP_printk(DEV_PR_FMT "%p", DEV_PR_ARG, __entry->skb) 234 - ); 235 - 236 - TRACE_EVENT(mt76x0_tx_status_cleaned, 237 - TP_PROTO(struct mt76_dev *dev, int cleaned), 238 - TP_ARGS(dev, cleaned), 239 - TP_STRUCT__entry( 240 - DEV_ENTRY 241 - __field(int, cleaned) 242 - ), 243 - TP_fast_assign( 244 - DEV_ASSIGN; 245 - __entry->cleaned = cleaned; 246 - ), 247 - TP_printk(DEV_PR_FMT "%d", DEV_PR_ARG, __entry->cleaned) 248 - ); 249 - 250 - TRACE_EVENT(mt76x0_tx_status, 251 - TP_PROTO(struct mt76_dev *dev, u32 stat1, u32 stat2), 252 - TP_ARGS(dev, stat1, stat2), 253 - TP_STRUCT__entry( 254 - DEV_ENTRY 255 - __field(u32, stat1) __field(u32, stat2) 256 - ), 257 - TP_fast_assign( 258 - DEV_ASSIGN; 259 - __entry->stat1 = stat1; 260 - __entry->stat2 = stat2; 261 - ), 262 - TP_printk(DEV_PR_FMT "%08x %08x", 263 - DEV_PR_ARG, __entry->stat1, __entry->stat2) 264 - ); 265 - 266 - TRACE_EVENT(mt76x0_rx_dma_aggr, 267 - TP_PROTO(struct mt76_dev *dev, int cnt, bool paged), 268 - TP_ARGS(dev, cnt, paged), 269 - TP_STRUCT__entry( 270 - DEV_ENTRY 271 - __field(u8, cnt) 272 - __field(bool, paged) 273 - ), 274 - TP_fast_assign( 275 - DEV_ASSIGN; 276 - __entry->cnt = cnt; 277 - __entry->paged = paged; 278 - ), 279 - TP_printk(DEV_PR_FMT "cnt:%d paged:%d", 280 - DEV_PR_ARG, __entry->cnt, __entry->paged) 281 - ); 282 - 283 - DEFINE_EVENT(dev_simple_evt, mt76x0_set_key, 284 - TP_PROTO(struct mt76_dev *dev, u8 val), 285 - TP_ARGS(dev, val) 286 - ); 287 - 288 - TRACE_EVENT(mt76x0_set_shared_key, 289 - TP_PROTO(struct mt76_dev *dev, u8 vid, u8 key), 290 - TP_ARGS(dev, vid, key), 291 - TP_STRUCT__entry( 292 - DEV_ENTRY 293 - __field(u8, vid) 294 - __field(u8, key) 295 - ), 296 - TP_fast_assign( 297 - DEV_ASSIGN; 298 - __entry->vid = vid; 299 - __entry->key = key; 300 - ), 301 - TP_printk(DEV_PR_FMT "phy:%02hhx off:%02hhx", 302 - DEV_PR_ARG, __entry->vid, __entry->key) 303 - ); 304 - 305 - #endif 306 - 307 - #undef TRACE_INCLUDE_PATH 308 - #define TRACE_INCLUDE_PATH . 309 - #undef TRACE_INCLUDE_FILE 310 - #define TRACE_INCLUDE_FILE trace 311 - 312 - #include <trace/define_trace.h>
+11 -7
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
··· 17 17 18 18 #include "mt76x0.h" 19 19 #include "mcu.h" 20 - #include "trace.h" 21 20 #include "../mt76x02_usb.h" 22 21 23 22 static struct usb_device_id mt76x0_device_table[] = { ··· 116 117 if (ret) 117 118 goto out; 118 119 120 + mt76x0_phy_calibrate(dev, true); 119 121 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mac_work, 120 122 MT_CALIBRATE_INTERVAL); 121 123 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, ··· 145 145 .remove_interface = mt76x02_remove_interface, 146 146 .config = mt76x0_config, 147 147 .configure_filter = mt76x02_configure_filter, 148 - .bss_info_changed = mt76x0_bss_info_changed, 149 - .sta_add = mt76x02_sta_add, 150 - .sta_remove = mt76x02_sta_remove, 148 + .bss_info_changed = mt76x02_bss_info_changed, 149 + .sta_state = mt76_sta_state, 151 150 .set_key = mt76x02_set_key, 152 151 .conf_tx = mt76x02_conf_tx, 153 - .sw_scan_start = mt76x0_sw_scan, 154 - .sw_scan_complete = mt76x0_sw_scan_complete, 152 + .sw_scan_start = mt76x02_sw_scan, 153 + .sw_scan_complete = mt76x02_sw_scan_complete, 155 154 .ampdu_action = mt76x02_ampdu_action, 156 155 .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, 157 - .set_rts_threshold = mt76x0_set_rts_threshold, 156 + .set_rts_threshold = mt76x02_set_rts_threshold, 158 157 .wake_tx_queue = mt76_wake_tx_queue, 158 + .get_txpower = mt76x02_get_txpower, 159 159 }; 160 160 161 161 static int mt76x0u_register_device(struct mt76x02_dev *dev) ··· 218 218 .tx_complete_skb = mt76x02u_tx_complete_skb, 219 219 .tx_status_data = mt76x02_tx_status_data, 220 220 .rx_skb = mt76x02_queue_rx_skb, 221 + .sta_add = mt76x02_sta_add, 222 + .sta_remove = mt76x02_sta_remove, 221 223 }; 222 224 struct usb_device *usb_dev = interface_to_usbdev(usb_intf); 223 225 struct mt76x02_dev *dev; ··· 339 337 } 340 338 341 339 MODULE_DEVICE_TABLE(usb, mt76x0_device_table); 340 + MODULE_FIRMWARE(MT7610E_FIRMWARE); 341 + MODULE_FIRMWARE(MT7610U_FIRMWARE); 342 342 MODULE_LICENSE("GPL"); 343 343 344 344 static struct usb_driver mt76x0_driver = {
+19 -4
drivers/net/wireless/mediatek/mt76/mt76x0/usb_mcu.c
··· 22 22 23 23 #define MCU_FW_URB_MAX_PAYLOAD 0x38f8 24 24 #define MCU_FW_URB_SIZE (MCU_FW_URB_MAX_PAYLOAD + 12) 25 - #define MT7610U_FIRMWARE "mediatek/mt7610u.bin" 26 25 27 26 static int 28 27 mt76x0u_upload_firmware(struct mt76x02_dev *dev, ··· 74 75 return err; 75 76 } 76 77 78 + static int mt76x0_get_firmware(struct mt76x02_dev *dev, 79 + const struct firmware **fw) 80 + { 81 + int err; 82 + 83 + /* try to load mt7610e fw if available 84 + * otherwise fall back to mt7610u one 85 + */ 86 + err = firmware_request_nowarn(fw, MT7610E_FIRMWARE, dev->mt76.dev); 87 + if (err) { 88 + dev_info(dev->mt76.dev, "%s not found, switching to %s", 89 + MT7610E_FIRMWARE, MT7610U_FIRMWARE); 90 + return request_firmware(fw, MT7610U_FIRMWARE, 91 + dev->mt76.dev); 92 + } 93 + return 0; 94 + } 95 + 77 96 static int mt76x0u_load_firmware(struct mt76x02_dev *dev) 78 97 { 79 98 const struct firmware *fw; ··· 105 88 if (mt76x0_firmware_running(dev)) 106 89 return 0; 107 90 108 - ret = request_firmware(&fw, MT7610U_FIRMWARE, dev->mt76.dev); 91 + ret = mt76x0_get_firmware(dev, &fw); 109 92 if (ret) 110 93 return ret; 111 94 ··· 188 171 189 172 return 0; 190 173 } 191 - 192 - MODULE_FIRMWARE(MT7610U_FIRMWARE);
+28 -15
drivers/net/wireless/mediatek/mt76/mt76x02.h
··· 26 26 #include "mt76x02_dfs.h" 27 27 #include "mt76x02_dma.h" 28 28 29 - struct mt76x02_mac_stats { 30 - u64 rx_stat[6]; 31 - u64 tx_stat[6]; 32 - u64 aggr_stat[2]; 33 - u64 aggr_n[32]; 34 - u64 zero_len_del[2]; 35 - }; 29 + #define MT_CALIBRATE_INTERVAL HZ 36 30 37 31 #define MT_MAX_CHAINS 2 38 32 struct mt76x02_rx_freq_cal { ··· 57 63 bool tssi_comp_pending; 58 64 bool dpd_cal_done; 59 65 bool channel_cal_done; 66 + bool gain_init_done; 67 + 68 + int tssi_target; 69 + s8 tssi_dc; 60 70 }; 61 71 62 72 struct mt76x02_dev { ··· 80 82 struct delayed_work cal_work; 81 83 struct delayed_work mac_work; 82 84 83 - struct mt76x02_mac_stats stats; 84 - atomic_t avg_ampdu_len; 85 85 u32 aggr_stats[32]; 86 86 87 87 struct sk_buff *beacons[8]; ··· 105 109 106 110 extern struct ieee80211_rate mt76x02_rates[12]; 107 111 112 + void mt76x02_init_device(struct mt76x02_dev *dev); 108 113 void mt76x02_configure_filter(struct ieee80211_hw *hw, 109 114 unsigned int changed_flags, 110 115 unsigned int *total_flags, u64 multicast); 111 - int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 112 - struct ieee80211_sta *sta); 113 - int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 114 - struct ieee80211_sta *sta); 116 + int mt76x02_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, 117 + struct ieee80211_sta *sta); 118 + void mt76x02_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, 119 + struct ieee80211_sta *sta); 115 120 121 + void mt76x02_config_mac_addr_list(struct mt76x02_dev *dev); 116 122 void mt76x02_vif_init(struct mt76x02_dev *dev, struct ieee80211_vif *vif, 117 123 unsigned int idx); 118 124 int mt76x02_add_interface(struct ieee80211_hw *hw, ··· 137 139 s8 mt76x02_tx_get_txpwr_adj(struct mt76x02_dev *dev, s8 txpwr, 138 140 s8 max_txpwr_adj); 139 141 void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr); 142 + void mt76x02_set_tx_ackto(struct mt76x02_dev *dev); 143 + void mt76x02_set_coverage_class(struct ieee80211_hw *hw, 144 + s16 coverage_class); 145 + int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val); 140 146 int mt76x02_insert_hdr_pad(struct sk_buff *skb); 141 147 void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len); 142 - void mt76x02_tx_complete(struct mt76_dev *dev, struct sk_buff *skb); 143 148 bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update); 144 149 void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, 145 150 struct sk_buff *skb); ··· 154 153 struct sk_buff *skb, struct mt76_queue *q, 155 154 struct mt76_wcid *wcid, struct ieee80211_sta *sta, 156 155 u32 *tx_info); 156 + void mt76x02_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 157 + const u8 *mac); 158 + void mt76x02_sw_scan_complete(struct ieee80211_hw *hw, 159 + struct ieee80211_vif *vif); 160 + int mt76x02_get_txpower(struct ieee80211_hw *hw, 161 + struct ieee80211_vif *vif, int *dbm); 162 + void mt76x02_sta_ps(struct mt76_dev *dev, struct ieee80211_sta *sta, bool ps); 163 + void mt76x02_bss_info_changed(struct ieee80211_hw *hw, 164 + struct ieee80211_vif *vif, 165 + struct ieee80211_bss_conf *info, u32 changed); 157 166 158 167 extern const u16 mt76x02_beacon_offsets[16]; 159 - void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev); 168 + void mt76x02_init_beacon_config(struct mt76x02_dev *dev); 160 169 void mt76x02_set_irq_mask(struct mt76x02_dev *dev, u32 clear, u32 set); 161 170 void mt76x02_mac_start(struct mt76x02_dev *dev); 171 + 172 + void mt76x02_init_debugfs(struct mt76x02_dev *dev); 162 173 163 174 static inline bool is_mt76x2(struct mt76x02_dev *dev) 164 175 {
+5
drivers/net/wireless/mediatek/mt76/mt76x02_dfs.h
··· 137 137 struct tasklet_struct dfs_tasklet; 138 138 }; 139 139 140 + void mt76x02_dfs_init_params(struct mt76x02_dev *dev); 141 + void mt76x02_dfs_init_detector(struct mt76x02_dev *dev); 142 + void mt76x02_regd_notifier(struct wiphy *wiphy, 143 + struct regulatory_request *request); 144 + void mt76x02_phy_dfs_adjust_agc(struct mt76x02_dev *dev); 140 145 #endif /* __MT76x02_DFS_H */
+12
drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.c
··· 53 53 return 0; 54 54 } 55 55 56 + int mt76x02_eeprom_copy(struct mt76x02_dev *dev, 57 + enum mt76x02_eeprom_field field, 58 + void *dest, int len) 59 + { 60 + if (field + len > dev->mt76.eeprom.size) 61 + return -1; 62 + 63 + memcpy(dest, dev->mt76.eeprom.data + field, len); 64 + return 0; 65 + } 66 + EXPORT_SYMBOL_GPL(mt76x02_eeprom_copy); 67 + 56 68 int mt76x02_get_efuse_data(struct mt76x02_dev *dev, u16 base, void *buf, 57 69 int len, enum mt76x02_eeprom_modes mode) 58 70 {
+10 -5
drivers/net/wireless/mediatek/mt76/mt76x02_eeprom.h
··· 25 25 MT_EE_VERSION = 0x002, 26 26 MT_EE_MAC_ADDR = 0x004, 27 27 MT_EE_PCI_ID = 0x00A, 28 + MT_EE_ANTENNA = 0x022, 28 29 MT_EE_NIC_CONF_0 = 0x034, 29 30 MT_EE_NIC_CONF_1 = 0x036, 30 31 MT_EE_COUNTRY_REGION_5GHZ = 0x038, ··· 56 55 #define MT_TX_POWER_GROUP_SIZE_5G 5 57 56 #define MT_TX_POWER_GROUPS_5G 6 58 57 MT_EE_TX_POWER_0_START_5G = 0x062, 58 + MT_EE_TSSI_SLOPE_2G = 0x06e, 59 59 60 60 MT_EE_TX_POWER_0_GRP3_TX_POWER_DELTA = 0x074, 61 61 MT_EE_TX_POWER_0_GRP4_TSSI_SLOPE = 0x076, ··· 87 85 MT_EE_TSSI_BOUND5 = 0x0dc, 88 86 MT_EE_TX_POWER_BYRATE_BASE = 0x0de, 89 87 88 + MT_EE_TSSI_SLOPE_5G = 0x0f0, 90 89 MT_EE_RF_TEMP_COMP_SLOPE_5G = 0x0f2, 91 90 MT_EE_RF_TEMP_COMP_SLOPE_2G = 0x0f4, 92 91 ··· 107 104 __MT_EE_MAX 108 105 }; 109 106 107 + #define MT_EE_ANTENNA_DUAL BIT(15) 108 + 110 109 #define MT_EE_NIC_CONF_0_RX_PATH GENMASK(3, 0) 111 110 #define MT_EE_NIC_CONF_0_TX_PATH GENMASK(7, 4) 112 111 #define MT_EE_NIC_CONF_0_PA_TYPE GENMASK(9, 8) ··· 123 118 #define MT_EE_NIC_CONF_1_LNA_EXT_5G BIT(3) 124 119 #define MT_EE_NIC_CONF_1_TX_ALC_EN BIT(13) 125 120 126 - #define MT_EE_NIC_CONF_2_RX_STREAM GENMASK(3, 0) 127 - #define MT_EE_NIC_CONF_2_TX_STREAM GENMASK(7, 4) 128 - #define MT_EE_NIC_CONF_2_HW_ANTDIV BIT(8) 121 + #define MT_EE_NIC_CONF_2_ANT_OPT BIT(3) 122 + #define MT_EE_NIC_CONF_2_ANT_DIV BIT(4) 129 123 #define MT_EE_NIC_CONF_2_XTAL_OPTION GENMASK(10, 9) 130 - #define MT_EE_NIC_CONF_2_TEMP_DISABLE BIT(11) 131 - #define MT_EE_NIC_CONF_2_COEX_METHOD GENMASK(15, 13) 132 124 133 125 #define MT_EFUSE_USAGE_MAP_SIZE (MT_EE_USAGE_MAP_END - \ 134 126 MT_EE_USAGE_MAP_START + 1) ··· 190 188 s8 *lna_2g, s8 *lna_5g, 191 189 struct ieee80211_channel *chan); 192 190 void mt76x02_eeprom_parse_hw_cap(struct mt76x02_dev *dev); 191 + int mt76x02_eeprom_copy(struct mt76x02_dev *dev, 192 + enum mt76x02_eeprom_field field, 193 + void *dest, int len); 193 194 194 195 #endif /* __MT76x02_EEPROM_H */
+259 -73
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
··· 18 18 #include "mt76x02.h" 19 19 #include "mt76x02_trace.h" 20 20 21 - enum mt76x02_cipher_type 21 + static enum mt76x02_cipher_type 22 22 mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data) 23 23 { 24 24 memset(key_data, 0, 32); ··· 43 43 return MT_CIPHER_NONE; 44 44 } 45 45 } 46 - EXPORT_SYMBOL_GPL(mt76x02_mac_get_key_info); 47 46 48 47 int mt76x02_mac_shared_key_setup(struct mt76x02_dev *dev, u8 vif_idx, 49 48 u8 key_idx, struct ieee80211_key_conf *key) ··· 94 95 95 96 return 0; 96 97 } 97 - EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_set_key); 98 98 99 99 void mt76x02_mac_wcid_setup(struct mt76x02_dev *dev, u8 idx, 100 100 u8 vif_idx, u8 *mac) ··· 105 107 FIELD_PREP(MT_WCID_ATTR_BSS_IDX_EXT, !!(vif_idx & 8)); 106 108 107 109 mt76_wr(dev, MT_WCID_ATTR(idx), attr); 108 - 109 - mt76_wr(dev, MT_WCID_TX_RATE(idx), 0); 110 - mt76_wr(dev, MT_WCID_TX_RATE(idx) + 4, 0); 111 110 112 111 if (idx >= 128) 113 112 return; ··· 125 130 if ((val & bit) != (bit * drop)) 126 131 mt76_wr(dev, MT_WCID_DROP(idx), (val & ~bit) | (bit * drop)); 127 132 } 128 - EXPORT_SYMBOL_GPL(mt76x02_mac_wcid_set_drop); 129 - 130 - void mt76x02_txq_init(struct mt76x02_dev *dev, struct ieee80211_txq *txq) 131 - { 132 - struct mt76_txq *mtxq; 133 - 134 - if (!txq) 135 - return; 136 - 137 - mtxq = (struct mt76_txq *) txq->drv_priv; 138 - if (txq->sta) { 139 - struct mt76x02_sta *sta; 140 - 141 - sta = (struct mt76x02_sta *) txq->sta->drv_priv; 142 - mtxq->wcid = &sta->wcid; 143 - } else { 144 - struct mt76x02_vif *mvif; 145 - 146 - mvif = (struct mt76x02_vif *) txq->vif->drv_priv; 147 - mtxq->wcid = &mvif->group_wcid; 148 - } 149 - 150 - mt76_txq_init(&dev->mt76, txq); 151 - } 152 - EXPORT_SYMBOL_GPL(mt76x02_txq_init); 153 133 154 134 static __le16 155 135 mt76x02_mac_tx_rate_val(struct mt76x02_dev *dev, ··· 186 216 spin_unlock_bh(&dev->mt76.lock); 187 217 } 188 218 219 + void mt76x02_mac_set_short_preamble(struct mt76x02_dev *dev, bool enable) 220 + { 221 + if (enable) 222 + mt76_set(dev, MT_AUTO_RSP_CFG, MT_AUTO_RSP_PREAMB_SHORT); 223 + else 224 + mt76_clear(dev, MT_AUTO_RSP_CFG, MT_AUTO_RSP_PREAMB_SHORT); 225 + } 226 + 189 227 bool mt76x02_mac_load_tx_status(struct mt76x02_dev *dev, 190 228 struct mt76x02_tx_status *stat) 191 229 { ··· 215 237 stat->retry = FIELD_GET(MT_TX_STAT_FIFO_EXT_RETRY, stat2); 216 238 stat->pktid = FIELD_GET(MT_TX_STAT_FIFO_EXT_PKTID, stat2); 217 239 240 + trace_mac_txstat_fetch(dev, stat); 241 + 218 242 return true; 219 243 } 220 - EXPORT_SYMBOL_GPL(mt76x02_mac_load_tx_status); 221 244 222 245 static int 223 246 mt76x02_mac_process_tx_rate(struct ieee80211_tx_rate *txrate, u16 rate, ··· 298 319 else 299 320 txwi->wcid = 0xff; 300 321 301 - txwi->pktid = 1; 302 - 303 322 if (wcid && wcid->sw_iv && key) { 304 323 u64 pn = atomic64_inc_return(&key->tx_pn); 305 324 ccmp_pn[0] = pn; ··· 343 366 txwi->ack_ctl |= MT_TXWI_ACK_CTL_REQ; 344 367 if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) 345 368 txwi->ack_ctl |= MT_TXWI_ACK_CTL_NSEQ; 346 - if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) 347 - txwi->pktid |= MT_TXWI_PKTID_PROBE; 348 369 if ((info->flags & IEEE80211_TX_CTL_AMPDU) && sta) { 349 370 u8 ba_size = IEEE80211_MIN_AMPDU_BUF; 350 371 ··· 395 420 info->status.ampdu_len = n_frames; 396 421 info->status.ampdu_ack_len = st->success ? n_frames : 0; 397 422 398 - if (st->pktid & MT_TXWI_PKTID_PROBE) 399 - info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; 400 - 401 423 if (st->aggr) 402 424 info->flags |= IEEE80211_TX_CTL_AMPDU | 403 425 IEEE80211_TX_STAT_AMPDU; ··· 409 437 struct mt76x02_tx_status *stat, u8 *update) 410 438 { 411 439 struct ieee80211_tx_info info = {}; 412 - struct ieee80211_sta *sta = NULL; 440 + struct ieee80211_tx_status status = { 441 + .info = &info 442 + }; 413 443 struct mt76_wcid *wcid = NULL; 414 444 struct mt76x02_sta *msta = NULL; 445 + struct mt76_dev *mdev = &dev->mt76; 446 + struct sk_buff_head list; 447 + 448 + if (stat->pktid == MT_PACKET_ID_NO_ACK) 449 + return; 415 450 416 451 rcu_read_lock(); 452 + mt76_tx_status_lock(mdev, &list); 453 + 417 454 if (stat->wcid < ARRAY_SIZE(dev->mt76.wcid)) 418 455 wcid = rcu_dereference(dev->mt76.wcid[stat->wcid]); 419 456 420 - if (wcid) { 457 + if (wcid && wcid->sta) { 421 458 void *priv; 422 459 423 460 priv = msta = container_of(wcid, struct mt76x02_sta, wcid); 424 - sta = container_of(priv, struct ieee80211_sta, 425 - drv_priv); 461 + status.sta = container_of(priv, struct ieee80211_sta, 462 + drv_priv); 426 463 } 427 464 428 - if (msta && stat->aggr) { 465 + if (wcid) { 466 + if (stat->pktid) 467 + status.skb = mt76_tx_status_skb_get(mdev, wcid, 468 + stat->pktid, &list); 469 + if (status.skb) 470 + status.info = IEEE80211_SKB_CB(status.skb); 471 + } 472 + 473 + if (msta && stat->aggr && !status.skb) { 429 474 u32 stat_val, stat_cache; 430 475 431 476 stat_val = stat->rate; ··· 456 467 goto out; 457 468 } 458 469 459 - mt76x02_mac_fill_tx_status(dev, &info, &msta->status, 470 + mt76x02_mac_fill_tx_status(dev, status.info, &msta->status, 460 471 msta->n_frames); 461 472 462 473 msta->status = *stat; 463 474 msta->n_frames = 1; 464 475 *update = 0; 465 476 } else { 466 - mt76x02_mac_fill_tx_status(dev, &info, stat, 1); 477 + mt76x02_mac_fill_tx_status(dev, status.info, stat, 1); 467 478 *update = 1; 468 479 } 469 480 470 - ieee80211_tx_status_noskb(dev->mt76.hw, sta, &info); 481 + if (status.skb) 482 + mt76_tx_status_skb_done(mdev, status.skb, &list); 483 + else 484 + ieee80211_tx_status_ext(mt76_hw(dev), &status); 471 485 472 486 out: 487 + mt76_tx_status_unlock(mdev, &list); 473 488 rcu_read_unlock(); 474 489 } 475 - EXPORT_SYMBOL_GPL(mt76x02_send_tx_status); 476 490 477 - int 491 + static int 478 492 mt76x02_mac_process_rate(struct mt76_rx_status *status, u16 rate) 479 493 { 480 494 u8 idx = FIELD_GET(MT_RXWI_RATE_INDEX, rate); ··· 543 551 544 552 return 0; 545 553 } 546 - EXPORT_SYMBOL_GPL(mt76x02_mac_process_rate); 547 554 548 555 void mt76x02_mac_setaddr(struct mt76x02_dev *dev, u8 *addr) 549 556 { ··· 686 695 if (!ret) 687 696 break; 688 697 689 - trace_mac_txstat_fetch(dev, &stat); 690 - 691 698 if (!irq) { 692 699 mt76x02_send_tx_status(dev, &stat, &update); 693 700 continue; ··· 694 705 kfifo_put(&dev->txstatus_fifo, stat); 695 706 } 696 707 } 697 - EXPORT_SYMBOL_GPL(mt76x02_mac_poll_tx_status); 698 - 699 - static void 700 - mt76x02_mac_queue_txdone(struct mt76x02_dev *dev, struct sk_buff *skb, 701 - void *txwi_ptr) 702 - { 703 - struct mt76x02_tx_info *txi = mt76x02_skb_tx_info(skb); 704 - struct mt76x02_txwi *txwi = txwi_ptr; 705 - 706 - mt76x02_mac_poll_tx_status(dev, false); 707 - 708 - txi->tries = 0; 709 - txi->jiffies = jiffies; 710 - txi->wcid = txwi->wcid; 711 - txi->pktid = txwi->pktid; 712 - trace_mac_txdone_add(dev, txwi->wcid, txwi->pktid); 713 - mt76x02_tx_complete(&dev->mt76, skb); 714 - } 715 708 716 709 void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q, 717 710 struct mt76_queue_entry *e, bool flush) 718 711 { 719 712 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 713 + struct mt76x02_txwi *txwi; 720 714 721 - if (e->txwi) 722 - mt76x02_mac_queue_txdone(dev, e->skb, &e->txwi->txwi); 723 - else 715 + if (!e->txwi) { 724 716 dev_kfree_skb_any(e->skb); 717 + return; 718 + } 719 + 720 + mt76x02_mac_poll_tx_status(dev, false); 721 + 722 + txwi = (struct mt76x02_txwi *) &e->txwi->txwi; 723 + trace_mac_txdone_add(dev, txwi->wcid, txwi->pktid); 724 + 725 + mt76_tx_complete_skb(mdev, e->skb); 725 726 } 726 727 EXPORT_SYMBOL_GPL(mt76x02_tx_complete_skb); 728 + 729 + void mt76x02_mac_set_tx_protection(struct mt76x02_dev *dev, u32 val) 730 + { 731 + u32 data = 0; 732 + 733 + if (val != ~0) 734 + data = FIELD_PREP(MT_PROT_CFG_CTRL, 1) | 735 + MT_PROT_CFG_RTS_THRESH; 736 + 737 + mt76_rmw_field(dev, MT_TX_RTS_CFG, MT_TX_RTS_CFG_THRESH, val); 738 + 739 + mt76_rmw(dev, MT_CCK_PROT_CFG, 740 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 741 + mt76_rmw(dev, MT_OFDM_PROT_CFG, 742 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 743 + mt76_rmw(dev, MT_MM20_PROT_CFG, 744 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 745 + mt76_rmw(dev, MT_MM40_PROT_CFG, 746 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 747 + mt76_rmw(dev, MT_GF20_PROT_CFG, 748 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 749 + mt76_rmw(dev, MT_GF40_PROT_CFG, 750 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 751 + mt76_rmw(dev, MT_TX_PROT_CFG6, 752 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 753 + mt76_rmw(dev, MT_TX_PROT_CFG7, 754 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 755 + mt76_rmw(dev, MT_TX_PROT_CFG8, 756 + MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 757 + } 758 + 759 + void mt76x02_update_channel(struct mt76_dev *mdev) 760 + { 761 + struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 762 + struct mt76_channel_state *state; 763 + u32 active, busy; 764 + 765 + state = mt76_channel_state(&dev->mt76, dev->mt76.chandef.chan); 766 + 767 + busy = mt76_rr(dev, MT_CH_BUSY); 768 + active = busy + mt76_rr(dev, MT_CH_IDLE); 769 + 770 + spin_lock_bh(&dev->mt76.cc_lock); 771 + state->cc_busy += busy; 772 + state->cc_active += active; 773 + spin_unlock_bh(&dev->mt76.cc_lock); 774 + } 775 + EXPORT_SYMBOL_GPL(mt76x02_update_channel); 776 + 777 + static void mt76x02_check_mac_err(struct mt76x02_dev *dev) 778 + { 779 + u32 val = mt76_rr(dev, 0x10f4); 780 + 781 + if (!(val & BIT(29)) || !(val & (BIT(7) | BIT(5)))) 782 + return; 783 + 784 + dev_err(dev->mt76.dev, "mac specific condition occurred\n"); 785 + 786 + mt76_set(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_RESET_CSR); 787 + udelay(10); 788 + mt76_clear(dev, MT_MAC_SYS_CTRL, 789 + MT_MAC_SYS_CTRL_ENABLE_TX | MT_MAC_SYS_CTRL_ENABLE_RX); 790 + } 791 + 792 + void mt76x02_mac_work(struct work_struct *work) 793 + { 794 + struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev, 795 + mac_work.work); 796 + int i, idx; 797 + 798 + mt76x02_update_channel(&dev->mt76); 799 + for (i = 0, idx = 0; i < 16; i++) { 800 + u32 val = mt76_rr(dev, MT_TX_AGG_CNT(i)); 801 + 802 + dev->aggr_stats[idx++] += val & 0xffff; 803 + dev->aggr_stats[idx++] += val >> 16; 804 + } 805 + 806 + /* XXX: check beacon stuck for ap mode */ 807 + if (!dev->beacon_mask) 808 + mt76x02_check_mac_err(dev); 809 + 810 + mt76_tx_status_check(&dev->mt76, NULL, false); 811 + 812 + ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work, 813 + MT_CALIBRATE_INTERVAL); 814 + } 815 + 816 + void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) 817 + { 818 + idx &= 7; 819 + mt76_wr(dev, MT_MAC_APC_BSSID_L(idx), get_unaligned_le32(addr)); 820 + mt76_rmw_field(dev, MT_MAC_APC_BSSID_H(idx), MT_MAC_APC_BSSID_H_ADDR, 821 + get_unaligned_le16(addr + 4)); 822 + } 823 + 824 + static int 825 + mt76x02_write_beacon(struct mt76x02_dev *dev, int offset, struct sk_buff *skb) 826 + { 827 + int beacon_len = mt76x02_beacon_offsets[1] - mt76x02_beacon_offsets[0]; 828 + struct mt76x02_txwi txwi; 829 + 830 + if (WARN_ON_ONCE(beacon_len < skb->len + sizeof(struct mt76x02_txwi))) 831 + return -ENOSPC; 832 + 833 + mt76x02_mac_write_txwi(dev, &txwi, skb, NULL, NULL, skb->len); 834 + 835 + mt76_wr_copy(dev, offset, &txwi, sizeof(txwi)); 836 + offset += sizeof(txwi); 837 + 838 + mt76_wr_copy(dev, offset, skb->data, skb->len); 839 + return 0; 840 + } 841 + 842 + static int 843 + __mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 bcn_idx, 844 + struct sk_buff *skb) 845 + { 846 + int beacon_len = mt76x02_beacon_offsets[1] - mt76x02_beacon_offsets[0]; 847 + int beacon_addr = mt76x02_beacon_offsets[bcn_idx]; 848 + int ret = 0; 849 + int i; 850 + 851 + /* Prevent corrupt transmissions during update */ 852 + mt76_set(dev, MT_BCN_BYPASS_MASK, BIT(bcn_idx)); 853 + 854 + if (skb) { 855 + ret = mt76x02_write_beacon(dev, beacon_addr, skb); 856 + if (!ret) 857 + dev->beacon_data_mask |= BIT(bcn_idx); 858 + } else { 859 + dev->beacon_data_mask &= ~BIT(bcn_idx); 860 + for (i = 0; i < beacon_len; i += 4) 861 + mt76_wr(dev, beacon_addr + i, 0); 862 + } 863 + 864 + mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xff00 | ~dev->beacon_data_mask); 865 + 866 + return ret; 867 + } 868 + 869 + int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx, 870 + struct sk_buff *skb) 871 + { 872 + bool force_update = false; 873 + int bcn_idx = 0; 874 + int i; 875 + 876 + for (i = 0; i < ARRAY_SIZE(dev->beacons); i++) { 877 + if (vif_idx == i) { 878 + force_update = !!dev->beacons[i] ^ !!skb; 879 + 880 + if (dev->beacons[i]) 881 + dev_kfree_skb(dev->beacons[i]); 882 + 883 + dev->beacons[i] = skb; 884 + __mt76x02_mac_set_beacon(dev, bcn_idx, skb); 885 + } else if (force_update && dev->beacons[i]) { 886 + __mt76x02_mac_set_beacon(dev, bcn_idx, 887 + dev->beacons[i]); 888 + } 889 + 890 + bcn_idx += !!dev->beacons[i]; 891 + } 892 + 893 + for (i = bcn_idx; i < ARRAY_SIZE(dev->beacons); i++) { 894 + if (!(dev->beacon_data_mask & BIT(i))) 895 + break; 896 + 897 + __mt76x02_mac_set_beacon(dev, i, NULL); 898 + } 899 + 900 + mt76_rmw_field(dev, MT_MAC_BSSID_DW1, MT_MAC_BSSID_DW1_MBEACON_N, 901 + bcn_idx - 1); 902 + return 0; 903 + } 904 + 905 + void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, 906 + u8 vif_idx, bool val) 907 + { 908 + u8 old_mask = dev->beacon_mask; 909 + bool en; 910 + u32 reg; 911 + 912 + if (val) { 913 + dev->beacon_mask |= BIT(vif_idx); 914 + } else { 915 + dev->beacon_mask &= ~BIT(vif_idx); 916 + mt76x02_mac_set_beacon(dev, vif_idx, NULL); 917 + } 918 + 919 + if (!!old_mask == !!dev->beacon_mask) 920 + return; 921 + 922 + en = dev->beacon_mask; 923 + 924 + mt76_rmw_field(dev, MT_INT_TIMER_EN, MT_INT_TIMER_EN_PRE_TBTT_EN, en); 925 + reg = MT_BEACON_TIME_CFG_BEACON_TX | 926 + MT_BEACON_TIME_CFG_TBTT_EN | 927 + MT_BEACON_TIME_CFG_TIMER_EN; 928 + mt76_rmw(dev, MT_BEACON_TIME_CFG, reg, reg * en); 929 + 930 + if (en) 931 + mt76x02_irq_enable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT); 932 + else 933 + mt76x02_irq_disable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT); 934 + }
+11 -27
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
··· 37 37 #define MT_MAX_VIFS 8 38 38 39 39 struct mt76x02_vif { 40 + struct mt76_wcid group_wcid; /* must be first */ 40 41 u8 idx; 41 - 42 - struct mt76_wcid group_wcid; 43 - }; 44 - 45 - struct mt76x02_tx_info { 46 - unsigned long jiffies; 47 - u8 tries; 48 - 49 - u8 wcid; 50 - u8 pktid; 51 - u8 retry; 52 42 }; 53 43 54 44 DECLARE_EWMA(signal, 10, 8); ··· 143 153 #define MT_TXWI_ACK_CTL_NSEQ BIT(1) 144 154 #define MT_TXWI_ACK_CTL_BA_WINDOW GENMASK(7, 2) 145 155 146 - #define MT_TXWI_PKTID_PROBE BIT(7) 147 - 148 156 struct mt76x02_txwi { 149 157 __le16 flags; 150 158 __le16 rate; ··· 178 190 return false; 179 191 } 180 192 181 - static inline struct mt76x02_tx_info * 182 - mt76x02_skb_tx_info(struct sk_buff *skb) 183 - { 184 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 185 - 186 - return (void *)info->status.status_driver_data; 187 - } 188 - 189 - void mt76x02_txq_init(struct mt76x02_dev *dev, struct ieee80211_txq *txq); 190 - enum mt76x02_cipher_type 191 - mt76x02_mac_get_key_info(struct ieee80211_key_conf *key, u8 *key_data); 192 - 193 + void mt76x02_mac_set_short_preamble(struct mt76x02_dev *dev, bool enable); 193 194 int mt76x02_mac_shared_key_setup(struct mt76x02_dev *dev, u8 vif_idx, 194 195 u8 key_idx, struct ieee80211_key_conf *key); 195 196 int mt76x02_mac_wcid_set_key(struct mt76x02_dev *dev, u8 idx, ··· 194 217 struct mt76x02_tx_status *stat, u8 *update); 195 218 int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb, 196 219 void *rxi); 197 - int 198 - mt76x02_mac_process_rate(struct mt76_rx_status *status, u16 rate); 220 + void mt76x02_mac_set_tx_protection(struct mt76x02_dev *dev, u32 val); 199 221 void mt76x02_mac_setaddr(struct mt76x02_dev *dev, u8 *addr); 200 222 void mt76x02_mac_write_txwi(struct mt76x02_dev *dev, struct mt76x02_txwi *txwi, 201 223 struct sk_buff *skb, struct mt76_wcid *wcid, ··· 202 226 void mt76x02_mac_poll_tx_status(struct mt76x02_dev *dev, bool irq); 203 227 void mt76x02_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue *q, 204 228 struct mt76_queue_entry *e, bool flush); 229 + void mt76x02_update_channel(struct mt76_dev *mdev); 230 + void mt76x02_mac_work(struct work_struct *work); 231 + 232 + void mt76x02_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr); 233 + int mt76x02_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx, 234 + struct sk_buff *skb); 235 + void mt76x02_mac_set_beacon_enable(struct mt76x02_dev *dev, u8 vif_idx, 236 + bool val); 205 237 #endif
+21 -23
drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
··· 21 21 22 22 #include "mt76x02_mcu.h" 23 23 24 - struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len) 24 + static struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len) 25 25 { 26 26 struct sk_buff *skb; 27 27 ··· 32 32 33 33 return skb; 34 34 } 35 - EXPORT_SYMBOL_GPL(mt76x02_mcu_msg_alloc); 36 35 37 36 static struct sk_buff * 38 37 mt76x02_mcu_get_response(struct mt76x02_dev *dev, unsigned long expires) ··· 79 80 return 0; 80 81 } 81 82 82 - int mt76x02_mcu_msg_send(struct mt76_dev *mdev, struct sk_buff *skb, 83 - int cmd, bool wait_resp) 83 + int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data, 84 + int len, bool wait_resp) 84 85 { 85 86 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 86 87 unsigned long expires = jiffies + HZ; 88 + struct sk_buff *skb; 87 89 int ret; 88 90 u8 seq; 89 91 92 + skb = mt76x02_mcu_msg_alloc(data, len); 90 93 if (!skb) 91 - return -EINVAL; 94 + return -ENOMEM; 92 95 93 96 mutex_lock(&mdev->mmio.mcu.mutex); 94 97 ··· 132 131 } 133 132 EXPORT_SYMBOL_GPL(mt76x02_mcu_msg_send); 134 133 135 - int mt76x02_mcu_function_select(struct mt76x02_dev *dev, 136 - enum mcu_function func, 137 - u32 val, bool wait_resp) 134 + int mt76x02_mcu_function_select(struct mt76x02_dev *dev, enum mcu_function func, 135 + u32 val) 138 136 { 139 - struct sk_buff *skb; 140 137 struct { 141 138 __le32 id; 142 139 __le32 value; ··· 142 143 .id = cpu_to_le32(func), 143 144 .value = cpu_to_le32(val), 144 145 }; 146 + bool wait = false; 145 147 146 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 147 - return mt76_mcu_send_msg(dev, skb, CMD_FUN_SET_OP, wait_resp); 148 + if (func != Q_SELECT) 149 + wait = true; 150 + 151 + return mt76_mcu_send_msg(dev, CMD_FUN_SET_OP, &msg, sizeof(msg), wait); 148 152 } 149 153 EXPORT_SYMBOL_GPL(mt76x02_mcu_function_select); 150 154 151 - int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on, 152 - bool wait_resp) 155 + int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on) 153 156 { 154 - struct sk_buff *skb; 155 157 struct { 156 158 __le32 mode; 157 159 __le32 level; ··· 161 161 .level = cpu_to_le32(0), 162 162 }; 163 163 164 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 165 - return mt76_mcu_send_msg(dev, skb, CMD_POWER_SAVING_OP, wait_resp); 164 + return mt76_mcu_send_msg(dev, CMD_POWER_SAVING_OP, &msg, sizeof(msg), false); 166 165 } 167 166 EXPORT_SYMBOL_GPL(mt76x02_mcu_set_radio_state); 168 167 169 - int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type, 170 - u32 param, bool wait) 168 + int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type, u32 param) 171 169 { 172 - struct sk_buff *skb; 173 170 struct { 174 171 __le32 id; 175 172 __le32 value; ··· 174 177 .id = cpu_to_le32(type), 175 178 .value = cpu_to_le32(param), 176 179 }; 180 + bool is_mt76x2e = mt76_is_mmio(dev) && is_mt76x2(dev); 177 181 int ret; 178 182 179 - if (wait) 183 + if (is_mt76x2e) 180 184 mt76_rmw(dev, MT_MCU_COM_REG0, BIT(31), 0); 181 185 182 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 183 - ret = mt76_mcu_send_msg(dev, skb, CMD_CALIBRATION_OP, true); 186 + ret = mt76_mcu_send_msg(dev, CMD_CALIBRATION_OP, &msg, sizeof(msg), 187 + true); 184 188 if (ret) 185 189 return ret; 186 190 187 - if (wait && 191 + if (is_mt76x2e && 188 192 WARN_ON(!mt76_poll_msec(dev, MT_MCU_COM_REG0, 189 193 BIT(31), BIT(31), 100))) 190 194 return -ETIMEDOUT;
+6 -10
drivers/net/wireless/mediatek/mt76/mt76x02_mcu.h
··· 97 97 }; 98 98 99 99 int mt76x02_mcu_cleanup(struct mt76x02_dev *dev); 100 - int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type, 101 - u32 param, bool wait); 102 - struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len); 103 - int mt76x02_mcu_msg_send(struct mt76_dev *mdev, struct sk_buff *skb, 104 - int cmd, bool wait_resp); 105 - int mt76x02_mcu_function_select(struct mt76x02_dev *dev, 106 - enum mcu_function func, 107 - u32 val, bool wait_resp); 108 - int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on, 109 - bool wait_resp); 100 + int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type, u32 param); 101 + int mt76x02_mcu_msg_send(struct mt76_dev *mdev, int cmd, const void *data, 102 + int len, bool wait_resp); 103 + int mt76x02_mcu_function_select(struct mt76x02_dev *dev, enum mcu_function func, 104 + u32 val); 105 + int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on); 110 106 void mt76x02_set_ethtool_fwver(struct mt76x02_dev *dev, 111 107 const struct mt76x02_fw_header *h); 112 108
+127 -1
drivers/net/wireless/mediatek/mt76/mt76x02_mmio.c
··· 21 21 #include "mt76x02.h" 22 22 #include "mt76x02_trace.h" 23 23 24 + struct beacon_bc_data { 25 + struct mt76x02_dev *dev; 26 + struct sk_buff_head q; 27 + struct sk_buff *tail[8]; 28 + }; 29 + 30 + static void 31 + mt76x02_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) 32 + { 33 + struct mt76x02_dev *dev = (struct mt76x02_dev *)priv; 34 + struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; 35 + struct sk_buff *skb = NULL; 36 + 37 + if (!(dev->beacon_mask & BIT(mvif->idx))) 38 + return; 39 + 40 + skb = ieee80211_beacon_get(mt76_hw(dev), vif); 41 + if (!skb) 42 + return; 43 + 44 + mt76x02_mac_set_beacon(dev, mvif->idx, skb); 45 + } 46 + 47 + static void 48 + mt76x02_add_buffered_bc(void *priv, u8 *mac, struct ieee80211_vif *vif) 49 + { 50 + struct beacon_bc_data *data = priv; 51 + struct mt76x02_dev *dev = data->dev; 52 + struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; 53 + struct ieee80211_tx_info *info; 54 + struct sk_buff *skb; 55 + 56 + if (!(dev->beacon_mask & BIT(mvif->idx))) 57 + return; 58 + 59 + skb = ieee80211_get_buffered_bc(mt76_hw(dev), vif); 60 + if (!skb) 61 + return; 62 + 63 + info = IEEE80211_SKB_CB(skb); 64 + info->control.vif = vif; 65 + info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; 66 + mt76_skb_set_moredata(skb, true); 67 + __skb_queue_tail(&data->q, skb); 68 + data->tail[mvif->idx] = skb; 69 + } 70 + 71 + static void 72 + mt76x02_resync_beacon_timer(struct mt76x02_dev *dev) 73 + { 74 + u32 timer_val = dev->beacon_int << 4; 75 + 76 + dev->tbtt_count++; 77 + 78 + /* 79 + * Beacon timer drifts by 1us every tick, the timer is configured 80 + * in 1/16 TU (64us) units. 81 + */ 82 + if (dev->tbtt_count < 62) 83 + return; 84 + 85 + if (dev->tbtt_count >= 64) { 86 + dev->tbtt_count = 0; 87 + return; 88 + } 89 + 90 + /* 91 + * The updated beacon interval takes effect after two TBTT, because 92 + * at this point the original interval has already been loaded into 93 + * the next TBTT_TIMER value 94 + */ 95 + if (dev->tbtt_count == 62) 96 + timer_val -= 1; 97 + 98 + mt76_rmw_field(dev, MT_BEACON_TIME_CFG, 99 + MT_BEACON_TIME_CFG_INTVAL, timer_val); 100 + } 101 + 102 + static void mt76x02_pre_tbtt_tasklet(unsigned long arg) 103 + { 104 + struct mt76x02_dev *dev = (struct mt76x02_dev *)arg; 105 + struct mt76_queue *q = &dev->mt76.q_tx[MT_TXQ_PSD]; 106 + struct beacon_bc_data data = {}; 107 + struct sk_buff *skb; 108 + int i, nframes; 109 + 110 + mt76x02_resync_beacon_timer(dev); 111 + 112 + data.dev = dev; 113 + __skb_queue_head_init(&data.q); 114 + 115 + ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev), 116 + IEEE80211_IFACE_ITER_RESUME_ALL, 117 + mt76x02_update_beacon_iter, dev); 118 + 119 + do { 120 + nframes = skb_queue_len(&data.q); 121 + ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev), 122 + IEEE80211_IFACE_ITER_RESUME_ALL, 123 + mt76x02_add_buffered_bc, &data); 124 + } while (nframes != skb_queue_len(&data.q)); 125 + 126 + if (!nframes) 127 + return; 128 + 129 + for (i = 0; i < ARRAY_SIZE(data.tail); i++) { 130 + if (!data.tail[i]) 131 + continue; 132 + 133 + mt76_skb_set_moredata(data.tail[i], false); 134 + } 135 + 136 + spin_lock_bh(&q->lock); 137 + while ((skb = __skb_dequeue(&data.q)) != NULL) { 138 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 139 + struct ieee80211_vif *vif = info->control.vif; 140 + struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; 141 + 142 + mt76_dma_tx_queue_skb(&dev->mt76, q, skb, &mvif->group_wcid, 143 + NULL); 144 + } 145 + spin_unlock_bh(&q->lock); 146 + } 147 + 24 148 static int 25 149 mt76x02_init_tx_queue(struct mt76x02_dev *dev, struct mt76_queue *q, 26 150 int idx, int n_desc) ··· 222 98 return -ENOMEM; 223 99 224 100 tasklet_init(&dev->tx_tasklet, mt76x02_tx_tasklet, (unsigned long) dev); 101 + tasklet_init(&dev->pre_tbtt_tasklet, mt76x02_pre_tbtt_tasklet, 102 + (unsigned long)dev); 103 + 225 104 kfifo_init(&dev->txstatus_fifo, status_fifo, fifo_size); 226 105 227 106 mt76_dma_attach(&dev->mt76); ··· 352 225 mt76_clear(dev, MT_WPDMA_GLO_CFG, 353 226 MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE); 354 227 } 355 - EXPORT_SYMBOL_GPL(mt76x02_dma_enable); 356 228 357 229 void mt76x02_dma_cleanup(struct mt76x02_dev *dev) 358 230 {
+1
drivers/net/wireless/mediatek/mt76/mt76x02_phy.c
··· 254 254 memcpy(dev->cal.agc_gain_cur, dev->cal.agc_gain_init, 255 255 sizeof(dev->cal.agc_gain_cur)); 256 256 dev->cal.low_gain = -1; 257 + dev->cal.gain_init_done = true; 257 258 } 258 259 EXPORT_SYMBOL_GPL(mt76x02_init_agc_gain);
+10 -21
drivers/net/wireless/mediatek/mt76/mt76x02_txrx.c
··· 22 22 void mt76x02_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, 23 23 struct sk_buff *skb) 24 24 { 25 + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 25 26 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 26 27 struct mt76x02_dev *dev = hw->priv; 27 28 struct ieee80211_vif *vif = info->control.vif; ··· 34 33 msta = (struct mt76x02_sta *)control->sta->drv_priv; 35 34 wcid = &msta->wcid; 36 35 /* sw encrypted frames */ 37 - if (!info->control.hw_key && wcid->hw_key_idx != 0xff) 36 + if (!info->control.hw_key && wcid->hw_key_idx != 0xff && 37 + ieee80211_has_protected(hdr->frame_control)) 38 38 control->sta = NULL; 39 39 } 40 40 ··· 112 110 113 111 return max_txpwr; 114 112 } 115 - EXPORT_SYMBOL_GPL(mt76x02_tx_get_max_txpwr_adj); 116 113 117 114 s8 mt76x02_tx_get_txpwr_adj(struct mt76x02_dev *dev, s8 txpwr, s8 max_txpwr_adj) 118 115 { ··· 126 125 else 127 126 return (txpwr < -16) ? 8 : (txpwr + 32) / 2; 128 127 } 129 - EXPORT_SYMBOL_GPL(mt76x02_tx_get_txpwr_adj); 130 128 131 129 void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr) 132 130 { ··· 139 139 MT_PROT_AUTO_TX_CFG_AUTO_PADJ, txpwr_adj); 140 140 } 141 141 EXPORT_SYMBOL_GPL(mt76x02_tx_set_txpwr_auto); 142 - 143 - void mt76x02_tx_complete(struct mt76_dev *dev, struct sk_buff *skb) 144 - { 145 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 146 - 147 - if (info->flags & IEEE80211_TX_CTL_AMPDU) { 148 - ieee80211_free_txskb(dev->hw, skb); 149 - } else { 150 - ieee80211_tx_info_clear_status(info); 151 - info->status.rates[0].idx = -1; 152 - info->flags |= IEEE80211_TX_STAT_ACK; 153 - ieee80211_tx_status(dev->hw, skb); 154 - } 155 - } 156 - EXPORT_SYMBOL_GPL(mt76x02_tx_complete); 157 142 158 143 bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update) 159 144 { ··· 154 169 } 155 170 EXPORT_SYMBOL_GPL(mt76x02_tx_status_data); 156 171 157 - int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi, 172 + int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr, 158 173 struct sk_buff *skb, struct mt76_queue *q, 159 174 struct mt76_wcid *wcid, struct ieee80211_sta *sta, 160 175 u32 *tx_info) 161 176 { 162 177 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 163 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 178 + struct mt76x02_txwi *txwi = txwi_ptr; 164 179 int qsel = MT_QSEL_EDCA; 180 + int pid; 165 181 int ret; 166 182 167 183 if (q == &dev->mt76.q_tx[MT_TXQ_PSD] && wcid && wcid->idx < 128) ··· 170 184 171 185 mt76x02_mac_write_txwi(dev, txwi, skb, wcid, sta, skb->len); 172 186 187 + pid = mt76_tx_status_skb_add(mdev, wcid, skb); 188 + txwi->pktid = pid; 189 + 173 190 ret = mt76x02_insert_hdr_pad(skb); 174 191 if (ret < 0) 175 192 return ret; 176 193 177 - if (info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) 194 + if (pid && pid != MT_PACKET_ID_NO_ACK) 178 195 qsel = MT_QSEL_MGMT; 179 196 180 197 *tx_info = FIELD_PREP(MT_TXD_INFO_QSEL, qsel) |
+19 -23
drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c
··· 30 30 struct mt76_queue_entry *e, bool flush) 31 31 { 32 32 mt76x02u_remove_dma_hdr(e->skb); 33 - mt76x02_tx_complete(mdev, e->skb); 33 + mt76_tx_complete_skb(mdev, e->skb); 34 34 } 35 35 EXPORT_SYMBOL_GPL(mt76x02u_tx_complete_skb); 36 36 ··· 67 67 return 0; 68 68 } 69 69 70 - static int 71 - mt76x02u_set_txinfo(struct sk_buff *skb, struct mt76_wcid *wcid, u8 ep) 70 + int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data, 71 + struct sk_buff *skb, struct mt76_queue *q, 72 + struct mt76_wcid *wcid, struct ieee80211_sta *sta, 73 + u32 *tx_info) 72 74 { 73 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 75 + struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 76 + struct mt76x02_txwi *txwi; 74 77 enum mt76_qsel qsel; 78 + int len = skb->len; 75 79 u32 flags; 80 + int pid; 76 81 77 - if ((info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE) || 78 - ep == MT_EP_OUT_HCCA) 82 + mt76x02_insert_hdr_pad(skb); 83 + 84 + txwi = skb_push(skb, sizeof(struct mt76x02_txwi)); 85 + mt76x02_mac_write_txwi(dev, txwi, skb, wcid, sta, len); 86 + 87 + pid = mt76_tx_status_skb_add(mdev, wcid, skb); 88 + txwi->pktid = pid; 89 + 90 + if ((pid && pid != MT_PACKET_ID_NO_ACK) || 91 + q2ep(q->hw_idx) == MT_EP_OUT_HCCA) 79 92 qsel = MT_QSEL_MGMT; 80 93 else 81 94 qsel = MT_QSEL_EDCA; ··· 99 86 flags |= MT_TXD_INFO_WIV; 100 87 101 88 return mt76x02u_skb_dma_info(skb, WLAN_PORT, flags); 102 - } 103 - 104 - int mt76x02u_tx_prepare_skb(struct mt76_dev *mdev, void *data, 105 - struct sk_buff *skb, struct mt76_queue *q, 106 - struct mt76_wcid *wcid, struct ieee80211_sta *sta, 107 - u32 *tx_info) 108 - { 109 - struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 110 - struct mt76x02_txwi *txwi; 111 - int len = skb->len; 112 - 113 - mt76x02_insert_hdr_pad(skb); 114 - 115 - txwi = skb_push(skb, sizeof(struct mt76x02_txwi)); 116 - mt76x02_mac_write_txwi(dev, txwi, skb, wcid, sta, len); 117 - 118 - return mt76x02u_set_txinfo(skb, wcid, q2ep(q->hw_idx)); 119 89 } 120 90 EXPORT_SYMBOL_GPL(mt76x02u_tx_prepare_skb);
+11 -7
drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c
··· 129 129 u8 seq = 0; 130 130 u32 info; 131 131 132 - if (!skb) 133 - return -EINVAL; 134 - 135 132 if (test_bit(MT76_REMOVED, &dev->state)) 136 133 return 0; 137 134 ··· 159 162 } 160 163 161 164 static int 162 - mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk_buff *skb, 163 - int cmd, bool wait_resp) 165 + mt76x02u_mcu_send_msg(struct mt76_dev *dev, int cmd, const void *data, 166 + int len, bool wait_resp) 164 167 { 165 168 struct mt76_usb *usb = &dev->usb; 169 + struct sk_buff *skb; 166 170 int err; 171 + 172 + skb = mt76x02u_mcu_msg_alloc(data, len); 173 + if (!skb) 174 + return -ENOMEM; 167 175 168 176 mutex_lock(&usb->mcu.mutex); 169 177 err = __mt76x02u_mcu_send_msg(dev, skb, cmd, wait_resp); ··· 188 186 { 189 187 const int CMD_RANDOM_WRITE = 12; 190 188 const int max_vals_per_cmd = MT_INBAND_PACKET_MAX_LEN / 8; 189 + struct mt76_usb *usb = &dev->usb; 191 190 struct sk_buff *skb; 192 191 int cnt, i, ret; 193 192 ··· 207 204 skb_put_le32(skb, data[i].value); 208 205 } 209 206 210 - ret = mt76x02u_mcu_send_msg(dev, skb, CMD_RANDOM_WRITE, cnt == n); 207 + mutex_lock(&usb->mcu.mutex); 208 + ret = __mt76x02u_mcu_send_msg(dev, skb, CMD_RANDOM_WRITE, cnt == n); 209 + mutex_unlock(&usb->mcu.mutex); 211 210 if (ret) 212 211 return ret; 213 212 ··· 350 345 void mt76x02u_init_mcu(struct mt76_dev *dev) 351 346 { 352 347 static const struct mt76_mcu_ops mt76x02u_mcu_ops = { 353 - .mcu_msg_alloc = mt76x02u_mcu_msg_alloc, 354 348 .mcu_send_msg = mt76x02u_mcu_send_msg, 355 349 .mcu_wr_rp = mt76x02u_mcu_wr_rp, 356 350 .mcu_rd_rp = mt76x02u_mcu_rd_rp,
+298 -36
drivers/net/wireless/mediatek/mt76/mt76x02_util.c
··· 47 47 }; 48 48 EXPORT_SYMBOL_GPL(mt76x02_rates); 49 49 50 + static const struct ieee80211_iface_limit mt76x02_if_limits[] = { 51 + { 52 + .max = 1, 53 + .types = BIT(NL80211_IFTYPE_ADHOC) 54 + }, { 55 + .max = 8, 56 + .types = BIT(NL80211_IFTYPE_STATION) | 57 + #ifdef CONFIG_MAC80211_MESH 58 + BIT(NL80211_IFTYPE_MESH_POINT) | 59 + #endif 60 + BIT(NL80211_IFTYPE_AP) 61 + }, 62 + }; 63 + 64 + static const struct ieee80211_iface_combination mt76x02_if_comb[] = { 65 + { 66 + .limits = mt76x02_if_limits, 67 + .n_limits = ARRAY_SIZE(mt76x02_if_limits), 68 + .max_interfaces = 8, 69 + .num_different_channels = 1, 70 + .beacon_int_infra_match = true, 71 + .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | 72 + BIT(NL80211_CHAN_WIDTH_20) | 73 + BIT(NL80211_CHAN_WIDTH_40) | 74 + BIT(NL80211_CHAN_WIDTH_80), 75 + } 76 + }; 77 + 78 + void mt76x02_init_device(struct mt76x02_dev *dev) 79 + { 80 + struct ieee80211_hw *hw = mt76_hw(dev); 81 + struct wiphy *wiphy = hw->wiphy; 82 + 83 + INIT_DELAYED_WORK(&dev->mac_work, mt76x02_mac_work); 84 + 85 + hw->queues = 4; 86 + hw->max_rates = 1; 87 + hw->max_report_rates = 7; 88 + hw->max_rate_tries = 1; 89 + hw->extra_tx_headroom = 2; 90 + 91 + if (mt76_is_usb(dev)) { 92 + hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) + 93 + MT_DMA_HDR_LEN; 94 + wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 95 + } else { 96 + mt76x02_dfs_init_detector(dev); 97 + 98 + wiphy->reg_notifier = mt76x02_regd_notifier; 99 + wiphy->iface_combinations = mt76x02_if_comb; 100 + wiphy->n_iface_combinations = ARRAY_SIZE(mt76x02_if_comb); 101 + wiphy->interface_modes = 102 + BIT(NL80211_IFTYPE_STATION) | 103 + BIT(NL80211_IFTYPE_AP) | 104 + #ifdef CONFIG_MAC80211_MESH 105 + BIT(NL80211_IFTYPE_MESH_POINT) | 106 + #endif 107 + BIT(NL80211_IFTYPE_ADHOC); 108 + 109 + wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS); 110 + } 111 + 112 + hw->sta_data_size = sizeof(struct mt76x02_sta); 113 + hw->vif_data_size = sizeof(struct mt76x02_vif); 114 + 115 + ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES); 116 + ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER); 117 + 118 + dev->mt76.global_wcid.idx = 255; 119 + dev->mt76.global_wcid.hw_key_idx = -1; 120 + dev->slottime = 9; 121 + 122 + if (is_mt76x2(dev)) { 123 + dev->mt76.sband_2g.sband.ht_cap.cap |= 124 + IEEE80211_HT_CAP_LDPC_CODING; 125 + dev->mt76.sband_5g.sband.ht_cap.cap |= 126 + IEEE80211_HT_CAP_LDPC_CODING; 127 + dev->mt76.chainmask = 0x202; 128 + dev->mt76.antenna_mask = 3; 129 + } else { 130 + dev->mt76.chainmask = 0x101; 131 + dev->mt76.antenna_mask = 1; 132 + } 133 + } 134 + EXPORT_SYMBOL_GPL(mt76x02_init_device); 135 + 50 136 void mt76x02_configure_filter(struct ieee80211_hw *hw, 51 137 unsigned int changed_flags, 52 138 unsigned int *total_flags, u64 multicast) ··· 167 81 } 168 82 EXPORT_SYMBOL_GPL(mt76x02_configure_filter); 169 83 170 - int mt76x02_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 84 + int mt76x02_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, 171 85 struct ieee80211_sta *sta) 172 86 { 173 - struct mt76x02_dev *dev = hw->priv; 87 + struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 174 88 struct mt76x02_sta *msta = (struct mt76x02_sta *)sta->drv_priv; 175 89 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; 176 - int ret = 0; 177 90 int idx = 0; 178 - int i; 179 - 180 - mutex_lock(&dev->mt76.mutex); 181 91 182 92 idx = mt76_wcid_alloc(dev->mt76.wcid_mask, ARRAY_SIZE(dev->mt76.wcid)); 183 - if (idx < 0) { 184 - ret = -ENOSPC; 185 - goto out; 186 - } 93 + if (idx < 0) 94 + return -ENOSPC; 187 95 188 96 msta->vif = mvif; 189 97 msta->wcid.sta = 1; ··· 185 105 msta->wcid.hw_key_idx = -1; 186 106 mt76x02_mac_wcid_setup(dev, idx, mvif->idx, sta->addr); 187 107 mt76x02_mac_wcid_set_drop(dev, idx, false); 188 - for (i = 0; i < ARRAY_SIZE(sta->txq); i++) 189 - mt76x02_txq_init(dev, sta->txq[i]); 190 108 191 109 if (vif->type == NL80211_IFTYPE_AP) 192 110 set_bit(MT_WCID_FLAG_CHECK_PS, &msta->wcid.flags); 193 111 194 112 ewma_signal_init(&msta->rssi); 195 113 196 - rcu_assign_pointer(dev->mt76.wcid[idx], &msta->wcid); 197 - 198 - out: 199 - mutex_unlock(&dev->mt76.mutex); 200 - 201 - return ret; 114 + return 0; 202 115 } 203 116 EXPORT_SYMBOL_GPL(mt76x02_sta_add); 204 117 205 - int mt76x02_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 206 - struct ieee80211_sta *sta) 118 + void mt76x02_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, 119 + struct ieee80211_sta *sta) 207 120 { 208 - struct mt76x02_dev *dev = hw->priv; 209 - struct mt76x02_sta *msta = (struct mt76x02_sta *)sta->drv_priv; 210 - int idx = msta->wcid.idx; 211 - int i; 121 + struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 122 + struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; 123 + int idx = wcid->idx; 212 124 213 - mutex_lock(&dev->mt76.mutex); 214 - rcu_assign_pointer(dev->mt76.wcid[idx], NULL); 215 - for (i = 0; i < ARRAY_SIZE(sta->txq); i++) 216 - mt76_txq_remove(&dev->mt76, sta->txq[i]); 217 125 mt76x02_mac_wcid_set_drop(dev, idx, true); 218 - mt76_wcid_free(dev->mt76.wcid_mask, idx); 219 126 mt76x02_mac_wcid_setup(dev, idx, 0, NULL); 220 - mutex_unlock(&dev->mt76.mutex); 221 - 222 - return 0; 223 127 } 224 128 EXPORT_SYMBOL_GPL(mt76x02_sta_remove); 225 129 ··· 211 147 unsigned int idx) 212 148 { 213 149 struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; 150 + struct mt76_txq *mtxq; 214 151 215 152 mvif->idx = idx; 216 153 mvif->group_wcid.idx = MT_VIF_WCID(idx); 217 154 mvif->group_wcid.hw_key_idx = -1; 218 - mt76x02_txq_init(dev, vif->txq); 155 + mtxq = (struct mt76_txq *) vif->txq->drv_priv; 156 + mtxq->wcid = &mvif->group_wcid; 157 + 158 + mt76_txq_init(&dev->mt76, vif->txq); 219 159 } 220 160 EXPORT_SYMBOL_GPL(mt76x02_vif_init); 221 161 ··· 425 357 } 426 358 EXPORT_SYMBOL_GPL(mt76x02_conf_tx); 427 359 360 + void mt76x02_set_tx_ackto(struct mt76x02_dev *dev) 361 + { 362 + u8 ackto, sifs, slottime = dev->slottime; 363 + 364 + /* As defined by IEEE 802.11-2007 17.3.8.6 */ 365 + slottime += 3 * dev->coverage_class; 366 + mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, 367 + MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); 368 + 369 + sifs = mt76_get_field(dev, MT_XIFS_TIME_CFG, 370 + MT_XIFS_TIME_CFG_OFDM_SIFS); 371 + 372 + ackto = slottime + sifs; 373 + mt76_rmw_field(dev, MT_TX_TIMEOUT_CFG, 374 + MT_TX_TIMEOUT_CFG_ACKTO, ackto); 375 + } 376 + EXPORT_SYMBOL_GPL(mt76x02_set_tx_ackto); 377 + 378 + void mt76x02_set_coverage_class(struct ieee80211_hw *hw, 379 + s16 coverage_class) 380 + { 381 + struct mt76x02_dev *dev = hw->priv; 382 + 383 + mutex_lock(&dev->mt76.mutex); 384 + dev->coverage_class = coverage_class; 385 + mt76x02_set_tx_ackto(dev); 386 + mutex_unlock(&dev->mt76.mutex); 387 + } 388 + EXPORT_SYMBOL_GPL(mt76x02_set_coverage_class); 389 + 390 + int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val) 391 + { 392 + struct mt76x02_dev *dev = hw->priv; 393 + 394 + if (val != ~0 && val > 0xffff) 395 + return -EINVAL; 396 + 397 + mutex_lock(&dev->mt76.mutex); 398 + mt76x02_mac_set_tx_protection(dev, val); 399 + mutex_unlock(&dev->mt76.mutex); 400 + 401 + return 0; 402 + } 403 + EXPORT_SYMBOL_GPL(mt76x02_set_rts_threshold); 404 + 428 405 void mt76x02_sta_rate_tbl_update(struct ieee80211_hw *hw, 429 406 struct ieee80211_vif *vif, 430 407 struct ieee80211_sta *sta) ··· 518 405 } 519 406 EXPORT_SYMBOL_GPL(mt76x02_remove_hdr_pad); 520 407 408 + void mt76x02_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 409 + const u8 *mac) 410 + { 411 + struct mt76x02_dev *dev = hw->priv; 412 + 413 + if (mt76_is_mmio(dev)) 414 + tasklet_disable(&dev->pre_tbtt_tasklet); 415 + set_bit(MT76_SCANNING, &dev->mt76.state); 416 + } 417 + EXPORT_SYMBOL_GPL(mt76x02_sw_scan); 418 + 419 + void mt76x02_sw_scan_complete(struct ieee80211_hw *hw, 420 + struct ieee80211_vif *vif) 421 + { 422 + struct mt76x02_dev *dev = hw->priv; 423 + 424 + clear_bit(MT76_SCANNING, &dev->mt76.state); 425 + if (mt76_is_mmio(dev)) 426 + tasklet_enable(&dev->pre_tbtt_tasklet); 427 + 428 + if (dev->cal.gain_init_done) { 429 + /* Restore AGC gain and resume calibration after scanning. */ 430 + dev->cal.low_gain = -1; 431 + ieee80211_queue_delayed_work(hw, &dev->cal_work, 0); 432 + } 433 + } 434 + EXPORT_SYMBOL_GPL(mt76x02_sw_scan_complete); 435 + 436 + int mt76x02_get_txpower(struct ieee80211_hw *hw, 437 + struct ieee80211_vif *vif, int *dbm) 438 + { 439 + struct mt76x02_dev *dev = hw->priv; 440 + u8 nstreams = dev->mt76.chainmask & 0xf; 441 + 442 + *dbm = dev->mt76.txpower_cur / 2; 443 + 444 + /* convert from per-chain power to combined 445 + * output on 2x2 devices 446 + */ 447 + if (nstreams > 1) 448 + *dbm += 3; 449 + 450 + return 0; 451 + } 452 + EXPORT_SYMBOL_GPL(mt76x02_get_txpower); 453 + 454 + void mt76x02_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, 455 + bool ps) 456 + { 457 + struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 458 + struct mt76x02_sta *msta = (struct mt76x02_sta *)sta->drv_priv; 459 + int idx = msta->wcid.idx; 460 + 461 + mt76_stop_tx_queues(&dev->mt76, sta, true); 462 + mt76x02_mac_wcid_set_drop(dev, idx, ps); 463 + } 464 + EXPORT_SYMBOL_GPL(mt76x02_sta_ps); 465 + 521 466 const u16 mt76x02_beacon_offsets[16] = { 522 467 /* 1024 byte per beacon */ 523 468 0xc000, ··· 596 425 0xc000, 597 426 0xc000, 598 427 }; 599 - EXPORT_SYMBOL_GPL(mt76x02_beacon_offsets); 600 428 601 - void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev) 429 + static void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev) 602 430 { 603 431 u16 val, base = MT_BEACON_BASE; 604 432 u32 regs[4] = {}; ··· 611 441 for (i = 0; i < 4; i++) 612 442 mt76_wr(dev, MT_BCN_OFFSET(i), regs[i]); 613 443 } 614 - EXPORT_SYMBOL_GPL(mt76x02_set_beacon_offsets); 444 + 445 + void mt76x02_init_beacon_config(struct mt76x02_dev *dev) 446 + { 447 + static const u8 null_addr[ETH_ALEN] = {}; 448 + int i; 449 + 450 + mt76_wr(dev, MT_MAC_BSSID_DW0, 451 + get_unaligned_le32(dev->mt76.macaddr)); 452 + mt76_wr(dev, MT_MAC_BSSID_DW1, 453 + get_unaligned_le16(dev->mt76.macaddr + 4) | 454 + FIELD_PREP(MT_MAC_BSSID_DW1_MBSS_MODE, 3) | /* 8 beacons */ 455 + MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT); 456 + 457 + /* Fire a pre-TBTT interrupt 8 ms before TBTT */ 458 + mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_PRE_TBTT, 459 + 8 << 4); 460 + mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_GP_TIMER, 461 + MT_DFS_GP_INTERVAL); 462 + mt76_wr(dev, MT_INT_TIMER_EN, 0); 463 + 464 + mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff); 465 + 466 + for (i = 0; i < 8; i++) { 467 + mt76x02_mac_set_bssid(dev, i, null_addr); 468 + mt76x02_mac_set_beacon(dev, i, NULL); 469 + } 470 + mt76x02_set_beacon_offsets(dev); 471 + } 472 + EXPORT_SYMBOL_GPL(mt76x02_init_beacon_config); 473 + 474 + void mt76x02_bss_info_changed(struct ieee80211_hw *hw, 475 + struct ieee80211_vif *vif, 476 + struct ieee80211_bss_conf *info, 477 + u32 changed) 478 + { 479 + struct mt76x02_vif *mvif = (struct mt76x02_vif *)vif->drv_priv; 480 + struct mt76x02_dev *dev = hw->priv; 481 + 482 + mutex_lock(&dev->mt76.mutex); 483 + 484 + if (changed & BSS_CHANGED_BSSID) 485 + mt76x02_mac_set_bssid(dev, mvif->idx, info->bssid); 486 + 487 + if (changed & BSS_CHANGED_BEACON_ENABLED) { 488 + tasklet_disable(&dev->pre_tbtt_tasklet); 489 + mt76x02_mac_set_beacon_enable(dev, mvif->idx, 490 + info->enable_beacon); 491 + tasklet_enable(&dev->pre_tbtt_tasklet); 492 + } 493 + 494 + if (changed & BSS_CHANGED_BEACON_INT) { 495 + mt76_rmw_field(dev, MT_BEACON_TIME_CFG, 496 + MT_BEACON_TIME_CFG_INTVAL, 497 + info->beacon_int << 4); 498 + dev->beacon_int = info->beacon_int; 499 + dev->tbtt_count = 0; 500 + } 501 + 502 + if (changed & BSS_CHANGED_ERP_PREAMBLE) 503 + mt76x02_mac_set_short_preamble(dev, info->use_short_preamble); 504 + 505 + if (changed & BSS_CHANGED_ERP_SLOT) { 506 + int slottime = info->use_short_slot ? 9 : 20; 507 + 508 + dev->slottime = slottime; 509 + mt76x02_set_tx_ackto(dev); 510 + } 511 + 512 + mutex_unlock(&dev->mt76.mutex); 513 + } 514 + EXPORT_SYMBOL_GPL(mt76x02_bss_info_changed); 515 + 516 + void mt76x02_config_mac_addr_list(struct mt76x02_dev *dev) 517 + { 518 + struct ieee80211_hw *hw = mt76_hw(dev); 519 + struct wiphy *wiphy = hw->wiphy; 520 + int i; 521 + 522 + for (i = 0; i < ARRAY_SIZE(dev->macaddr_list); i++) { 523 + u8 *addr = dev->macaddr_list[i].addr; 524 + 525 + memcpy(addr, dev->mt76.macaddr, ETH_ALEN); 526 + 527 + if (!i) 528 + continue; 529 + 530 + addr[0] |= BIT(1); 531 + addr[0] ^= ((i - 1) << 2); 532 + } 533 + wiphy->addresses = dev->macaddr_list; 534 + wiphy->n_addresses = ARRAY_SIZE(dev->macaddr_list); 535 + } 536 + EXPORT_SYMBOL_GPL(mt76x02_config_mac_addr_list); 615 537 616 538 MODULE_LICENSE("Dual BSD/GPL");
+3 -3
drivers/net/wireless/mediatek/mt76/mt76x2/Makefile
··· 3 3 obj-$(CONFIG_MT76x2U) += mt76x2u.o 4 4 5 5 mt76x2-common-y := \ 6 - eeprom.o mac.o init.o phy.o debugfs.o mcu.o 6 + eeprom.o mac.o init.o phy.o mcu.o 7 7 8 8 mt76x2e-y := \ 9 - pci.o pci_main.o pci_init.o pci_tx.o \ 10 - pci_mac.o pci_mcu.o pci_phy.o pci_dfs.o 9 + pci.o pci_main.o pci_init.o pci_mcu.o \ 10 + pci_phy.o 11 11 12 12 mt76x2u-y := \ 13 13 usb.o usb_init.o usb_main.o usb_mac.o usb_mcu.o \
+11 -11
drivers/net/wireless/mediatek/mt76/mt76x2/debugfs.c drivers/net/wireless/mediatek/mt76/mt76x02_debugfs.c
··· 15 15 */ 16 16 17 17 #include <linux/debugfs.h> 18 - #include "mt76x2.h" 18 + #include "mt76x02.h" 19 19 20 20 static int 21 - mt76x2_ampdu_stat_read(struct seq_file *file, void *data) 21 + mt76x02_ampdu_stat_read(struct seq_file *file, void *data) 22 22 { 23 23 struct mt76x02_dev *dev = file->private; 24 24 int i, j; ··· 42 42 } 43 43 44 44 static int 45 - mt76x2_ampdu_stat_open(struct inode *inode, struct file *f) 45 + mt76x02_ampdu_stat_open(struct inode *inode, struct file *f) 46 46 { 47 - return single_open(f, mt76x2_ampdu_stat_read, inode->i_private); 47 + return single_open(f, mt76x02_ampdu_stat_read, inode->i_private); 48 48 } 49 49 50 50 static int read_txpower(struct seq_file *file, void *data) ··· 59 59 } 60 60 61 61 static const struct file_operations fops_ampdu_stat = { 62 - .open = mt76x2_ampdu_stat_open, 62 + .open = mt76x02_ampdu_stat_open, 63 63 .read = seq_read, 64 64 .llseek = seq_lseek, 65 65 .release = single_release, 66 66 }; 67 67 68 68 static int 69 - mt76x2_dfs_stat_read(struct seq_file *file, void *data) 69 + mt76x02_dfs_stat_read(struct seq_file *file, void *data) 70 70 { 71 71 struct mt76x02_dev *dev = file->private; 72 72 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; ··· 92 92 } 93 93 94 94 static int 95 - mt76x2_dfs_stat_open(struct inode *inode, struct file *f) 95 + mt76x02_dfs_stat_open(struct inode *inode, struct file *f) 96 96 { 97 - return single_open(f, mt76x2_dfs_stat_read, inode->i_private); 97 + return single_open(f, mt76x02_dfs_stat_read, inode->i_private); 98 98 } 99 99 100 100 static const struct file_operations fops_dfs_stat = { 101 - .open = mt76x2_dfs_stat_open, 101 + .open = mt76x02_dfs_stat_open, 102 102 .read = seq_read, 103 103 .llseek = seq_lseek, 104 104 .release = single_release, ··· 116 116 return 0; 117 117 } 118 118 119 - void mt76x2_init_debugfs(struct mt76x02_dev *dev) 119 + void mt76x02_init_debugfs(struct mt76x02_dev *dev) 120 120 { 121 121 struct dentry *dir; 122 122 ··· 134 134 135 135 debugfs_create_devm_seqfile(dev->mt76.dev, "agc", dir, read_agc); 136 136 } 137 - EXPORT_SYMBOL_GPL(mt76x2_init_debugfs); 137 + EXPORT_SYMBOL_GPL(mt76x02_init_debugfs);
-26
drivers/net/wireless/mediatek/mt76/mt76x2/dfs.h
··· 1 - /* 2 - * Copyright (C) 2016 Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> 3 - * 4 - * Permission to use, copy, modify, and/or distribute this software for any 5 - * purpose with or without fee is hereby granted, provided that the above 6 - * copyright notice and this permission notice appear in all copies. 7 - * 8 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 - */ 16 - 17 - #ifndef __DFS_H 18 - #define __DFS_H 19 - 20 - void mt76x2_dfs_init_params(struct mt76x02_dev *dev); 21 - void mt76x2_dfs_init_detector(struct mt76x02_dev *dev); 22 - void mt76x2_dfs_adjust_agc(struct mt76x02_dev *dev); 23 - void mt76x2_dfs_set_domain(struct mt76x02_dev *dev, 24 - enum nl80211_dfs_regions region); 25 - 26 - #endif /* __DFS_H */
+2 -13
drivers/net/wireless/mediatek/mt76/mt76x2/eeprom.c
··· 22 22 #define EE_FIELD(_name, _value) [MT_EE_##_name] = (_value) | 1 23 23 24 24 static int 25 - mt76x2_eeprom_copy(struct mt76x02_dev *dev, enum mt76x02_eeprom_field field, 26 - void *dest, int len) 27 - { 28 - if (field + len > dev->mt76.eeprom.size) 29 - return -1; 30 - 31 - memcpy(dest, dev->mt76.eeprom.data + field, len); 32 - return 0; 33 - } 34 - 35 - static int 36 25 mt76x2_eeprom_get_macaddr(struct mt76x02_dev *dev) 37 26 { 38 27 void *src = dev->mt76.eeprom.data + MT_EE_MAC_ADDR; ··· 367 378 else 368 379 delta_idx = 5; 369 380 370 - mt76x2_eeprom_copy(dev, offset, data, sizeof(data)); 381 + mt76x02_eeprom_copy(dev, offset, data, sizeof(data)); 371 382 372 383 t->chain[chain].tssi_slope = data[0]; 373 384 t->chain[chain].tssi_offset = data[1]; ··· 418 429 else 419 430 delta_idx = 4; 420 431 421 - mt76x2_eeprom_copy(dev, offset, data, sizeof(data)); 432 + mt76x02_eeprom_copy(dev, offset, data, sizeof(data)); 422 433 423 434 t->chain[chain].tssi_slope = data[0]; 424 435 t->chain[chain].tssi_offset = data[1];
-32
drivers/net/wireless/mediatek/mt76/mt76x2/init.c
··· 158 158 } 159 159 EXPORT_SYMBOL_GPL(mt76_write_mac_initvals); 160 160 161 - void mt76x2_init_device(struct mt76x02_dev *dev) 162 - { 163 - struct ieee80211_hw *hw = mt76_hw(dev); 164 - 165 - hw->queues = 4; 166 - hw->max_rates = 1; 167 - hw->max_report_rates = 7; 168 - hw->max_rate_tries = 1; 169 - hw->extra_tx_headroom = 2; 170 - if (mt76_is_usb(dev)) 171 - hw->extra_tx_headroom += sizeof(struct mt76x02_txwi) + 172 - MT_DMA_HDR_LEN; 173 - 174 - hw->sta_data_size = sizeof(struct mt76x02_sta); 175 - hw->vif_data_size = sizeof(struct mt76x02_vif); 176 - 177 - ieee80211_hw_set(hw, SUPPORTS_HT_CCK_RATES); 178 - ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER); 179 - 180 - dev->mt76.sband_2g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING; 181 - dev->mt76.sband_5g.sband.ht_cap.cap |= IEEE80211_HT_CAP_LDPC_CODING; 182 - 183 - dev->mt76.chainmask = 0x202; 184 - dev->mt76.global_wcid.idx = 255; 185 - dev->mt76.global_wcid.hw_key_idx = -1; 186 - dev->slottime = 9; 187 - 188 - /* init antenna configuration */ 189 - dev->mt76.antenna_mask = 3; 190 - } 191 - EXPORT_SYMBOL_GPL(mt76x2_init_device); 192 - 193 161 void mt76x2_init_txpower(struct mt76x02_dev *dev, 194 162 struct ieee80211_supported_band *sband) 195 163 {
-7
drivers/net/wireless/mediatek/mt76/mt76x2/mac.h
··· 26 26 int mt76x2_mac_start(struct mt76x02_dev *dev); 27 27 void mt76x2_mac_stop(struct mt76x02_dev *dev, bool force); 28 28 void mt76x2_mac_resume(struct mt76x02_dev *dev); 29 - void mt76x2_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr); 30 - 31 - int mt76x2_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx, 32 - struct sk_buff *skb); 33 - void mt76x2_mac_set_beacon_enable(struct mt76x02_dev *dev, u8 vif_idx, bool val); 34 - 35 - void mt76x2_mac_work(struct work_struct *work); 36 29 37 30 #endif
+8 -14
drivers/net/wireless/mediatek/mt76/mt76x2/mcu.c
··· 26 26 int mt76x2_mcu_set_channel(struct mt76x02_dev *dev, u8 channel, u8 bw, 27 27 u8 bw_index, bool scan) 28 28 { 29 - struct sk_buff *skb; 30 29 struct { 31 30 u8 idx; 32 31 u8 scan; ··· 44 45 }; 45 46 46 47 /* first set the channel without the extension channel info */ 47 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 48 - mt76_mcu_send_msg(dev, skb, CMD_SWITCH_CHANNEL_OP, true); 48 + mt76_mcu_send_msg(dev, CMD_SWITCH_CHANNEL_OP, &msg, sizeof(msg), true); 49 49 50 50 usleep_range(5000, 10000); 51 51 52 52 msg.ext_chan = 0xe0 + bw_index; 53 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 54 - return mt76_mcu_send_msg(dev, skb, CMD_SWITCH_CHANNEL_OP, true); 53 + return mt76_mcu_send_msg(dev, CMD_SWITCH_CHANNEL_OP, &msg, sizeof(msg), 54 + true); 55 55 } 56 56 EXPORT_SYMBOL_GPL(mt76x2_mcu_set_channel); 57 57 58 58 int mt76x2_mcu_load_cr(struct mt76x02_dev *dev, u8 type, u8 temp_level, 59 59 u8 channel) 60 60 { 61 - struct sk_buff *skb; 62 61 struct { 63 62 u8 cr_mode; 64 63 u8 temp; ··· 77 80 msg.cfg = cpu_to_le32(val); 78 81 79 82 /* first set the channel without the extension channel info */ 80 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 81 - return mt76_mcu_send_msg(dev, skb, CMD_LOAD_CR, true); 83 + return mt76_mcu_send_msg(dev, CMD_LOAD_CR, &msg, sizeof(msg), true); 82 84 } 83 85 EXPORT_SYMBOL_GPL(mt76x2_mcu_load_cr); 84 86 85 87 int mt76x2_mcu_init_gain(struct mt76x02_dev *dev, u8 channel, u32 gain, 86 88 bool force) 87 89 { 88 - struct sk_buff *skb; 89 90 struct { 90 91 __le32 channel; 91 92 __le32 gain_val; ··· 95 100 if (force) 96 101 msg.channel |= cpu_to_le32(BIT(31)); 97 102 98 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 99 - return mt76_mcu_send_msg(dev, skb, CMD_INIT_GAIN_OP, true); 103 + return mt76_mcu_send_msg(dev, CMD_INIT_GAIN_OP, &msg, sizeof(msg), 104 + true); 100 105 } 101 106 EXPORT_SYMBOL_GPL(mt76x2_mcu_init_gain); 102 107 103 108 int mt76x2_mcu_tssi_comp(struct mt76x02_dev *dev, 104 109 struct mt76x2_tssi_comp *tssi_data) 105 110 { 106 - struct sk_buff *skb; 107 111 struct { 108 112 __le32 id; 109 113 struct mt76x2_tssi_comp data; ··· 111 117 .data = *tssi_data, 112 118 }; 113 119 114 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 115 - return mt76_mcu_send_msg(dev, skb, CMD_CALIBRATION_OP, true); 120 + return mt76_mcu_send_msg(dev, CMD_CALIBRATION_OP, &msg, sizeof(msg), 121 + true); 116 122 } 117 123 EXPORT_SYMBOL_GPL(mt76x2_mcu_tssi_comp);
+2 -18
drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2.h
··· 31 31 #define MT7662_ROM_PATCH "mt7662_rom_patch.bin" 32 32 #define MT7662_EEPROM_SIZE 512 33 33 34 - #define MT7662U_FIRMWARE "mediatek/mt7662u.bin" 35 - #define MT7662U_ROM_PATCH "mediatek/mt7662u_rom_patch.bin" 36 - 37 - #define MT_CALIBRATE_INTERVAL HZ 38 - 39 34 #include "../mt76x02.h" 40 35 #include "mac.h" 41 - #include "dfs.h" 42 36 43 37 static inline bool is_mt7612(struct mt76x02_dev *dev) 44 38 { ··· 51 57 52 58 struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev); 53 59 int mt76x2_register_device(struct mt76x02_dev *dev); 54 - void mt76x2_init_debugfs(struct mt76x02_dev *dev); 55 - void mt76x2_init_device(struct mt76x02_dev *dev); 56 60 57 61 void mt76x2_phy_power_on(struct mt76x02_dev *dev); 58 62 int mt76x2_init_hardware(struct mt76x02_dev *dev); 59 63 void mt76x2_stop_hardware(struct mt76x02_dev *dev); 60 64 int mt76x2_eeprom_init(struct mt76x02_dev *dev); 61 65 int mt76x2_apply_calibration_data(struct mt76x02_dev *dev, int channel); 62 - void mt76x2_set_tx_ackto(struct mt76x02_dev *dev); 63 66 64 67 void mt76x2_phy_set_antenna(struct mt76x02_dev *dev); 65 68 int mt76x2_phy_start(struct mt76x02_dev *dev); ··· 73 82 74 83 void mt76x2_cleanup(struct mt76x02_dev *dev); 75 84 76 - void mt76x2_mac_set_tx_protection(struct mt76x02_dev *dev, u32 val); 77 - 78 - void mt76x2_pre_tbtt_tasklet(unsigned long arg); 79 - 80 - void mt76x2_sta_ps(struct mt76_dev *dev, struct ieee80211_sta *sta, bool ps); 81 - 82 - void mt76x2_update_channel(struct mt76_dev *mdev); 83 - 84 85 void mt76x2_reset_wlan(struct mt76x02_dev *dev, bool enable); 85 86 void mt76x2_init_txpower(struct mt76x02_dev *dev, 86 87 struct ieee80211_supported_band *sband); 87 88 void mt76_write_mac_initvals(struct mt76x02_dev *dev); 88 89 89 - void mt76x2_phy_tssi_compensate(struct mt76x02_dev *dev, bool wait); 90 + void mt76x2_phy_tssi_compensate(struct mt76x02_dev *dev); 90 91 void mt76x2_phy_set_txpower_regs(struct mt76x02_dev *dev, 91 92 enum nl80211_band band); 92 93 void mt76x2_configure_tx_delay(struct mt76x02_dev *dev, 93 94 enum nl80211_band band, u8 bw); 94 95 void mt76x2_apply_gain_adj(struct mt76x02_dev *dev); 96 + void mt76x2_phy_update_channel_gain(struct mt76x02_dev *dev); 95 97 96 98 #endif
-3
drivers/net/wireless/mediatek/mt76/mt76x2/mt76x2u.h
··· 43 43 int mt76x2u_phy_set_channel(struct mt76x02_dev *dev, 44 44 struct cfg80211_chan_def *chandef); 45 45 void mt76x2u_phy_calibrate(struct work_struct *work); 46 - void mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev); 47 46 48 47 void mt76x2u_mcu_complete_urb(struct urb *urb); 49 - int mt76x2u_mcu_set_dynamic_vga(struct mt76x02_dev *dev, u8 channel, bool ap, 50 - bool ext, int rssi, u32 false_cca); 51 48 int mt76x2u_mcu_init(struct mt76x02_dev *dev); 52 49 int mt76x2u_mcu_fw_init(struct mt76x02_dev *dev); 53 50
+87 -66
drivers/net/wireless/mediatek/mt76/mt76x2/pci_dfs.c drivers/net/wireless/mediatek/mt76/mt76x02_dfs.c
··· 14 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 15 */ 16 16 17 - #include "mt76x2.h" 17 + #include "mt76x02.h" 18 18 19 19 #define RADAR_SPEC(m, len, el, eh, wl, wh, \ 20 20 w_tolerance, tl, th, t_tolerance, \ ··· 151 151 }; 152 152 153 153 static void 154 - mt76x2_dfs_set_capture_mode_ctrl(struct mt76x02_dev *dev, 155 - u8 enable) 154 + mt76x02_dfs_set_capture_mode_ctrl(struct mt76x02_dev *dev, u8 enable) 156 155 { 157 156 u32 data; 158 157 ··· 159 160 mt76_wr(dev, MT_BBP(DFS, 36), data); 160 161 } 161 162 162 - static void mt76x2_dfs_seq_pool_put(struct mt76x02_dev *dev, 163 - struct mt76x02_dfs_sequence *seq) 163 + static void mt76x02_dfs_seq_pool_put(struct mt76x02_dev *dev, 164 + struct mt76x02_dfs_sequence *seq) 164 165 { 165 166 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 166 167 ··· 171 172 } 172 173 173 174 static struct mt76x02_dfs_sequence * 174 - mt76x2_dfs_seq_pool_get(struct mt76x02_dev *dev) 175 + mt76x02_dfs_seq_pool_get(struct mt76x02_dev *dev) 175 176 { 176 177 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 177 178 struct mt76x02_dfs_sequence *seq; ··· 191 192 return seq; 192 193 } 193 194 194 - static int mt76x2_dfs_get_multiple(int val, int frac, int margin) 195 + static int mt76x02_dfs_get_multiple(int val, int frac, int margin) 195 196 { 196 197 int remainder, factor; 197 198 ··· 213 214 return factor; 214 215 } 215 216 216 - static void mt76x2_dfs_detector_reset(struct mt76x02_dev *dev) 217 + static void mt76x02_dfs_detector_reset(struct mt76x02_dev *dev) 217 218 { 218 219 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 219 220 struct mt76x02_dfs_sequence *seq, *tmp_seq; ··· 230 231 231 232 list_for_each_entry_safe(seq, tmp_seq, &dfs_pd->sequences, head) { 232 233 list_del_init(&seq->head); 233 - mt76x2_dfs_seq_pool_put(dev, seq); 234 + mt76x02_dfs_seq_pool_put(dev, seq); 234 235 } 235 236 } 236 237 237 - static bool mt76x2_dfs_check_chirp(struct mt76x02_dev *dev) 238 + static bool mt76x02_dfs_check_chirp(struct mt76x02_dev *dev) 238 239 { 239 240 bool ret = false; 240 241 u32 current_ts, delta_ts; ··· 255 256 return ret; 256 257 } 257 258 258 - static void mt76x2_dfs_get_hw_pulse(struct mt76x02_dev *dev, 259 - struct mt76x02_dfs_hw_pulse *pulse) 259 + static void mt76x02_dfs_get_hw_pulse(struct mt76x02_dev *dev, 260 + struct mt76x02_dfs_hw_pulse *pulse) 260 261 { 261 262 u32 data; 262 263 ··· 275 276 pulse->burst = mt76_rr(dev, MT_BBP(DFS, 22)); 276 277 } 277 278 278 - static bool mt76x2_dfs_check_hw_pulse(struct mt76x02_dev *dev, 279 - struct mt76x02_dfs_hw_pulse *pulse) 279 + static bool mt76x02_dfs_check_hw_pulse(struct mt76x02_dev *dev, 280 + struct mt76x02_dfs_hw_pulse *pulse) 280 281 { 281 282 bool ret = false; 282 283 ··· 289 290 break; 290 291 291 292 if (pulse->engine == 3) { 292 - ret = mt76x2_dfs_check_chirp(dev); 293 + ret = mt76x02_dfs_check_chirp(dev); 293 294 break; 294 295 } 295 296 ··· 333 334 break; 334 335 335 336 if (pulse->engine == 3) { 336 - ret = mt76x2_dfs_check_chirp(dev); 337 + ret = mt76x02_dfs_check_chirp(dev); 337 338 break; 338 339 } 339 340 ··· 370 371 return ret; 371 372 } 372 373 373 - static bool mt76x2_dfs_fetch_event(struct mt76x02_dev *dev, 374 - struct mt76x02_dfs_event *event) 374 + static bool mt76x02_dfs_fetch_event(struct mt76x02_dev *dev, 375 + struct mt76x02_dfs_event *event) 375 376 { 376 377 u32 data; 377 378 ··· 397 398 return true; 398 399 } 399 400 400 - static bool mt76x2_dfs_check_event(struct mt76x02_dev *dev, 401 - struct mt76x02_dfs_event *event) 401 + static bool mt76x02_dfs_check_event(struct mt76x02_dev *dev, 402 + struct mt76x02_dfs_event *event) 402 403 { 403 404 if (event->engine == 2) { 404 405 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; ··· 416 417 return true; 417 418 } 418 419 419 - static void mt76x2_dfs_queue_event(struct mt76x02_dev *dev, 420 - struct mt76x02_dfs_event *event) 420 + static void mt76x02_dfs_queue_event(struct mt76x02_dev *dev, 421 + struct mt76x02_dfs_event *event) 421 422 { 422 423 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 423 424 struct mt76x02_dfs_event_rb *event_buff; ··· 434 435 MT_DFS_EVENT_BUFLEN); 435 436 } 436 437 437 - static int mt76x2_dfs_create_sequence(struct mt76x02_dev *dev, 438 - struct mt76x02_dfs_event *event, 439 - u16 cur_len) 438 + static int mt76x02_dfs_create_sequence(struct mt76x02_dev *dev, 439 + struct mt76x02_dfs_event *event, 440 + u16 cur_len) 440 441 { 441 442 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 442 443 struct mt76x02_dfs_sw_detector_params *sw_params; ··· 496 497 while (j != end) { 497 498 cur_event = &event_rb->data[j]; 498 499 cur_pri = event->ts - cur_event->ts; 499 - factor = mt76x2_dfs_get_multiple(cur_pri, seq.pri, 500 + factor = mt76x02_dfs_get_multiple(cur_pri, seq.pri, 500 501 sw_params->pri_margin); 501 502 if (factor > 0) { 502 503 seq.first_ts = cur_event->ts; ··· 508 509 if (seq.count <= cur_len) 509 510 goto next; 510 511 511 - seq_p = mt76x2_dfs_seq_pool_get(dev); 512 + seq_p = mt76x02_dfs_seq_pool_get(dev); 512 513 if (!seq_p) 513 514 return -ENOMEM; 514 515 ··· 521 522 return 0; 522 523 } 523 524 524 - static u16 mt76x2_dfs_add_event_to_sequence(struct mt76x02_dev *dev, 525 - struct mt76x02_dfs_event *event) 525 + static u16 mt76x02_dfs_add_event_to_sequence(struct mt76x02_dev *dev, 526 + struct mt76x02_dfs_event *event) 526 527 { 527 528 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 528 529 struct mt76x02_dfs_sw_detector_params *sw_params; ··· 534 535 list_for_each_entry_safe(seq, tmp_seq, &dfs_pd->sequences, head) { 535 536 if (event->ts > seq->first_ts + MT_DFS_SEQUENCE_WINDOW) { 536 537 list_del_init(&seq->head); 537 - mt76x2_dfs_seq_pool_put(dev, seq); 538 + mt76x02_dfs_seq_pool_put(dev, seq); 538 539 continue; 539 540 } 540 541 ··· 542 543 continue; 543 544 544 545 pri = event->ts - seq->last_ts; 545 - factor = mt76x2_dfs_get_multiple(pri, seq->pri, 546 - sw_params->pri_margin); 546 + factor = mt76x02_dfs_get_multiple(pri, seq->pri, 547 + sw_params->pri_margin); 547 548 if (factor > 0) { 548 549 seq->last_ts = event->ts; 549 550 seq->count++; ··· 553 554 return max_seq_len; 554 555 } 555 556 556 - static bool mt76x2_dfs_check_detection(struct mt76x02_dev *dev) 557 + static bool mt76x02_dfs_check_detection(struct mt76x02_dev *dev) 557 558 { 558 559 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 559 560 struct mt76x02_dfs_sequence *seq; ··· 570 571 return false; 571 572 } 572 573 573 - static void mt76x2_dfs_add_events(struct mt76x02_dev *dev) 574 + static void mt76x02_dfs_add_events(struct mt76x02_dev *dev) 574 575 { 575 576 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 576 577 struct mt76x02_dfs_event event; 577 578 int i, seq_len; 578 579 579 580 /* disable debug mode */ 580 - mt76x2_dfs_set_capture_mode_ctrl(dev, false); 581 + mt76x02_dfs_set_capture_mode_ctrl(dev, false); 581 582 for (i = 0; i < MT_DFS_EVENT_LOOP; i++) { 582 - if (!mt76x2_dfs_fetch_event(dev, &event)) 583 + if (!mt76x02_dfs_fetch_event(dev, &event)) 583 584 break; 584 585 585 586 if (dfs_pd->last_event_ts > event.ts) 586 - mt76x2_dfs_detector_reset(dev); 587 + mt76x02_dfs_detector_reset(dev); 587 588 dfs_pd->last_event_ts = event.ts; 588 589 589 - if (!mt76x2_dfs_check_event(dev, &event)) 590 + if (!mt76x02_dfs_check_event(dev, &event)) 590 591 continue; 591 592 592 - seq_len = mt76x2_dfs_add_event_to_sequence(dev, &event); 593 - mt76x2_dfs_create_sequence(dev, &event, seq_len); 593 + seq_len = mt76x02_dfs_add_event_to_sequence(dev, &event); 594 + mt76x02_dfs_create_sequence(dev, &event, seq_len); 594 595 595 - mt76x2_dfs_queue_event(dev, &event); 596 + mt76x02_dfs_queue_event(dev, &event); 596 597 } 597 - mt76x2_dfs_set_capture_mode_ctrl(dev, true); 598 + mt76x02_dfs_set_capture_mode_ctrl(dev, true); 598 599 } 599 600 600 - static void mt76x2_dfs_check_event_window(struct mt76x02_dev *dev) 601 + static void mt76x02_dfs_check_event_window(struct mt76x02_dev *dev) 601 602 { 602 603 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 603 604 struct mt76x02_dfs_event_rb *event_buff; ··· 620 621 } 621 622 } 622 623 623 - static void mt76x2_dfs_tasklet(unsigned long arg) 624 + static void mt76x02_dfs_tasklet(unsigned long arg) 624 625 { 625 626 struct mt76x02_dev *dev = (struct mt76x02_dev *)arg; 626 627 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; ··· 636 637 637 638 dfs_pd->last_sw_check = jiffies; 638 639 639 - mt76x2_dfs_add_events(dev); 640 - radar_detected = mt76x2_dfs_check_detection(dev); 640 + mt76x02_dfs_add_events(dev); 641 + radar_detected = mt76x02_dfs_check_detection(dev); 641 642 if (radar_detected) { 642 643 /* sw detector rx radar pattern */ 643 644 ieee80211_radar_detected(dev->mt76.hw); 644 - mt76x2_dfs_detector_reset(dev); 645 + mt76x02_dfs_detector_reset(dev); 645 646 646 647 return; 647 648 } 648 - mt76x2_dfs_check_event_window(dev); 649 + mt76x02_dfs_check_event_window(dev); 649 650 } 650 651 651 652 engine_mask = mt76_rr(dev, MT_BBP(DFS, 1)); ··· 659 660 continue; 660 661 661 662 pulse.engine = i; 662 - mt76x2_dfs_get_hw_pulse(dev, &pulse); 663 + mt76x02_dfs_get_hw_pulse(dev, &pulse); 663 664 664 - if (!mt76x2_dfs_check_hw_pulse(dev, &pulse)) { 665 + if (!mt76x02_dfs_check_hw_pulse(dev, &pulse)) { 665 666 dfs_pd->stats[i].hw_pulse_discarded++; 666 667 continue; 667 668 } ··· 669 670 /* hw detector rx radar pattern */ 670 671 dfs_pd->stats[i].hw_pattern++; 671 672 ieee80211_radar_detected(dev->mt76.hw); 672 - mt76x2_dfs_detector_reset(dev); 673 + mt76x02_dfs_detector_reset(dev); 673 674 674 675 return; 675 676 } ··· 681 682 mt76x02_irq_enable(dev, MT_INT_GPTIMER); 682 683 } 683 684 684 - static void mt76x2_dfs_init_sw_detector(struct mt76x02_dev *dev) 685 + static void mt76x02_dfs_init_sw_detector(struct mt76x02_dev *dev) 685 686 { 686 687 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 687 688 ··· 707 708 } 708 709 } 709 710 710 - static void mt76x2_dfs_set_bbp_params(struct mt76x02_dev *dev) 711 + static void mt76x02_dfs_set_bbp_params(struct mt76x02_dev *dev) 711 712 { 712 713 const struct mt76x02_radar_specs *radar_specs; 713 714 u8 i, shift; ··· 799 800 800 801 /* enable detection*/ 801 802 mt76_wr(dev, MT_BBP(DFS, 0), MT_DFS_CH_EN << 16); 802 - mt76_wr(dev, 0x212c, 0x0c350001); 803 + mt76_wr(dev, MT_BBP(IBI, 11), 0x0c350001); 803 804 } 804 805 805 - void mt76x2_dfs_adjust_agc(struct mt76x02_dev *dev) 806 + void mt76x02_phy_dfs_adjust_agc(struct mt76x02_dev *dev) 806 807 { 807 808 u32 agc_r8, agc_r4, val_r8, val_r4, dfs_r31; 808 809 ··· 820 821 dfs_r31 = (dfs_r31 << 16) | 0x00000307; 821 822 mt76_wr(dev, MT_BBP(DFS, 31), dfs_r31); 822 823 823 - mt76_wr(dev, MT_BBP(DFS, 32), 0x00040071); 824 + if (is_mt76x2(dev)) { 825 + mt76_wr(dev, MT_BBP(DFS, 32), 0x00040071); 826 + } else { 827 + /* disable hw detector */ 828 + mt76_wr(dev, MT_BBP(DFS, 0), 0); 829 + /* enable hw detector */ 830 + mt76_wr(dev, MT_BBP(DFS, 0), MT_DFS_CH_EN << 16); 831 + } 824 832 } 833 + EXPORT_SYMBOL_GPL(mt76x02_phy_dfs_adjust_agc); 825 834 826 - void mt76x2_dfs_init_params(struct mt76x02_dev *dev) 835 + void mt76x02_dfs_init_params(struct mt76x02_dev *dev) 827 836 { 828 837 struct cfg80211_chan_def *chandef = &dev->mt76.chandef; 829 838 830 839 if ((chandef->chan->flags & IEEE80211_CHAN_RADAR) && 831 840 dev->dfs_pd.region != NL80211_DFS_UNSET) { 832 - mt76x2_dfs_init_sw_detector(dev); 833 - mt76x2_dfs_set_bbp_params(dev); 841 + mt76x02_dfs_init_sw_detector(dev); 842 + mt76x02_dfs_set_bbp_params(dev); 834 843 /* enable debug mode */ 835 - mt76x2_dfs_set_capture_mode_ctrl(dev, true); 844 + mt76x02_dfs_set_capture_mode_ctrl(dev, true); 836 845 837 846 mt76x02_irq_enable(dev, MT_INT_GPTIMER); 838 847 mt76_rmw_field(dev, MT_INT_TIMER_EN, ··· 850 843 mt76_wr(dev, MT_BBP(DFS, 0), 0); 851 844 /* clear detector status */ 852 845 mt76_wr(dev, MT_BBP(DFS, 1), 0xf); 853 - mt76_wr(dev, 0x212c, 0); 846 + if (mt76_chip(&dev->mt76) == 0x7610 || 847 + mt76_chip(&dev->mt76) == 0x7630) 848 + mt76_wr(dev, MT_BBP(IBI, 11), 0xfde8081); 849 + else 850 + mt76_wr(dev, MT_BBP(IBI, 11), 0); 854 851 855 852 mt76x02_irq_disable(dev, MT_INT_GPTIMER); 856 853 mt76_rmw_field(dev, MT_INT_TIMER_EN, 857 854 MT_INT_TIMER_EN_GP_TIMER_EN, 0); 858 855 } 859 856 } 857 + EXPORT_SYMBOL_GPL(mt76x02_dfs_init_params); 860 858 861 - void mt76x2_dfs_init_detector(struct mt76x02_dev *dev) 859 + void mt76x02_dfs_init_detector(struct mt76x02_dev *dev) 862 860 { 863 861 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 864 862 ··· 871 859 INIT_LIST_HEAD(&dfs_pd->seq_pool); 872 860 dfs_pd->region = NL80211_DFS_UNSET; 873 861 dfs_pd->last_sw_check = jiffies; 874 - tasklet_init(&dfs_pd->dfs_tasklet, mt76x2_dfs_tasklet, 862 + tasklet_init(&dfs_pd->dfs_tasklet, mt76x02_dfs_tasklet, 875 863 (unsigned long)dev); 876 864 } 877 865 878 - void mt76x2_dfs_set_domain(struct mt76x02_dev *dev, 879 - enum nl80211_dfs_regions region) 866 + static void 867 + mt76x02_dfs_set_domain(struct mt76x02_dev *dev, 868 + enum nl80211_dfs_regions region) 880 869 { 881 870 struct mt76x02_dfs_pattern_detector *dfs_pd = &dev->dfs_pd; 882 871 883 872 if (dfs_pd->region != region) { 884 873 tasklet_disable(&dfs_pd->dfs_tasklet); 885 874 dfs_pd->region = region; 886 - mt76x2_dfs_init_params(dev); 875 + mt76x02_dfs_init_params(dev); 887 876 tasklet_enable(&dfs_pd->dfs_tasklet); 888 877 } 889 878 } 890 879 880 + void mt76x02_regd_notifier(struct wiphy *wiphy, 881 + struct regulatory_request *request) 882 + { 883 + struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 884 + struct mt76x02_dev *dev = hw->priv; 885 + 886 + mt76x02_dfs_set_domain(dev, request->dfs_region); 887 + }
+15 -119
drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
··· 79 79 80 80 static int mt76x2_mac_reset(struct mt76x02_dev *dev, bool hard) 81 81 { 82 - static const u8 null_addr[ETH_ALEN] = {}; 83 82 const u8 *macaddr = dev->mt76.macaddr; 84 83 u32 val; 85 84 int i, k; ··· 122 123 mt76_wr(dev, MT_MAC_ADDR_DW0, get_unaligned_le32(macaddr)); 123 124 mt76_wr(dev, MT_MAC_ADDR_DW1, get_unaligned_le16(macaddr + 4)); 124 125 125 - mt76_wr(dev, MT_MAC_BSSID_DW0, get_unaligned_le32(macaddr)); 126 - mt76_wr(dev, MT_MAC_BSSID_DW1, get_unaligned_le16(macaddr + 4) | 127 - FIELD_PREP(MT_MAC_BSSID_DW1_MBSS_MODE, 3) | /* 8 beacons */ 128 - MT_MAC_BSSID_DW1_MBSS_LOCAL_BIT); 129 - 130 - /* Fire a pre-TBTT interrupt 8 ms before TBTT */ 131 - mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_PRE_TBTT, 132 - 8 << 4); 133 - mt76_rmw_field(dev, MT_INT_TIMER_CFG, MT_INT_TIMER_CFG_GP_TIMER, 134 - MT_DFS_GP_INTERVAL); 135 - mt76_wr(dev, MT_INT_TIMER_EN, 0); 136 - 137 - mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xffff); 126 + mt76x02_init_beacon_config(dev); 138 127 if (!hard) 139 128 return 0; 140 129 141 130 for (i = 0; i < 256 / 32; i++) 142 131 mt76_wr(dev, MT_WCID_DROP_BASE + i * 4, 0); 143 132 144 - for (i = 0; i < 256; i++) 133 + for (i = 0; i < 256; i++) { 145 134 mt76x02_mac_wcid_setup(dev, i, 0, NULL); 135 + mt76_wr(dev, MT_WCID_TX_RATE(i), 0); 136 + mt76_wr(dev, MT_WCID_TX_RATE(i) + 4, 0); 137 + } 146 138 147 139 for (i = 0; i < MT_MAX_VIFS; i++) 148 140 mt76x02_mac_wcid_setup(dev, MT_VIF_WCID(i), i, NULL); ··· 141 151 for (i = 0; i < 16; i++) 142 152 for (k = 0; k < 4; k++) 143 153 mt76x02_mac_shared_key_setup(dev, i, k, NULL); 144 - 145 - for (i = 0; i < 8; i++) { 146 - mt76x2_mac_set_bssid(dev, i, null_addr); 147 - mt76x2_mac_set_beacon(dev, i, NULL); 148 - } 149 154 150 155 for (i = 0; i < 16; i++) 151 156 mt76_rr(dev, MT_TX_STAT_FIFO); ··· 153 168 MT_CH_TIME_CFG_EIFS_AS_BUSY | 154 169 FIELD_PREP(MT_CH_TIME_CFG_CH_TIMER_CLR, 1)); 155 170 156 - mt76x02_set_beacon_offsets(dev); 157 - 158 - mt76x2_set_tx_ackto(dev); 171 + mt76x02_set_tx_ackto(dev); 159 172 160 173 return 0; 161 174 } ··· 260 277 mt76x2_power_on_rf(dev, 1); 261 278 } 262 279 263 - void mt76x2_set_tx_ackto(struct mt76x02_dev *dev) 264 - { 265 - u8 ackto, sifs, slottime = dev->slottime; 266 - 267 - /* As defined by IEEE 802.11-2007 17.3.8.6 */ 268 - slottime += 3 * dev->coverage_class; 269 - mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, 270 - MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); 271 - 272 - sifs = mt76_get_field(dev, MT_XIFS_TIME_CFG, 273 - MT_XIFS_TIME_CFG_OFDM_SIFS); 274 - 275 - ackto = slottime + sifs; 276 - mt76_rmw_field(dev, MT_TX_TIMEOUT_CFG, 277 - MT_TX_TIMEOUT_CFG_ACKTO, ackto); 278 - } 279 - 280 280 int mt76x2_init_hardware(struct mt76x02_dev *dev) 281 281 { 282 282 int ret; 283 - 284 - tasklet_init(&dev->pre_tbtt_tasklet, mt76x2_pre_tbtt_tasklet, 285 - (unsigned long) dev); 286 283 287 284 mt76x02_dma_disable(dev); 288 285 mt76x2_reset_wlan(dev, true); ··· 300 337 { 301 338 cancel_delayed_work_sync(&dev->cal_work); 302 339 cancel_delayed_work_sync(&dev->mac_work); 303 - mt76x02_mcu_set_radio_state(dev, false, true); 340 + mt76x02_mcu_set_radio_state(dev, false); 304 341 mt76x2_mac_stop(dev, false); 305 342 } 306 343 ··· 317 354 { 318 355 static const struct mt76_driver_ops drv_ops = { 319 356 .txwi_size = sizeof(struct mt76x02_txwi), 320 - .update_survey = mt76x2_update_channel, 357 + .update_survey = mt76x02_update_channel, 321 358 .tx_prepare_skb = mt76x02_tx_prepare_skb, 322 359 .tx_complete_skb = mt76x02_tx_complete_skb, 323 360 .rx_skb = mt76x02_queue_rx_skb, 324 361 .rx_poll_complete = mt76x02_rx_poll_complete, 325 - .sta_ps = mt76x2_sta_ps, 362 + .sta_ps = mt76x02_sta_ps, 363 + .sta_add = mt76x02_sta_add, 364 + .sta_remove = mt76x02_sta_remove, 326 365 }; 327 366 struct mt76x02_dev *dev; 328 367 struct mt76_dev *mdev; ··· 339 374 340 375 return dev; 341 376 } 342 - 343 - static void mt76x2_regd_notifier(struct wiphy *wiphy, 344 - struct regulatory_request *request) 345 - { 346 - struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); 347 - struct mt76x02_dev *dev = hw->priv; 348 - 349 - mt76x2_dfs_set_domain(dev, request->dfs_region); 350 - } 351 - 352 - static const struct ieee80211_iface_limit if_limits[] = { 353 - { 354 - .max = 1, 355 - .types = BIT(NL80211_IFTYPE_ADHOC) 356 - }, { 357 - .max = 8, 358 - .types = BIT(NL80211_IFTYPE_STATION) | 359 - #ifdef CONFIG_MAC80211_MESH 360 - BIT(NL80211_IFTYPE_MESH_POINT) | 361 - #endif 362 - BIT(NL80211_IFTYPE_AP) 363 - }, 364 - }; 365 - 366 - static const struct ieee80211_iface_combination if_comb[] = { 367 - { 368 - .limits = if_limits, 369 - .n_limits = ARRAY_SIZE(if_limits), 370 - .max_interfaces = 8, 371 - .num_different_channels = 1, 372 - .beacon_int_infra_match = true, 373 - .radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) | 374 - BIT(NL80211_CHAN_WIDTH_20) | 375 - BIT(NL80211_CHAN_WIDTH_40) | 376 - BIT(NL80211_CHAN_WIDTH_80), 377 - } 378 - }; 379 377 380 378 static void mt76x2_led_set_config(struct mt76_dev *mt76, u8 delay_on, 381 379 u8 delay_off) ··· 390 462 391 463 int mt76x2_register_device(struct mt76x02_dev *dev) 392 464 { 393 - struct ieee80211_hw *hw = mt76_hw(dev); 394 - struct wiphy *wiphy = hw->wiphy; 395 - int i, ret; 465 + int ret; 396 466 397 467 INIT_DELAYED_WORK(&dev->cal_work, mt76x2_phy_calibrate); 398 - INIT_DELAYED_WORK(&dev->mac_work, mt76x2_mac_work); 399 468 400 - mt76x2_init_device(dev); 469 + mt76x02_init_device(dev); 401 470 402 471 ret = mt76x2_init_hardware(dev); 403 472 if (ret) 404 473 return ret; 405 474 406 - for (i = 0; i < ARRAY_SIZE(dev->macaddr_list); i++) { 407 - u8 *addr = dev->macaddr_list[i].addr; 408 - 409 - memcpy(addr, dev->mt76.macaddr, ETH_ALEN); 410 - 411 - if (!i) 412 - continue; 413 - 414 - addr[0] |= BIT(1); 415 - addr[0] ^= ((i - 1) << 2); 416 - } 417 - wiphy->addresses = dev->macaddr_list; 418 - wiphy->n_addresses = ARRAY_SIZE(dev->macaddr_list); 419 - 420 - wiphy->iface_combinations = if_comb; 421 - wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); 422 - 423 - wiphy->reg_notifier = mt76x2_regd_notifier; 424 - 425 - wiphy->interface_modes = 426 - BIT(NL80211_IFTYPE_STATION) | 427 - BIT(NL80211_IFTYPE_AP) | 428 - #ifdef CONFIG_MAC80211_MESH 429 - BIT(NL80211_IFTYPE_MESH_POINT) | 430 - #endif 431 - BIT(NL80211_IFTYPE_ADHOC); 432 - 433 - wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_VHT_IBSS); 434 - 435 - mt76x2_dfs_init_detector(dev); 475 + mt76x02_config_mac_addr_list(dev); 436 476 437 477 /* init led callbacks */ 438 478 if (IS_ENABLED(CONFIG_MT76_LEDS)) { ··· 413 517 if (ret) 414 518 goto fail; 415 519 416 - mt76x2_init_debugfs(dev); 520 + mt76x02_init_debugfs(dev); 417 521 mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband); 418 522 mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband); 419 523
-203
drivers/net/wireless/mediatek/mt76/mt76x2/pci_mac.c
··· 1 - /* 2 - * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name> 3 - * 4 - * Permission to use, copy, modify, and/or distribute this software for any 5 - * purpose with or without fee is hereby granted, provided that the above 6 - * copyright notice and this permission notice appear in all copies. 7 - * 8 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 - */ 16 - 17 - #include <linux/delay.h> 18 - #include "mt76x2.h" 19 - #include "mcu.h" 20 - #include "eeprom.h" 21 - 22 - void mt76x2_mac_set_bssid(struct mt76x02_dev *dev, u8 idx, const u8 *addr) 23 - { 24 - idx &= 7; 25 - mt76_wr(dev, MT_MAC_APC_BSSID_L(idx), get_unaligned_le32(addr)); 26 - mt76_rmw_field(dev, MT_MAC_APC_BSSID_H(idx), MT_MAC_APC_BSSID_H_ADDR, 27 - get_unaligned_le16(addr + 4)); 28 - } 29 - 30 - static int 31 - mt76_write_beacon(struct mt76x02_dev *dev, int offset, struct sk_buff *skb) 32 - { 33 - int beacon_len = mt76x02_beacon_offsets[1] - mt76x02_beacon_offsets[0]; 34 - struct mt76x02_txwi txwi; 35 - 36 - if (WARN_ON_ONCE(beacon_len < skb->len + sizeof(struct mt76x02_txwi))) 37 - return -ENOSPC; 38 - 39 - mt76x02_mac_write_txwi(dev, &txwi, skb, NULL, NULL, skb->len); 40 - 41 - mt76_wr_copy(dev, offset, &txwi, sizeof(txwi)); 42 - offset += sizeof(txwi); 43 - 44 - mt76_wr_copy(dev, offset, skb->data, skb->len); 45 - return 0; 46 - } 47 - 48 - static int 49 - __mt76x2_mac_set_beacon(struct mt76x02_dev *dev, u8 bcn_idx, struct sk_buff *skb) 50 - { 51 - int beacon_len = mt76x02_beacon_offsets[1] - mt76x02_beacon_offsets[0]; 52 - int beacon_addr = mt76x02_beacon_offsets[bcn_idx]; 53 - int ret = 0; 54 - int i; 55 - 56 - /* Prevent corrupt transmissions during update */ 57 - mt76_set(dev, MT_BCN_BYPASS_MASK, BIT(bcn_idx)); 58 - 59 - if (skb) { 60 - ret = mt76_write_beacon(dev, beacon_addr, skb); 61 - if (!ret) 62 - dev->beacon_data_mask |= BIT(bcn_idx); 63 - } else { 64 - dev->beacon_data_mask &= ~BIT(bcn_idx); 65 - for (i = 0; i < beacon_len; i += 4) 66 - mt76_wr(dev, beacon_addr + i, 0); 67 - } 68 - 69 - mt76_wr(dev, MT_BCN_BYPASS_MASK, 0xff00 | ~dev->beacon_data_mask); 70 - 71 - return ret; 72 - } 73 - 74 - int mt76x2_mac_set_beacon(struct mt76x02_dev *dev, u8 vif_idx, 75 - struct sk_buff *skb) 76 - { 77 - bool force_update = false; 78 - int bcn_idx = 0; 79 - int i; 80 - 81 - for (i = 0; i < ARRAY_SIZE(dev->beacons); i++) { 82 - if (vif_idx == i) { 83 - force_update = !!dev->beacons[i] ^ !!skb; 84 - 85 - if (dev->beacons[i]) 86 - dev_kfree_skb(dev->beacons[i]); 87 - 88 - dev->beacons[i] = skb; 89 - __mt76x2_mac_set_beacon(dev, bcn_idx, skb); 90 - } else if (force_update && dev->beacons[i]) { 91 - __mt76x2_mac_set_beacon(dev, bcn_idx, dev->beacons[i]); 92 - } 93 - 94 - bcn_idx += !!dev->beacons[i]; 95 - } 96 - 97 - for (i = bcn_idx; i < ARRAY_SIZE(dev->beacons); i++) { 98 - if (!(dev->beacon_data_mask & BIT(i))) 99 - break; 100 - 101 - __mt76x2_mac_set_beacon(dev, i, NULL); 102 - } 103 - 104 - mt76_rmw_field(dev, MT_MAC_BSSID_DW1, MT_MAC_BSSID_DW1_MBEACON_N, 105 - bcn_idx - 1); 106 - return 0; 107 - } 108 - 109 - void mt76x2_mac_set_beacon_enable(struct mt76x02_dev *dev, 110 - u8 vif_idx, bool val) 111 - { 112 - u8 old_mask = dev->beacon_mask; 113 - bool en; 114 - u32 reg; 115 - 116 - if (val) { 117 - dev->beacon_mask |= BIT(vif_idx); 118 - } else { 119 - dev->beacon_mask &= ~BIT(vif_idx); 120 - mt76x2_mac_set_beacon(dev, vif_idx, NULL); 121 - } 122 - 123 - if (!!old_mask == !!dev->beacon_mask) 124 - return; 125 - 126 - en = dev->beacon_mask; 127 - 128 - mt76_rmw_field(dev, MT_INT_TIMER_EN, MT_INT_TIMER_EN_PRE_TBTT_EN, en); 129 - reg = MT_BEACON_TIME_CFG_BEACON_TX | 130 - MT_BEACON_TIME_CFG_TBTT_EN | 131 - MT_BEACON_TIME_CFG_TIMER_EN; 132 - mt76_rmw(dev, MT_BEACON_TIME_CFG, reg, reg * en); 133 - 134 - if (en) 135 - mt76x02_irq_enable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT); 136 - else 137 - mt76x02_irq_disable(dev, MT_INT_PRE_TBTT | MT_INT_TBTT); 138 - } 139 - 140 - void mt76x2_update_channel(struct mt76_dev *mdev) 141 - { 142 - struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 143 - struct mt76_channel_state *state; 144 - u32 active, busy; 145 - 146 - state = mt76_channel_state(&dev->mt76, dev->mt76.chandef.chan); 147 - 148 - busy = mt76_rr(dev, MT_CH_BUSY); 149 - active = busy + mt76_rr(dev, MT_CH_IDLE); 150 - 151 - spin_lock_bh(&dev->mt76.cc_lock); 152 - state->cc_busy += busy; 153 - state->cc_active += active; 154 - spin_unlock_bh(&dev->mt76.cc_lock); 155 - } 156 - 157 - void mt76x2_mac_work(struct work_struct *work) 158 - { 159 - struct mt76x02_dev *dev = container_of(work, struct mt76x02_dev, 160 - mac_work.work); 161 - int i, idx; 162 - 163 - mt76x2_update_channel(&dev->mt76); 164 - for (i = 0, idx = 0; i < 16; i++) { 165 - u32 val = mt76_rr(dev, MT_TX_AGG_CNT(i)); 166 - 167 - dev->aggr_stats[idx++] += val & 0xffff; 168 - dev->aggr_stats[idx++] += val >> 16; 169 - } 170 - 171 - ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work, 172 - MT_CALIBRATE_INTERVAL); 173 - } 174 - 175 - void mt76x2_mac_set_tx_protection(struct mt76x02_dev *dev, u32 val) 176 - { 177 - u32 data = 0; 178 - 179 - if (val != ~0) 180 - data = FIELD_PREP(MT_PROT_CFG_CTRL, 1) | 181 - MT_PROT_CFG_RTS_THRESH; 182 - 183 - mt76_rmw_field(dev, MT_TX_RTS_CFG, MT_TX_RTS_CFG_THRESH, val); 184 - 185 - mt76_rmw(dev, MT_CCK_PROT_CFG, 186 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 187 - mt76_rmw(dev, MT_OFDM_PROT_CFG, 188 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 189 - mt76_rmw(dev, MT_MM20_PROT_CFG, 190 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 191 - mt76_rmw(dev, MT_MM40_PROT_CFG, 192 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 193 - mt76_rmw(dev, MT_GF20_PROT_CFG, 194 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 195 - mt76_rmw(dev, MT_GF40_PROT_CFG, 196 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 197 - mt76_rmw(dev, MT_TX_PROT_CFG6, 198 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 199 - mt76_rmw(dev, MT_TX_PROT_CFG7, 200 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 201 - mt76_rmw(dev, MT_TX_PROT_CFG8, 202 - MT_PROT_CFG_CTRL | MT_PROT_CFG_RTS_THRESH, data); 203 - }
+8 -115
drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
··· 74 74 mt76_rr(dev, MT_CH_IDLE); 75 75 mt76_rr(dev, MT_CH_BUSY); 76 76 77 - mt76x2_dfs_init_params(dev); 77 + mt76x02_dfs_init_params(dev); 78 78 79 79 mt76x2_mac_resume(dev); 80 80 tasklet_enable(&dev->dfs_pd.dfs_tasklet); ··· 128 128 } 129 129 130 130 static void 131 - mt76x2_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 132 - struct ieee80211_bss_conf *info, u32 changed) 133 - { 134 - struct mt76x02_dev *dev = hw->priv; 135 - struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; 136 - 137 - mutex_lock(&dev->mt76.mutex); 138 - 139 - if (changed & BSS_CHANGED_BSSID) 140 - mt76x2_mac_set_bssid(dev, mvif->idx, info->bssid); 141 - 142 - if (changed & BSS_CHANGED_BEACON_INT) { 143 - mt76_rmw_field(dev, MT_BEACON_TIME_CFG, 144 - MT_BEACON_TIME_CFG_INTVAL, 145 - info->beacon_int << 4); 146 - dev->beacon_int = info->beacon_int; 147 - dev->tbtt_count = 0; 148 - } 149 - 150 - if (changed & BSS_CHANGED_BEACON_ENABLED) { 151 - tasklet_disable(&dev->pre_tbtt_tasklet); 152 - mt76x2_mac_set_beacon_enable(dev, mvif->idx, 153 - info->enable_beacon); 154 - tasklet_enable(&dev->pre_tbtt_tasklet); 155 - } 156 - 157 - if (changed & BSS_CHANGED_ERP_SLOT) { 158 - int slottime = info->use_short_slot ? 9 : 20; 159 - 160 - dev->slottime = slottime; 161 - mt76x2_set_tx_ackto(dev); 162 - } 163 - 164 - mutex_unlock(&dev->mt76.mutex); 165 - } 166 - 167 - void 168 - mt76x2_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps) 169 - { 170 - struct mt76x02_sta *msta = (struct mt76x02_sta *) sta->drv_priv; 171 - struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); 172 - int idx = msta->wcid.idx; 173 - 174 - mt76_stop_tx_queues(&dev->mt76, sta, true); 175 - mt76x02_mac_wcid_set_drop(dev, idx, ps); 176 - } 177 - 178 - static void 179 - mt76x2_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 180 - const u8 *mac) 181 - { 182 - struct mt76x02_dev *dev = hw->priv; 183 - 184 - tasklet_disable(&dev->pre_tbtt_tasklet); 185 - set_bit(MT76_SCANNING, &dev->mt76.state); 186 - } 187 - 188 - static void 189 - mt76x2_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 190 - { 191 - struct mt76x02_dev *dev = hw->priv; 192 - 193 - clear_bit(MT76_SCANNING, &dev->mt76.state); 194 - tasklet_enable(&dev->pre_tbtt_tasklet); 195 - } 196 - 197 - static void 198 131 mt76x2_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 199 132 u32 queues, bool drop) 200 133 { 201 - } 202 - 203 - static int 204 - mt76x2_get_txpower(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int *dbm) 205 - { 206 - struct mt76x02_dev *dev = hw->priv; 207 - 208 - *dbm = dev->mt76.txpower_cur / 2; 209 - 210 - /* convert from per-chain power to combined output on 2x2 devices */ 211 - *dbm += 3; 212 - 213 - return 0; 214 - } 215 - 216 - static void mt76x2_set_coverage_class(struct ieee80211_hw *hw, 217 - s16 coverage_class) 218 - { 219 - struct mt76x02_dev *dev = hw->priv; 220 - 221 - mutex_lock(&dev->mt76.mutex); 222 - dev->coverage_class = coverage_class; 223 - mt76x2_set_tx_ackto(dev); 224 - mutex_unlock(&dev->mt76.mutex); 225 134 } 226 135 227 136 static int ··· 173 264 return 0; 174 265 } 175 266 176 - static int 177 - mt76x2_set_rts_threshold(struct ieee80211_hw *hw, u32 val) 178 - { 179 - struct mt76x02_dev *dev = hw->priv; 180 - 181 - if (val != ~0 && val > 0xffff) 182 - return -EINVAL; 183 - 184 - mutex_lock(&dev->mt76.mutex); 185 - mt76x2_mac_set_tx_protection(dev, val); 186 - mutex_unlock(&dev->mt76.mutex); 187 - 188 - return 0; 189 - } 190 - 191 267 const struct ieee80211_ops mt76x2_ops = { 192 268 .tx = mt76x02_tx, 193 269 .start = mt76x2_start, ··· 181 287 .remove_interface = mt76x02_remove_interface, 182 288 .config = mt76x2_config, 183 289 .configure_filter = mt76x02_configure_filter, 184 - .bss_info_changed = mt76x2_bss_info_changed, 185 - .sta_add = mt76x02_sta_add, 186 - .sta_remove = mt76x02_sta_remove, 290 + .bss_info_changed = mt76x02_bss_info_changed, 291 + .sta_state = mt76_sta_state, 187 292 .set_key = mt76x02_set_key, 188 293 .conf_tx = mt76x02_conf_tx, 189 - .sw_scan_start = mt76x2_sw_scan, 190 - .sw_scan_complete = mt76x2_sw_scan_complete, 294 + .sw_scan_start = mt76x02_sw_scan, 295 + .sw_scan_complete = mt76x02_sw_scan_complete, 191 296 .flush = mt76x2_flush, 192 297 .ampdu_action = mt76x02_ampdu_action, 193 - .get_txpower = mt76x2_get_txpower, 298 + .get_txpower = mt76x02_get_txpower, 194 299 .wake_tx_queue = mt76_wake_tx_queue, 195 300 .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, 196 301 .release_buffered_frames = mt76_release_buffered_frames, 197 - .set_coverage_class = mt76x2_set_coverage_class, 302 + .set_coverage_class = mt76x02_set_coverage_class, 198 303 .get_survey = mt76_get_survey, 199 304 .set_tim = mt76x2_set_tim, 200 305 .set_antenna = mt76x2_set_antenna, 201 306 .get_antenna = mt76x2_get_antenna, 202 - .set_rts_threshold = mt76x2_set_rts_threshold, 307 + .set_rts_threshold = mt76x02_set_rts_threshold, 203 308 }; 204 309
+1 -2
drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c
··· 168 168 int mt76x2_mcu_init(struct mt76x02_dev *dev) 169 169 { 170 170 static const struct mt76_mcu_ops mt76x2_mcu_ops = { 171 - .mcu_msg_alloc = mt76x02_mcu_msg_alloc, 172 171 .mcu_send_msg = mt76x02_mcu_msg_send, 173 172 }; 174 173 int ret; ··· 182 183 if (ret) 183 184 return ret; 184 185 185 - mt76x02_mcu_function_select(dev, Q_SELECT, 1, true); 186 + mt76x02_mcu_function_select(dev, Q_SELECT, 1); 186 187 return 0; 187 188 }
+12 -102
drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
··· 38 38 if (mt76x02_ext_pa_enabled(dev, chan->band)) 39 39 flag |= BIT(8); 40 40 41 - mt76x02_mcu_calibrate(dev, MCU_CAL_TSSI, flag, true); 41 + mt76x02_mcu_calibrate(dev, MCU_CAL_TSSI, flag); 42 42 dev->cal.tssi_cal_done = true; 43 43 return true; 44 44 } ··· 62 62 mt76x2_mac_stop(dev, false); 63 63 64 64 if (is_5ghz) 65 - mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 0, true); 65 + mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 0); 66 66 67 - mt76x02_mcu_calibrate(dev, MCU_CAL_TX_LOFT, is_5ghz, true); 68 - mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz, true); 69 - mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQC_FI, is_5ghz, true); 70 - mt76x02_mcu_calibrate(dev, MCU_CAL_TEMP_SENSOR, 0, true); 71 - mt76x02_mcu_calibrate(dev, MCU_CAL_TX_SHAPING, 0, true); 67 + mt76x02_mcu_calibrate(dev, MCU_CAL_TX_LOFT, is_5ghz); 68 + mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz); 69 + mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQC_FI, is_5ghz); 70 + mt76x02_mcu_calibrate(dev, MCU_CAL_TEMP_SENSOR, 0); 71 + mt76x02_mcu_calibrate(dev, MCU_CAL_TX_SHAPING, 0); 72 72 73 73 if (!mac_stopped) 74 74 mt76x2_mac_resume(dev); ··· 122 122 break; 123 123 } 124 124 mt76_wr(dev, MT_BBP(AGC, 0), val); 125 - } 126 - 127 - static void 128 - mt76x2_phy_set_gain_val(struct mt76x02_dev *dev) 129 - { 130 - u32 val; 131 - u8 gain_val[2]; 132 - 133 - gain_val[0] = dev->cal.agc_gain_cur[0] - dev->cal.agc_gain_adjust; 134 - gain_val[1] = dev->cal.agc_gain_cur[1] - dev->cal.agc_gain_adjust; 135 - 136 - if (dev->mt76.chandef.width >= NL80211_CHAN_WIDTH_40) 137 - val = 0x1e42 << 16; 138 - else 139 - val = 0x1836 << 16; 140 - 141 - val |= 0xf8; 142 - 143 - mt76_wr(dev, MT_BBP(AGC, 8), 144 - val | FIELD_PREP(MT_BBP_AGC_GAIN, gain_val[0])); 145 - mt76_wr(dev, MT_BBP(AGC, 9), 146 - val | FIELD_PREP(MT_BBP_AGC_GAIN, gain_val[1])); 147 - 148 - if (dev->mt76.chandef.chan->flags & IEEE80211_CHAN_RADAR) 149 - mt76x2_dfs_adjust_agc(dev); 150 - } 151 - 152 - static void 153 - mt76x2_phy_update_channel_gain(struct mt76x02_dev *dev) 154 - { 155 - u8 *gain = dev->cal.agc_gain_init; 156 - u8 low_gain_delta, gain_delta; 157 - bool gain_change; 158 - int low_gain; 159 - u32 val; 160 - 161 - dev->cal.avg_rssi_all = mt76x02_phy_get_min_avg_rssi(dev); 162 - 163 - low_gain = (dev->cal.avg_rssi_all > mt76x02_get_rssi_gain_thresh(dev)) + 164 - (dev->cal.avg_rssi_all > mt76x02_get_low_rssi_gain_thresh(dev)); 165 - 166 - gain_change = (dev->cal.low_gain & 2) ^ (low_gain & 2); 167 - dev->cal.low_gain = low_gain; 168 - 169 - if (!gain_change) { 170 - if (mt76x02_phy_adjust_vga_gain(dev)) 171 - mt76x2_phy_set_gain_val(dev); 172 - return; 173 - } 174 - 175 - if (dev->mt76.chandef.width == NL80211_CHAN_WIDTH_80) { 176 - mt76_wr(dev, MT_BBP(RXO, 14), 0x00560211); 177 - val = mt76_rr(dev, MT_BBP(AGC, 26)) & ~0xf; 178 - if (low_gain == 2) 179 - val |= 0x3; 180 - else 181 - val |= 0x5; 182 - mt76_wr(dev, MT_BBP(AGC, 26), val); 183 - } else { 184 - mt76_wr(dev, MT_BBP(RXO, 14), 0x00560423); 185 - } 186 - 187 - if (mt76x2_has_ext_lna(dev)) 188 - low_gain_delta = 10; 189 - else 190 - low_gain_delta = 14; 191 - 192 - if (low_gain == 2) { 193 - mt76_wr(dev, MT_BBP(RXO, 18), 0xf000a990); 194 - mt76_wr(dev, MT_BBP(AGC, 35), 0x08080808); 195 - mt76_wr(dev, MT_BBP(AGC, 37), 0x08080808); 196 - gain_delta = low_gain_delta; 197 - dev->cal.agc_gain_adjust = 0; 198 - } else { 199 - mt76_wr(dev, MT_BBP(RXO, 18), 0xf000a991); 200 - if (dev->mt76.chandef.width == NL80211_CHAN_WIDTH_80) 201 - mt76_wr(dev, MT_BBP(AGC, 35), 0x10101014); 202 - else 203 - mt76_wr(dev, MT_BBP(AGC, 35), 0x11111116); 204 - mt76_wr(dev, MT_BBP(AGC, 37), 0x2121262C); 205 - gain_delta = 0; 206 - dev->cal.agc_gain_adjust = low_gain_delta; 207 - } 208 - 209 - dev->cal.agc_gain_cur[0] = gain[0] - gain_delta; 210 - dev->cal.agc_gain_cur[1] = gain[1] - gain_delta; 211 - mt76x2_phy_set_gain_val(dev); 212 - 213 - /* clear false CCA counters */ 214 - mt76_rr(dev, MT_RX_STAT_1); 215 125 } 216 126 217 127 int mt76x2_phy_set_channel(struct mt76x02_dev *dev, ··· 223 313 u8 val = mt76x02_eeprom_get(dev, MT_EE_BT_RCAL_RESULT); 224 314 225 315 if (val != 0xff) 226 - mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0, true); 316 + mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0); 227 317 } 228 318 229 - mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, channel, true); 319 + mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, channel); 230 320 231 321 /* Rx LPF calibration */ 232 322 if (!dev->cal.init_cal_done) 233 - mt76x02_mcu_calibrate(dev, MCU_CAL_RC, 0, true); 323 + mt76x02_mcu_calibrate(dev, MCU_CAL_RC, 0); 234 324 235 325 dev->cal.init_cal_done = true; 236 326 ··· 294 384 295 385 dev = container_of(work, struct mt76x02_dev, cal_work.work); 296 386 mt76x2_phy_channel_calibrate(dev, false); 297 - mt76x2_phy_tssi_compensate(dev, true); 387 + mt76x2_phy_tssi_compensate(dev); 298 388 mt76x2_phy_temp_compensate(dev); 299 389 mt76x2_phy_update_channel_gain(dev); 300 390 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work, ··· 305 395 { 306 396 int ret; 307 397 308 - ret = mt76x02_mcu_set_radio_state(dev, true, true); 398 + ret = mt76x02_mcu_set_radio_state(dev, true); 309 399 if (ret) 310 400 return ret; 311 401
-142
drivers/net/wireless/mediatek/mt76/mt76x2/pci_tx.c
··· 1 - /* 2 - * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name> 3 - * 4 - * Permission to use, copy, modify, and/or distribute this software for any 5 - * purpose with or without fee is hereby granted, provided that the above 6 - * copyright notice and this permission notice appear in all copies. 7 - * 8 - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 - */ 16 - 17 - #include "mt76x2.h" 18 - 19 - struct beacon_bc_data { 20 - struct mt76x02_dev *dev; 21 - struct sk_buff_head q; 22 - struct sk_buff *tail[8]; 23 - }; 24 - 25 - static void 26 - mt76x2_update_beacon_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) 27 - { 28 - struct mt76x02_dev *dev = (struct mt76x02_dev *) priv; 29 - struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; 30 - struct sk_buff *skb = NULL; 31 - 32 - if (!(dev->beacon_mask & BIT(mvif->idx))) 33 - return; 34 - 35 - skb = ieee80211_beacon_get(mt76_hw(dev), vif); 36 - if (!skb) 37 - return; 38 - 39 - mt76x2_mac_set_beacon(dev, mvif->idx, skb); 40 - } 41 - 42 - static void 43 - mt76x2_add_buffered_bc(void *priv, u8 *mac, struct ieee80211_vif *vif) 44 - { 45 - struct beacon_bc_data *data = priv; 46 - struct mt76x02_dev *dev = data->dev; 47 - struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; 48 - struct ieee80211_tx_info *info; 49 - struct sk_buff *skb; 50 - 51 - if (!(dev->beacon_mask & BIT(mvif->idx))) 52 - return; 53 - 54 - skb = ieee80211_get_buffered_bc(mt76_hw(dev), vif); 55 - if (!skb) 56 - return; 57 - 58 - info = IEEE80211_SKB_CB(skb); 59 - info->control.vif = vif; 60 - info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; 61 - mt76_skb_set_moredata(skb, true); 62 - __skb_queue_tail(&data->q, skb); 63 - data->tail[mvif->idx] = skb; 64 - } 65 - 66 - static void 67 - mt76x2_resync_beacon_timer(struct mt76x02_dev *dev) 68 - { 69 - u32 timer_val = dev->beacon_int << 4; 70 - 71 - dev->tbtt_count++; 72 - 73 - /* 74 - * Beacon timer drifts by 1us every tick, the timer is configured 75 - * in 1/16 TU (64us) units. 76 - */ 77 - if (dev->tbtt_count < 62) 78 - return; 79 - 80 - if (dev->tbtt_count >= 64) { 81 - dev->tbtt_count = 0; 82 - return; 83 - } 84 - 85 - /* 86 - * The updated beacon interval takes effect after two TBTT, because 87 - * at this point the original interval has already been loaded into 88 - * the next TBTT_TIMER value 89 - */ 90 - if (dev->tbtt_count == 62) 91 - timer_val -= 1; 92 - 93 - mt76_rmw_field(dev, MT_BEACON_TIME_CFG, 94 - MT_BEACON_TIME_CFG_INTVAL, timer_val); 95 - } 96 - 97 - void mt76x2_pre_tbtt_tasklet(unsigned long arg) 98 - { 99 - struct mt76x02_dev *dev = (struct mt76x02_dev *) arg; 100 - struct mt76_queue *q = &dev->mt76.q_tx[MT_TXQ_PSD]; 101 - struct beacon_bc_data data = {}; 102 - struct sk_buff *skb; 103 - int i, nframes; 104 - 105 - mt76x2_resync_beacon_timer(dev); 106 - 107 - data.dev = dev; 108 - __skb_queue_head_init(&data.q); 109 - 110 - ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev), 111 - IEEE80211_IFACE_ITER_RESUME_ALL, 112 - mt76x2_update_beacon_iter, dev); 113 - 114 - do { 115 - nframes = skb_queue_len(&data.q); 116 - ieee80211_iterate_active_interfaces_atomic(mt76_hw(dev), 117 - IEEE80211_IFACE_ITER_RESUME_ALL, 118 - mt76x2_add_buffered_bc, &data); 119 - } while (nframes != skb_queue_len(&data.q)); 120 - 121 - if (!nframes) 122 - return; 123 - 124 - for (i = 0; i < ARRAY_SIZE(data.tail); i++) { 125 - if (!data.tail[i]) 126 - continue; 127 - 128 - mt76_skb_set_moredata(data.tail[i], false); 129 - } 130 - 131 - spin_lock_bh(&q->lock); 132 - while ((skb = __skb_dequeue(&data.q)) != NULL) { 133 - struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 134 - struct ieee80211_vif *vif = info->control.vif; 135 - struct mt76x02_vif *mvif = (struct mt76x02_vif *) vif->drv_priv; 136 - 137 - mt76_dma_tx_queue_skb(&dev->mt76, q, skb, &mvif->group_wcid, 138 - NULL); 139 - } 140 - spin_unlock_bh(&q->lock); 141 - } 142 -
+93 -2
drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
··· 210 210 } 211 211 EXPORT_SYMBOL_GPL(mt76x2_configure_tx_delay); 212 212 213 - void mt76x2_phy_tssi_compensate(struct mt76x02_dev *dev, bool wait) 213 + void mt76x2_phy_tssi_compensate(struct mt76x02_dev *dev) 214 214 { 215 215 struct ieee80211_channel *chan = dev->mt76.chandef.chan; 216 216 struct mt76x2_tx_power_info txp; ··· 245 245 return; 246 246 247 247 usleep_range(10000, 20000); 248 - mt76x02_mcu_calibrate(dev, MCU_CAL_DPD, chan->hw_value, wait); 248 + mt76x02_mcu_calibrate(dev, MCU_CAL_DPD, chan->hw_value); 249 249 dev->cal.dpd_cal_done = true; 250 250 } 251 251 } 252 252 EXPORT_SYMBOL_GPL(mt76x2_phy_tssi_compensate); 253 + 254 + static void 255 + mt76x2_phy_set_gain_val(struct mt76x02_dev *dev) 256 + { 257 + u32 val; 258 + u8 gain_val[2]; 259 + 260 + gain_val[0] = dev->cal.agc_gain_cur[0] - dev->cal.agc_gain_adjust; 261 + gain_val[1] = dev->cal.agc_gain_cur[1] - dev->cal.agc_gain_adjust; 262 + 263 + if (dev->mt76.chandef.width >= NL80211_CHAN_WIDTH_40) 264 + val = 0x1e42 << 16; 265 + else 266 + val = 0x1836 << 16; 267 + 268 + val |= 0xf8; 269 + 270 + mt76_wr(dev, MT_BBP(AGC, 8), 271 + val | FIELD_PREP(MT_BBP_AGC_GAIN, gain_val[0])); 272 + mt76_wr(dev, MT_BBP(AGC, 9), 273 + val | FIELD_PREP(MT_BBP_AGC_GAIN, gain_val[1])); 274 + 275 + if (dev->mt76.chandef.chan->flags & IEEE80211_CHAN_RADAR) 276 + mt76x02_phy_dfs_adjust_agc(dev); 277 + } 278 + 279 + void mt76x2_phy_update_channel_gain(struct mt76x02_dev *dev) 280 + { 281 + u8 *gain = dev->cal.agc_gain_init; 282 + u8 low_gain_delta, gain_delta; 283 + bool gain_change; 284 + int low_gain; 285 + u32 val; 286 + 287 + dev->cal.avg_rssi_all = mt76x02_phy_get_min_avg_rssi(dev); 288 + 289 + low_gain = (dev->cal.avg_rssi_all > mt76x02_get_rssi_gain_thresh(dev)) + 290 + (dev->cal.avg_rssi_all > mt76x02_get_low_rssi_gain_thresh(dev)); 291 + 292 + gain_change = dev->cal.low_gain < 0 || 293 + (dev->cal.low_gain & 2) ^ (low_gain & 2); 294 + dev->cal.low_gain = low_gain; 295 + 296 + if (!gain_change) { 297 + if (mt76x02_phy_adjust_vga_gain(dev)) 298 + mt76x2_phy_set_gain_val(dev); 299 + return; 300 + } 301 + 302 + if (dev->mt76.chandef.width == NL80211_CHAN_WIDTH_80) { 303 + mt76_wr(dev, MT_BBP(RXO, 14), 0x00560211); 304 + val = mt76_rr(dev, MT_BBP(AGC, 26)) & ~0xf; 305 + if (low_gain == 2) 306 + val |= 0x3; 307 + else 308 + val |= 0x5; 309 + mt76_wr(dev, MT_BBP(AGC, 26), val); 310 + } else { 311 + mt76_wr(dev, MT_BBP(RXO, 14), 0x00560423); 312 + } 313 + 314 + if (mt76x2_has_ext_lna(dev)) 315 + low_gain_delta = 10; 316 + else 317 + low_gain_delta = 14; 318 + 319 + if (low_gain == 2) { 320 + mt76_wr(dev, MT_BBP(RXO, 18), 0xf000a990); 321 + mt76_wr(dev, MT_BBP(AGC, 35), 0x08080808); 322 + mt76_wr(dev, MT_BBP(AGC, 37), 0x08080808); 323 + gain_delta = low_gain_delta; 324 + dev->cal.agc_gain_adjust = 0; 325 + } else { 326 + mt76_wr(dev, MT_BBP(RXO, 18), 0xf000a991); 327 + if (dev->mt76.chandef.width == NL80211_CHAN_WIDTH_80) 328 + mt76_wr(dev, MT_BBP(AGC, 35), 0x10101014); 329 + else 330 + mt76_wr(dev, MT_BBP(AGC, 35), 0x11111116); 331 + mt76_wr(dev, MT_BBP(AGC, 37), 0x2121262C); 332 + gain_delta = 0; 333 + dev->cal.agc_gain_adjust = low_gain_delta; 334 + } 335 + 336 + dev->cal.agc_gain_cur[0] = gain[0] - gain_delta; 337 + dev->cal.agc_gain_cur[1] = gain[1] - gain_delta; 338 + mt76x2_phy_set_gain_val(dev); 339 + 340 + /* clear false CCA counters */ 341 + mt76_rr(dev, MT_RX_STAT_1); 342 + } 343 + EXPORT_SYMBOL_GPL(mt76x2_phy_update_channel_gain);
+2 -2
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
··· 131 131 } 132 132 133 133 MODULE_DEVICE_TABLE(usb, mt76x2u_device_table); 134 - MODULE_FIRMWARE(MT7662U_FIRMWARE); 135 - MODULE_FIRMWARE(MT7662U_ROM_PATCH); 134 + MODULE_FIRMWARE(MT7662_FIRMWARE); 135 + MODULE_FIRMWARE(MT7662_ROM_PATCH); 136 136 137 137 static struct usb_driver mt76x2u_driver = { 138 138 .name = KBUILD_MODNAME,
+13 -31
drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
··· 141 141 .tx_complete_skb = mt76x02u_tx_complete_skb, 142 142 .tx_status_data = mt76x02_tx_status_data, 143 143 .rx_skb = mt76x02_queue_rx_skb, 144 + .sta_add = mt76x02_sta_add, 145 + .sta_remove = mt76x02_sta_remove, 144 146 }; 145 147 struct mt76x02_dev *dev; 146 148 struct mt76_dev *mdev; ··· 158 156 return dev; 159 157 } 160 158 161 - static void mt76x2u_init_beacon_offsets(struct mt76x02_dev *dev) 162 - { 163 - mt76_wr(dev, MT_BCN_OFFSET(0), 0x18100800); 164 - mt76_wr(dev, MT_BCN_OFFSET(1), 0x38302820); 165 - mt76_wr(dev, MT_BCN_OFFSET(2), 0x58504840); 166 - mt76_wr(dev, MT_BCN_OFFSET(3), 0x78706860); 167 - } 168 - 169 159 int mt76x2u_init_hardware(struct mt76x02_dev *dev) 170 160 { 171 - const struct mt76_wcid_addr addr = { 172 - .macaddr = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, 173 - .ba_mask = 0, 174 - }; 175 - int i, err; 161 + int i, k, err; 176 162 177 163 mt76x2_reset_wlan(dev, true); 178 164 mt76x2u_power_on(dev); ··· 181 191 if (!mt76x02_wait_for_mac(&dev->mt76)) 182 192 return -ETIMEDOUT; 183 193 184 - mt76_wr(dev, MT_HEADER_TRANS_CTRL_REG, 0); 185 - mt76_wr(dev, MT_TSO_CTRL, 0); 186 - 187 194 mt76x2u_init_dma(dev); 188 195 189 196 err = mt76x2u_mcu_init(dev); ··· 194 207 mt76x02_mac_setaddr(dev, dev->mt76.eeprom.data + MT_EE_MAC_ADDR); 195 208 dev->mt76.rxfilter = mt76_rr(dev, MT_RX_FILTR_CFG); 196 209 197 - mt76x2u_init_beacon_offsets(dev); 198 - 199 210 if (!mt76x02_wait_for_txrx_idle(&dev->mt76)) 200 211 return -ETIMEDOUT; 201 212 202 213 /* reset wcid table */ 203 - for (i = 0; i < 254; i++) 204 - mt76_wr_copy(dev, MT_WCID_ADDR(i), &addr, 205 - sizeof(struct mt76_wcid_addr)); 214 + for (i = 0; i < 256; i++) 215 + mt76x02_mac_wcid_setup(dev, i, 0, NULL); 206 216 207 217 /* reset shared key table and pairwise key table */ 208 - for (i = 0; i < 4; i++) 209 - mt76_wr(dev, MT_SKEY_MODE_BASE_0 + 4 * i, 0); 210 - for (i = 0; i < 256; i++) 211 - mt76_wr(dev, MT_WCID_ATTR(i), 1); 218 + for (i = 0; i < 16; i++) { 219 + for (k = 0; k < 4; k++) 220 + mt76x02_mac_shared_key_setup(dev, i, k, NULL); 221 + } 212 222 213 223 mt76_clear(dev, MT_BEACON_TIME_CFG, 214 224 MT_BEACON_TIME_CFG_TIMER_EN | ··· 229 245 int mt76x2u_register_device(struct mt76x02_dev *dev) 230 246 { 231 247 struct ieee80211_hw *hw = mt76_hw(dev); 232 - struct wiphy *wiphy = hw->wiphy; 233 248 int err; 234 249 235 250 INIT_DELAYED_WORK(&dev->cal_work, mt76x2u_phy_calibrate); 236 - mt76x2_init_device(dev); 251 + mt76x02_init_device(dev); 237 252 238 253 err = mt76x2u_init_eeprom(dev); 239 254 if (err < 0) ··· 250 267 if (err < 0) 251 268 goto fail; 252 269 253 - wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 254 - 255 270 err = mt76_register_device(&dev->mt76, true, mt76x02_rates, 256 271 ARRAY_SIZE(mt76x02_rates)); 257 272 if (err) ··· 263 282 264 283 set_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); 265 284 266 - mt76x2_init_debugfs(dev); 285 + mt76x02_init_debugfs(dev); 267 286 mt76x2_init_txpower(dev, &dev->mt76.sband_2g.sband); 268 287 mt76x2_init_txpower(dev, &dev->mt76.sband_5g.sband); 269 288 ··· 278 297 { 279 298 mt76u_stop_stat_wk(&dev->mt76); 280 299 cancel_delayed_work_sync(&dev->cal_work); 300 + cancel_delayed_work_sync(&dev->mac_work); 281 301 mt76x2u_mac_stop(dev); 282 302 } 283 303 284 304 void mt76x2u_cleanup(struct mt76x02_dev *dev) 285 305 { 286 - mt76x02_mcu_set_radio_state(dev, false, false); 306 + mt76x02_mcu_set_radio_state(dev, false); 287 307 mt76x2u_stop_hw(dev); 288 308 mt76u_queues_deinit(&dev->mt76); 289 309 mt76u_mcu_deinit(&dev->mt76);
+9 -46
drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c
··· 27 27 if (ret) 28 28 goto out; 29 29 30 + ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mac_work, 31 + MT_CALIBRATE_INTERVAL); 30 32 set_bit(MT76_STATE_RUNNING, &dev->mt76.state); 31 33 32 34 out: ··· 50 48 struct ieee80211_vif *vif) 51 49 { 52 50 struct mt76x02_dev *dev = hw->priv; 51 + unsigned int idx = 8; 53 52 54 53 if (!ether_addr_equal(dev->mt76.macaddr, vif->addr)) 55 54 mt76x02_mac_setaddr(dev, vif->addr); 56 55 57 - mt76x02_vif_init(dev, vif, 0); 56 + mt76x02_vif_init(dev, vif, idx); 58 57 return 0; 59 58 } 60 59 ··· 82 79 mt76_txq_schedule_all(&dev->mt76); 83 80 84 81 return err; 85 - } 86 - 87 - static void 88 - mt76x2u_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 89 - struct ieee80211_bss_conf *info, u32 changed) 90 - { 91 - struct mt76x02_dev *dev = hw->priv; 92 - 93 - mutex_lock(&dev->mt76.mutex); 94 - 95 - if (changed & BSS_CHANGED_ASSOC) { 96 - mt76x2u_phy_channel_calibrate(dev); 97 - mt76x2_apply_gain_adj(dev); 98 - } 99 - 100 - if (changed & BSS_CHANGED_BSSID) { 101 - mt76_wr(dev, MT_MAC_BSSID_DW0, 102 - get_unaligned_le32(info->bssid)); 103 - mt76_wr(dev, MT_MAC_BSSID_DW1, 104 - get_unaligned_le16(info->bssid + 4)); 105 - } 106 - 107 - mutex_unlock(&dev->mt76.mutex); 108 82 } 109 83 110 84 static int ··· 121 141 return err; 122 142 } 123 143 124 - static void 125 - mt76x2u_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 126 - const u8 *mac) 127 - { 128 - struct mt76x02_dev *dev = hw->priv; 129 - 130 - set_bit(MT76_SCANNING, &dev->mt76.state); 131 - } 132 - 133 - static void 134 - mt76x2u_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 135 - { 136 - struct mt76x02_dev *dev = hw->priv; 137 - 138 - clear_bit(MT76_SCANNING, &dev->mt76.state); 139 - } 140 - 141 144 const struct ieee80211_ops mt76x2u_ops = { 142 145 .tx = mt76x02_tx, 143 146 .start = mt76x2u_start, 144 147 .stop = mt76x2u_stop, 145 148 .add_interface = mt76x2u_add_interface, 146 149 .remove_interface = mt76x02_remove_interface, 147 - .sta_add = mt76x02_sta_add, 148 - .sta_remove = mt76x02_sta_remove, 150 + .sta_state = mt76_sta_state, 149 151 .set_key = mt76x02_set_key, 150 152 .ampdu_action = mt76x02_ampdu_action, 151 153 .config = mt76x2u_config, 152 154 .wake_tx_queue = mt76_wake_tx_queue, 153 - .bss_info_changed = mt76x2u_bss_info_changed, 155 + .bss_info_changed = mt76x02_bss_info_changed, 154 156 .configure_filter = mt76x02_configure_filter, 155 157 .conf_tx = mt76x02_conf_tx, 156 - .sw_scan_start = mt76x2u_sw_scan, 157 - .sw_scan_complete = mt76x2u_sw_scan_complete, 158 + .sw_scan_start = mt76x02_sw_scan, 159 + .sw_scan_complete = mt76x02_sw_scan_complete, 158 160 .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update, 161 + .get_txpower = mt76x02_get_txpower, 159 162 };
+4 -28
drivers/net/wireless/mediatek/mt76/mt76x2/usb_mcu.c
··· 29 29 #define MT76U_MCU_DLM_OFFSET 0x110000 30 30 #define MT76U_MCU_ROM_PATCH_OFFSET 0x90000 31 31 32 - int mt76x2u_mcu_set_dynamic_vga(struct mt76x02_dev *dev, u8 channel, bool ap, 33 - bool ext, int rssi, u32 false_cca) 34 - { 35 - struct { 36 - __le32 channel; 37 - __le32 rssi_val; 38 - __le32 false_cca_val; 39 - } __packed __aligned(4) msg = { 40 - .rssi_val = cpu_to_le32(rssi), 41 - .false_cca_val = cpu_to_le32(false_cca), 42 - }; 43 - struct sk_buff *skb; 44 - u32 val = channel; 45 - 46 - if (ap) 47 - val |= BIT(31); 48 - if (ext) 49 - val |= BIT(30); 50 - msg.channel = cpu_to_le32(val); 51 - 52 - skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg)); 53 - return mt76_mcu_send_msg(dev, skb, CMD_DYNC_VGA_OP, true); 54 - } 55 - 56 32 static void mt76x2u_mcu_load_ivb(struct mt76x02_dev *dev) 57 33 { 58 34 mt76u_vendor_request(&dev->mt76, MT_VEND_DEV_MODE, ··· 93 117 return 0; 94 118 } 95 119 96 - err = request_firmware(&fw, MT7662U_ROM_PATCH, dev->mt76.dev); 120 + err = request_firmware(&fw, MT7662_ROM_PATCH, dev->mt76.dev); 97 121 if (err < 0) 98 122 return err; 99 123 ··· 159 183 int err, len, ilm_len, dlm_len; 160 184 const struct firmware *fw; 161 185 162 - err = request_firmware(&fw, MT7662U_FIRMWARE, dev->mt76.dev); 186 + err = request_firmware(&fw, MT7662_FIRMWARE, dev->mt76.dev); 163 187 if (err < 0) 164 188 return err; 165 189 ··· 258 282 { 259 283 int err; 260 284 261 - err = mt76x02_mcu_function_select(dev, Q_SELECT, 1, false); 285 + err = mt76x02_mcu_function_select(dev, Q_SELECT, 1); 262 286 if (err < 0) 263 287 return err; 264 288 265 - return mt76x02_mcu_set_radio_state(dev, true, false); 289 + return mt76x02_mcu_set_radio_state(dev, true); 266 290 }
+27 -51
drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c
··· 18 18 #include "eeprom.h" 19 19 #include "../mt76x02_phy.h" 20 20 21 - void mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev) 21 + static void 22 + mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped) 22 23 { 23 24 struct ieee80211_channel *chan = dev->mt76.chandef.chan; 24 25 bool is_5ghz = chan->band == NL80211_BAND_5GHZ; 25 26 27 + if (dev->cal.channel_cal_done) 28 + return; 29 + 26 30 if (mt76x2_channel_silent(dev)) 27 31 return; 28 32 29 - mt76x2u_mac_stop(dev); 33 + if (!mac_stopped) 34 + mt76x2u_mac_stop(dev); 30 35 31 36 if (is_5ghz) 32 - mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 0, false); 37 + mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 0); 33 38 34 - mt76x02_mcu_calibrate(dev, MCU_CAL_TX_LOFT, is_5ghz, false); 35 - mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz, false); 36 - mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQC_FI, is_5ghz, false); 37 - mt76x02_mcu_calibrate(dev, MCU_CAL_TEMP_SENSOR, 0, false); 39 + mt76x02_mcu_calibrate(dev, MCU_CAL_TX_LOFT, is_5ghz); 40 + mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz); 41 + mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQC_FI, is_5ghz); 42 + mt76x02_mcu_calibrate(dev, MCU_CAL_TEMP_SENSOR, 0); 43 + mt76x02_mcu_calibrate(dev, MCU_CAL_TX_SHAPING, 0); 38 44 39 - mt76x2u_mac_resume(dev); 40 - } 45 + if (!mac_stopped) 46 + mt76x2u_mac_resume(dev); 47 + mt76x2_apply_gain_adj(dev); 41 48 42 - static void 43 - mt76x2u_phy_update_channel_gain(struct mt76x02_dev *dev) 44 - { 45 - u8 channel = dev->mt76.chandef.chan->hw_value; 46 - int freq, freq1; 47 - u32 false_cca; 48 - 49 - freq = dev->mt76.chandef.chan->center_freq; 50 - freq1 = dev->mt76.chandef.center_freq1; 51 - 52 - switch (dev->mt76.chandef.width) { 53 - case NL80211_CHAN_WIDTH_80: { 54 - int ch_group_index; 55 - 56 - ch_group_index = (freq - freq1 + 30) / 20; 57 - if (WARN_ON(ch_group_index < 0 || ch_group_index > 3)) 58 - ch_group_index = 0; 59 - channel += 6 - ch_group_index * 4; 60 - break; 61 - } 62 - case NL80211_CHAN_WIDTH_40: 63 - if (freq1 > freq) 64 - channel += 2; 65 - else 66 - channel -= 2; 67 - break; 68 - default: 69 - break; 70 - } 71 - 72 - dev->cal.avg_rssi_all = mt76x02_phy_get_min_avg_rssi(dev); 73 - false_cca = FIELD_GET(MT_RX_STAT_1_CCA_ERRORS, 74 - mt76_rr(dev, MT_RX_STAT_1)); 75 - 76 - mt76x2u_mcu_set_dynamic_vga(dev, channel, false, false, 77 - dev->cal.avg_rssi_all, false_cca); 49 + dev->cal.channel_cal_done = true; 78 50 } 79 51 80 52 void mt76x2u_phy_calibrate(struct work_struct *work) ··· 54 82 struct mt76x02_dev *dev; 55 83 56 84 dev = container_of(work, struct mt76x02_dev, cal_work.work); 57 - mt76x2_phy_tssi_compensate(dev, false); 58 - mt76x2u_phy_update_channel_gain(dev); 85 + mt76x2u_phy_channel_calibrate(dev, false); 86 + mt76x2_phy_tssi_compensate(dev); 87 + mt76x2_phy_update_channel_gain(dev); 59 88 60 89 ieee80211_queue_delayed_work(mt76_hw(dev), &dev->cal_work, 61 90 MT_CALIBRATE_INTERVAL); ··· 153 180 u8 val = mt76x02_eeprom_get(dev, MT_EE_BT_RCAL_RESULT); 154 181 155 182 if (val != 0xff) 156 - mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0, false); 183 + mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0); 157 184 } 158 185 159 - mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, channel, false); 186 + mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, channel); 160 187 161 188 /* Rx LPF calibration */ 162 189 if (!dev->cal.init_cal_done) 163 - mt76x02_mcu_calibrate(dev, MCU_CAL_RC, 0, false); 190 + mt76x02_mcu_calibrate(dev, MCU_CAL_RC, 0); 164 191 dev->cal.init_cal_done = true; 165 192 166 193 mt76_wr(dev, MT_BBP(AGC, 61), 0xff64a4e2); ··· 174 201 175 202 if (scan) 176 203 return 0; 204 + 205 + mt76x2u_phy_channel_calibrate(dev, true); 206 + mt76x02_init_agc_gain(dev); 177 207 178 208 if (mt76x2_tssi_enabled(dev)) { 179 209 /* init default values for temp compensation */ ··· 195 219 flag |= BIT(0); 196 220 if (mt76x02_ext_pa_enabled(dev, chan->band)) 197 221 flag |= BIT(8); 198 - mt76x02_mcu_calibrate(dev, MCU_CAL_TSSI, flag, false); 222 + mt76x02_mcu_calibrate(dev, MCU_CAL_TSSI, flag); 199 223 dev->cal.tssi_cal_done = true; 200 224 } 201 225 }
+152 -1
drivers/net/wireless/mediatek/mt76/tx.c
··· 104 104 } 105 105 106 106 void 107 + mt76_tx_status_lock(struct mt76_dev *dev, struct sk_buff_head *list) 108 + __acquires(&dev->status_list.lock) 109 + { 110 + __skb_queue_head_init(list); 111 + spin_lock_bh(&dev->status_list.lock); 112 + __acquire(&dev->status_list.lock); 113 + } 114 + EXPORT_SYMBOL_GPL(mt76_tx_status_lock); 115 + 116 + void 117 + mt76_tx_status_unlock(struct mt76_dev *dev, struct sk_buff_head *list) 118 + __releases(&dev->status_list.unlock) 119 + { 120 + struct sk_buff *skb; 121 + 122 + spin_unlock_bh(&dev->status_list.lock); 123 + __release(&dev->status_list.unlock); 124 + 125 + while ((skb = __skb_dequeue(list)) != NULL) 126 + ieee80211_tx_status(dev->hw, skb); 127 + } 128 + EXPORT_SYMBOL_GPL(mt76_tx_status_unlock); 129 + 130 + static void 131 + __mt76_tx_status_skb_done(struct mt76_dev *dev, struct sk_buff *skb, u8 flags, 132 + struct sk_buff_head *list) 133 + { 134 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 135 + struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb); 136 + u8 done = MT_TX_CB_DMA_DONE | MT_TX_CB_TXS_DONE; 137 + 138 + flags |= cb->flags; 139 + cb->flags = flags; 140 + 141 + if ((flags & done) != done) 142 + return; 143 + 144 + __skb_unlink(skb, &dev->status_list); 145 + 146 + /* Tx status can be unreliable. if it fails, mark the frame as ACKed */ 147 + if (flags & MT_TX_CB_TXS_FAILED) { 148 + ieee80211_tx_info_clear_status(info); 149 + info->status.rates[0].idx = -1; 150 + info->flags |= IEEE80211_TX_STAT_ACK; 151 + } 152 + 153 + __skb_queue_tail(list, skb); 154 + } 155 + 156 + void 157 + mt76_tx_status_skb_done(struct mt76_dev *dev, struct sk_buff *skb, 158 + struct sk_buff_head *list) 159 + { 160 + __mt76_tx_status_skb_done(dev, skb, MT_TX_CB_TXS_DONE, list); 161 + } 162 + EXPORT_SYMBOL_GPL(mt76_tx_status_skb_done); 163 + 164 + int 165 + mt76_tx_status_skb_add(struct mt76_dev *dev, struct mt76_wcid *wcid, 166 + struct sk_buff *skb) 167 + { 168 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 169 + struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb); 170 + int pid; 171 + 172 + if (!wcid) 173 + return 0; 174 + 175 + if (info->flags & IEEE80211_TX_CTL_NO_ACK) 176 + return MT_PACKET_ID_NO_ACK; 177 + 178 + if (!(info->flags & (IEEE80211_TX_CTL_REQ_TX_STATUS | 179 + IEEE80211_TX_CTL_RATE_CTRL_PROBE))) 180 + return 0; 181 + 182 + spin_lock_bh(&dev->status_list.lock); 183 + 184 + memset(cb, 0, sizeof(*cb)); 185 + wcid->packet_id = (wcid->packet_id + 1) & MT_PACKET_ID_MASK; 186 + if (!wcid->packet_id || wcid->packet_id == MT_PACKET_ID_NO_ACK) 187 + wcid->packet_id = 1; 188 + 189 + pid = wcid->packet_id; 190 + cb->wcid = wcid->idx; 191 + cb->pktid = pid; 192 + cb->jiffies = jiffies; 193 + 194 + __skb_queue_tail(&dev->status_list, skb); 195 + spin_unlock_bh(&dev->status_list.lock); 196 + 197 + return pid; 198 + } 199 + EXPORT_SYMBOL_GPL(mt76_tx_status_skb_add); 200 + 201 + struct sk_buff * 202 + mt76_tx_status_skb_get(struct mt76_dev *dev, struct mt76_wcid *wcid, int pktid, 203 + struct sk_buff_head *list) 204 + { 205 + struct sk_buff *skb, *tmp; 206 + 207 + if (pktid == MT_PACKET_ID_NO_ACK) 208 + return NULL; 209 + 210 + skb_queue_walk_safe(&dev->status_list, skb, tmp) { 211 + struct mt76_tx_cb *cb = mt76_tx_skb_cb(skb); 212 + 213 + if (wcid && cb->wcid != wcid->idx) 214 + continue; 215 + 216 + if (cb->pktid == pktid) 217 + return skb; 218 + 219 + if (!pktid && 220 + !time_after(jiffies, cb->jiffies + MT_TX_STATUS_SKB_TIMEOUT)) 221 + continue; 222 + 223 + __mt76_tx_status_skb_done(dev, skb, MT_TX_CB_TXS_FAILED | 224 + MT_TX_CB_TXS_DONE, list); 225 + } 226 + 227 + return NULL; 228 + } 229 + EXPORT_SYMBOL_GPL(mt76_tx_status_skb_get); 230 + 231 + void 232 + mt76_tx_status_check(struct mt76_dev *dev, struct mt76_wcid *wcid, bool flush) 233 + { 234 + struct sk_buff_head list; 235 + 236 + mt76_tx_status_lock(dev, &list); 237 + mt76_tx_status_skb_get(dev, wcid, flush ? -1 : 0, &list); 238 + mt76_tx_status_unlock(dev, &list); 239 + } 240 + EXPORT_SYMBOL_GPL(mt76_tx_status_check); 241 + 242 + void mt76_tx_complete_skb(struct mt76_dev *dev, struct sk_buff *skb) 243 + { 244 + struct sk_buff_head list; 245 + 246 + if (!skb->prev) { 247 + ieee80211_free_txskb(dev->hw, skb); 248 + return; 249 + } 250 + 251 + mt76_tx_status_lock(dev, &list); 252 + __mt76_tx_status_skb_done(dev, skb, MT_TX_CB_DMA_DONE, &list); 253 + mt76_tx_status_unlock(dev, &list); 254 + } 255 + EXPORT_SYMBOL_GPL(mt76_tx_complete_skb); 256 + 257 + void 107 258 mt76_tx(struct mt76_dev *dev, struct ieee80211_sta *sta, 108 259 struct mt76_wcid *wcid, struct sk_buff *skb) 109 260 { ··· 595 444 596 445 spin_lock_bh(&hwq->lock); 597 446 if (!list_empty(&mtxq->list)) 598 - list_del(&mtxq->list); 447 + list_del_init(&mtxq->list); 599 448 spin_unlock_bh(&hwq->lock); 600 449 601 450 while ((skb = skb_dequeue(&mtxq->retry_q)) != NULL)
+8 -4
drivers/net/wireless/mediatek/mt76/usb.c
··· 100 100 return data; 101 101 } 102 102 103 - u32 mt76u_rr(struct mt76_dev *dev, u32 addr) 103 + static u32 mt76u_rr(struct mt76_dev *dev, u32 addr) 104 104 { 105 105 u32 ret; 106 106 ··· 110 110 111 111 return ret; 112 112 } 113 - EXPORT_SYMBOL_GPL(mt76u_rr); 114 113 115 114 /* should be called with usb_ctrl_mtx locked */ 116 115 static void __mt76u_wr(struct mt76_dev *dev, u32 addr, u32 val) ··· 135 136 trace_usb_reg_wr(dev, addr, val); 136 137 } 137 138 138 - void mt76u_wr(struct mt76_dev *dev, u32 addr, u32 val) 139 + static void mt76u_wr(struct mt76_dev *dev, u32 addr, u32 val) 139 140 { 140 141 mutex_lock(&dev->usb.usb_ctrl_mtx); 141 142 __mt76u_wr(dev, addr, val); 142 143 mutex_unlock(&dev->usb.usb_ctrl_mtx); 143 144 } 144 - EXPORT_SYMBOL_GPL(mt76u_wr); 145 145 146 146 static u32 mt76u_rmw(struct mt76_dev *dev, u32 addr, 147 147 u32 mask, u32 val) ··· 354 356 355 357 usb_fill_bulk_urb(buf->urb, udev, pipe, NULL, buf->len, 356 358 complete_fn, context); 359 + trace_submit_urb(dev, buf->urb); 357 360 358 361 return usb_submit_urb(buf->urb, gfp); 359 362 } ··· 440 441 struct mt76_dev *dev = urb->context; 441 442 struct mt76_queue *q = &dev->q_rx[MT_RXQ_MAIN]; 442 443 unsigned long flags; 444 + 445 + trace_rx_urb(dev, urb); 443 446 444 447 switch (urb->status) { 445 448 case -ECONNRESET: ··· 700 699 if (q->queued == q->ndesc) 701 700 return -ENOSPC; 702 701 702 + skb->prev = skb->next = NULL; 703 703 err = dev->drv->tx_prepare_skb(dev, NULL, skb, q, wcid, sta, NULL); 704 704 if (err < 0) 705 705 return err; ··· 730 728 731 729 while (q->first != q->tail) { 732 730 buf = &q->entry[q->first].ubuf; 731 + 732 + trace_submit_urb(dev, buf->urb); 733 733 err = usb_submit_urb(buf->urb, GFP_ATOMIC); 734 734 if (err < 0) { 735 735 if (err == -ENODEV)
+27 -2
drivers/net/wireless/mediatek/mt76/usb_trace.h
··· 26 26 #define MAXNAME 32 27 27 #define DEV_ENTRY __array(char, wiphy_name, 32) 28 28 #define DEV_ASSIGN strlcpy(__entry->wiphy_name, wiphy_name(dev->hw->wiphy), MAXNAME) 29 - #define DEV_PR_FMT "%s" 29 + #define DEV_PR_FMT "%s " 30 30 #define DEV_PR_ARG __entry->wiphy_name 31 31 32 32 #define REG_ENTRY __field(u32, reg) __field(u32, val) 33 33 #define REG_ASSIGN __entry->reg = reg; __entry->val = val 34 - #define REG_PR_FMT " %04x=%08x" 34 + #define REG_PR_FMT "reg:0x%04x=0x%08x" 35 35 #define REG_PR_ARG __entry->reg, __entry->val 36 36 37 37 DECLARE_EVENT_CLASS(dev_reg_evt, ··· 59 59 DEFINE_EVENT(dev_reg_evt, usb_reg_wr, 60 60 TP_PROTO(struct mt76_dev *dev, u32 reg, u32 val), 61 61 TP_ARGS(dev, reg, val) 62 + ); 63 + 64 + DECLARE_EVENT_CLASS(urb_transfer, 65 + TP_PROTO(struct mt76_dev *dev, struct urb *u), 66 + TP_ARGS(dev, u), 67 + TP_STRUCT__entry( 68 + DEV_ENTRY __field(unsigned, pipe) __field(u32, len) 69 + ), 70 + TP_fast_assign( 71 + DEV_ASSIGN; 72 + __entry->pipe = u->pipe; 73 + __entry->len = u->transfer_buffer_length; 74 + ), 75 + TP_printk(DEV_PR_FMT "p:%08x len:%u", 76 + DEV_PR_ARG, __entry->pipe, __entry->len) 77 + ); 78 + 79 + DEFINE_EVENT(urb_transfer, submit_urb, 80 + TP_PROTO(struct mt76_dev *dev, struct urb *u), 81 + TP_ARGS(dev, u) 82 + ); 83 + 84 + DEFINE_EVENT(urb_transfer, rx_urb, 85 + TP_PROTO(struct mt76_dev *dev, struct urb *u), 86 + TP_ARGS(dev, u) 62 87 ); 63 88 64 89 #endif
+2 -1
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c
··· 444 444 skb_queue_tail(&priv->rx_queue, skb); 445 445 usb_anchor_urb(entry, &priv->anchored); 446 446 ret = usb_submit_urb(entry, GFP_KERNEL); 447 - usb_put_urb(entry); 448 447 if (ret) { 449 448 skb_unlink(skb, &priv->rx_queue); 450 449 usb_unanchor_urb(entry); 450 + usb_put_urb(entry); 451 451 goto err; 452 452 } 453 + usb_put_urb(entry); 453 454 } 454 455 return ret; 455 456
-2
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/trx.c
··· 306 306 u8 *praddr; 307 307 u8 *psaddr; 308 308 __le16 fc; 309 - u16 type; 310 309 bool packet_matchbssid, packet_toself, packet_beacon; 311 310 312 311 tmp_buf = skb->data + pstatus->rx_drvinfo_size + pstatus->rx_bufshift; 313 312 314 313 hdr = (struct ieee80211_hdr *)tmp_buf; 315 314 fc = hdr->frame_control; 316 - type = WLAN_FC_GET_TYPE(hdr->frame_control); 317 315 praddr = hdr->addr1; 318 316 psaddr = ieee80211_get_SA(hdr); 319 317 ether_addr_copy(pstatus->psaddr, psaddr);
+4 -28
drivers/net/wireless/st/cw1200/debug.c
··· 289 289 return 0; 290 290 } 291 291 292 - static int cw1200_status_open(struct inode *inode, struct file *file) 293 - { 294 - return single_open(file, &cw1200_status_show, 295 - inode->i_private); 296 - } 297 - 298 - static const struct file_operations fops_status = { 299 - .open = cw1200_status_open, 300 - .read = seq_read, 301 - .llseek = seq_lseek, 302 - .release = single_release, 303 - .owner = THIS_MODULE, 304 - }; 292 + DEFINE_SHOW_ATTRIBUTE(cw1200_status); 305 293 306 294 static int cw1200_counters_show(struct seq_file *seq, void *v) 307 295 { ··· 333 345 return 0; 334 346 } 335 347 336 - static int cw1200_counters_open(struct inode *inode, struct file *file) 337 - { 338 - return single_open(file, &cw1200_counters_show, 339 - inode->i_private); 340 - } 341 - 342 - static const struct file_operations fops_counters = { 343 - .open = cw1200_counters_open, 344 - .read = seq_read, 345 - .llseek = seq_lseek, 346 - .release = single_release, 347 - .owner = THIS_MODULE, 348 - }; 348 + DEFINE_SHOW_ATTRIBUTE(cw1200_counters); 349 349 350 350 static ssize_t cw1200_wsm_dumps(struct file *file, 351 351 const char __user *user_buf, size_t count, loff_t *ppos) ··· 375 399 goto err; 376 400 377 401 if (!debugfs_create_file("status", 0400, d->debugfs_phy, 378 - priv, &fops_status)) 402 + priv, &cw1200_status_fops)) 379 403 goto err; 380 404 381 405 if (!debugfs_create_file("counters", 0400, d->debugfs_phy, 382 - priv, &fops_counters)) 406 + priv, &cw1200_counters_fops)) 383 407 goto err; 384 408 385 409 if (!debugfs_create_file("wsm_dumps", 0200, d->debugfs_phy,
+6 -7
drivers/net/wireless/st/cw1200/scan.c
··· 78 78 if (req->n_ssids > WSM_SCAN_MAX_NUM_OF_SSIDS) 79 79 return -EINVAL; 80 80 81 + /* will be unlocked in cw1200_scan_work() */ 82 + down(&priv->scan.lock); 83 + mutex_lock(&priv->conf_mutex); 84 + 81 85 frame.skb = ieee80211_probereq_get(hw, priv->vif->addr, NULL, 0, 82 86 req->ie_len); 83 87 if (!frame.skb) ··· 90 86 if (req->ie_len) 91 87 skb_put_data(frame.skb, req->ie, req->ie_len); 92 88 93 - /* will be unlocked in cw1200_scan_work() */ 94 - down(&priv->scan.lock); 95 - mutex_lock(&priv->conf_mutex); 96 - 97 89 ret = wsm_set_template_frame(priv, &frame); 98 90 if (!ret) { 99 91 /* Host want to be the probe responder. */ 100 92 ret = wsm_set_probe_responder(priv, true); 101 93 } 102 94 if (ret) { 95 + dev_kfree_skb(frame.skb); 103 96 mutex_unlock(&priv->conf_mutex); 104 97 up(&priv->scan.lock); 105 - dev_kfree_skb(frame.skb); 106 98 return ret; 107 99 } 108 100 ··· 120 120 ++priv->scan.n_ssids; 121 121 } 122 122 123 - mutex_unlock(&priv->conf_mutex); 124 - 125 123 if (frame.skb) 126 124 dev_kfree_skb(frame.skb); 125 + mutex_unlock(&priv->conf_mutex); 127 126 queue_work(priv->workqueue, &priv->scan.work); 128 127 return 0; 129 128 }
+1
include/linux/mmc/sdio_ids.h
··· 42 42 #define SDIO_DEVICE_ID_BROADCOM_4354 0x4354 43 43 #define SDIO_DEVICE_ID_BROADCOM_4356 0x4356 44 44 #define SDIO_DEVICE_ID_CYPRESS_4373 0x4373 45 + #define SDIO_DEVICE_ID_CYPRESS_43012 43012 45 46 46 47 #define SDIO_VENDOR_ID_INTEL 0x0089 47 48 #define SDIO_DEVICE_ID_INTEL_IWMC3200WIMAX 0x1402