OSDN Git Service

uclinux-h8/linux.git
4 years agortw88: no need to set registers for SDIO
Kevin Lo [Fri, 15 May 2020 06:11:53 +0000 (14:11 +0800)]
rtw88: no need to set registers for SDIO

There's no need to set SDIO related registers when powering up/down the chip.

Signed-off-by: Kevin Lo <kevlo@kevlo.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200515061153.GA15714@ns.kevlo.org
4 years agortw88: 8723d: fix incorrect setting of ldo_pwr
Colin Ian King [Thu, 14 May 2020 18:13:29 +0000 (19:13 +0100)]
rtw88: 8723d: fix incorrect setting of ldo_pwr

Currently ldo_pwr has the LDO25 voltage bits set to zero and then
it is overwritten with the new voltage setting. The assignment
looks incorrect, it should be bit-wise or'ing in the new voltage
setting rather than a direct assignment.

Addresses-Coverity: ("Unused value")
Fixes: 1afb5eb7a00d ("rtw88: 8723d: Add cfg_ldo25 to control LDO25")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200514181329.16292-1-colin.king@canonical.com
4 years agortw88: rename rtw88.ko/rtwpci.ko to rtw88_core.ko/rtw88_pci.ko
Yan-Hsuan Chuang [Fri, 15 May 2020 05:23:27 +0000 (13:23 +0800)]
rtw88: rename rtw88.ko/rtwpci.ko to rtw88_core.ko/rtw88_pci.ko

Rename the name of the kernel module for rtw88's core and pci.
Add proper prefix 'rtw88_' to easily recognize them, also can
avoid confusion with other drivers. (ex. r8822be in staging)

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200515052327.31874-8-yhchuang@realtek.com
4 years agortw88: extract: remove the unused after extracting
Zong-Zhe Yang [Fri, 15 May 2020 05:23:26 +0000 (13:23 +0800)]
rtw88: extract: remove the unused after extracting

remove the unused about pci after extracting chip modules

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200515052327.31874-7-yhchuang@realtek.com
4 years agortw88: extract: make 8723d an individual kernel module
Zong-Zhe Yang [Fri, 15 May 2020 05:23:25 +0000 (13:23 +0800)]
rtw88: extract: make 8723d an individual kernel module

Make objects about 8723d functions and 8723d tables,
i.e. rtw8723d.o and rtw8723d_table.o, an individual
kernel module called rtw88_8723d.ko.

For 8723d pcie chip, i.e. 8723DE chip, add a chip
entry point module called rtw88_8723de.ko which
will depend on rtw88_8723d.ko and rtwpci.ko.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200515052327.31874-6-yhchuang@realtek.com
4 years agortw88: extract: make 8822b an individual kernel module
Zong-Zhe Yang [Fri, 15 May 2020 05:23:24 +0000 (13:23 +0800)]
rtw88: extract: make 8822b an individual kernel module

Make objects about 8822b functions and 8822b tables,
i.e. rtw8822b.o and rtw8822b_table.o, an individual
kernel module called rtw88_8822b.ko.

For 8822b pcie chip, i.e. 8822BE chip, add a chip
entry point module called rtw88_8822be.ko which
will depend on rtw88_8822b.ko and rtwpci.ko.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200515052327.31874-5-yhchuang@realtek.com
4 years agortw88: extract: make 8822c an individual kernel module
Zong-Zhe Yang [Fri, 15 May 2020 05:23:23 +0000 (13:23 +0800)]
rtw88: extract: make 8822c an individual kernel module

Make objects about 8822c functions and 8822c tables,
i.e. rtw8822c.o and rtw8822c_table.o, an individual
kernel module called rtw88_8822c.ko.

For 8822c pcie chip, i.e. 8822CE chip, add a chip
entry point module called rtw88_8822ce.ko which
will depend on rtw88_8822c.ko and rtwpci.ko.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200515052327.31874-4-yhchuang@realtek.com
4 years agortw88: extract: export symbols about pci interface
Zong-Zhe Yang [Fri, 15 May 2020 05:23:22 +0000 (13:23 +0800)]
rtw88: extract: export symbols about pci interface

In the current design, chip entry points are built into
the pci module. That makes the pci module depend on chips.
According to dependence, once the pci module is loaded,
kernel will load chip functionalities, including those that
may not be currently used.

We plan to split chip entry points from the pci module.
Thence we export pci symbols that will be used in chip
entry point modules.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200515052327.31874-3-yhchuang@realtek.com
4 years agortw88: extract: export symbols used in chip functionalities
Zong-Zhe Yang [Fri, 15 May 2020 05:23:21 +0000 (13:23 +0800)]
rtw88: extract: export symbols used in chip functionalities

In the current design, various chip functions and tables
are built into rtw88 core. That causes kernel to load its
functionalities even if a chip isn't currently used. We
plan to make each chip's functionalities a separate
kernel module to reduce rtw88 core. And kernel will be
able to load the necessary.

Before extracting chip functionalities, we export symbols
inside rtw88 core which will be used in chip modules.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200515052327.31874-2-yhchuang@realtek.com
4 years agortlwifi: Fix a double free in _rtl_usb_tx_urb_setup()
Dan Carpenter [Wed, 13 May 2020 09:39:51 +0000 (12:39 +0300)]
rtlwifi: Fix a double free in _rtl_usb_tx_urb_setup()

Seven years ago we tried to fix a leak but actually introduced a double
free instead.  It was an understandable mistake because the code was a
bit confusing and the free was done in the wrong place.  The "skb"
pointer is freed in both _rtl_usb_tx_urb_setup() and _rtl_usb_transmit().
The free belongs _rtl_usb_transmit() instead of _rtl_usb_tx_urb_setup()
and I've cleaned the code up a bit to hopefully make it more clear.

Fixes: 36ef0b473fbf ("rtlwifi: usb: add missing freeing of skbuff")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200513093951.GD347693@mwanda
4 years agoMerge tag 'mt76-for-kvalo-2020-05-14' of https://github.com/nbd168/wireless
Kalle Valo [Mon, 18 May 2020 12:03:37 +0000 (15:03 +0300)]
Merge tag 'mt76-for-kvalo-2020-05-14' of https://github.com/nbd168/wireless

