aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
AgeCommit message (Collapse)Author
2023-12-07wifi: mt76: Remove unnecessary (void*) conversionsWu Yunchuan
No need cast (void *) to (struct mt7615_phy *). Signed-off-by: Wu Yunchuan <yunchuan@nfschina.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-09-30wifi: mt76: fix per-band IEEE80211_CONF_MONITOR flag comparisonShayne Chen
Use the correct ieee80211_conf of each band for IEEE80211_CONF_MONITOR comparison. Fixes: 24e69f6bc3ca ("mt76: fix monitor rx FCS error in DFS channel") Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-17wifi: mt76: move mcu_uni_event and mcu_reg_event in common codeLorenzo Bianconi
mcu_uni_event and mcu_reg_event structs are shared between mt7921 and mt7615 drivers, so move them in connac lib. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-04-17wifi: mt76: mt7921: enable p2p supportSean Wang
Introduce p2p-go/p2p-client support to mt7921 driver CONNECTION_P2P_GC/GO is not supported with the current firmware so we added mt76_dev to mt76_connac_mcu_sta_basic_tlv signature to use CONNECTION_INFRA_STA/AP instead for p2p-client and p2p-go respectively to make it work. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-03wifi: mt76: mt7615: avoid mcu_restart function pointerLorenzo Bianconi
Run mt7615_mcu_restart routine directly and avoid mcu_restart function pointer whenever it is possible. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: mt7921: add chanctx parameter to mt76_connac_mcu_uni_add_bss ↵Sean Wang
signature Add a chanctx parameter to mt76_connac_mcu_uni_add_bss signature to allow the firmware binds the BSS into the specific channel context. Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-07-11mt76: convert MT_TX_HW_QUEUE_EXT_PHY to MT_TX_HW_QUEUE_PHYLorenzo Bianconi
Report phy_indx in tx_info->hw_queue. This is a preliminary patch to add newer chipset support Co-developed-by: Bo Jiao <bo.jiao@mediatek.com> Signed-off-by: Bo Jiao <bo.jiao@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-07-11mt76: introduce phys array in mt76_dev structureLorenzo Bianconi
Introduce phys array in mt76_dev structure to reference mt76_phy supported by the chipset. This is a preliminary patch to introduce newer chipset support. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-07-11mt76: do not use skb_set_queue_mapping for internal purposesFelix Fietkau
Previously the code used skb_set_queue_mapping for management or non-bufferable powersave frames that need to be sent to a different hardware queue. This can confuse AQL, which expects the value to remain the same until the tx status report. The only place that currently uses the altered skb queue mapping is the txwi write function. Change the code to pass the hardware queue id as a function parameter instead. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-07-11mt76: mt7615: fix throughput regression on DFS channelsFelix Fietkau
For some reason, mt7615 reacts badly to repeatedly enabling/disabling the radar detector without also switching the channel. This results in very bad throughput on DFS channels, because hw->conf.radar_enabled can get toggled a few times after CAC ends. Fix this by always leaving the DFS detector enabled on DFS channels and instead suppress unwanted detection events. Fixes: 2c86f6752046 ("mt76: mt7615: fix/rewrite the dfs state handling logic") Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-07-11mt76: mt7615: add sta_rec with EXTRA_INFO_NEW for the first time onlyFelix Fietkau
Set EXTRA_INFO_NEW for the first time only to prevent adding the same starec entry, otherwise the entry might be removed in fw. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-07-11mt76: mt7615: do not update pm stats in case of errorLorenzo Bianconi
Do not update pm stats if mt7615_mcu_fw_pmctrl returns an error. Fixes: abe912ae3cd42 ("mt76: mt7663: add awake and doze time accounting") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-07-11mt76: mt7663: rely on mt76_connac2_fw_trailerLorenzo Bianconi
Remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-06-20wifi: mac80211: return a beacon for a specific linkShaul Triebitz
Pass the link id through to the get_beacon and return the beacon for a specific link id. Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: move interface config to new structJohannes Berg
We'll use bss_conf for per-link configuration later, so move out all the non-link-specific data out into a new struct ieee80211_vif_cfg used in the vif. Some adjustments were done with the following spatch: @@ expression sdata; struct ieee80211_vif *vifp; identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator }; @@ ( -sdata->vif.bss_conf.var +sdata->vif.cfg.var | -vifp->bss_conf.var +vifp->cfg.var ) @bss_conf@ struct ieee80211_bss_conf *bss_conf; identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator }; @@ -bss_conf->var +vif_cfg->var (though more manual fixups were needed, e.g. replacing "vif_cfg->" by "vif->cfg." in many files.) Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-06-20wifi: mac80211: move some future per-link data to bss_confJohannes Berg
To add MLD, reuse the bss_conf structure later for per-link information, so move some things into it that are per link. Most transformations were done with the following spatch: @@ expression sdata; identifier var = { chanctx_conf, mu_mimo_owner, csa_active, color_change_active, color_change_color }; @@ -sdata->vif.var +sdata->vif.bss_conf.var @@ struct ieee80211_vif *vif; identifier var = { chanctx_conf, mu_mimo_owner, csa_active, color_change_active, color_change_color }; @@ -vif->var +vif->bss_conf.var Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2022-03-16mt76: fix monitor rx FCS error in DFS channelDeren Wu
When setup monitor mode in DFS channel, mt76 send CH_SWITCH_DFS to fw for channel config. This would cause rx performance bad while monitoring frames. Settings CH_SWITCH_NORMAL in monitor mode would get the same performance as normal channels. Reviewed-by: Shayne Chen <shayne.chen@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-16mt76: split single ldpc cap bit into bitsMeiChia Chiu
The original single LDPC cap bit cannot be used to differentiate LDPC cap in each PHY mode. This modification split the single bit into 3 bits, ht_ldpc, vht_ldpc, and he_ldpc. Reviewed-by: Ryder Lee <ryder.lee@mediatek.com> Suggested-by: Money Wang <Money.Wang@mediatek.com> Signed-off-by: MeiChia Chiu <MeiChia.Chiu@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-24mt76: fix dfs state issue with 160 MHz channelsFelix Fietkau
When operating on a mix of DFS and non-DFS channels, the driver only checks the CAC status of the control channel. This causes beacons/tx to fail if the control channel is on a non-DFS channel. Fix this by calling cfg80211_reg_can_beacon to determine the DFS status of all affected channels Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-23mt76: mt7615: introduce SAR supportLorenzo Bianconi
Add SAR spec support to mt7615 driver to allow configuring SAR power limitations on the frequency ranges from the userland. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: connac: move mt76_connac_mcu_rdd_cmd in mt76-connac moduleLorenzo Bianconi
Move mt76_connac_mcu_rdd_cmd routine in mt76-connac module and remove duplicated code. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: connac: move mt76_connac_mcu_gen_dl_mode in mt76-connac moduleLorenzo Bianconi
Move mt76_connac_mcu_gen_dl_mode utility routine in mt76_connac_mcu.h since it is shared by all drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: connac: move mt76_connac_mcu_set_pm in connac moduleLorenzo Bianconi
Move mt76_connac_mcu_set_pm utility routine in connac module since it is shared between mt7615 and mt7915 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: connac: move mt76_connac_mcu_wtbl_update_hdr_trans in connac moduleLorenzo Bianconi
Move mt76_connac_mcu_wtbl_update_hdr_trans routine in mt76-connac module since it is shared between mt7915 and mt7615 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: mt7915: rely on mt76_connac_mcu_wtbl_ht_tlvLorenzo Bianconi
Rely on mt76_connac_mcu_wtbl_ht_tlv routine and remove duplicated code. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: mt7915: rely on mt76_connac_mcu_sta_baLorenzo Bianconi
Rely on mt76_connac_mcu_sta_ba routine in mt7915 and remove duplicated code. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: connac: move mt76_connac_mcu_bss_basic_tlv in connac moduleLorenzo Bianconi
Move mt7615_mcu_bss_basic_tlv/mt7915_mcu_bss_basic_tlv in connac module since it is shared between mt7615 and mt7915 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: connac: move mt76_connac_mcu_bss_ext_tlv in connac moduleLorenzo Bianconi
Move mt7915_mcu_bss_ext_tlv/mt7615_mcu_bss_ext_tlv in connac module since it is shared between mt7615 and mt7915 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-02-03mt76: connac: move mt76_connac_mcu_bss_omac_tlv in connac moduleLorenzo Bianconi
Move mt7915_mcu_bss_omac_tlv/mt7615_mcu_bss_omac_tlv in connac module since it is shared between mt7615 and mt7915 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-12-19mt76: mt7915: rely on mt76_connac definitionsLorenzo Bianconi
Remove duplicated mcu definitions in mt7915 mcu.h and reused connac ones. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-12-19mt76: connac: rely on MCU_CMD macroLorenzo Bianconi
Similar to mt7915 driver, rely on MCU_CMD macro and do not command definitions directly Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-12-19mt76: connac: introduce MCU_CE_CMD macroLorenzo Bianconi
Similar to MCU_EXT_CMD, introduce MCU_CE_CMD for CE commands Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-12-19mt76: connac: introduce MCU_UNI_CMD macroLorenzo Bianconi
Similar to MCU_EXT_CMD, introduce MCU_UNI_CMD for unified commands Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-12-19mt76: connac: align MCU_EXT definitions with 7915 driverLorenzo Bianconi
Align MCU_EXT and MCU_FW definitions between mt76_connac and mt7915 driver. This is a preliminary patch to reuse mt76_connac in mt7915 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-12-19mt76: connac: introduce MCU_EXT macrosLorenzo Bianconi
Introduce MCU_EXT_CMD and MCU_EXT_QUERY macros in mt76_connac module. This is a preliminary patch to reuse mt76_connac module in mt7915 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-10-23mt76: mt7615: apply cached RF data for DBDCRyder Lee
Band0 and band1 share the same hardware, so band0 will stop Tx/Rx when band1 performs Rx calibration. cal_cache is introduced to solve such corner cases by moving necessary datas from channel_switch to bootup. Co-developed-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-10-20mt76: mt7663s: rely on mcu reg access utilitySean Wang
rely on mcu reg access utility and drop the duplicated code. Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-10-20mt76: mt7615: fix monitor mode tear down crashRyder Lee
[ 103.451600] CPU 3 Unable to handle kernel paging request at virtual address 00000003, epc == 8576591c, ra == 857659f0 [ 103.462226] Oops[#1]: [ 103.464499] CPU: 3 PID: 9247 Comm: ifconfig Tainted: G W 5.4.143 #0 [ 103.472031] $ 0 : 00000000 00000001 83be3854 00000000 [ 103.477239] $ 4 : 8102a374 8102a374 8102f0b0 00000200 [ 103.482444] $ 8 : 0000002d 000001e4 64373765 5d206337 [ 103.487647] $12 : 00000000 00000005 00000000 0006d1df [ 103.492853] $16 : 83be3848 853838a8 8743d600 00010000 [ 103.498059] $20 : 00000000 00000000 8553dec0 0000007f [ 103.503266] $24 : 00000003 80382084 [ 103.508472] $28 : 831d4000 831d5bc0 00000001 857659f0 [ 103.513678] Hi : 00000122 [ 103.516543] Lo : d1768000 [ 103.519452] epc : 8576591c mt7615_mcu_add_bss+0xd0/0x3c0 [mt7615_common] [ 103.526306] ra : 857659f0 mt7615_mcu_add_bss+0x1a4/0x3c0 [mt7615_common] [ 103.533232] Status: 11007c03 KERNEL EXL IE [ 103.537402] Cause : 40800008 (ExcCode 02) [ 103.541389] BadVA : 00000003 [ 103.544253] PrId : 0001992f (MIPS 1004Kc) [ 103.797086] Call Trace: [ 103.799562] [<8576591c>] mt7615_mcu_add_bss+0xd0/0x3c0 [mt7615_common] [ 103.806082] [<85760a14>] mt7615_remove_interface+0x74/0x1e0 [mt7615_common] [ 103.813280] [<85603fcc>] drv_remove_interface+0x2c/0xa0 [mac80211] [ 103.819612] [<8561a8e4>] ieee80211_del_virtual_monitor.part.22+0x74/0xe8 [mac80211] [ 103.827410] [<8561b7f0>] ieee80211_do_stop+0x4a4/0x8a0 [mac80211] [ 103.833671] [<8561bc00>] ieee80211_stop+0x14/0x24 [mac80211] [ 103.839405] [<8045a328>] __dev_close_many+0x9c/0x10c [ 103.844364] [<80463de4>] __dev_change_flags+0x16c/0x1e4 [ 103.849569] [<80463e84>] dev_change_flags+0x28/0x70 [ 103.854440] [<80521e54>] devinet_ioctl+0x280/0x774 [ 103.859222] [<80526248>] inet_ioctl+0xa4/0x1c8 [ 103.863674] [<80436830>] sock_ioctl+0x2d8/0x4bc [ 103.868201] [<801adbb4>] do_vfs_ioctl+0xb8/0x7c0 [ 103.872804] [<801ae30c>] ksys_ioctl+0x50/0xb4 [ 103.877156] [<80014598>] syscall_common+0x34/0x58 Fixes: 04b8e65922f63 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets") Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-10-20mt76: mt7615: move mt7615_mcu_set_p2p_oppps in mt76_connac moduleLorenzo Bianconi
Move mt7615_mcu_set_p2p_oppps routine in mt76_connac_lib module in order to be reused in mt7921 driver Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt7921: enable deep sleep at runtimeSean Wang
Enable the deep sleep mode with that firmware is able to trap into the doze state at runtime to reduce the power consumption further. The deep sleep mode is not allowed in the STA state transition with the firmware to have the fast connection experience as we've done in the full power mode Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: connac: fix UC entry is being overwrittenLorenzo Bianconi
Fix UC entry is being overwritten by BC entry Tested-by: Deren Wu <deren.wu@mediatek.com> Co-developed-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Deren Wu <deren.wu@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt7615: update radar parametersRyder Lee
Patch radar parameters to match the SDK to avoid possible false alarms. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt7615: fix potential overflow on large shiftRyder Lee
Fix the following static checker warning: error: undefined (user controlled) shift '(((1))) << (c->omac_idx)' Fixes: 402a695b1ae6 ("mt76: mt7615: fix CSA notification for DBDC") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt7615: add thermal sensor device supportRyder Lee
Similar to mt7915, switching to use standard hwmon sysfs. For reading temperature, cat /sys/class/ieee80211/phy*/hwmon*/temp1_input Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt7663: enable hw rx header translationLorenzo Bianconi
As already done for mt7615 and mt7915, enable rx header translation offload for mt7663 in order to reduce cpu load in the rx path. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: connac: add missing configuration in mt76_connac_mcu_wtbl_hdr_trans_tlvLorenzo Bianconi
Add missing configuration parameters in mt76_connac_mcu_wtbl_hdr_trans_tlv routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: mt7615: fix a precision vs width bug in printkDan Carpenter
Precision "%.*s" was intended instead of width "%*s". The original code will print garbage from beyond the end of the skb->data. Fixes: d76d6c3ba2b0 ("mt76: mt7615: limit firmware log message printk to buffer length") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: mt7663: add awake and doze time accountingLorenzo Bianconi
Similar to mt7921, introduce awake and doze time accounting for runtime pm. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: connac: check wake refcount in mcu_fw_pmctrlLorenzo Bianconi
In order to avoid synchronization races between tx and rx path, rely on mt76_connac_skip_fw_pmctrl putting the chip in sleep mode for mt7921 and mt7663 devices Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: connac: unschedule ps_work in mt76_connac_pm_wakeLorenzo Bianconi
In order to avoid synchronization issues between wake and ps works, cancel ps_work in mt76_connac_pm_wake routine Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>