Sean Wang [Fri, 14 Jan 2022 23:56:32 +0000 (07:56 +0800)]
mt76: sdio: honor the largest Tx buffer the hardware can support
We don't have to create a separate sdio.xmit_buf buffer for each queue.
Instead, we just need to create one, reuse it across all queues to reduce
memory consumption further.
And then we should take it into account the actual the host and the device
MMC capability to determine what the appropriate xmit_buf_size can be.
Both MT7921S and MT7663 can support up to Tx FIFO size of 0x3fe00 which
means the device can receive 511 blocks of block size 512 in a row from
the host. So if the driver aggregates the frames as many as possible the
the device can support, we can merge multiple MMC requests into a single
one to get rid of the overhead of the handling and synchronizing in those
unnecessary MMC requests and reduce the SDIO lock contention with the
Bluetooth concurrent traffic and finally to have the higher bus
utilization with less idle cycle.
With the patch, it is helpful for WiFi to have steady throughput
performance especially while running Bluetooth concurrently.
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>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
MeiChia Chiu [Thu, 27 Jan 2022 13:32:26 +0000 (21:32 +0800)]
mt76: mt7915: fix the nss setting in bitrates
without this change, the fixed MCS only supports 1 Nss.
Fixes: 70fd1333cd32f ("mt76: mt7915: rework .set_bitrate_mask() to support more options")
Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Peter Chiu [Wed, 26 Jan 2022 04:50:34 +0000 (12:50 +0800)]
mt76: mt7915: update max_mpdu_size in mt7915_mcu_sta_amsdu_tlv()
The maximum max_mpdu_size of mt7915 is 7991, whereas mt7916 can
support 11454.
Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Peter Chiu [Wed, 26 Jan 2022 02:05:29 +0000 (10:05 +0800)]
mt76: mt7915: fix mcs_map in mt7915_mcu_set_sta_he_mcs()
Should use peer's bandwidth instead of chandef->width to
get correct mcs_map.
Fixes: 76be6c076c077 ("mt76: mt7915: add .set_bitrate_mask() callback")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Mon, 24 Jan 2022 20:03:44 +0000 (21:03 +0100)]
mt76: mt7921s: fix a possible memory leak in mt7921_load_patch
Always release fw data at the end of mt7921_load_patch routine.
Fixes: 78b217580c509 ("mt76: mt7921s: fix bus hang with wrong privilege")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Mon, 24 Jan 2022 19:36:52 +0000 (20:36 +0100)]
mt76: mt7915: fix possible memory leak in mt7915_mcu_add_sta
Free allocated skb in mt7915_mcu_add_sta routine in case of failures.
Fixes: 89bbd3730f382 ("mt76: mt7915: rework starec TLV tags")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Xing Song [Mon, 24 Jan 2022 03:28:11 +0000 (11:28 +0800)]
mt76: stop the radar detector after leaving dfs channel
The radar detctor is used for dfs channel. So it will start after switching
to dfs channel and will stop after leaving. The TX will be blocked if radar
detctor isn't stopped in non-dfs channel.
This patch resets the dfs state to indicate the radar detector needs to be
stopped.
Signed-off-by: Xing Song <xing.song@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sat, 22 Jan 2022 14:58:58 +0000 (15:58 +0100)]
mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update
Check sta_rates pointer value in mt7615_sta_rate_tbl_update routine
since minstrel_ht_update_rates can fail allocating rates array.
Fixes: 04b8e65922f63 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sat, 22 Jan 2022 14:58:57 +0000 (15:58 +0100)]
mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update
Check sta_rates pointer value in mt7603_sta_rate_tbl_update routine
since minstrel_ht_update_rates can fail allocating rates array.
Fixes: c8846e1015022 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sat, 22 Jan 2022 14:45:38 +0000 (15:45 +0100)]
mt76: mt7663s: flush runtime-pm queue after waking up the device
Add missing mt76_connac_pm_dequeue_skbs routine waking up mt7663s device
from runtime-pm sleep state.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Piotr Dymacz [Wed, 19 Jan 2022 12:31:21 +0000 (13:31 +0100)]
mt76: mt7615: add support for LG LGSBWAC02 (MT7663BUN)
The LG LGSBWAC02 (FCC ID: BEJLGSBWAC02) is a combo Wi-Fi/BT module which
can be found in several different LG TV models. This module is based on
already supported MediaTek MT7663U series.
Device from /sys/kernel/debug/usb/devices:
T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=02 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.10 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=043e ProdID=310c Rev= 1.00
S: Manufacturer=MediaTek Inc.
S: Product=Wireless_Device
S: SerialNumber=
000000000
C:* #Ifs= 3 Cfg#= 1 Atr=a0 MxPwr=100mA
A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=125us
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms
E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 8 Cls=ff(vend.) Sub=ff Prot=ff Driver=mt7663u
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=08(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
And dmesg:
usbcore: registered new interface driver mt7663u
mt7663u 1-1.4:1.2: N9 Firmware Version: 3.1.1, Build Time:
20200604161656
mt7663u 1-1.4:1.2: Region number: 0x4
mt7663u 1-1.4:1.2: Parsing tailer Region: 0
mt7663u 1-1.4:1.2: Region 0, override_addr = 0x00118000
mt7663u 1-1.4:1.2: Parsing tailer Region: 1
mt7663u 1-1.4:1.2: Parsing tailer Region: 2
mt7663u 1-1.4:1.2: Parsing tailer Region: 3
mt7663u 1-1.4:1.2: override_addr = 0x00118000, option = 3
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Tue, 18 Jan 2022 10:13:32 +0000 (11:13 +0100)]
mt76: mt7921: remove duplicated code in mt7921_mac_decode_he_radiotap
Remove duplicated DATA4_SU_MU_SPTL_REUSE flag configuration in
mt7921_mac_decode_he_radiotap routine.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Tue, 18 Jan 2022 10:12:07 +0000 (11:12 +0100)]
mt76: mt7915: add missing DATA4_TB_SPTL_REUSE1 to mt7915_mac_decode_he_radiotap
Add missing DATA4_TB_SPTL_REUSE1 he radiotap flag to
mt7915_mac_decode_he_radiotap routine.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sun, 16 Jan 2022 12:43:14 +0000 (13:43 +0100)]
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>
Lorenzo Bianconi [Wed, 12 Jan 2022 17:53:55 +0000 (18:53 +0100)]
dt-bindings:net:wireless:mediatek,mt76: add disable-radar-offchan
Add the capability to disable/enable radar/CAC detection running on
a dedicated offchannel chain available on some hw.
Offchannel radar/CAC detection allows to avoid CAC downtime switching
on a different channel during CAC detection on the selected radar
channel.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 12 Jan 2022 17:53:54 +0000 (18:53 +0100)]
mt76: mt7915: enable radar background detection
Notify userland the hw supports background radar/CAC detection.
Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 12 Jan 2022 17:53:53 +0000 (18:53 +0100)]
mt76: mt7915: report radar pattern if detected by rdd2
Report radar pattern to mac80211 if detected by the
offchannel chain.
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 12 Jan 2022 17:53:52 +0000 (18:53 +0100)]
mt76: mt7915: introduce rdd_monitor debugfs node
Introduce rdd_monitor debugfs node in order to dump rdd2 configuration.
Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 12 Jan 2022 17:53:51 +0000 (18:53 +0100)]
mt76: mt7915: enable radar trigger on rdd2
Enable radar trigger for rdd2 in mt7915_radar_trigger.
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 12 Jan 2022 17:53:50 +0000 (18:53 +0100)]
mt76: mt7915: introduce mt7915_set_radar_background routine
Introduce mt7915_mcu_rdd_background_enable and
mt7915_mcu_background_chain_ctrl routines to configure rx dfs dedicated chain.
This is a preliminary patch to add zero-wait dfs support performing CAC
detection on rdd2.
Tested-by: Owen Peng <owen.peng@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Shayne Chen [Fri, 14 Jan 2022 09:49:11 +0000 (17:49 +0800)]
mt76: mt7915: set bssinfo/starec command when adding interface
bssinfo/starec disabled commands are sent during removing interface.
However, if we don't set corresponding enabled commands before
removing interface, the fw may enter an exception state due to
some NULL structs.
For example, the following commands can cause fw timeout in our newer
chips:
ifconfig wlan0/mon0 up
ifconfig wlan0/mon0 down
Fix this by setting enabled commands once interface added.
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Tue, 11 Jan 2022 09:34:17 +0000 (10:34 +0100)]
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>
Lorenzo Bianconi [Sun, 9 Jan 2022 17:56:57 +0000 (18:56 +0100)]
mt76: mt7921: fix endianness issues in mt7921_mcu_set_tx()
Fix the following sparse warning in mt7921_mcu_set_tx routine:
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:792:25: warning: incorrect type in assignment (different base types)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:792:25: expected restricted __le16 [usertype] aifs
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:792:25: got unsigned char [usertype] aifs
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:798:35: warning: incorrect type in assignment (different base types)
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:798:35: expected restricted __le16 [usertype] cw_min
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Sun, 9 Jan 2022 08:33:50 +0000 (16:33 +0800)]
mt76: sdio: disable interrupt in mt76s_sdio_irq
It is unnecessary to keep the interrupt enabled in mt76s_sdio_irq because
the driver is already aware of the interrupt, schedules the
mt76s_txrx_worker to handle the corresponding actions, and eventually,
the interrupt would be enabled again when mt76s_txrx_worker finishes its
work.
So we can safely disable the interrupt in mt76s_sdio_irq as soon as
possible to increase the CPU productivity by dropping the redundant
interrupt triggers.
Note that sdio lock acquired/released would be handled in sdio_irq_work
at mmc driver so we don't take care in mt76s_sdio_irq at function driver.
Co-developed-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Leon Yen <leon.yen@mediatek.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>
Ben Greear [Sat, 8 Jan 2022 19:08:14 +0000 (11:08 -0800)]
mt76: mt7921: fix crash when startup fails.
If the nic fails to start, it is possible that the
reset_work has already been scheduled. Ensure the
work item is canceled so we do not have use-after-free
crash in case cleanup is called before the work item
is executed.
This fixes crash on my x86_64 apu2 when mt7921k radio
fails to work. Radio still fails, but OS does not
crash.
Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Fri, 7 Jan 2022 07:30:03 +0000 (15:30 +0800)]
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>
Leon Yen [Thu, 6 Jan 2022 19:50:10 +0000 (03:50 +0800)]
mt76: mt7921s: fix mt7921s_mcu_[fw|drv]_pmctrl
According to the firmware behavior (even the oldest one in linux-firmware)
If the firmware is downloaded, MT7921S must rely on the additional mailbox
mechanism that resides in firmware to check if the device is the right
state for mt7921s_mcu_[fw|drv]_pmctrl. Otherwise, we still apply the old
way for that.
That is a necessary patch before we enable runtime pm for mt7921s as
default.
Fixes: 48fab5bbef40 ("mt76: mt7921: introduce mt7921s support")
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Leon Yen <leon.yen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Peter Chiu [Thu, 6 Jan 2022 06:20:57 +0000 (14:20 +0800)]
mt76: mt7921: fix ht mcs in mt7921_mac_add_txs_skb()
The mcs value of HT mode reported by mt7921_mac_add_txs_skb()
has already been converted to the expected format.
Fixes: 970ab80ef9f63 ("mt76: mt7921: report tx rate directly from tx status")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Peter Chiu [Thu, 6 Jan 2022 06:20:56 +0000 (14:20 +0800)]
mt76: mt7915: fix ht mcs in mt7915_mac_add_txs_skb()
The mcs value of HT mode reported by mt7915_mac_add_txs_skb()
has already been converted to the expected format.
Fixes: 9908d98ae72cd ("mt76: mt7915: report tx rate directly from tx status")
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 30 Dec 2021 20:47:06 +0000 (21:47 +0100)]
mt76: mt7615: fix a leftover race in runtime-pm
Fix a possible race in mt7615_pm_power_save_work() if rx/tx napi
schedules ps_work and we are currently accessing device register
on a different cpu.
Fixes: db928f1ab9789 ("mt76: mt7663: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx/rx napi")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 30 Dec 2021 20:47:05 +0000 (21:47 +0100)]
mt76: mt7921: fix a leftover race in runtime-pm
Fix a possible race in mt7921_pm_power_save_work() if rx/tx napi
schedules ps_work and we are currently accessing device register
on a different cpu.
Fixes: 1d8efc741df8 ("mt76: mt7921: introduce Runtime PM support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Fri, 31 Dec 2021 11:36:02 +0000 (12:36 +0100)]
mt76: mt7921: do not always disable fw runtime-pm
After commit '
d430dffbe9dd ("mt76: mt7921: fix a possible race
enabling/disabling runtime-pm")', runtime-pm is always disabled in the
fw even if the user requests to enable it toggling debugfs node since
mt7921_pm_interface_iter routine will use pm->enable to configure the fw.
Fix the issue moving enable variable configuration before running
mt7921_pm_interface_iter routine.
Fixes: d430dffbe9dd ("mt76: mt7921: fix a possible race enabling/disabling runtime-pm")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Sun, 26 Dec 2021 21:18:32 +0000 (22:18 +0100)]
mt76: mt7915: add support for passing chip/firmware debug data to user space
This can be used to assist in debugging driver or firmware tx/rx issues.
The data is streamed to user space using a relay file in debugfs
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Tue, 28 Dec 2021 14:33:57 +0000 (15:33 +0100)]
mt76: mt7615e: 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>
Felix Fietkau [Wed, 29 Dec 2021 11:21:46 +0000 (12:21 +0100)]
mt76: mt7915: update bss_info with cipher after setting the group key
In some cases, the WA firmware needs to know if encryption is used, in order
to set the protection bit of packets
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Wed, 29 Dec 2021 11:21:00 +0000 (12:21 +0100)]
mt76: mt7615: update bss_info with cipher after setting the group key
In some cases, the WA firmware needs to know if encryption is used, in order
to set the protection bit of packets
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Wed, 29 Dec 2021 11:19:37 +0000 (12:19 +0100)]
mt76: connac: add support for passing the cipher field in bss_info
Initialize it from a field in struct mt76_vif
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Tue, 28 Dec 2021 12:01:19 +0000 (13:01 +0100)]
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>
Lorenzo Bianconi [Mon, 27 Dec 2021 13:08:52 +0000 (14:08 +0100)]
mt76: mt7615: fix a possible race enabling/disabling runtime-pm
Similar to mt7921 driver, fix a possible race enabling/disabling
runtime-pm between mt7615_pm_set() and mt7615_poll_rx().
mt7615_pm_wake_work() always schedules rx-napi callback and it will
trigger mt7615_pm_power_save_work routine putting the chip in low-power
state even if we are disabling runtime-pm deferring the actual chip wake
at the next access.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Fri, 24 Dec 2021 08:33:56 +0000 (16:33 +0800)]
mt76: mt7921: set EDCA parameters with the MCU CE command
The command MCU_EXT_CMD_EDCA_UPDATE is not fully supported by the MT7921
firmware, so we apply CE command MCU_CE_CMD_SET_EDCA_PARAMS instead which
is supported even in the oldest firmware to properly set up EDCA parameters
for each AC.
Fixes: 1c099ab44727 ("mt76: mt7921: add MCU support")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Fri, 24 Dec 2021 08:33:55 +0000 (16:33 +0800)]
mt76: mt76_connac: fix MCU_CE_CMD_SET_ROC definition error
Fixed an MCU_CE_CMD_SET_ROC definition error that occurred from a previous
refactor work.
Fixes: d0e274af2f2e4 ("mt76: mt76_connac: create mcu library")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
YN Chen [Fri, 24 Dec 2021 08:32:49 +0000 (16:32 +0800)]
mt76: mt7921: forbid the doze mode when coredump is in progress
We forbid the doze mode while the collecting core dump is going because
that doesn't make sense and the firmware possibly stays in the abnormal
state where cannot handle the doze request from the driver anymore until
the WiFi reset procedure is completed.
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Fri, 24 Dec 2021 08:32:48 +0000 (16:32 +0800)]
mt76: mt7921e: make dev->fw_assert usage consistent
Clear dev->fw_assert flag in mt7921s to be consistent with mt7921s driver.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:11 +0000 (11:58 +0100)]
mt76: connac: move mt76_connac_mcu_rdd_cmd in mt76-connac module
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>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:10 +0000 (11:58 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_set_rts_thresh
Rely on mt76_connac_mcu_set_rts_thresh routine in mt7915 driver and
remove duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:09 +0000 (11:58 +0100)]
mt76: connac: move mt76_connac_mcu_gen_dl_mode in mt76-connac module
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>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:08 +0000 (11:58 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_init_download
Rely on mt76_connac_mcu_init_download routine in mt7915 driver and
remove duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:07 +0000 (11:58 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_patch_sem_ctrl/mt76_connac_mcu_start_patch
Rely on mt76_connac_mcu_patch_sem_ctrl/mt76_connac_mcu_start_patch
routine in mt7915 driver and remove duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:06 +0000 (11:58 +0100)]
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>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:05 +0000 (11:58 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_start_firmware
Rely on mt76_connac_mcu_start_firmware and remove duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:04 +0000 (11:58 +0100)]
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>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:03 +0000 (11:58 +0100)]
mt76: connac: move mt76_connac_mcu_set_pm in connac module
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>
Lorenzo Bianconi [Fri, 24 Dec 2021 10:58:02 +0000 (11:58 +0100)]
mt76: connac: introduce is_connac_v1 utility routine
Introduce is_connac_v1 inline utility routine to check if the device is
generation v1.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:42 +0000 (13:07 +0100)]
mt76: connac: move mt76_connac_mcu_wtbl_update_hdr_trans in connac module
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>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:41 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_wtbl_hdr_trans_tlv
Rely on mt76_connac_mcu_wtbl_hdr_trans_tlv routine and
remove duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:40 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_wtbl_ht_tlv
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>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:39 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_wtbl_smps_tlv
Rely on mt76_connac_mcu_wtbl_smps_tlv routine in mt7915
and remove duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:38 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_sta_uapsd
Rely on mt76_connac_mcu_sta_uapsd routine in mt7915 and remove
duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:37 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_sta_basic_tlv
Rely on mt76_connac_mcu_sta_basic_tlv routine in mt7915 and remove
duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:36 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_wtbl_generic_tlv
Rely on mt76_connac_mcu_wtbl_generic_tlv routine in mt7915 and remove
duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:35 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_sta_ba
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>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:34 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_wtbl_ba_tlv
Rely on mt76_connac_mcu_wtbl_ba_tlv routine in mt7915 and remove
duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:33 +0000 (13:07 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_sta_ba_tlv
Rely on mt76_connac_mcu_sta_ba_tlv routine in mt7915 and remove
duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:32 +0000 (13:07 +0100)]
mt76: connac: move mt76_connac_mcu_bss_basic_tlv in connac module
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>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:31 +0000 (13:07 +0100)]
mt76: connac: move mt76_connac_mcu_bss_ext_tlv in connac module
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>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:30 +0000 (13:07 +0100)]
mt76: connac: move mt76_connac_mcu_bss_omac_tlv in connac module
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>
Lorenzo Bianconi [Thu, 23 Dec 2021 12:07:29 +0000 (13:07 +0100)]
mt76: mt7915: remove duplicated defs in mcu.h
Remove duplicated definitions in mt7915/mcu.h
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Wed, 22 Dec 2021 22:00:47 +0000 (23:00 +0100)]
mt76: mt7915: move pci specific code back to pci.c
This avoids the need to check for the device type in mmio.c and makes the code
cleaner
Signed-off-by: Felix Fietkau <nbd@nbd.name>
YN Chen [Wed, 22 Dec 2021 05:58:18 +0000 (13:58 +0800)]
mt76: mt7921s: update mt7921s_wfsys_reset sequence
MT7921S firmware expects driver to clear out the firmware download state
before FW is downloaded again in WiFi reset procedure.
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Wed, 22 Dec 2021 05:58:17 +0000 (13:58 +0800)]
mt76: mt7921s: clear MT76_STATE_MCU_RUNNING immediately after reset
clear the flag MT76_STATE_MCU_RUNNING immediately after reset to indicate
the MCU has already stopped working at the point. That is a preliminary
patch for the following patch to perform the register access in the
remaining reset handler using SDIO mailbox way instead of MCU command
because the RAM firmware is cleared out.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Sean Wang [Wed, 22 Dec 2021 05:56:28 +0000 (13:56 +0800)]
mt76: sdio: lock sdio when it is needed
Acquire the SDIO as needed as possible because either MT7663S or MT7921S
is a multiple-function device that always includes Bluetooth that would
share with the same SDIO bus. So not to avoid breaking Bluetooth pairing,
audio, and HID such kind of time critical application on that, we only
lock sdio bus when it is necessary in WiFi driver.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 22 Dec 2021 16:06:36 +0000 (17:06 +0100)]
mt76: mt7915: use proper aid value in mt7915_mcu_sta_basic_tlv
Similar to mt7915_mcu_wtbl_generic_tlv, rely on vif->bss_conf.aid for
aid in sta mode and not on sta->aid.
Fixes: e57b7901469fc ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Wed, 22 Dec 2021 11:52:17 +0000 (12:52 +0100)]
mt76: mt7915: use proper aid value in mt7915_mcu_wtbl_generic_tlv in sta mode
mac80211 provides aid in vif->bss_conf.aid for sta mode and not in
sta->aid. Fix mt7915_mcu_wtbl_generic_tlv routine using proper value for
aid in sta mode.
Fixes: e57b7901469fc ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Tue, 21 Dec 2021 08:25:57 +0000 (09:25 +0100)]
mt76: make mt76_sar_capa static
Fix the following sparse warning:
drivers/net/wireless/mediatek/mt76/mac80211.c:183:32:
warning: symbol 'mt76_sar_capa' was not declared. Should it be static?
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:18:04 +0000 (10:18 +0800)]
mt76: mt7915: add device id for mt7916
Add pci_device_id to enable mt7916. Note that MT_HW_CHIPID is no
longer used for further chips, so drop it accordingly.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Wed, 22 Dec 2021 12:29:16 +0000 (20:29 +0800)]
mt76: set wlan_idx_hi on mt7916
Since mt7916 supports up to 544 wcid entries, wlan_idx_hi needs to be set
in order to support wcid index >= 256
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sun, 19 Dec 2021 17:40:14 +0000 (18:40 +0100)]
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>
Lorenzo Bianconi [Sun, 19 Dec 2021 17:40:13 +0000 (18:40 +0100)]
mt76: mt7915: rely on mt76_connac_get_phy utilities
Rely on mt76_connac_get_phy_mode and mt76_connac_get_he_phy_cap utility
routines in mt7915 driver and remove duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sun, 19 Dec 2021 17:40:12 +0000 (18:40 +0100)]
mt76: connac: move mt76_connac_chan_bw in common code
Move mt76_connac_chan_bw in mt76-connac code and remove
duplicated code from mt7921 and mt7915 driver.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sun, 19 Dec 2021 17:40:11 +0000 (18:40 +0100)]
mt76: connac: move mt76_connac_mcu_get_cipher in common code
Move mt76_connac_mcu_get_cipher in mt76-connac code and remove
duplicated code from mt7921 and mt7915 driver.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sun, 19 Dec 2021 17:40:10 +0000 (18:40 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_add_tlv routine
Rely on common code available in mt76-connac module and remove
mt7915_mcu_add_tlv/mt7915_mcu_add_nested_tlv in mt7915 driver.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sun, 19 Dec 2021 17:40:09 +0000 (18:40 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_alloc_wtbl_req
Rely on mt76_connac_mcu_alloc_wtbl_req routine and remove
duplicated code.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sun, 19 Dec 2021 17:40:08 +0000 (18:40 +0100)]
mt76: mt7915: rely on mt76_connac_mcu_alloc_sta_req
Rely on mt76_connac_mcu_alloc_sta_req routine and remove
duplicated code.
Add MT76_CONNAC_LIB module dependency in mt7915 module
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Lorenzo Bianconi [Sun, 19 Dec 2021 17:40:06 +0000 (18:40 +0100)]
mt76: connac: fix sta_rec_wtbl tag len
Similar to mt7915 driver, fix tag len error for sta_rec_wtbl, which
causes fw parsing error for the tags placed behind it.
Fixes: d0e274af2f2e4 ("mt76: mt76_connac: create mcu library")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:18:03 +0000 (10:18 +0800)]
mt76: mt7915: add mt7916 calibrated data support
Adjust proper eeprom size and add default calibrated data support
for mt7916.
Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:18:02 +0000 (10:18 +0800)]
mt76: mt7915: update mt7915_chan_mib_offs for mt7916
Update v2 offset. This is an intermediate patch to add mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:18:01 +0000 (10:18 +0800)]
mt76: mt7915: update rx rate reporting for mt7916
mt7916 reports rx rate from rxd group3 directly.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:18:00 +0000 (10:18 +0800)]
mt76: mt7915: add txfree event v3
Update txfree v3 format.
This is an intermediate patch to add mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:17:59 +0000 (10:17 +0800)]
mt76: mt7915: enlarge wcid size to 544
The mt7916 can support up to 544 wcid entries.
This is an intermediate patch to add mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:17:58 +0000 (10:17 +0800)]
mt76: mt7915: rework eeprom.c to adapt mt7916 changes
This is an intermediate patch to add mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:17:57 +0000 (10:17 +0800)]
mt76: mt7915: add firmware support for mt7916
Update firmware initialization for mt7916.
This is an intermediate patch to add mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:17:56 +0000 (10:17 +0800)]
mt76: mt7915: rework dma.c to adapt mt7916 changes
The RXQ of mt7916 are separated to MT_RXQ_MAIN_WA and MT_RXQ_MCU_WA,
so, add initialization and preftech setting for the queue MT_RXQ_MAIN_WA.
This is an intermediate patch to add mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:17:55 +0000 (10:17 +0800)]
mt76: add MT_RXQ_MAIN_WA for mt7916
mt7916 add MT_RXQ_MAIN_WA to receive tx free event separately
This is an intermediate patch to add mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:17:54 +0000 (10:17 +0800)]
mt76: mt7915: refine register definition
Add mt7915_reg_desc to differentiate chip generations.
This is an intermediate patch to introduce mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bo Jiao [Mon, 20 Dec 2021 02:17:53 +0000 (10:17 +0800)]
mt76: mt7915: add mt7915_mmio_probe() as a common probing function
Add mt7915_mmio_probe() which will be used for the upcoming devices.
This is an intermediate patch to add mt7916 support.
Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Mon, 23 Nov 2020 13:06:50 +0000 (14:06 +0100)]
mt76: mt7915: fix polling firmware-own status
Check the register status bit instead of the trigger bit
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Hector Martin [Mon, 31 Jan 2022 16:07:13 +0000 (01:07 +0900)]
brcmfmac: pcie: Read the console on init and shutdown
This allows us to get console messages if the firmware crashed during
early init, or if an operation failed and we're about to shut down.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-10-marcan@marcan.st
Hector Martin [Mon, 31 Jan 2022 16:07:12 +0000 (01:07 +0900)]
brcmfmac: fwil: Constify iovar name arguments
Make all the iovar name arguments const char * instead of just char *.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-9-marcan@marcan.st
Hector Martin [Mon, 31 Jan 2022 16:07:11 +0000 (01:07 +0900)]
brcmfmac: of: Use devm_kstrdup for board_type & check for errors
This was missing a NULL check, and we can collapse the strlen/alloc/copy
into a devm_kstrdup().
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-8-marcan@marcan.st
Hector Martin [Mon, 31 Jan 2022 16:07:10 +0000 (01:07 +0900)]
brcmfmac: pcie: Fix crashes due to early IRQs
The driver was enabling IRQs before the message processing was
initialized. This could cause IRQs to come in too early and crash the
driver. Instead, move the IRQ enable and hostready to a bus preinit
function, at which point everything is properly initialized.
Fixes: 9e37f045d5e7 ("brcmfmac: Adding PCIe bus layer support.")
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-7-marcan@marcan.st