History log of /linux-master/drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h
Revision Date Author Comments
# 352d9661 06-Feb-2024 Leon Yen <leon.yen@mediatek.com>

wifi: mt76: mt7921: fix a potential association failure upon resuming

In multi-channel scenarios, the granted channel must be aborted before
suspending. Otherwise, the firmware will be put into a wrong state,
resulting in an association failure after resuming.
With this patch, the granted channel will be aborted before suspending
if necessary.

Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d0a2bc5f 21-Nov-2023 Ming Yen Hsieh <mingyen.hsieh@mediatek.com>

wifi: mt76: mt7921: fix CLC command timeout when suspend/resume

When enter suspend/resume while in a connected state, the upper layer
will trigger disconnection before entering suspend, and at the same time,
it will trigger regd_notifier() and update CLC, causing the CLC event to
not be received due to suspend, resulting in a command timeout.

Therefore, the update of CLC is postponed until resume, to ensure data
consistency and avoid the occurrence of command timeout.

Fixes: 4fc8df50fd41 ("wifi: mt76: mt7921: get regulatory information from the clc event")
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4812ba9a 21-Nov-2023 Sean Wang <sean.wang@mediatek.com>

wifi: mt76: mt7921: reduce the size of MCU firmware download Rx queue

We actually don't need the reserve the 512 entries for the MCU firmware
download Rx queue because the queue was only used in the firmware download
phase to save the most of space and the reduction can significantly help
with reducing latency we spent by ~20% further in resetting the Rx queue
as the device was waking up from deep sleep mode.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4fc8df50 29-Sep-2023 Ming Yen Hsieh <mingyen.hsieh@mediatek.com>

wifi: mt76: mt7921: get regulatory information from the clc event

The clc event can report the radio configuration for the corresponding
country and the driver would take it as regulatory information of a
certain platform device.

This patch would change the clc commnad from no-waiting to waiting for
event. For backward compatible, we also add a new nic capability tag
to indicate the firmware did support this new clc event from now on.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5ab7d466 20-Sep-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt792x: move some common usb code in mt792x module

Move the following shared usb routines in mt792x module:
- mt792xu_stop
- mt792x_stop

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4d2cb56a 20-Sep-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt792x: move mt7921_skb_add_usb_sdio_hdr in mt792x module

Since mt7921_skb_add_usb_sdio_hdr is shared between mt7925 and mt7921
drivers, move it in mt792x module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2e7f7a2c 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move mt7921_dma_init in pci.c

Move mt7921_dma_init routine in pci.c and make it static since it is run
just in mt7921_pci_probe(). Get rid of dma.c.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7d403f3a 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt792x: move MT7921_PM_TIMEOUT and MT7921_HW_SCAN_TIMEOUT in common code

MT7921_PM_TIMEOUT is shared between mt7925 and mt7921 so move it in
mt792x module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 583204ae 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt792x: move mt7921_load_firmware in mt792x-lib module

mt7921_load_firmware routine is shared between mt7921 and mt7925 chipset
so move it in mt792x-lib module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d28e1a48 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt792x: introduce mt792x-usb module

Add usb shared code between mt7921 and mt7925 chipset to mt792x-usb module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 29f5a494 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move acpi_sar code in mt792x-lib module

Move acpi_sar code in mt792x-lib module since it is shared between
mt7921 and mt7925 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1c025496 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move runtime-pm pci code in mt792x-lib

Move the following runtime-pm pci routines in mt792x-lib since they are
shared between mt7921 and mt7925 chipsets:
- __mt7921e_mcu_drv_pmctrl
- mt7921e_mcu_drv_pmctrl
- mt7921e_mcu_fw_pmctrl

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c21a7f9f 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move shared runtime-pm code on mt792x-lib

Moving hif_ops marcos in mt792x.h, we can move shared runtime-pm code
between mt7925 and mt7921 in mt792x-lib module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5c041325 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move hif_ops macro in mt792x.h

Move the following hif_ops macro in mt792x.h:
- mt7925_init_reset
- mt7925_dev_reset
- mt7925_mcu_init
- __mt7925_mcu_drv_pmctrl
- __mt7925_mcu_fw_pmctrl

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ff655174 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt792x: move more dma shared code in mt792x_dma

Rely on irq_map support, move more dma shared code between mt7921 and
mt7925 in mt792x_dma.c
Move the following dma code in mt792x-lib
- mt792x_dma_enable
- mt792x_dma_reset
- mt792x_wpdma_reset
- mt792x_wpdma_reinit_cond

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e8a264cc 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move init shared code in mt792x-lib module

Reduce duplicated code moving init shared code in mt792x-lib module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c693f2f0 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move dma shared code in mt792x-lib module

Reduce duplicated code moving dma shared code in mt792x-lib module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 311f121c 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move mac shared code in mt792x-lib module

Reduce duplicated code moving mac shared code in mt792x-lib module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c74df1c0 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt792x: introduce mt792x-lib module

