summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
AgeCommit message (Collapse)AuthorFilesLines
2019-09-24mt76: mt7615: fix mt7615 firmware path definitionsLorenzo Bianconi1-7/+4
mt7615 patch/n9/cr4 firmwares are available in mediatek folder in linux-firmware repository. Because of this mt7615 won't work on regular distributions like Ubuntu. Fix path definitions. Moreover remove useless firmware name pointers and use definitions directly Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Cc: stable@vger.kernel.org Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-09-05mt76: mt7615: add support to read temperature from mcuLorenzo Bianconi1-11/+43
Introduce debugfs entry to read device temperature and related cmu command. Introduce mt7615_mcu_parse_response to parse mcu response messages and refactor mt7615_mcu_msg_send routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: fix some checkpatch warningsRyder Lee1-2/+0
This fixes the following checkpatch warnings: WARNING: Improper SPDX comment style Fix blank lines. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: update cw_min/max related settingsRyder Lee1-9/+9
Add default values of cw_min/max and use fls() for configuration. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: introduce mt7615_mac_wtbl_set_key routineLorenzo Bianconi1-39/+0
Add mt7615_mac_wtbl_set_key routine to configure wtbl key parameter directly from host cpu. This is a preliminary patch to add BIP_CMAC_128 hw support. Moreover add static qualifier to mt7615_mac_get_key_info routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: move mt7615_mac_get_key_info in mac.cLorenzo Bianconi1-34/+1
This is a preliminary patch to update wtbl key directly from host processor Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: move mt7615_mcu_set_rates to mac.cFelix Fietkau1-88/+0
It bypasses the MCU, so it does not belong in mcu.c Also make mt7615_mac_tx_rate_val static Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: introduce mt7615_mcu_send_ram_firmware routineLorenzo Bianconi1-48/+42
Add mt7615_mcu_send_ram_firmware routine since mt7615_load_ram runs the same code to send ram firmware to cr4 and n9 mcus. Moreover rename gen_dl_mode in mt7615_mcu_gen_dl_mode. This patch does not introduce any behaviour change, it is just code refactor. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: always release sem in mt7615_load_patchLorenzo Bianconi1-3/+3
Release patch semaphore even if request_firmware fails in mt7615_load_patch Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: clean up FWDL TXQ during/after firmware uploadFelix Fietkau1-0/+3
Since we don't clean that tx queue from the tx tasklet, we need to do it after the firmware upload is done. This patch also adds a cleanup step during the upload, to help reclaim memory faster. Fixes unprocessed queued frames eating up memory long after the firmware upload has already completed Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add radar pattern test knob to debugfsLorenzo Bianconi1-0/+31
Introduce mt7615_mcu_rdd_send_pattern routine to trigger a radar pattern detection. Moreover move debugfs related routines in a dedicated source file. Suggested-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add csa supportLorenzo Bianconi1-5/+21
Add Channel Switch Announcement support to mt7615 driver updating beacon template with CSA IE received from mac80211 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: do not perform txcalibration before cac is complitedLorenzo Bianconi1-10/+15
Delay channel calibration after Channel Availability Check. Add some code cleanup to mt7615_mcu_set_channel Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: add hw dfs pattern detector supportLorenzo Bianconi1-0/+65
Add hw radar detection support to mt7615 driver in order to unlock dfs channels on 5GHz band Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-09-05mt76: mt7615: fix sparse warnings: warning: restricted __le16 degrades to ↵Lorenzo Bianconi1-1/+1
integer Fix the following sparse warning in __mt7615_mcu_msg_send: drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:78:15: sparse: warning: restricted __le16 degrades to integer drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:78:15: sparse: warning: cast from restricted __le16 Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: fix sparse warnings: warning: cast from restricted __le16Lorenzo Bianconi1-4/+2
Do not convert {tx,rx}_mcs_map to little-endian since it is already done by mac80211. This patch fix the following sparse warning: drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:1497:25: sparse: warning: cast from restricted __le16 drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:1499:25: sparse: warning: cast from restricted __le16 Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Fixes: 3ca0a6f6e9df ("mt7615: mcu: use standard signature for mt7615_mcu_msg_send") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: fix sparse warnings: incorrect type in assignment (different ↵Lorenzo Bianconi1-2/+3
base types) Fix the following sparse warning in mt7615_mcu_bss_info_ext_header: drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:728:30: sparse: sparse: incorrect type in assignment (different base types) drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:728:30: sparse: expected restricted __le32 [usertype] mbss_tsf_offset Reported-by: kbuild test robot <lkp@intel.com> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Fixes: 7339fbc0caa5 ("mt7615: mcu: do not use function pointers whenever possible") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: update peer's bssid when state transition occursRyder Lee1-13/+14
This makes sure that the driver update peer's bssid when state transition occurs. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: fix incorrect settings in mesh modeRyder Lee1-1/+1
Fix wrong settings that will drop packets due to hardware's RX table searching flow. Fixes: f072c7ba2150 ("mt76: mt7615: enable support for mesh") Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: take into account extPA when configuring tx powerLorenzo Bianconi1-4/+6
When TSSI calibration is disabled (which it means the device has been equipped with an external power amplifier) we need to refer to different eeprom fields in order to properly configure tx power Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: simplify mt7615_mcu_set_sta_rec routineLorenzo Bianconi1-21/+12
Move conn_type configuration directly in mt7615_mcu_set_sta_rec and remove sta_rec_convert_vif_type since it is actually used just in mt7615_mcu_set_sta_rec Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: remove key check in mt7615_mcu_set_wtbl_keyLorenzo Bianconi1-1/+1
Do not check key pointer in mt7615_mcu_set_wtbl_key since if set_key_cmd is SET_KEY, key will be always not NULL. This patch will address a false positive reported by Coverity-Scan Addresses-Coverity-ID: 1445463 ("Dereference after null check") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: remove unused variable in mt7615_mcu_set_bcnLorenzo Bianconi1-2/+2
Remove tim_len in mt7615_mcu_set_bcn since it is not actually used and ieee80211_beacon_get_tim checks if tim_length is NULL Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: fix slow performance when enable encryptionRyder Lee1-0/+1
Fix wrong WCID assignment and add RKV (RX Key of this entry is valid) flag to check if peer uses the same configuration with previous handshaking. If the configuration is mismatch, WTBL indicates a “cipher mismatch” to stop SEC decryption to prevent the packet from damage. Suggested-by: YF Luo <yf.luo@mediatek.com> Suggested-by: Yiwei Chung <yiwei.chung@mediatek.com> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: enable support for meshRyder Lee1-1/+3
Enable NL80211_IFTYPE_MESH_POINT and update its path. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-27mt76: mt7615: add the capability to configure tx powerLorenzo Bianconi1-0/+64
Introduce mt7615_mcu_set_tx_power routine in order to cap tx power according to the value configured by the user Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: run __mt76_mcu_send_msg in mt7615_mcu_send_firmwareLorenzo Bianconi1-10/+5
Run __mt76_mcu_send_msg instead of __mt7615_mcu_msg_send and remove duplicated code. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: init mcu_restart function pointerLorenzo Bianconi1-4/+5
Use common function wrapper in mt7615_mcu_exit since the code is shared with m7603 driver Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: initialize mt76_mcu_ops data structureLorenzo Bianconi1-34/+40
Use __mt76_mcu_send_msg wrapper instead of mt7615_mcu_msg_send. This is a preliminary patch for mt7615-mt7603 mcu code unification Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: use standard signature for mt7615_mcu_msg_sendLorenzo Bianconi1-295/+319
Use mt76 common signature for mt7615_mcu_msg_send. Move skb allocation in mt7615_mcu_msg_send and remove duplicated code. Remove __mt7615_mcu_set_wtbl and __mt7615_mcu_set_sta_rec since now are used just to send mcu msgs. This is a preliminary patch for mt7615-mt7603 mcu code unification Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: do not use function pointers whenever possibleLorenzo Bianconi1-115/+105
Remove function pointers in mt7615_mcu_set_bss_info and run function directly. Moreover remove __mt7615_mcu_set_bss_info since it is run just by mt7615_mcu_set_bss_info and remove duplicated istructions Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: unify __mt7615_mcu_set_dev_info and mt7615_mcu_set_dev_infoLorenzo Bianconi1-55/+36
Unify mt7615_mcu_set_dev_info and __mt7615_mcu_set_dev_info since the latter is run just by mt7615_mcu_set_dev_info Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: remove skb_ret from mt7615_mcu_msg_sendLorenzo Bianconi1-53/+24
Remove skb_ret parameter from mt7615_mcu_msg_send signature since it is actually used just by mt7615_mcu_patch_sem_ctrl. This is a prelimanry patch to use mt76 common mcu API Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: remove dest from mt7615_mcu_msg_send signatureLorenzo Bianconi1-34/+22
Remove dest parameter from mt7615_mcu_msg_send/__mt7615_mcu_msg_send routine signature since it can is always set to MCU_S2D_H2N Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: remove query from mt7615_mcu_msg_send signatureLorenzo Bianconi1-27/+26
Remove query parameter from mt7615_mcu_msg_send routine signature since it can be obtained from cmd value Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: remove unused parameter in mt7615_mcu_del_wtblLorenzo Bianconi1-1/+1
Remove unused vif parameter in mt7615_mcu_del_wtbl signature Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: unify mt7615_mcu_add_wtbl_bmc and mt7615_mcu_del_wtbl_bmcLorenzo Bianconi1-4/+8
Remove duplicated code in mt7615_bss_info_changed Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: use proper msg size in mt7615_mcu_add_wtblLorenzo Bianconi1-30/+24
Use proper mcu message size in mt7615_mcu_add_wtbl and do not allocate a huge buffer. Moreover use stack memory instead of heap one Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: use proper msg size in mt7615_mcu_add_wtbl_bmcLorenzo Bianconi1-30/+24
Use proper mcu message size in mt7615_mcu_add_wtbl_bmc and do not allocate a huge buffer. Moreover use stack memory instead of heap one Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: remove bss_info_convert_vif_type routineLorenzo Bianconi1-46/+27
Remove bss_info_convert_vif_type routine since it is run just in mt7615_mcu_set_bss_info and the switch over vif->type is already there. Simplify mt7615_mcu_set_bss_info routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: simplify __mt7615_mcu_set_sta_recLorenzo Bianconi1-30/+21
Do not loop over cmd payload in __mt7615_mcu_set_sta_rec since it is already done in before running __mt7615_mcu_set_sta_rec (e.g. mt7615_mcu_set_sta_rec) Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt7615: mcu: simplify __mt7615_mcu_set_wtblLorenzo Bianconi1-36/+26
Do not loop over cmd payload in __mt7615_mcu_set_wtbl since it is already done in before running __mt7615_mcu_set_wtbl (e.g. mt7615_mcu_set_wtbl_key) Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-06-25mt76: mt7615: Use after free in mt7615_mcu_set_bcn()Dan Carpenter1-1/+1
We dereference "skb" when we assign: req.pkt_len = cpu_to_le16(MT_TXD_SIZE + skb->len); ^^^^^^^^ So this patch just moves the dev_kfree_skb() down a bit to avoid the use after free. Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-05-01mt76: mt7615: use sizeof instead of sizeof_fieldFelix Fietkau1-2/+1
It is simpler in this case Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-05-01mt76: add mac80211 driver for MT7615 PCIe-based chipsetsRyder Lee1-0/+1656
This driver is for a newer generation of MediaTek MT7615 4x4 802.11ac PCIe-based chipsets, which support wave2 MU-MIMO up to 4 users/group and also support up to 160MHz bandwidth. The driver fully supports AP, station and monitor mode. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Roy Luo <royluo@google.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>