mt76 patches for 5.8

* new devices for mt76x0/mt76x2
* mt7615 fixes
* mt7663 fixes
* support for non-offload firmware on mt7663
* hw/sched scan support for mt7663
* mt7615/mt7663 MSI support
* TDLS support
* mt7603/mt7615 rate control fixes
* new driver for mt7915
* wowlan support for mt7663
* suspend/resume support for mt7663

# gpg: Signature made Thu 14 May 2020 01:10:07 PM EEST using DSA key ID 02A76EF5
# gpg: Good signature from "Felix Fietkau <nbd@nbd.name>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 75D1 1A7D 91A7 710F 4900  42EF D77D 141D 02A7 6EF5

4 years agomt76: mt7615: fix typo defining ps work
Lorenzo Bianconi [Wed, 13 May 2020 13:53:04 +0000 (15:53 +0200)]
mt76: mt7615: fix typo defining ps work

Fix typo defining ps_work in mt7615_register_ext_phy(). This is not a
real issue since 802.11 power save is not yet support by the external phy

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: configure bss info adding the interface
Sean Wang [Tue, 12 May 2020 20:02:50 +0000 (22:02 +0200)]
mt76: mt7615: configure bss info adding the interface

Introduce essential bss information for multiple vifs hw_scan in
mt7615_mcu_uni_add_dev adding the interface

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: enable p2p support
Lorenzo Bianconi [Tue, 12 May 2020 20:02:49 +0000 (22:02 +0200)]
mt76: enable p2p support

Introduce p2p-go/p2p-client suppor to mt76 driver

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: reduce hw scan timeout
Lorenzo Bianconi [Tue, 12 May 2020 20:02:48 +0000 (22:02 +0200)]
mt76: mt7615: reduce hw scan timeout

Differentiate hw scan channel time between passive and active scan

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: do not report scan_complete twice to mac80211
Lorenzo Bianconi [Tue, 12 May 2020 20:02:47 +0000 (22:02 +0200)]
mt76: mt7615: do not report scan_complete twice to mac80211

Fix the following kernel warning that occurs if scan work is scheduled
and the hw scan has been cancelled by mac80211

WARNING: CPU: 1 PID: 502 at net/mac80211/scan.c:391 __ieee80211_scan_completed+0x299/0x690
Modules linked in:
CPU: 1 PID: 502 Comm: kworker/u4:4 Not tainted 5.7.0-rc1+ #2882
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
Workqueue: phy0 ieee80211_scan_work
RIP: 0010:__ieee80211_scan_completed+0x299/0x690
RSP: 0018:ffffc9000036fda8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 8c6318c6318c6320
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: ffff88803bb129b8
RBP: ffff88803bb10d80 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: ffff88803bb12ae8
FS:  0000000000000000(0000) GS:ffff88803ec00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f13ee5c1470 CR3: 000000003c790000 CR4: 00000000000006a0
Call Trace:
 ieee80211_scan_work+0x170/0x850
 ? sched_clock_cpu+0x11/0xb0
 process_one_work+0x24f/0x580
 ? worker_thread+0xcc/0x3e0
 worker_thread+0x4f/0x3e0
 ? process_one_work+0x580/0x580
 kthread+0x11b/0x140
 ? __kthread_bind_mask+0x60/0x60
 ret_from_fork+0x3a/0x50
irq event stamp: 9255532
hardirqs last  enabled at (9255531): [<ffffffff81a504e4>] _raw_spin_unlock_irq+0x24/0x30
hardirqs last disabled at (9255532): [<ffffffff81001b3f>] trace_hardirqs_off_thunk+0x1a/0x1c
softirqs last  enabled at (9255526): [<ffffffff8107c9ef>] process_one_work+0x24f/0x580
softirqs last disabled at (9255524): [<ffffffff815f2f41>] mt7615_scan_work+0x91/0xc0

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: fix the usage WoW with net detect support
Sean Wang [Tue, 12 May 2020 19:39:13 +0000 (21:39 +0200)]
mt76: mt7663: fix the usage WoW with net detect support

mt7615_mcu_sched_scan_enable should be taken along with
mt7615_mcu_sched_scan_req to have proper scan plans initialization.

Fixes: bd39bd2f00c3 ("mt76: mt7663: introduce WoW with net detect support")
Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agoMerge tag 'iwlwifi-next-for-kalle-2020-05-08' of git://git.kernel.org/pub/scm/linux...
Kalle Valo [Wed, 13 May 2020 16:10:08 +0000 (19:10 +0300)]
Merge tag 'iwlwifi-next-for-kalle-2020-05-08' of git://git./linux/kernel/git/iwlwifi/iwlwifi-next

Second set of iwlwifi patches intended for v5.8

* Support new FW APIs;
* Remove some old and unused features;
* HW configuration rework continues;
* Some queues rework by Johannes;
* Enable A-AMSDU in low  latency;
* Some debugging fixes;
* Some other small fixes and clean-ups;

# gpg: Signature made Fri 08 May 2020 10:08:58 AM EEST using RSA key ID 1A3CC5FA
# gpg: Good signature from "Luciano Roth Coelho (Luca) <luca@coelho.fi>"
# gpg:                 aka "Luciano Roth Coelho (Intel) <luciano.coelho@intel.com>"

4 years agortl8187: Remove unused variable rtl8225z2_tx_power_ofdm
ChenTao [Wed, 13 May 2020 01:17:54 +0000 (09:17 +0800)]
rtl8187: Remove unused variable rtl8225z2_tx_power_ofdm

Fix the following warning:

drivers/net/wireless/realtek/rtl818x/rtl8187/rtl8225.c:609:17: warning:
‘rtl8225z2_tx_power_ofdm’ defined but not used
 static const u8 rtl8225z2_tx_power_ofdm[] = {

Acked-by: Hin-Tak Leung <htl10@users.sourceforge.net>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: ChenTao <chentao107@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200513011754.28432-1-chentao107@huawei.com
4 years agortw88: 8723d: fix sparse warnings for power tracking
Yan-Hsuan Chuang [Tue, 12 May 2020 10:35:34 +0000 (18:35 +0800)]
rtw88: 8723d: fix sparse warnings for power tracking

sparse warnings: (new ones prefixed by >>)

>> drivers/net/wireless/realtek/rtw88/rtw8723d.c:1899:6: sparse: sparse:
symbol 'rtw8723d_pwr_track' was not declared. Should it be static?

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512103534.5889-1-yhchuang@realtek.com
4 years agortw88: 8723d: Add 8723DE to Kconfig and Makefile
Ping-Ke Shih [Tue, 12 May 2020 10:26:21 +0000 (18:26 +0800)]
rtw88: 8723d: Add 8723DE to Kconfig and Makefile

Since 8723D code is ready, we can build it.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-10-yhchuang@realtek.com
4 years agortw88: fill zeros to words 0x06 and 0x07 of security cam entry
Ping-Ke Shih [Tue, 12 May 2020 10:26:20 +0000 (18:26 +0800)]
rtw88: fill zeros to words 0x06 and 0x07 of security cam entry

8723D adds some experimental features to word 0x06 of cam entry, so fill
zeros to initialize them to off state. For existing chips, these two words
are reserved and always zeros, so this change is harmless for them.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-9-yhchuang@realtek.com
4 years agortw88: 8723d: Add coex support
Ping-Ke Shih [Tue, 12 May 2020 10:26:19 +0000 (18:26 +0800)]
rtw88: 8723d: Add coex support

8723D is a Wifi+BT combo card. To make them work properly, we need coex
mechanism to avoid interference, such as TX simultaneously. Basically,
coex.c provide main algorithm to deal with many use cases, and this commit
adds some parameters and ops differ from other chips, because coex
hardware and WiFi generation are changed.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-8-yhchuang@realtek.com
4 years agortw88: 8723d: set ltecoex register address in chip_info
Ping-Ke Shih [Tue, 12 May 2020 10:26:18 +0000 (18:26 +0800)]
rtw88: 8723d: set ltecoex register address in chip_info

Since 8723D use different address of ltecoex register, this commit add a
new field in chip_info and fill proper address. Then, ltecoex_read_reg()
and ltecoex_reg_write() can use them to access ltecoex according to chip.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-7-yhchuang@realtek.com
4 years agortw88: 8723d: implement flush queue
Ping-Ke Shih [Tue, 12 May 2020 10:26:17 +0000 (18:26 +0800)]
rtw88: 8723d: implement flush queue

Flush queue is used to check if queue is empty, before doing something
else. Since 8723D uses different registers and page number of
availabl/reserved occupy 8 bits instead of 16 bits, so use a 'wsize' field
to discriminate which rtw_read{8,16} is adopted.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-6-yhchuang@realtek.com
4 years agortw88: 8723d: Add shutdown callback to disable BT USB suspend
Ping-Ke Shih [Tue, 12 May 2020 10:26:16 +0000 (18:26 +0800)]
rtw88: 8723d: Add shutdown callback to disable BT USB suspend

Without this patch, wifi card can't initialize properly due to BT in USB
suspend state. So, we disable BT USB suspend (wakeup) in shutdown callback
that is the moment before rebooting. To save BT USB power, we can't do this
in 'remove' callback.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-5-yhchuang@realtek.com
4 years agortw88: 8723d: Add power tracking
Ping-Ke Shih [Tue, 12 May 2020 10:26:15 +0000 (18:26 +0800)]
rtw88: 8723d: Add power tracking

When chip's temperature is changed, RF characters are changed. To keep the
characters to be consistent, 8723d uses thermal meter to assist in
calibrating LCK, IQK, crystal and TX power.

A base thermal value is programmed in efuse, all calibration data in
MP process is based on this thermal value. So we calucate the delta of
thermal value between the base value, and use this delta to reference XTAL
and TX power offset tables to know how much we need to adjust.

For IQK and LCK, driver checks if delta of thermal value is over 8, then
they are triggered.

For crystal adjustment, when delta of thermal value is changed, we check
XTAL tables to get offset of XTAL value. If thermal value is larger than
base value, positive table (_p as suffix) is used. Otherwise, we use
negative table (_n as suffix). Then, we add offset to XTAL default value
programmed in efuse, and write sum value to register.

To compensate TX power, there are two hierarchical tables. First level use
delta of thermal value to access eight tables to yield delta of TX power
index. Then, plus base TX power index to get index of BB swing table
(second level tables) where register value is induced.

BB swing table can't deal with all cases, if index of BB swing table is
over the size of the table. In this case, TX AGC is used to compensate the
remnant part. Assume 'upper' is the upper bound of BB swing table, and
'target' is the desired index. Then, we can illustrate them as

  compensation method    BB swing        TX AGC
  -------------------    --------    --------------
  target > upper         upper       target - upper
  target < 0             0           target
  otherwise              target      0

For debug purpose, add a column 'rem' to tx_pwr_tbl entry, and it looks
like

  path rate       pwr       base      (byr  lmt ) rem
    A  CCK_1M     32(0x20)   34   -2 (   0   -2)    0

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-4-yhchuang@realtek.com
4 years agortw88: 8723d: add IQ calibration
Ping-Ke Shih [Tue, 12 May 2020 10:26:14 +0000 (18:26 +0800)]
rtw88: 8723d: add IQ calibration

IQ calibration is used to calibrate RF characteristic to yield expected
performance. Basically, we do calibration twice and compare the similarity
to determine calibration is good or not, if not we do the third
calibration, and then compare with the results of first and second
calibration. If it still not similar, IQK is failed.

Before doing calibration, we need to backup registers that will be
modified in calibration procedure, and restore these registers after
calibration is done.

A calibration procedure can divided into four sub-procedures that are
S1-TX, S1-RX, S0-TX and S0-RX. Where, S1 and S0 represent to path A and B
respectively. Each sub-procedure configure proper registers, and then
rigger one-shot calibration and poll until completion. For RX calibration,
it needs to do twice one-shot calibration, first one is to yield parameter
used by second one.

The result of TX part is stored for TX power tracking that adjusts TX AGC
to output expected power.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-3-yhchuang@realtek.com
4 years agortw88: 8723d: Add LC calibration
Ping-Ke Shih [Tue, 12 May 2020 10:26:13 +0000 (18:26 +0800)]
rtw88: 8723d: Add LC calibration

LC calibration is done by hardware circuit. Driver sets the LCK bit to kick
start, and then poll the bit to check if it's done.

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200512102621.5148-2-yhchuang@realtek.com
4 years agobrcmfmac: fix WPA/WPA2-PSK 4-way handshake offload and SAE offload failures
Chung-Hsien Hsu [Tue, 12 May 2020 10:03:08 +0000 (05:03 -0500)]
brcmfmac: fix WPA/WPA2-PSK 4-way handshake offload and SAE offload failures

An incorrect value of use_fwsup is set for 4-way handshake offload for
WPA//WPA2-PSK, caused by commit 3b1e0a7bdfee ("brcmfmac: add support for
SAE authentication offload"). It results in missing bit
BRCMF_VIF_STATUS_EAP_SUCCESS set in brcmf_is_linkup() and causes the
failure. This patch correct the value for the case.

Also setting bit BRCMF_VIF_STATUS_EAP_SUCCESS for SAE offload case in
brcmf_is_linkup() to fix SAE offload failure.

Fixes: 3b1e0a7bdfee ("brcmfmac: add support for SAE authentication offload")
Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1589277788-119966-1-git-send-email-chi-hsien.lin@cypress.com
4 years agomt76: mt7915: fix possible deadlock in mt7915_stop
Ryder Lee [Mon, 11 May 2020 16:06:38 +0000 (00:06 +0800)]
mt76: mt7915: fix possible deadlock in mt7915_stop

make mac_work per phy instead of per device and fix a possible deadlock
in mt7915_stop since mt7915_mac_work runs holding mt76 mutex

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: allocate proper size for tlv tags
Ryder Lee [Mon, 11 May 2020 16:06:37 +0000 (00:06 +0800)]
mt76: mt7915: allocate proper size for tlv tags

Allocating proper memory size according to tlv usage.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add debugfs to track TxBF status
Ryder Lee [Mon, 11 May 2020 16:06:36 +0000 (00:06 +0800)]
mt76: mt7915: add debugfs to track TxBF status

Add debug counters to track status of beamformer and beamformee.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add TxBF capabilities
Ryder Lee [Mon, 11 May 2020 16:06:35 +0000 (00:06 +0800)]
mt76: mt7915: add TxBF capabilities

This allows to set HE TxBF runtime stream capabilities

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add Tx beamformee support
Ryder Lee [Mon, 11 May 2020 16:06:34 +0000 (00:06 +0800)]
mt76: mt7915: add Tx beamformee support

Enable beamformee support.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add Tx beamformer support
Ryder Lee [Mon, 11 May 2020 16:06:33 +0000 (00:06 +0800)]
mt76: mt7915: add Tx beamformer support

Enable TxBF modules and trigger sounding process to support Tx beamformer.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: introduce mt7915_get_he_phy_cap
Ryder Lee [Mon, 11 May 2020 16:06:32 +0000 (00:06 +0800)]
mt76: mt7915: introduce mt7915_get_he_phy_cap

Add a helper to reduce duplicate codes.
This is a preliminary patch to add Tx beamforming support.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: usb: cancel ps work stopping the vif
Lorenzo Bianconi [Sat, 9 May 2020 21:40:05 +0000 (23:40 +0200)]
mt76: mt7615: usb: cancel ps work stopping the vif

Cancel possible power_save work before stopping the mt7663u interface

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663u: add missing register definitions
Lorenzo Bianconi [Sat, 9 May 2020 21:38:35 +0000 (23:38 +0200)]
mt76: mt7663u: add missing register definitions

Add missing PLE/PSE base register definitions for mt7663u

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663u: copy key pointer in mt7663u_mac_write_txwi
Lorenzo Bianconi [Fri, 8 May 2020 16:26:29 +0000 (18:26 +0200)]
mt76: mt7663u: copy key pointer in mt7663u_mac_write_txwi

Copy key pointer value before running mt76_tx_status_skb_add() in
mt7663u_mac_write_txwi since it will be overwritten setting
mt76_tx_cb for probing frames

Co-developed-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: set runtime stream caps by mt76_phy
Ryder Lee [Fri, 24 Apr 2020 19:32:39 +0000 (03:32 +0800)]
mt76: set runtime stream caps by mt76_phy

This patch can support concurrent dual-band operation.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: enable firmware module debug support
Ryder Lee [Fri, 24 Apr 2020 19:32:38 +0000 (03:32 +0800)]
mt76: mt7915: enable firmware module debug support

This allows host driver to get useful information of some important modules.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Chih-Min Chen <chih-min.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add tsf related callbacks
Ryder Lee [Fri, 24 Apr 2020 19:32:37 +0000 (03:32 +0800)]
mt76: mt7915: add tsf related callbacks

It is useful for IBSS Mesh to adjust t_clockdrift.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Reported-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: set peer Tx fixed rate through debugfs
Ryder Lee [Fri, 24 Apr 2020 19:32:36 +0000 (03:32 +0800)]
mt76: mt7915: set peer Tx fixed rate through debugfs

Driver can manually set fixed rate for each peer through debugfs.

May use .set_bitrate_mask callback and iterate stations under the
current vif to achieve the aim once it supports HE rate.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add .sta_statistics support
Ryder Lee [Fri, 24 Apr 2020 19:32:35 +0000 (03:32 +0800)]
mt76: mt7915: add .sta_statistics support

Add useful debug counters since this generation uses struct rate_info
to report HE tx rate.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add .sta_add_debugfs support
Ryder Lee [Fri, 24 Apr 2020 19:32:34 +0000 (03:32 +0800)]
mt76: mt7915: add .sta_add_debugfs support

This generation supports much more per-peer statistics than legacy ones,
so add .sta_add_debugfs accordingly.

This is convenient to set/get more settings/counters in the long run.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add Rx radiotap header support
Ryder Lee [Fri, 24 Apr 2020 19:32:33 +0000 (03:32 +0800)]
mt76: mt7915: add Rx radiotap header support

mac80211 expects the definition of what HE rate info is available
inside astruct prepended to the skb.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add HE capabilities support for peers
Ryder Lee [Fri, 24 Apr 2020 19:32:32 +0000 (03:32 +0800)]
mt76: mt7915: add HE capabilities support for peers

Set peer's bsic HE capabilities through starec.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Suggested-by: Shihwei Lin <shihwei.lin@mediatek.com>
Tested-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Chih-Min Chen <chih-min.chen@mediatek.com>
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Acked-by: Yiwei Chung <yiwei.chung@mediatek.com>
Acked-by: YF Luo <yf.luo@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: add HE bss_conf support for interfaces
Ryder Lee [Fri, 24 Apr 2020 19:32:31 +0000 (03:32 +0800)]
mt76: mt7915: add HE bss_conf support for interfaces

Add basic HE BSS's info for interfaces. As for the advanced features
will be added gradually in the future patches.
(i.e. BSS color, TWT, spatial reuse and OFDMA)

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Shayne Chen <shayne.chen@mediatek.com>
Tested-by: Chih-Min Chen <chih-min.chen@mediatek.com>
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Acked-by: Yiwei Chung <yiwei.chung@mediatek.com>
Acked-by: YF Luo <yf.luo@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: register per-phy HE capabilities for each interface
Ryder Lee [Fri, 24 Apr 2020 19:32:30 +0000 (03:32 +0800)]
mt76: mt7915: register per-phy HE capabilities for each interface

The capabilities for the HE interfaces are generated from the capabilities
reported by the firmware.

This should move to common file once we got other HE devices support.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: implement HE per-rate tx power support
Ryder Lee [Fri, 24 Apr 2020 19:32:29 +0000 (03:32 +0800)]
mt76: mt7915: implement HE per-rate tx power support

Use firmware support for applying per-rate limit and power offsets.
This can support all HE RU types.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Tested-by: Chih-Min Chen <chih-min.chen@mediatek.com>
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Acked-by: Yiwei Chung <yiwei.chung@mediatek.com>
Acked-by: YF Luo <yf.luo@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7915: enable Rx HE rate reporting
Ryder Lee [Fri, 24 Apr 2020 19:32:28 +0000 (03:32 +0800)]
mt76: mt7915: enable Rx HE rate reporting

Enable HE rate reporting in Rx path

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add mac80211 driver for MT7915 PCIe-based chipsets
Ryder Lee [Fri, 24 Apr 2020 19:32:27 +0000 (03:32 +0800)]
mt76: add mac80211 driver for MT7915 PCIe-based chipsets

Add support for the MediaTek latest generation IEEE 802.11ax 4x4
device MT7915E, which supports concurrent dual-band operation at
both 5GHz and 2.4GHz.

Note that this patch just add basic part and will add more HE
capabilities support in the further patches.

The driver supports AP, Station, Mesh and monitor mode.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Chih-Min Chen <chih-min.chen@mediatek.com>
Suggested-by: Shihwei Lin <shihwei.lin@mediatek.com>
Tested-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Acked-by: Yiwei Chung <yiwei.chung@mediatek.com>
Acked-by: YF Luo <yf.luo@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add HE phy modes and hardware queue
Ryder Lee [Fri, 24 Apr 2020 19:32:26 +0000 (03:32 +0800)]
mt76: add HE phy modes and hardware queue

This is a preliminary patch to support 11ax deivces.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: adjust wcid size to support new 802.11ax generation
Ryder Lee [Fri, 24 Apr 2020 19:32:25 +0000 (03:32 +0800)]
mt76: adjust wcid size to support new 802.11ax generation

The newer 802.11ax devices (i.e. MT7915E) can connect to much more
peers than previous generations.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add Rx stats support for radiotap
Ryder Lee [Fri, 24 Apr 2020 19:32:24 +0000 (03:32 +0800)]
mt76: add Rx stats support for radiotap

HE deivces need to add Rx radiotap header.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: add support for HE RX rate reporting
Ryder Lee [Fri, 24 Apr 2020 19:32:23 +0000 (03:32 +0800)]
mt76: add support for HE RX rate reporting

Add support for encoding and reporting HE RX rates.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: avoid rx reorder buffer overflow
Ryder Lee [Fri, 24 Apr 2020 19:32:22 +0000 (03:32 +0800)]
mt76: avoid rx reorder buffer overflow

Enlarge slot to support 11ax 256 BA (256 MPDUs in an AMPDU)

Signed-off-by: Chih-Min Chen <chih-min.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: scan all channels if not specified
Lorenzo Bianconi [Wed, 6 May 2020 09:58:32 +0000 (11:58 +0200)]
mt76: mt7615: scan all channels if not specified

Configure the mcu to scan all available channels if mac80211 does not
provide any frequency list

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: add support to sched scan with randomise addr
Sean Wang [Wed, 6 May 2020 09:55:42 +0000 (11:55 +0200)]
mt76: mt7663: add support to sched scan with randomise addr

Add support to sched scan with randomise addr

Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: introduce WoW with net detect support
Sean Wang [Wed, 6 May 2020 09:53:35 +0000 (11:53 +0200)]
mt76: mt7663: introduce WoW with net detect support

Introduce WoW with net detect support

Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix delta tx power for mt7663
Lorenzo Bianconi [Sun, 3 May 2020 15:30:53 +0000 (17:30 +0200)]
mt76: mt7615: fix delta tx power for mt7663

Fix mt7663 eeprom definitions for delta tx power parsing

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: fix target power parsing
Lorenzo Bianconi [Sun, 3 May 2020 15:23:54 +0000 (17:23 +0200)]
mt76: mt7663: fix target power parsing

Fix target parsing from eeprom/efuse partition for 7663 chipsets

Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix ibss mode for mt7663
Lorenzo Bianconi [Sat, 2 May 2020 16:00:41 +0000 (18:00 +0200)]
mt76: mt7615: fix ibss mode for mt7663

Fix the following kernel warning adding an adhoc interface to a
mt7663e device

[  233.363394] WARNING: CPU: 0 PID: 2345 at drivers/net/wireless/mt76/mt7615/mcu.c:1449 mt7615_mcu_uni_add_bss+0x15f/0x24e [mt7615_common]
[  233.363432] CPU: 0 PID: 2345 Comm: iw Tainted: G        W       4.14.171 #12
[  233.363434] Hardware name: HP Meep/Meep, BIOS Google_Meep.11297.75.0 06/17/2019
[  233.363436] task: ffff9a1a4020e3c0 task.stack: ffffb9124113c000
[  233.363441] RIP: 0010:mt7615_mcu_uni_add_bss+0x15f/0x24e [mt7615_common]
[  233.363443] RSP: 0018:ffffb9124113f730 EFLAGS: 00010246
[  233.363446] RAX: 0000000000000024 RBX: ffff9a1a788c74e8 RCX: 41826d413aea9200
[  233.363448] RDX: 0000000000000007 RSI: 0000000000000006 RDI: ffff9a1a7fc15418
[  233.363450] RBP: ffffb9124113f7c0 R08: 0000000000000356 R09: 00000000ffff0a10
[  233.363452] R10: 0000001000000000 R11: ffffffff93f2a4be R12: 0000000000000000
[  233.363454] R13: ffff9a1a7383bd48 R14: ffffb9124113f77a R15: 0000000000000000
[  233.363456] FS:  00007f203314ab80(0000) GS:ffff9a1a7fc00000(0000) knlGS:0000000000000000
[  233.363458] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  233.363460] CR2: 00005a13d647c950 CR3: 0000000171238000 CR4: 00000000003406f0
[  233.363462] Call Trace:
[  233.363470]  mt7615_bss_info_changed+0x98/0xf4 [mt7615_common]
[  233.363484]  ieee80211_bss_info_change_notify+0x139/0x1d4 [mt76_mac80211]
[  233.363496]  ieee80211_ibss_disconnect+0x183/0x1bb [mt76_mac80211]
[  233.363507]  ieee80211_ibss_leave+0x14/0xa0 [mt76_mac80211]
[  233.363519]  __cfg80211_leave_ibss+0xa6/0x13a [cfg80211]
[  233.363528]  cfg80211_netdev_notifier_call+0x8b/0x631 [cfg80211]
[  233.363535]  ? packet_notifier+0x196/0x1a3
[  233.363540]  raw_notifier_call_chain+0x39/0x58
[  233.363544]  __dev_close_many+0x6b/0xf0
[  233.363548]  dev_close_many+0x62/0xe8
[  233.363552]  ? _raw_spin_unlock_irq+0xe/0x21
[  233.363555]  rollback_registered_many+0xf6/0x35c
[  233.363560]  ? __rcu_read_unlock+0x4a/0x4a
[  233.363563]  unregister_netdevice_queue+0x7f/0x105
[  233.363573]  ieee80211_del_iface+0x12/0x16 [mt76_mac80211]
[  233.363582]  nl80211_del_interface+0xa8/0x124 [cfg80211]
[  233.363588]  genl_rcv_msg+0x40b/0x481
[  233.363592]  ? genl_unbind+0xb8/0xb8
[  233.363595]  netlink_rcv_skb+0x85/0xf8
[  233.363598]  genl_rcv+0x28/0x36
[  233.363601]  netlink_unicast+0x165/0x1f8
[  233.363604]  netlink_sendmsg+0x35f/0x3a6
[  233.363608]  sock_sendmsg+0x38/0x48
[  233.363611]  ___sys_sendmsg+0x1bf/0x267
[  233.363615]  ? __inode_wait_for_writeback+0x72/0xd7
[  233.363619]  ? dentry_kill+0x69/0x76
[  233.363622]  ? dput+0xd1/0x170
[  233.363624]  __sys_sendmsg+0x52/0x8f
[  233.363628]  do_syscall_64+0x6b/0xf7
[  233.363632]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[  233.363635] RIP: 0033:0x7f2032ca1264
[  233.363637] RSP: 002b:00007ffec3668e38 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
[  233.363639] RAX: ffffffffffffffda RBX: 000058f7175e7880 RCX: 00007f2032ca1264
[  233.363641] RDX: 0000000000000000 RSI: 00007ffec3668e98 RDI: 0000000000000003
[  233.363643] RBP: 00007ffec3668e70 R08: 0000000000000001 R09: 00007f2032ce1fd0
[  233.363645] R10: 000058f7175e2010 R11: 0000000000000246 R12: 000058f7175e7740
[  233.363646] R13: 00007ffec3668ff0 R14: 000058f7175e2350 R15: 00007ffec3668e98

Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: check return value of mt7615_eeprom_get_power_index
Lorenzo Bianconi [Fri, 1 May 2020 23:16:10 +0000 (01:16 +0200)]
mt76: mt7615: check return value of mt7615_eeprom_get_power_index

