summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
AgeCommit message (Collapse)AuthorFilesLines
2021-11-18mt76: mt7615: fix monitor mode tear down crashRyder Lee1-5/+13
[ Upstream commit a6fdbdd1ac2996a58a84672ef37efb5cbb98fadf ] [ 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-19mt76: mt7921: enable deep sleep at runtimeSean Wang1-3/+5
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 Bianconi1-3/+5
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 Lee1-0/+4
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 Lee1-0/+3
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 Lee1-4/+2
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 Bianconi1-19/+47
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 Bianconi1-4/+4
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 Carpenter1-1/+1
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 Bianconi1-5/+19
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 Bianconi1-1/+1
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 Bianconi1-1/+0
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>
2021-04-21mt76: mt7663: fix a race between mt7615_mcu_drv_pmctrl and mt7615_mcu_fw_pmctrlLorenzo Bianconi1-6/+14
Introduce a mutex in order to avoid a race between mt7615_mcu_lp_drv_pmctrl and mt7615_mcu_fw_pmctrl routines since they are run two independent works Fixes: 1f549009b5b2 ("mt76: mt7615: do not request {driver,fw}_own if already granted") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: connac: move mcu_update_arp_filter in mt76_connac moduleLorenzo Bianconi1-47/+0
Move mt76_connac_mcu_update_arp_filter in mt76_connac module since the code is shared between mt7615 and mt7921 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: improve mcu error loggingLorenzo Bianconi1-2/+2
Dump mcu command code in hex and related prefix to help debugging Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: mt7615: load ROM patch before checking patch semaphore statusFelix Fietkau1-14/+16
For MT7663, the availability of the patch files is used to detect, which corresponding firmware is going to be used (AP firmware or STA offload firmware). If the ROM patch was already applied, it could attempt to load the wrong firmware (without considering the alternative). Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: mt7615: fix entering driver-own state on mt7663Felix Fietkau1-2/+10
Fixes hardware wakeup issues Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: mt7615: do not use mt7615 single-sku values for mt7663Lorenzo Bianconi1-0/+5
mt7663 mcu relies on different APIs to configure APIs per-rate power limit respect to mt7615 driver. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-21mt76: mt7615: implement support for using DT rate power limitsFelix Fietkau1-1/+60
Limits are used to update the channel max_power settings and also passed to the firmware on channel changes Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-13mt76: mt7615: always add rx header translation tlv when adding stationsFelix Fietkau1-1/+3
Ensures that header translation is disabled for interfaces that do not support it. Fixes: d4b98c63d7a7 ("mt76: mt7615: add support for rx decapsulation offload") Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: fix .add_beacon_offload()Ryder Lee1-2/+10
ieee80211_beacon_get_template() returns NULL when beacon state is disabled, so beacon_offload cannot be disabled for some devices. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: limit firmware log message printk to buffer lengthFelix Fietkau1-1/+2
Avoid including garbage from previous rx data Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: fix chip reset on MT7622 and MT7663eFelix Fietkau1-0/+1
After chip reset, the DMA scheduler needs to be initialized as well. Since the code is PCI/SoC specific, move it to pci_mac.c, so that it can depend on a function in dma.c Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7622: trigger hif interrupt for system resetRyder Lee1-1/+1
hif interrupt needs to be triggered after MT_MCU_INT_EVENT. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: connac: introduce mt76_sta_cmd_info data structureLorenzo Bianconi1-4/+9
Introduce mt76_sta_cmd_info data structure to contain parameters passed to mt76_sta_cmd_info routine. This is preliminary patch to properly configure rcpi for mt7921 devices. Tested-by: Jayden.Kuo <jayden.kuo@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: fix CSA notification for DBDCRyder Lee1-5/+20
Add CSA notification for second phy. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: remove hdr->fw_ver checkRyder Lee1-2/+1
Only mt7615 uses v1 version. Also, some of released firmware doesn't have hdr->fw_ver. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12mt76: mt7615: add support for rx decapsulation offloadRyder Lee1-0/+39
For AP and Client mode, the hardware can pass received packets as 802.3 frames that can be passed to the network stack as-is. Tested-by: Frank Wunderlich <frank-w@public-files.de> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-11mt76: connac: always check return value from mt76_connac_mcu_alloc_wtbl_reqLorenzo Bianconi1-0/+3
Even if this is not a real bug since mt76_connac_mcu_alloc_wtbl_req routine can fails just if nskb is NULL , always check return value from mt76_connac_mcu_alloc_wtbl_req in order to avoid possible future mistake. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-02-08Merge tag 'mt76-for-kvalo-2021-01-29' of https://github.com/nbd168/wirelessKalle Valo1-1458/+145
mt76 patches for 5.12 * add new mt7921e driver * factor out common code shared between 7615/7663 and 7921 * performance optimizations * 7915 dbdc fixes * 802.11 encap offload support * support for multiple pcie gen1 host interfaces on 7915 * 7915 testmode support * bugfixes * testmode support enhancements * endian fixes * 7915 txbf support
2021-01-29mt76: mt7663: introduce coredump supportLorenzo Bianconi1-0/+5
Similar to mt7921 devices, introduce coredump support for mt7663 chipset Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: mt76_connac: move WoW and suspend code in mt76_connac_mcu moduleLorenzo Bianconi1-307/+3
Move WoW and suspend code in mt76_connac_mcu module in order to be reused in mt7615 and mt7921 drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: mt76_connac: move hw_scan and sched_scan routine in mt76_connac_mcu moduleLorenzo Bianconi1-210/+3
Move hw_scan/sched_scan in mt76_connac_mcu module in order to be reused in mt7615 and mt7921 drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: mt76_connac: create mcu libraryLorenzo Bianconi1-936/+112
Introduce mt76_connac common mcu library for code sharing between mt7615 and mt7921 devices Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-29mt76: introduce mt76_vif data structureLorenzo Bianconi1-54/+55
Introduce mt76_vif data structure to share common fields between mt7615_vif and mt7921_vif and create a mcu common library Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-27mt76: mt7615: unify init workFelix Fietkau1-2/+0
Reduce code duplication and remove unnecessary exports Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-27mt76: mt7615: set mcu country code in mt7615_mcu_set_channel_domain()Lorenzo Bianconi1-14/+32
Update mcu country code running mt7615_mcu_set_channel_domain routine in mt7615_regd_notifier(). Filter out disabled channels in mt7615_mcu_set_channel_domain(). Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-26mt76: move chainmask in mt76_phyLorenzo Bianconi1-2/+2
Move chainmask from driver phy to mt76_phy since it is used by all drivers. This is a preliminary patch to create a common mcu library used by mt7615 and mt7921 drivers Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-26mt76: testmode: introduce dbdc supportShayne Chen1-1/+1
Add testmode support for DBDC NICs (both MT7615D and MT7915D work). Testmode data and parameters are moved from per-dev to per-phy for maintaining the value of each band. Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> Acked-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-26mt76: mt7615: convert comma to semicolonZheng Yongjun1-1/+1
Replace a comma between expression statements by a semicolon. Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-14mt76: Fix queue ID variable types after mcu queue splitNathan Chancellor1-1/+1
Clang warns in both mt7615 and mt7915: drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:271:9: warning: implicit conversion from enumeration type 'enum mt76_mcuq_id' to different enumeration type 'enum mt76_txq_id' [-Wenum-conversion] txq = MT_MCUQ_FWDL; ~ ^~~~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:278:9: warning: implicit conversion from enumeration type 'enum mt76_mcuq_id' to different enumeration type 'enum mt76_txq_id' [-Wenum-conversion] txq = MT_MCUQ_WA; ~ ^~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:282:9: warning: implicit conversion from enumeration type 'enum mt76_mcuq_id' to different enumeration type 'enum mt76_txq_id' [-Wenum-conversion] txq = MT_MCUQ_WM; ~ ^~~~~~~~~~ 3 warnings generated. drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:238:9: warning: implicit conversion from enumeration type 'enum mt76_mcuq_id' to different enumeration type 'enum mt76_txq_id' [-Wenum-conversion] qid = MT_MCUQ_WM; ~ ^~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt7615/mcu.c:240:9: warning: implicit conversion from enumeration type 'enum mt76_mcuq_id' to different enumeration type 'enum mt76_txq_id' [-Wenum-conversion] qid = MT_MCUQ_FWDL; ~ ^~~~~~~~~~~~ 2 warnings generated. Use the proper type for the queue ID variables to fix these warnings. Additionally, rename the txq variable in mt7915_mcu_send_message to be more neutral like mt7615_mcu_send_message. Fixes: e637763b606b ("mt76: move mcu queues to mt76_dev q_mcu array") Link: https://github.com/ClangBuiltLinux/linux/issues/1229 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/20201229211548.1348077-1-natechancellor@gmail.com
2020-12-04mt76: mt7615: fix rdd mcu cmd endiannessLorenzo Bianconi1-23/+66
Similar to mt7915 driver, fix mt7615 radar mcu command endianness Fixes: 2ce73efe0f8e5 ("mt76: mt7615: initialize radar specs from host driver") Fixes: 70911d9638069 ("mt76: mt7615: add radar pattern test knob to debugfs") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: move mcu queues to mt76_dev q_mcu arrayLorenzo Bianconi1-4/+4
Move mcu queue to a dedicated array q_mcu in mt76_dev structure. This is a preliminary patch to move data queues in mt76_phy and properly support dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: rely on mt76_queue in tx_queue_skb_raw signatureLorenzo Bianconi1-1/+1
This is a preliminary patch to move data queues in mt76_phy and properly support dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: dma: rely on mt76_queue in mt76_dma_tx_cleanup signatureLorenzo Bianconi1-1/+1
This is a preliminary patch to move data queues in mt76_phy and properly support dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt7615: support 16 interfacesRyder Lee1-3/+46
When looking for a MAC address slot, start by using main BSSID slots 1-3, afterwards use 16 repeater mode BSSID slots, then start using the slots usually used for AP mode. This search order should prevent unnecessary conflicts with AP mode interfaces on the same PHY. Note that two PHYs share global 32 omac slots with each other. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt7663s: introduce WoW support via GPIOSean Wang1-2/+12
SDIO-based WiFi would rely on an additional GPIO pin to wake up the host. Co-developed-by: YN Chen <YN.Chen@mediatek.com> Signed-off-by: YN Chen <YN.Chen@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: move mt76_mcu_send_firmware in common moduleLorenzo Bianconi1-26/+6
Move mt76_mcu_send_firmware routine in common code since it is actually shared between mt7615, mt7663, mt7603 and mt7915 devices Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt7615: enable beacon filtering by default for offload fwLorenzo Bianconi1-5/+2
In order to reduce cpu cycles, enable hw beacon filter by default if the device is running offload fw with sta only interfaces. Disable runtime pm for multi-vif scenario. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: make mcu_ops->mcu_send_msg optionalFelix Fietkau1-14/+0
Remove it from mt7615 and mt7915 and implement it in core code instead Signed-off-by: Felix Fietkau <nbd@nbd.name>