mt792x-lib module will contain the shared code between mt7921 and new
MT79 WiFi7 chipset

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 20249e1a 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move mt792x_hw_dev in mt792x.h

This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c605d0ce 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move mt792x_mutex_{acquire/release} in mt792x.h

This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1c42e0f2 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt792x: move shared structure definition in mt792x.h

This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 838cc667 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: rename mt7921_hif_ops in mt792x_hif_ops

This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 975e122d 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: rename mt7921_dev in mt792x_dev

This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 78562b2c 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: rename mt7921_phy in mt792x_phy

This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b7bfad2c 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: rename mt7921_sta in mt792x_sta

This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 15ca8970 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: rename mt7921_vif in mt792x_vif

This is a preliminary patch to introduce WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 95a686dc 28-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: convert acpisar and clc pointers to void

Convert acpisar and clc pointers in mt7921_dev structure to void.
This is a preliminary patch to add WiFi7 chipset support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c8e370fe 22-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move more mt7921/mt7915 mac shared code in connac lib

Move the following routines in mt76-connac lib since they are shared
between mt7915 and mt7921:
- mt76_connac2_tx_check_aggr
- mt76_connac2_txwi_free
- mt76_connac2_tx_token_put

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ef591d74 22-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: move ampdu_state in mt76_wcid

ampdu_state field is used by most of the drivers, so move it in
mt76_wcid structure.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d17a2fe8 22-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: rely on shared poll_list field

Rely on poll_list field in mt76_wcid structure and get rid of
private copy.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 419acc51 22-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: rely on shared sta_poll_list and sta_poll_lock

Rely on sta_poll_list and sta_poll_lock fields in mt76_dev structure
and get rid of private copies.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f124ed65 05-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: get rid of MT7921_RESET_TIMEOUT marco

MT7921_RESET_TIMEOUT is never used, so get rid of it.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0dde9c11 27-May-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: make mt7921_mac_sta_poll static

Make mt7921_mac_sta_poll static since it is run just in mac.c

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6ae39b7c 02-Jun-2023 Ben Greear <greearb@candelatech.com>

wifi: mt76: mt7921: Support temp sensor

Allow sensors tool to read radio's temperature, example:

mt7921_phy17-pci-1800
Adapter: PCI adapter
temp1: +72.0°C

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 52a1f158 12-May-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: rely on mib_stats shared definition

Get rid of private copy of mib_stats structure.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 50cc972d 02-Apr-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: get rid of eeprom.h

eeprom.h is mostly empty for mt7921, so get rid of it.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f28c3139 02-Apr-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: get rid of unused sta_ps callbacks

sta_ps callback is just an empty stub for most of the drivers,
so get rid of them.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4fc44156 02-Apr-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: add mt76_connac_irq_enable utility routine

Most of connac based drivers (mt7921, mt7615, mt7663) share the same
code to enable interrupts. Move it in mt76_connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ec193b41 02-Apr-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: move irq_tasklet in mt76_dev struct

irq_tasklet struct is used by most of the drivers (e.g. mt7915, mt7921,
mt7615, mt7663 and mt7996) so move it in common code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a1ec7e62 06-Mar-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: introduce mt7921_get_mac80211_ops utility routine

Since the fw offload capability check is shared between pci,usb and sdio
devices, move it in common init code and reduce code duplication.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c222f77f 17-Jan-2023 Neil Chen <yn.chen@mediatek.com>

wifi: mt76: mt7921: fix rx filter incorrect by drv/fw inconsistent

The rx filter, in mt7921 series, may be changed in fw operation. There is
a racing problem if rx filter controlled by both driver and firmware at
the same time. To avoid this issue, let mt7921 driver set rx filter by new
command MCU_CE_CMD_SET_RX_FILTER and allow the firmware controlling it
only.

Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Neil Chen <yn.chen@mediatek.com>
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 67fc7a30 16-Dec-2022 Deren Wu <deren.wu@mediatek.com>

wifi: mt76: mt7921: add ack signal support

This reports signal strength of ACK packets from the peer as measured
at each interface.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 914189af 16-Dec-2022 Deren Wu <deren.wu@mediatek.com>

wifi: mt76: mt7921: fix channel switch fail in monitor mode

When the chanctx enabled, IEEE80211_CONF_CHANGE_CHANNEL in .config()
would not be called anymore. mt76 cannot control RF channel for monitor.
Add monitor type set-channel flow in .change_chanctx().

Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support")
Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7176fe65 06-Dec-2022 Quan Zhou <quan.zhou@mediatek.com>

wifi: mt76: mt7921: add support to update fw capability with MTFG table

In ACPI enabled devices, mt7921 should read MTFG table from platform
hardware. Apply necessary settings for firmware capabilities through CLC
command.

Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e5c6bc6f 28-Nov-2022 Deren Wu <deren.wu@mediatek.com>

wifi: mt76: mt7921: Add missing __packed annotation of struct mt7921_clc

Add __packed annotation to avoid potential CLC parsing error