mt7615_eeprom_get_power_index can return negative error value.
Check mt7615_eeprom_get_power_index return value before using it

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: read tx streams from eeprom
Lorenzo Bianconi [Fri, 1 May 2020 23:13:11 +0000 (01:13 +0200)]
mt76: mt7663: read tx streams from eeprom

Read tx stream configuration from eeprom/efuse

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: introduce beacon_loss mcu event
Lorenzo Bianconi [Fri, 1 May 2020 10:36:17 +0000 (12:36 +0200)]
mt76: mt7615: introduce beacon_loss mcu event

If device has enabled beacon hw filter rx beacons are not reported to
the host. Introduce beacon_loss mcu event to trigger mac80211 mlme
connection state machine in this configuration.
IEEE80211_VIF_BEACON_FILTER has not set in vif flags since hw beacon
filter is not enabled yet

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add gtk rekey offload support
Lorenzo Bianconi [Fri, 1 May 2020 10:36:16 +0000 (12:36 +0200)]
mt76: mt7615: add gtk rekey offload support

Add KCK and KEK offload support to mt7615 driver in order to
support GTK rekeying during PM suspend

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: introduce PM support
Lorenzo Bianconi [Fri, 1 May 2020 10:36:15 +0000 (12:36 +0200)]
mt76: mt7615: introduce PM support

