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
Hector Martin [Mon, 31 Jan 2022 16:07:09 +0000 (01:07 +0900)]
brcmfmac: pcie: Replace brcmf_pcie_copy_mem_todev with memcpy_toio
The alignment check was wrong (e.g. & 4 instead of & 3), and the logic
was also inefficient if the length was not a multiple of 4, since it
would needlessly fall back to copying the entire buffer bytewise.
We already have a perfectly good memcpy_toio function, so just call that
instead of rolling our own copy logic here. brcmf_pcie_init_ringbuffers
was already using it anyway.
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>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-6-marcan@marcan.st
Hector Martin [Mon, 31 Jan 2022 16:07:08 +0000 (01:07 +0900)]
brcmfmac: pcie: Declare missing firmware files in pcie.c
Move one of the declarations from sdio.c to pcie.c, since it makes no
sense in the former (SDIO support is optional), and add missing ones.
Fixes:
75729e110e68 ("brcmfmac: expose firmware config files through modinfo")
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>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220131160713.245637-5-marcan@marcan.st
Hector Martin [Mon, 31 Jan 2022 16:07:06 +0000 (01:07 +0900)]
brcmfmac: firmware: Allocate space for default boardrev in nvram
If boardrev is missing from the NVRAM we add a default one, but this
might need more space in the output buffer than was allocated. Ensure
we have enough padding for this in the buffer.
Fixes:
46f2b38a91b0 ("brcmfmac: insert default boardrev in nvram data if missing")
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-3-marcan@marcan.st
Hector Martin [Mon, 31 Jan 2022 16:07:05 +0000 (01:07 +0900)]
brcmfmac: pcie: Release firmwares in the brcmf_pcie_setup error path
This avoids leaking memory if brcmf_chip_get_raminfo fails. Note that
the CLM blob is released in the device remove path.
Fixes:
82f93cf46d60 ("brcmfmac: get chip's default RAM info during PCIe setup")
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-2-marcan@marcan.st
Colin Ian King [Sun, 30 Jan 2022 22:37:14 +0000 (22:37 +0000)]
rtlwifi: remove redundant initialization of variable ul_encalgo
Variable ul_encalgo is initialized with a value that is never read,
it is being re-assigned a new value in every case in the following
switch statement. The initialization is redundant and can be removed.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220130223714.6999-1-colin.i.king@gmail.com
Yang Guang [Fri, 14 Jan 2022 00:11:02 +0000 (08:11 +0800)]
ssb: fix boolreturn.cocci warning
The coccinelle report
./include/linux/ssb/ssb_driver_gige.h:98:8-9:
WARNING: return of 0/1 in function
'ssb_gige_must_flush_posted_writes' with return type bool
Return statements in functions returning bool should use true/false
instead of 1/0.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/fa4f1fa737e715eb62a85229ac5f12bae21145cf.1642065490.git.davidcomponentone@gmail.com
Jiasheng Jiang [Thu, 30 Dec 2021 02:29:26 +0000 (10:29 +0800)]
ray_cs: Check ioremap return value
As the possible failure of the ioremap(), the 'local->sram' and other
two could be NULL.
Therefore it should be better to check it in order to avoid the later
dev_dbg.
Fixes:
1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211230022926.1846757-1-jiasheng@iscas.ac.cn
Colin Ian King [Sun, 9 Jan 2022 23:09:21 +0000 (23:09 +0000)]
cw1200: wsm: make array queue_id_to_wmm_aci static const
Don't populate the read-only array queue_id_to_wmm_aci on the stack
but instead make it static. Also makes the object code a little smaller.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220109230921.58766-1-colin.i.king@gmail.com
Changcheng Deng [Wed, 22 Dec 2021 07:08:15 +0000 (07:08 +0000)]
wilc1000: use min_t() to make code cleaner
Use min_t() in order to make code cleaner.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@zte.com.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211222070815.483009-1-deng.changcheng@zte.com.cn
Ping-Ke Shih [Fri, 7 Jan 2022 02:47:39 +0000 (20:47 -0600)]
rtw88: rtw8821c: enable rfe 6 devices
Ping-Ke Shih answered[1] a question for a user about an rtl8821ce device that
reported RFE 6, which the driver did not support. Ping-Ke suggested a possible
fix, but the user never reported back.
A second user discovered the above thread and tested the proposed fix.
Accordingly, I am pushing this change, even though I am not the author.
[1] https://lore.kernel.org/linux-wireless/
3f5e2f6eac344316b5dd518ebfea2f95@realtek.com/
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Reported-and-tested-by: masterzorag <masterzorag@gmail.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220107024739.20967-1-Larry.Finger@lwfinger.net
Po-Hao Huang [Fri, 21 Jan 2022 07:08:13 +0000 (15:08 +0800)]
rtw88: fix memory overrun and memory leak during hw_scan
Previously we allocated less memory than actual required, overwrite
to the buffer causes the mm module to complaint and raise access
violation faults. Along with potential memory leaks when returned
early. Fix these by passing the correct size and proper deinit flow.
Fixes:
10d162b2ed39 ("rtw88: 8822c: add ieee80211_ops::hw_scan")
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220121070813.9656-4-pkshih@realtek.com
Po-Hao Huang [Fri, 21 Jan 2022 07:08:12 +0000 (15:08 +0800)]
rtw88: fix idle mode flow for hw scan
Upon hw scan completion, idle mode is not re-entered. This might
increase power consumption under no link mode. Fix this by adding the
re-enter flow. We need another work for this since enter_ips waits
for c2h_work to finish, which might lead to deadlock if caller is in
the same work.
Fixes:
10d162b2ed39 ("rtw88: 8822c: add ieee80211_ops::hw_scan")
Signed-off-by: Po-Hao Huang <phhuang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220121070813.9656-3-pkshih@realtek.com
Muhammad Usama Anjum [Fri, 21 Jan 2022 07:08:11 +0000 (15:08 +0800)]
rtw88: check for validity before using a pointer
ieee80211_probereq_get() can return NULL. Pointer skb should be checked
for validty before use. If it is not valid, list of skbs needs to be
freed.
Fixes:
10d162b2ed39 ("rtw88: 8822c: add ieee80211_ops::hw_scan")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220121070813.9656-2-pkshih@realtek.com
Soontak Lee [Wed, 29 Dec 2021 03:51:44 +0000 (21:51 -0600)]
brcmfmac: add CYW43570 PCIE device
CYW43570 is a 3-antenna, 2x2 MIMO,802.11a/b/g/n/ac, PCIe 3.0 for WLAN.
It is BT/WIFI combo.
Signed-off-by: Soontak Lee <soontak.lee@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@infineon.com>
Signed-off-by: Ian Lin <ian.lin-ee@infineon.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211229035144.9205-1-ian.lin-ee@infineon.com
Hans de Goede [Sat, 18 Dec 2021 18:56:43 +0000 (19:56 +0100)]
brcmfmac: use ISO3166 country code and 0 rev as fallback on some devices
This is a second attempt at honering the country code send out by access
points. This was first added in commit
b0b524f079a2 ("brcmfmac: use
ISO3166 country code and 0 rev as fallback").
Subsequently this was reverted in commit
151a7c12c4fc ("Revert "brcmfmac:
use ISO3166 country code and 0 rev as fallback""), because it was causing
issues with AP mode on some brcmfmac models (specifically on BCM4359/9).
Many devices ship with a nvram ccode value of X2/XT/XU/XV/ALL which are
all special world-wide compatibility ccode-s. Most of these world-wide
ccode-s allow passive scan mode only for 2.4GHz channels 12-14,
only enabling them when an AP is seen on them.
But at least on brcmfmac43455 devices this is not working correctly, these
do not see accesspoints on channels 12-14 unless the ccode is changes to
a country where these channels are allowed.
Translating received country codes to an ISO3166 country code and 0 rev
ccreq fixes devices using a brcmfmac43455 with a X2/XT/XU/XV/ALL ccode
not seeing accesspoints on channels 12-14.
To avoid this causing issues on other brcmfmac models again, the
fallback is limited to only brcmfmac4345* chips this time.
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Soeren Moch <smoch@web.de>
Cc: Fabio Aiuto <fabioaiuto83@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Soeren Moch <smoch@web.de> # on BCM4359/9
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211218185643.158182-1-hdegoede@redhat.com
Chin-Yen Lee [Fri, 21 Jan 2022 07:55:55 +0000 (15:55 +0800)]
rtw89: use pci_read/write_config instead of dbi read/write
In the past we use dbi function of wifi mac to read/write
pci config space, but the function will be remove in new
chip. So use kernel api pci_read/write_config_byte instead.
Signed-off-by: Chin-Yen Lee <timlee@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220121075555.12457-2-pkshih@realtek.com
Johnson Lin [Fri, 21 Jan 2022 07:55:54 +0000 (15:55 +0800)]
rtw89: refine DIG feature to support 160M and CCK PD
DIG, which is short for dynamic initial gain, is used to adjust gain to get
good RX performance. CCK PD feature, a mechanism that adjusts 802.11b CCK
packet detection(PD) power threshold based on environment noisy level in
order to avoid false alarm. Also, refine related variable naming.
Signed-off-by: Johnson Lin <johnson.lin@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220121075555.12457-1-pkshih@realtek.com
Íñigo Huguet [Thu, 13 Jan 2022 09:42:53 +0000 (10:42 +0100)]
rtw89: fix maybe uninitialized `qempty` variable
Call to dle_dfi_qempty might fail, leaving qempty.qempty untouched, which
is latter used to control the for loop. If that happens, it's not
initialized anywhere.
Initialize it so the loop doesn't iterate unless it's modified by the
call to dle_dfi_qempty.
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220113094253.73370-1-ihuguet@redhat.com
Zong-Zhe Yang [Thu, 13 Jan 2022 01:10:42 +0000 (09:10 +0800)]
rtw89: include subband type in channel params
Make stuffs related to channel be collected in channel_params,
and encapsulate the corresponding decision in get_channel_params().
Then, functions that takes channel_params can also notice subband type.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220113011042.6705-2-pkshih@realtek.com
Zong-Zhe Yang [Thu, 13 Jan 2022 01:10:41 +0000 (09:10 +0800)]
rtw89: handle 6G band if supported by a chipset
For next chipset which can support 6G band, we add the handling
of ieee80211_supported_band for 6G band in advance. And a bitmap,
support_bands, is added to rtw89_chip_info to declare which
NL80211_BAND_* are supported. With the chipset's declaration,
we register the corresponding instances of ieee80211_supported_band
with wiphy.
Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220113011042.6705-1-pkshih@realtek.com