Fixes: 23bdc5d8cadf ("wifi: mt76: mt7921: introduce Country Location Control support")
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c3137942 12-Nov-2022 Sujuan Chen <sujuan.chen@mediatek.com>

wifi: mt76: add info parameter to rx_skb signature

This is a preliminary patch to introduce WED RX support for mt7915.

Tested-by: Daniel Golle <daniel@makrotopia.org>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7eefb93d 16-Nov-2022 YN Chen <YN.Chen@mediatek.com>

wifi: mt76: mt7921: fix wrong power after multiple SAR set

We should update CLC config before SAR set to synchronize all
related settings.

Fixes: 23bdc5d8cadf ("wifi: mt76: mt7921: introduce Country Location Control support")
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 41ac53c8 14-Nov-2022 Sean Wang <sean.wang@mediatek.com>

wifi: mt76: mt7921: introduce chanctx support

The firmware can have the capability to manage the channel context
scheduling on multiple roles running on the device including Station,
AP and P2P GC/GO mode (will be extended based on the future patchset)
to help users sharing the network with others on a single device.

The firmware is able to support the channel chanctx up to 2 interface
simultaneously running on the different channels.

Another thing to be noted is that before the driver is going sent out the
management frames, the driver has to get the privilege from the firmware
to occupy the current channel context until the frame handshake is
completed and then get the privilege back to the firmware.

Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 034ae28b 14-Nov-2022 Sean Wang <sean.wang@mediatek.com>

wifi: mt76: mt7921: introduce remain_on_channel support

Introduce remain_on_channel support. Additionally, we add
mt7921_check_offload_capability to disable .remain_on_channel and
.cancel_remain_on_channel and related configuration because those
operations would rely on the fundamental MCU commands that will be only
supported with newer firmware.

Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5b55b6da 10-Nov-2022 Quan Zhou <quan.zhou@mediatek.com>

wifi: mt76: mt7921: add unified ROC cmd/event support

Add unified ROC cmd/event which is only supported by the newer fw.

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Co-developed-by: Kaikai Hu <kaikai.hu@mediatek.com>
Signed-off-by: Kaikai Hu <kaikai.hu@mediatek.com>
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 23bdc5d8 07-Sep-2022 Ming Yen Hsieh <mingyen.hsieh@mediatek.com>

wifi: mt76: mt7921: introduce Country Location Control support

Country Location Control (CLC) is an additional control for country rules
in firmware. We introduce this new feature to make sure mt7921 series
working properly in all region.

The addtional policies would be put into firmware based on differnt
regions. mt76 driver should be in charge of submitting per region policy.

Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: YN Chen <YN.Chen@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# dc877523 10-Aug-2022 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: move move mt76_sta_stats to mt76_wcid

This is a preliminary patch for WED's TxS support.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0af1ad95 20-Jul-2022 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7921: move mt7921_rx_check and mt7921_queue_rx_skb in mac.c

Since both mt7921_rx_check and mt7921_queue_rx_skb routines are used by
all chipsets (mmio, usb and sdio), move them in mac.c and remove
duplicated code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 12d7440e 20-Jul-2022 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: add rx_check callback for usb devices

Introduce rx_check callback support for mt7663u and mt7921u drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9dfb28e9 23-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move tx initialization/cleanup in mt76_connac module

Move mt76_connac_init_tx_queues and mt76_connac_tx_cleanup routines
in mt76_connac module. This is a preliminary patch to add mt7990
chipset support.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 81f302fd 23-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: make mt7921_pci_driver static

mt7921_pci_driver struct is only referenced in mt7921/pci.c so make it
static.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d2f5c8ed 20-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move mt76_connac2_mcu_fill_message in mt76_connac module

Move mt76_connac2_mcu_fill_message routine in shared module in order to
reuse it for mt7921 and mt7915e drivers. This is a preliminary patch to
add mt7990 driver support.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0a178a60 19-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac_tx_complete_skb in shared code

Since now txp structures are in common code we can reuse
mt76_connac_tx_complete_skb routine in mt7921e, mt7915e and mt7615e
drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9d958b60 08-Jun-2022 Deren Wu <deren.wu@mediatek.com>

mt76: mt7921: fix command timeout in AP stop period

Due to AP stop improperly, mt7921 driver would face random command timeout
by chip fw problem. Migrate AP start/stop process to .start_ap/.stop_ap and
congiure BSS network settings in both hooks.

The new flow is shown below.
* AP start
.start_ap()
configure BSS network resource
set BSS to connected state
.bss_info_changed()
enable fw beacon offload

* AP stop
.bss_info_changed()
disable fw beacon offload (skip this command)
.stop_ap()
set BSS to disconnected state (beacon offload disabled automatically)
destroy BSS network resource

Fixes: 116c69603b01 ("mt76: mt7921: Add AP mode support")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 182071cd 07-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move connac2_mac_write_txwi in mt76_connac module

mac_write_txwi code is shared between connac2 devices (mt7915 and
mt7921). Move it in connac module.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 90211957 07-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mac connac2 defs in mt76_connac2_mac.h