Introduce suspend/resume to mt7615e driver

Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663u: introduce suspend/resume to mt7663u
Sean Wang [Fri, 1 May 2020 10:36:14 +0000 (12:36 +0200)]
mt76: mt7663u: introduce suspend/resume to mt7663u

Tested on Chromebok by "echo mem to /sys/power/state" to suspend and
then waked up by keyboard keystrokes to resume system.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add WoW support
Lorenzo Bianconi [Fri, 1 May 2020 10:36:13 +0000 (12:36 +0200)]
mt76: mt7615: add WoW support

Introduce WoW support to mt7615 driver.
Current supported trigger are:
- magic-packet
- disconnect
- user-pattern

Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: introduce mt7615_mcu_set_hif_suspend mcu command
Sean Wang [Fri, 1 May 2020 10:36:12 +0000 (12:36 +0200)]
mt76: mt7615: introduce mt7615_mcu_set_hif_suspend mcu command

Introduce the mt7615_mcu_set_hif_suspend mcu command, which is usually
used to configure the interface including PCIe, USB or SDIO to the right
state during operation suspend / resume.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: introduce support for hardware beacon filter
Lorenzo Bianconi [Fri, 1 May 2020 10:36:11 +0000 (12:36 +0200)]
mt76: mt7615: introduce support for hardware beacon filter