This is a preliminary patch to share connac2 mac txwi code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e00b3e40 07-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: rely on mt76_dev in mt7921_mac_write_txwi signature

This is a preliminary patch to share txwi configuration code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 56054087 03-Jun-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: get rid of mt7921_mcu_exit

Run skb_queue_purge when needed.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 63db9d40 20-May-2022 Deren Wu <deren.wu@mediatek.com>

mt76: mt7921: introduce ACPI SAR config in tx power

Add new function mt7921_set_tx_sar_pwr() to update SAR power from
.set_sar_specs and ACPI setting. Both settings would be merged into
mt76_freq_range_power for final tx power value.

Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f965333e 20-May-2022 Deren Wu <deren.wu@mediatek.com>

mt76: mt7921: introduce ACPI SAR support

In ACPI SAR enabled device, mt7921 should read power limit in ACPI config.
The limit value would be applied to regular tx power settings in mt76.

Two major functionalities added:
1. Get SAR power table through ACPI.
2. Read power in Dynamic/Geo SAR table for tx power limit.

Table note
MTDS: Dynamic SAR table
MTGS: Geo SAR table
MTCL: Country List table (for 6GHz support)

Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Quan Zhou <quan.zhou@mediatek.com>
Signed-off-by: Quan Zhou <quan.zhou@mediatek.com>
Co-developed-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5fc201aa 11-May-2022 Deren Wu <deren.wu@mediatek.com>

mt76: mt7921: add ipv6 NS offload support

Add ipv6 NS offload for WoWLAN state.

Tested in this way:
1. Put device-A into WoW state.
2. ping6 from device-B to device-A.
3. In sniffer, see Neighbour advertisement from device-A.

Reviewed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 116c6960 06-Apr-2022 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: Add AP mode support

add AP mode support to mt7921 that can work for mt7921[e,s,u]
with the common code.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Tested-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5e0abf6f 17-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: rely on mt76_dev rxfilter in mt7921_configure_filter

mt7921 is currently using rxfilter defined in mt76_dev for rx filter
configuration. Fix mt7921_configure_filter implementation.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# df3e4143 17-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921u: add suspend/resume support

Introduce suspend/resume callbacks for mt7921u driver.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1c71e03a 14-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: move mt7921_init_hw in a dedicated work

Firmware initialization can take a while. Move mt7921_init_hw routine in
a dedicated work in order to not slow down bootstrap process.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0d2afe09f 14-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: add mt7921u driver

Introduce support for MT7921U 802.11ax 2x2:2SS wireless devices.

Tested-by: Sean Wang <sean.wang@mediatek.com>
Tested-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 8b7a56d5 14-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: move mt7921_usb_sdio_tx_status_data in mac common code.

This is a preliminary patch to add mt7921u driver support.

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9da47b50 14-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: move mt7921_usb_sdio_tx_complete_skb in common mac code.

This is a preliminary patch to add mt7921u driver support.

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5b834b0d 14-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: move mt7921_usb_sdio_tx_prepare_skb in common mac code

This is a preliminary patch to add mt7921u driver support.

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b72fd217 14-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: update mt7921_skb_add_usb_sdio_hdr to support usb

This is a preliminary patch to add mt7921u driver support.

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9a657684 06-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: get rid of mt7921_wait_for_mcu_init declaration

mt7921_wait_for_mcu_init is no longer used.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 11a72265 02-Mar-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: make mt7921_init_tx_queues static

mt7921 is only used in mt7921_dma_init routine.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# cbaa0a40 28-Feb-2022 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: fix up the monitor mode

Properly set up the monitor mode the firmware can support to fix up
RTS/CTS and beacon frames cannot be captured and forwarded to the host.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Tested-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4a74ecc8 16-Jan-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac_lmac_mapping in mt76-connac module

mt76_connac_lmac_mapping is shared between mt7921 and mt7915

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4ad65a54 11-Jan-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: toggle runtime-pm adding a monitor vif

Toggle runtime-pm and deep-sleep configuration adding/removing
a montior vif in order to forward all tx/rx frames to mac80211.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 602cc0c9 07-Jan-2022 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921e: fix possible probe failure after reboot

It doesn't guarantee the mt7921e gets started with ASPM L0 after each
machine reboot on every platform.

If mt7921e gets started with not ASPM L0, it would be possible that the
driver encounters time to time failure in mt7921_pci_probe, like a
weird chip identifier is read

[ 215.514503] mt7921e 0000:05:00.0: ASIC revision: feed0000
[ 216.604741] mt7921e: probe of 0000:05:00.0 failed with error -110

or failing to init hardware because the driver is not allowed to access the
register until the device is in ASPM L0 state. So, we call
__mt7921e_mcu_drv_pmctrl in early mt7921_pci_probe to force the device
to bring back to the L0 state for we can safely access registers in any
case.

In the patch, we move all functions from dma.c to pci.c and register mt76
bus operation earilier, that is the __mt7921e_mcu_drv_pmctrl depends on.