Introduce support for hw beacon filter if available in the firmware

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: free pci_vector if mt7615_pci_probe fails
Lorenzo Bianconi [Thu, 30 Apr 2020 20:31:03 +0000 (22:31 +0200)]
mt76: mt7615: free pci_vector if mt7615_pci_probe fails

Always free pci irq vector if mt7615_pci_probe routine fails
Moreover free irq in mt7615_pci_remove routine

Co-developed-by: Soul Huang <sean.wang@mediatek.com>
Signed-off-by: Soul Huang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add passive mode for hw scan
Lorenzo Bianconi [Thu, 30 Apr 2020 09:11:34 +0000 (11:11 +0200)]
mt76: mt7615: add passive mode for hw scan

Introduce support for passive frequency scanning to mt7615_mcu_hw_scan

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: do not mark sched_scan disabled in mt7615_scan_work
Lorenzo Bianconi [Thu, 30 Apr 2020 07:59:31 +0000 (09:59 +0200)]
mt76: mt7615: do not mark sched_scan disabled in mt7615_scan_work

For the moment offload firmware supports just one entry in the scheduled
scan plan and so it runs till it is disabled by the userspace.
Do not mark the hw scheduled scan as disabled in mt7615_scan_work
after receiving a scan result

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: introduce mt7615_check_offload_capability routine
Lorenzo Bianconi [Wed, 29 Apr 2020 17:52:15 +0000 (19:52 +0200)]
mt76: mt7615: introduce mt7615_check_offload_capability routine