Fixes: bf3747ae2e25 ("mt76: mt7921: enable aspm by default")
Reported-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3f1c16fd 28-Dec-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921e: process txfree and txstatus without allocating skbs

Similar to mt7915 driver, process txfree and txstatus without allocating
skbs in order to reduce pressure on the memory allocator

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ae90bdd6 24-Dec-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac_mcu_restart in common module

Move mt76_connac_mcu_restart routine in mt76-connac since it is shared
between mt7921 and mt7915.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 8f4fa0f3 24-Dec-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: get rid of mt7921_mcu_get_eeprom

Remove mt7921_mcu_get_eeprom since it is no longer used.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6683d988 19-Dec-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mt76_connac_mcu_add_key in connac module

Move key configuration code shared between mt7921 and mt7915 in
mt76-connac module and remove duplicated code.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e0bf699a 08-Dec-2021 Deren Wu <deren.wu@mediatek.com>

mt76: mt7921: fix network buffer leak by txs missing

TXS in mt7921 may be forwared to tx_done event. Should try to catch
TXS information in tx_done event as well.

Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0efaf31d 02-Nov-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: fix MT7921E reset failure

There is a missing mt7921e_driver_own in the MT7921E reset procedure
since the mt7921 mcu.c has been refactored for MT7921S, that will
result in MT7921E reset failure, so add it back now.

Fixes: dfc7743de1eb ("mt76: mt7921: refactor mcu.c to be bus independent")
Reported-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fe041bee 18-Oct-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: move tx amsdu stats in mib_stats

Move tx_amsdu histogram stats in mib_stats structure since registers are
clear-on-read

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9e893d28 18-Oct-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: add sta stats accounting in mt7921_mac_add_txs_skb

This is a preliminary patch to add ethtool stats to mt7921 driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6b16ae47 18-Oct-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: add some more MIB counters

This is a preliminary patch to introduce ethtool stats support to mt7921
driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ca74b9b9 18-Oct-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921s: add reset support

Introduce wifi chip reset support for mt7921 device to recover
mcu hangs or abnormal wifi system.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 48fab5bb 18-Oct-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: introduce mt7921s support

Introduce support for mt7921s 802.11ax (Wi-Fi 6) 2x2:2SS chipset.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fe0195f7 18-Oct-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: refactor mt7921_mcu_send_message

This is a preliminary patch to introduce mt7921s support.

Refactor mt7921_mcu_send_message to be sharable between mt7921s and
mt7921e.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 16d98b54 18-Oct-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: rely on mcu_get_nic_capability

Rely on mcu_get_nic_capability to obtain Tx quota information
for the SDIO device, get PHY capability, MAC address and then we can
totally drop mt7921/eeprom.c and any unnecessary code.

Noting that mt76_connac_mcu_get_nic_capability should be run before set
flag MT76_STATE_MCU_RUNNING being set to setup the proper parameters
like Tx quota control before the device is started to running.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 033ae79b 18-Oct-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: refactor init.c to be bus independent

This is a preliminary patch to introduce mt7921s support.

Make init.c reusable between mt7921s and mt7921e

Tested-by: Deren Wu <deren.wu@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# dfc7743d 18-Oct-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: refactor mcu.c to be bus independent

This is a preliminary patch to introduce mt7921s support.

Make mcu.c reusable between mt7921s and mt7921e

Tested-by: Deren Wu <deren.wu@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f1b27f54 18-Oct-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: refactor dma.c to be pcie specific

This is a preliminary patch to introduce mt7921s support.

make dma.c be used dedicately for mt7921e.

by moving out mt7921_tx_cleanup from dma.c to mcu.c and then renaming
mt7921_tx_cleanup to refect the exact thing the function actually does.

Finally, dma.c totally become pcie specific one, only needed to
be compiled only when CONFIG_MT7921E is enabled.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 576b4484 18-Oct-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: refactor mac.c to be bus independent

This is a preliminary patch to introduce mt7921s support.

Split out a new pci_mac.c from mac.c to make mac.c reusable between
mt7921s and mt7921e.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 50ac15a5 23-Aug-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: add 6GHz support

Unlock 6GHz band if supported by the device. Configure HE 6G
capabilities.

Tested-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3a009876 14-Sep-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: robustify hardware initialization flow

Robustify hardware initialization in the current driver probing flow
to get rid of the device is possibly lost after the machine boot due
to possible firmware abnormal state by trying to recover the failure
with more chances.

Tested-by: Leon Yen <Leon.Yen@mediatek.com>
Tested-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1799c220 03-Sep-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: remove mt7921_sta_stats

mt7921_sta_stats is no longer needed

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 8c19b3fe 03-Sep-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: remove mcu rate reporting code

Remove unused tx rate reporting through mcu tx done event since
now tx status is fully supported

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 970ab80e 03-Sep-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: report tx rate directly from tx status

Report tx rate from tx status packets instead of receiving periodic mcu
event. This improves flexibility, accuracy and AQL performance, and
simplifies code flow for better readability.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 273910ac 03-Sep-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: add support for tx status reporting

Introduce infrastructure support for tx status reporting

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 159d95d4 03-Sep-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: start reworking tx rate reporting

Similar to mt7915, introduce mt7921_txwi_free to report tx rate to
mac80211. This is a preliminary patch to add proper tx status report.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# cf592be1 18-Aug-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: update mib counters dumping phy stats

mt7921 mac work can be idle for a long time due to runtime-pm so
update mib counters dumping phy stats

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0ab947c3 16-Aug-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: move mt7921_queue_rx_skb to mac.c

As for 7915 moving mt7921_queue_rx_skb makes it possible to make
some functions in mac.c static

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 890809ca 08-Aug-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: introduce mt7921_mcu_set_beacon_filter utility routine

Introduce mt7921_mcu_set_beacon_filter utility routine in order to
remove duplicated code for hw beacon filtering.
Move mt7921_pm_interface_iter in debugfs since it is just used there.
Make the following routine static:
- mt7921_pm_interface_iter
- mt7921_mcu_uni_bss_bcnft
- mt7921_mcu_set_bss_pm

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b3036310 09-Aug-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: get rid of mt7921_mac_set_beacon_filter

Remove mt7921_mac_set_beacon_filter routine since it is no longer used.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 82e0f596 09-Aug-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: get rid of monitor_vif

Remove monitor_vif pointer from mt7921 since it is just a leftover of
initial porting.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 68808872 15-Jul-2021 Deren Wu <deren.wu@mediatek.com>

mt76: mt7921: Add mt7922 support

Add new chip mt7922 in mt7921 module with following items
1. new chip ID / fw bin name
2. is_mt7922()
check chip type for different fw files
3. mt7921_get_data_mode()
check security type of fw (backward compatible)

Co-developed-by: Jimmy Hu <Jimmy.Hu@mediatek.com>
Signed-off-by: Jimmy Hu <Jimmy.Hu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 326d229f 13-Jul-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: fix mgmt frame using unexpected bitrate

Fix the current driver mgmt frame is not respecting the basic rates field
provided by the AP and then unconditionally is using the lowest (1 or 6
Mbps) rate.

For example, if the AP only supported basic rate {24, 36, 48, 54} Mbps,
mt7921 cannot send mgmt frame with the rate not in the group. So,
instead, we pick up the lowest basic rate the AP can support to send.

Fixes: 163f4d22c118 ("mt76: mt7921: add MAC support")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# bce84458 21-Jun-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: introduce testmode support

We add the testmode support to access the testmode feature provided
by the MT7921 firmware.

Tested-by: Sean Wang <sean.wang@mediatek.com>
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>


# 61a1f99d 17-Jun-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: allow chip reset during device restart

Disable chip full reset just during device probing but allow
it during hw restart.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f5056657 10-May-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: enable deep sleep at runtime

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>


# c560b137 10-Jun-2021 Ryder Lee <ryder.lee@mediatek.com>

mt76: make mt76_update_survey() per phy

Reduce duplicated survey for DBDC.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5bc52dee 05-Jun-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: make mt7921_set_channel static

Make mt7921_set_channel routine static since it is only used in main.c

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 15539a5b 31-May-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: remove mt7921_get_wtbl_info routine

Since now the fw reports tx rate events without polling,
mt7921_get_wtbl_info and related structures are no longer used.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a60951d4 31-May-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: enable hw offloading for wep keys

Enable wep key hw offloading for sta mode. This patch fixes
WoW support for wep connections.

Tested-by: Deren.Wu <deren.wu@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3cce2b98 28-May-2021 Deren Wu <deren.wu@mediatek.com>

mt76: mt7921: introduce mac tx done handling

Instead of read tx status from mac table, add new mechanisam to hanele
tx done event for data frame, every 250ms

This event indicate the real tx status of this pkt in mac layer and
would help mac80211 correct status more frequently

Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f5e3db30 23-May-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: return proper error value in mt7921_mac_init

Return possible error values in mt7921_mac_init routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f07ac384 19-May-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: avoid unnecessary consecutive WiFi resets

Avoid unnecessary consecutive WiFi resets by dropping reset
request when reset work is working.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7bf0a71e 19-May-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: fix reset under the deep sleep is enabled

To fix possibly the race to access register between the WiFi reset
and the other context that is caused by explicitly cancelling ps_work
and wake_work to break PM_STATE consistency.

Deep sleep would cause the hardware into the inactive state,
so we forcely put device drv_own state before we start to reset.

The patch also ignore the reset request when the procedure is in
progress to avoid the consecutive WiFi resets.