Introduce mt7615_check_offload_capability routine to set hw/wiphy
offload capabilities according to the running firmware

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix ssid configuration in mt7615_mcu_hw_scan
Lorenzo Bianconi [Wed, 29 Apr 2020 17:48:53 +0000 (19:48 +0200)]
mt76: mt7615: fix ssid configuration in mt7615_mcu_hw_scan

Fix SSID configuration performing hw frequency scanning

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: remove duplicate error message
Dejin Zheng [Tue, 28 Apr 2020 14:31:52 +0000 (22:31 +0800)]
mt76: mt7603: remove duplicate error message

it will print an error message by itself when
devm_platform_ioremap_resource() goes wrong. so remove the duplicate
error message.

Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix getting maximum tx power from eeprom
Felix Fietkau [Wed, 29 Apr 2020 12:34:23 +0000 (14:34 +0200)]
mt76: mt7615: fix getting maximum tx power from eeprom

On top of the EEPROM target power, each rate can also has a power offset.
On many devices, this power offset is used to boost the tx power of lower
rates. Take this into account when parsing rate power.
The assumption here is, that the first rate (OFDM 6M or CCK 1M) has the
highest tx power

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: set spatial extension index
Felix Fietkau [Mon, 27 Apr 2020 17:45:02 +0000 (19:45 +0200)]
mt76: mt7615: set spatial extension index