localhost ~ # [ 2932.073966] SError Interrupt on CPU7, code 0xbe000011
[ 2932.073967] CPU: 7 PID: 8761 Comm: kworker/u16:2 Not tainted 5.4.112 #30
[ 2932.073968] Hardware name: MediaTek Asurada rev1 board (DT)
[ 2932.073968] Workqueue: phy0 ieee80211_reconfig_filter [mac80211]
[ 2932.073969] pstate: 80400089 (Nzcv daIf +PAN -UAO)
[ 2932.073969] pc : el1_irq+0x78/0x180
[ 2932.073970] lr : mt76_mmio_rmw+0x30/0x5c [mt76]
[ 2932.073970] sp : ffffffc01142bad0
[ 2932.073970] x29: ffffffc01142bc00 x28: ffffff8f96fb1e00
[ 2932.073971] x27: ffffffd2cdc12138 x26: ffffffd2cdaeb018
[ 2932.073972] x25: 0000000000000000 x24: ffffff8fa8e14c08
[ 2932.073973] x23: 0000000080c00009 x22: ffffffd2a5603918
[ 2932.073974] x21: ffffffc01142bc10 x20: 0000007fffffffff
[ 2932.073975] x19: 0000000000000000 x18: 0000000000000400
[ 2932.073975] x17: 0000000000000400 x16: ffffffd2cd2b87dc
[ 2932.073976] x15: 0000000000000000 x14: 0000000000000000
[ 2932.073977] x13: 0000000000000001 x12: 0000000000000001
[ 2932.073978] x11: 0000000000000001 x10: 000000000010e000
[ 2932.073978] x9 : 0000000000000000 x8 : ffffffc013921404
[ 2932.073979] x7 : 000000b2b5593519 x6 : 0000000000300000
[ 2932.073980] x5 : 0000000000000000 x4 : ffffffc01142bbc8
[ 2932.073980] x3 : 00000000000001f0 x2 : 0000000000000000
[ 2932.073981] x1 : 0000000000021404 x0 : ffffff8fa8e12300
[ 2932.073982] Kernel panic - not syncing: Asynchronous SError Interrupt
[ 2932.073983] CPU: 7 PID: 8761 Comm: kworker/u16:2 Not tainted 5.4.112 #30
[ 2932.073983] Hardware name: MediaTek Asurada rev1 board (DT)
[ 2932.073984] Workqueue: phy0 ieee80211_reconfig_filter [mac80211]
[ 2932.073984] Call trace:
[ 2932.073985] dump_backtrace+0x0/0x14c
[ 2932.073985] show_stack+0x20/0x2c
[ 2932.073985] dump_stack+0xa0/0xf8
[ 2932.073986] panic+0x154/0x360
[ 2932.073986] test_taint+0x0/0x44
[ 2932.073986] arm64_serror_panic+0x78/0x84
[ 2932.073987] do_serror+0x0/0x118
[ 2932.073987] do_serror+0xa4/0x118
[ 2932.073987] el1_error+0x84/0xf8
[ 2932.073988] el1_irq+0x78/0x180
[ 2932.073988] mt76_mmio_rr+0x30/0xf0 [mt76]
[ 2932.073988] mt76_mmio_rmw+0x30/0x5c [mt76]
[ 2932.073989] mt7921_rmw+0x4c/0x5c [mt7921e]
[ 2932.073989] mt7921_configure_filter+0x138/0x160 [mt7921e]
[ 2932.073990] ieee80211_configure_filter+0x2f0/0x3e0 [mac80211]
[ 2932.073990] ieee80211_reconfig_filter+0x1c/0x28 [mac80211]
[ 2932.073990] process_one_work+0x208/0x3c8
[ 2932.073991] worker_thread+0x23c/0x3e8
[ 2932.073991] kthread+0x140/0x17c
[ 2932.073992] ret_from_fork+0x10/0x18
[ 2932.074071] SMP: stopping secondary CPUs
[ 2932.074071] Kernel Offset: 0x12bc800000 from 0xffffffc010000000
[ 2932.074072] PHYS_OFFSET: 0xfffffff180000000
[ 2932.074072] CPU features: 0x080026,2a80aa18
[ 2932.074072] Memory Limit: none

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 36fcc8cf 19-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: introduce mt7921_mcu_sta_add routine

mt7921_mcu_sta_add will be used to add and remove wtbl entries.
Create broadcast wtbl entry after AP association

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>


# c18ba14c 20-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: improve doze opportunity

Increase mt7921 mac work timeout in oder to have move sleep
opportunities

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d089692b 20-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move token utilities in mt76 common module

Move token management in mt76 common module since it is shared between
mt7615, mt7915 and mt7921 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b17aff33 20-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move token_lock, token and token_count in mt76_dev

Move token_lock, token and token_count data structures in mt76_dev.
This is a preliminary patch to move token management in mt76 common
module since it is shared by mt7615, mt7915 and mt7921 drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 77ba3491 19-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: introduce mt7921_wpdma_reinit_cond utility routine

Add mt7921_wpdma_reinit_cond to check dummy reg if driver needs to
reinitialized WPDMA after driver_own operation

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fcad15d5 19-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: introduce mt7921_wpdma_reset utility routine

Introduce mt7921_wpdma_reset routine to reset wpdma during chip reset
or driver_own request.

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>


# 0a1059d0 19-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: move mt7921_dma_reset in dma.c