The vendor driver sets this in firmware rate control (which we don't use)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: remove check in mt7663_load_n9
Lorenzo Bianconi [Sun, 26 Apr 2020 14:42:52 +0000 (16:42 +0200)]
mt76: mt7663: remove check in mt7663_load_n9

Get rid of useless check in mt7663_load_n9 since it is used only for
mt7663 devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: add the possibility to load firmware v2
Lorenzo Bianconi [Tue, 28 Apr 2020 13:34:09 +0000 (15:34 +0200)]
mt76: mt7663: add the possibility to load firmware v2

mt7663 firmware v2 is used for embedded devices since it has more completed
features in AP mode.
Add the capability to specify which firmware load first (v3 or v2)
using prefer_offload_fw kernel parameter and fallback to the other one
if the selected firmware fails to load

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt76x0: enable MCS 8 and MCS9
Lorenzo Bianconi [Sat, 25 Apr 2020 12:11:09 +0000 (14:11 +0200)]
mt76: mt76x0: enable MCS 8 and MCS9

Enable MCS8 and MCS9 for mt76x0{u,e} devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix event report in mt7615_mcu_bss_event
Lorenzo Bianconi [Fri, 24 Apr 2020 12:51:29 +0000 (14:51 +0200)]
mt76: mt7615: fix event report in mt7615_mcu_bss_event

Currently mt7663 devices do not support DBDC so fw events have no info
about it. Fix mt7615_mcu_bss_event that wrongly use bss_idx as DBDC
band_idx while it is vif index.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: add sta pointer to mt7615_mcu_add_bss_info signature
Lorenzo Bianconi [Thu, 23 Apr 2020 13:47:55 +0000 (15:47 +0200)]
mt76: mt7615: add sta pointer to mt7615_mcu_add_bss_info signature

Introduce sta pointer to mt7615_mcu_add_bss_info signature in order to
avoid sta lookup in mt7615_mcu_bss_basic_tlv routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663: fix up BMC entry indicated to unicmd firmware
Sean Wang [Thu, 23 Apr 2020 13:47:54 +0000 (15:47 +0200)]
mt76: mt7663: fix up BMC entry indicated to unicmd firmware

BMC entry for MT7663 unicmd firmware should be a broadcast/multicast entry,
not a unicast entry, that is GTK rekey offload would rely on.

Fixes: 138860679b2a ("mt76: mt7615: add more uni mcu commands")
Cc: Soul Huang <Soul.Huang@mediatek.com>
Suggested-by: YF Luo <Yf.Luo@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: enable TDLS support
Lorenzo Bianconi [Wed, 22 Apr 2020 16:29:32 +0000 (18:29 +0200)]
mt76: enable TDLS support

Enable mac80211 TDLS support by default. Disable TDLS hw filtering for
mt7615 devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: move mcu bss upload before creating the sta
Lorenzo Bianconi [Wed, 22 Apr 2020 11:07:44 +0000 (13:07 +0200)]
mt76: mt7615: move mcu bss upload before creating the sta

Run mt7615_mcu_add_bss_info routine before mt7615_mcu_sta_add since
the firmware requires the bss is created before the relative sta

Tested-by: Sean Wang <sean.wang@mediatek.com>
Suggested-by: YF Luo <yf.luo@mediatek.com>
Suggested-by: Lucy Hsu <lucy.hsu@mediatek.com>
Co-developed-by: Soul Huang <soul.huang@mediatek.com>
Signed-off-by: Soul Huang <soul.huang@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: fix tx status rate index calculation
Felix Fietkau [Wed, 22 Apr 2020 11:15:06 +0000 (13:15 +0200)]
mt76: mt7603: fix tx status rate index calculation

A switch from one rate index to the next only happens when tx count from
the current slot is greater than MT7615_RATE_RETRY, which is 1 has to be
subtracted from count, instead of added to it.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix tx status rate index calculation
Felix Fietkau [Wed, 22 Apr 2020 11:10:00 +0000 (13:10 +0200)]
mt76: mt7615: fix tx status rate index calculation

A switch from one rate index to the next only happens when tx count from
the current slot is greater than MT7615_RATE_RETRY, which is 1 has to be
subtracted from count, instead of added to it.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: do not adjust MAC timings if the device is not running
Felix Fietkau [Wed, 22 Apr 2020 10:32:10 +0000 (12:32 +0200)]
mt76: mt7615: do not adjust MAC timings if the device is not running

Avoids register writes and MAC start/stop when the hardware isn't ready for it

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: adjust timing in mt7615_mac_set_timing to match fw/hw values
Felix Fietkau [Wed, 22 Apr 2020 10:28:19 +0000 (12:28 +0200)]
mt76: mt7615: adjust timing in mt7615_mac_set_timing to match fw/hw values

Slightly improves performance

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7603: never use an 802.11b CF-End rate on 5GHz
Felix Fietkau [Wed, 22 Apr 2020 15:46:58 +0000 (17:46 +0200)]
mt76: mt7603: never use an 802.11b CF-End rate on 5GHz

Sometimes mt7615_mac_set_timing gets called while the slot time is still
configured to 20. Ensure that in this case it always uses the OFDM CFend
rate.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: never use an 802.11b CF-End rate on 5GHz
Felix Fietkau [Wed, 22 Apr 2020 10:25:54 +0000 (12:25 +0200)]
mt76: mt7615: never use an 802.11b CF-End rate on 5GHz

Sometimes mt7615_mac_set_timing gets called while the slot time is still
configured to 20. Ensure that in this case it always uses the OFDM CFend
rate.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: use larger rx buffers if VHT is supported
Felix Fietkau [Mon, 20 Apr 2020 14:53:28 +0000 (16:53 +0200)]
mt76: mt7615: use larger rx buffers if VHT is supported

In VHT mode we can receive larger MPDUs. Increasing the buffer size reduces
fragmentation here, which should improve performance.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: fix A-MPDU density handling
Felix Fietkau [Mon, 20 Apr 2020 14:34:16 +0000 (16:34 +0200)]
mt76: fix A-MPDU density handling

The hardware requirements for A-MPDU density are entirely on the tx side,
not the rx side. Because of that, the IE value should stay at 0 and the
minimum value should instead be enforced in WTBL/TXWI

MT7615 has no restrictions here

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: fix sta ampdu factor for VHT
Felix Fietkau [Mon, 20 Apr 2020 13:49:35 +0000 (15:49 +0200)]
mt76: mt7615: fix sta ampdu factor for VHT

If VHT has a larger A-MPDU size limit, pass it to the MCU via the wtbl_ht
TLV element.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7663u: enable AirTimeFairness
Lorenzo Bianconi [Wed, 22 Apr 2020 08:47:24 +0000 (10:47 +0200)]
mt76: mt7663u: enable AirTimeFairness

Initialize tx_status_data pointer in order to enable Air Time Fairness
for mt7663u chipset

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
4 years agomt76: mt7615: rework mt7615_mac_sta_poll for usb code
Lorenzo Bianconi [Wed, 22 Apr 2020 08:47:23 +0000 (10:47 +0200)]
mt76: mt7615: rework mt7615_mac_sta_poll for usb code

Since usb code can't access device registers in interrupt context, move
rcu_read_lock/rcu_read_unlock in mt7615_poll_tx routine. Moreover loop
over a local msta list in mt7615_mac_sta_poll since mt7663u driver will
not be able to complete the inner while loop before sta_poll_list list
is refilled by mt7615_mac_add_txs/mt7615_mac_fill_rx

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