Move mt7921_dma_reset routine in dma.c and make mt7921_dma_prefetch
static. Moreover add force parameter to mt7921_dma_reset signature.
This is a preliminary patch to reset dma mt7921_mcu_drv_pmctrl.

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>


# 917dccb6 18-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx/rx napi

Introduce mt7921_poll_rx rx napi callback for mt7921.
Do not access device registers in tx/rx napi if the device is not awake.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9800462d 18-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx path

Introduce mt7921_tx_worker routine as mt76 tx worker callback for
mt7921.
Rely on mt76_connac_pm_ref/mt76_connac_pm_unref to check PM state and
increment/decrement wake counter

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d5a2abb0 17-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: remove leftover function declaration

Get rid of leftover mt7921_mcu_add_bss_info routine declaration

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f4f4089e 16-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mcu_update_arp_filter in mt76_connac module

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>


# a8333801 15-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: move hw configuration in mt7921_register_device

Get rid of init work since firmware loading is already performed in
mt7921_init_hardware

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ea29acc9 13-Apr-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: add dumping Tx power table

Dump the tx power table saved in offload firmware.

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>


# 0fda6d7b 29-Mar-2021 Ryder Lee <ryder.lee@mediatek.com>

mt76: report Rx timestamp

Frame reception timestamp (low 32-bits) that indicates the value of the
local TSF timer value at the time the first bit of the MAC header in the
received frame (PPDU unit) arriving at the MAC.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 49897c52 05-Apr-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: fix the insmod hangs

Fix the second insert module causing the device hangs after remove module.

Fixes: 1c099ab44727 ("mt76: mt7921: add MCU support")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9c9d8321 05-Apr-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: fix inappropriate WoW setup with the missing ARP informaiton

Fix the Wake-on-WoWLAN failure should rely on ARP Information is being
updated in time to the firmware.

Fixes: ffa1bf97425b ("mt76: mt7921: introduce PM support")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 93c81df5 24-Mar-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: properly configure rcpi adding a sta to the fw

Properly configure rcpi based on association process rssi. rcpi is used
by rate controller embedded into the fw to initialize amsdu size.

Tested-by: Jayden.Kuo <jayden.kuo@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0c1ce988 07-Mar-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: add wifi reset support

Introduce wifi chip reset support for mt7921 device to recover mcu
hangs.

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>


# 1f7396ac 07-Mar-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: introduce __mt7921_start utility routine

This is a preliminary patch to introduce mt7921 chip reset support.

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>


# d32464e6 07-Mar-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: introduce mt7921_run_firmware utility routine.

This is a preliminary patch to introduce chip reset for mt7921 devices.

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>


# f76e9019 22-Feb-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: fix stats register definitions

Fix register definitions for mac80211 stats reporting.
Move mib counter reset to mt7921_get_stats routine.

Fixes: 163f4d22c118d ("mt76: mt7921: add MAC support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0da3c795 27-Jan-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: add coredump support

Introduce coredump support to mt7921 driver.

The coredump would be produced when MCU met the fatal error or driver
sent out the specific cmd to force trigger it.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1d8efc74 27-Jan-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: introduce Runtime PM support

Introduce runtime PM to mt7921 driver

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 022159b0 27-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: rely on mt76_connac_mcu module for suspend and WoW support

Rely on mt76_connac_mcu module for suspend and WoW support and remove
duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 80fc1e37 27-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: rely on mt76_connac_mcu module for sched_scan and hw_scan

Rely on mt76_connac_mcu module for sched_scan and hw_scan and remove
duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 67aa2743 27-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7921: rely on mt76_connac_mcu common library

Rely on mt76_connac_mcu common library and remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ffa1bf97 27-Jan-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: introduce PM support

Introduce suspend/resume and WoW (Wake-on-WoWLAN) support to mt7921
driver to allow remote wakeu-up from the suspend state.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4086ee28 27-Jan-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: introduce support for hardware beacon filter

Introduce support for hw beacon filter available in the mt7921 firmware.

According to mt7921e firmware, enabling hardware filter would rely on
mt7921_mcu_uni_bss_bcnft and disabling hardware filter still rely on legacy
mt7921_mcu_set_bss_pm.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 56d965da 27-Jan-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: introduce 802.11 PS support in sta mode

Enable 802.11 power-save support available in mt7921 firmware

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 29f9d8b0 27-Jan-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: introduce schedule scan support

introduce schedule scan to control mt7921 firmware to do background scan in
defined plan to see if the matched SSID is available.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1c099ab4 27-Jan-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: add MCU support

MT7921 contains a microprocessor with which the host can use command/event
to communicate to implement offload features such as establish connection,
hardware scan and so on. The host has to download the ROM patch, RAM
firmware and finally activate the MCU to complete the MT7921
initialization.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 163f4d22 27-Jan-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7921: add MAC support

Add Rx packet description parsing, Tx packet description compositon, handle
packet recycling and provide MAC information mt76 core needs to support
mac80211.

Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>