summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt76x0
AgeCommit message (Collapse)Author
2024-02-08wifi: mac80211: simplify non-chanctx driversJohannes Berg
There are still surprisingly many non-chanctx drivers, but in mac80211 that code is a bit awkward. Simplify this by having those drivers assign 'emulated' ops, so that the mac80211 code can be more unified between non-chanctx/chanctx drivers. This cuts the number of places caring about it by about 15, which are scattered across - now they're fewer and no longer in the channel context handling. Link: https://msgid.link/20240129194108.6d0ead50f5cf.I60d093b2fc81ca1853925a4d0ac3a2337d5baa5b@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-01-31wifi: fill in MODULE_DESCRIPTION()s for mt76 driversBreno Leitao
W=1 builds now warn if module is built without a MODULE_DESCRIPTION(). Add descriptions to the MediaTek mt76 drivers. Here is a sorted list of descriptions. It might make the reviewing process easier. MODULE_DESCRIPTION("MediaTek MT7603E and MT76x8 wireless driver"); MODULE_DESCRIPTION("MediaTek MT7615E and MT7663E wireless driver"); MODULE_DESCRIPTION("MediaTek MT7615E MMIO helpers"); MODULE_DESCRIPTION("MediaTek MT7663 SDIO/USB helpers"); MODULE_DESCRIPTION("MediaTek MT7663S (SDIO) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7663U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x02 helpers"); MODULE_DESCRIPTION("MediaTek MT76x02 MCU helpers"); MODULE_DESCRIPTION("MediaTek MT76x0E (PCIe) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x0U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x2 EEPROM helpers"); MODULE_DESCRIPTION("MediaTek MT76x2E (PCIe) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x2U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT76x connac layer helpers"); MODULE_DESCRIPTION("MediaTek MT76x EEPROM helpers"); MODULE_DESCRIPTION("MediaTek MT76x helpers"); MODULE_DESCRIPTION("MediaTek MT76x SDIO helpers"); MODULE_DESCRIPTION("MediaTek MT76x USB helpers"); MODULE_DESCRIPTION("MediaTek MT7915E MMIO helpers"); MODULE_DESCRIPTION("MediaTek MT7921 core driver"); MODULE_DESCRIPTION("MediaTek MT7921E (PCIe) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7921S (SDIO) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7921U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7925 core driver"); MODULE_DESCRIPTION("MediaTek MT7925E (PCIe) wireless driver"); MODULE_DESCRIPTION("MediaTek MT7925U (USB) wireless driver"); MODULE_DESCRIPTION("MediaTek MT792x core driver"); MODULE_DESCRIPTION("MediaTek MT792x USB helpers"); MODULE_DESCRIPTION("MediaTek MT7996 MMIO helpers"); Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://msgid.link/20240130104243.3025393-10-leitao@debian.org
2023-08-25Fix nomenclature for USB and PCI wireless devicesAlan Stern
A mouse that uses a USB connection is called a "USB mouse" device (or "USB mouse" for short), not a "mouse USB" device. By analogy, a WiFi adapter that connects to the host computer via USB is a "USB wireless" device, not a "wireless USB" device. (The latter term more properly refers to a defunct Wireless USB specification, which described a technology for sending USB protocol messages over an ultra wideband radio link.) Similarly for a WiFi adapter card that plugs into a PCIe slot: It is a "PCIe wireless" device, not a "wireless PCIe" device. Rephrase the text in the kernel source where the word ordering is wrong. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://lore.kernel.org/r/57da7c80-0e48-41b5-8427-884a02648f55@rowland.harvard.edu
2023-02-03wifi: mt76: mt76x0u: report firmware version through ethtoolLorenzo Bianconi
Run mt76x02_set_ethtool_fwver utility routine in mt76x0u_load_firmware() in order to report firmware version through ethtool Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-09wifi: mt76: mt76x0: fix oob access in mt76x0_phy_get_target_powerLorenzo Bianconi
After 'commit ba45841ca5eb ("wifi: mt76: mt76x02: simplify struct mt76x02_rate_power")', mt76x02 relies on ht[0-7] rate_power data for vht mcs{0,7}, while it uses vth[0-1] rate_power for vht mcs {8,9}. Fix a possible out-of-bound access in mt76x0_phy_get_target_power routine. Fixes: ba45841ca5eb ("wifi: mt76: mt76x02: simplify struct mt76x02_rate_power") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: mt76x0: remove dead code in mt76x0_phy_get_target_powerLorenzo Bianconi
tx_rate can't be greater than 3 in mt76x0_phy_get_target_power routine for cck rates. Get rid of dead code. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: mt76x02: simplify struct mt76x02_rate_powerFelix Fietkau
- remove stbc, because mt76x0 doesn't support it and mt76x2 uses the same values as HT/VHT - reduce vht array to 2 elements, because VHT MCS0-7 are the same as HT Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-01wifi: mt76: move mt76_rate_power from core to mt76x02 driver codeFelix Fietkau
Its layout and code is mt76x02 specific Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-16mt76: usb: introduce __mt76u_init utility routineLorenzo Bianconi
Introduce __mt76u_init unitility routine and move mt7615 usb bus ops into mt7615 module in order to allow specifying driver specific parameter. This is a preliminary patch to add usb support to mt7921 driver. Tested-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-12-19mt76: mt76x02: introduce SAR supportLorenzo Bianconi
Add SAR spec support to mt76x02 driver to allow configuring SAR power limitations on the frequency ranges from the userland. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-10-20mt76: mt76x0: correct VHT MCS 8/9 tx power eeprom offsetRichard Huynh
Appears to have incorrectly offset 0x120 + 0x12 instead of 12 decimal, leading to bogus power values being used. Signed-off-by: Richard Huynh <voxlympha@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-10-20mt76: disable BH around napi_schedule() callsFelix Fietkau
napi_schedule() can call __raise_softirq_irqoff(), which can perform softirq handling, so it must not be called in a pure process context with BH enabled. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-10-20mt76: switch from 'pci_' to 'dma_' APIChristophe JAILLET
The wrappers in include/linux/pci-dma-compat.h should go away. The patch has been generated with the coccinelle script below. It has been compile tested. @@ @@ - PCI_DMA_BIDIRECTIONAL + DMA_BIDIRECTIONAL @@ @@ - PCI_DMA_TODEVICE + DMA_TO_DEVICE @@ @@ - PCI_DMA_FROMDEVICE + DMA_FROM_DEVICE @@ @@ - PCI_DMA_NONE + DMA_NONE @@ expression e1, e2, e3; @@ - pci_alloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3; @@ - pci_zalloc_consistent(e1, e2, e3) + dma_alloc_coherent(&e1->dev, e2, e3, GFP_) @@ expression e1, e2, e3, e4; @@ - pci_free_consistent(e1, e2, e3, e4) + dma_free_coherent(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_single(e1, e2, e3, e4) + dma_map_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_single(e1, e2, e3, e4) + dma_unmap_single(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4, e5; @@ - pci_map_page(e1, e2, e3, e4, e5) + dma_map_page(&e1->dev, e2, e3, e4, e5) @@ expression e1, e2, e3, e4; @@ - pci_unmap_page(e1, e2, e3, e4) + dma_unmap_page(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_map_sg(e1, e2, e3, e4) + dma_map_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_unmap_sg(e1, e2, e3, e4) + dma_unmap_sg(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_cpu(e1, e2, e3, e4) + dma_sync_single_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_single_for_device(e1, e2, e3, e4) + dma_sync_single_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_cpu(e1, e2, e3, e4) + dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4) @@ expression e1, e2, e3, e4; @@ - pci_dma_sync_sg_for_device(e1, e2, e3, e4) + dma_sync_sg_for_device(&e1->dev, e2, e3, e4) @@ expression e1, e2; @@ - pci_dma_mapping_error(e1, e2) + dma_mapping_error(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_dma_mask(e1, e2) + dma_set_mask(&e1->dev, e2) @@ expression e1, e2; @@ - pci_set_consistent_dma_mask(e1, e2) + dma_set_coherent_mask(&e1->dev, e2) Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-06-19mt76: mt76x0: use dev_debug instead of dev_err for hw_rf_ctrlLorenzo Bianconi
BIT(0) in MT_EE_NIC_CONF_1 is use to notify the driver if the radio RF switch is controlled through a gpio. Use dev_debug instead of dev_err to log this info. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-05-15mt76: mt76x0e: fix device hang during suspend/resumeLorenzo Bianconi
Similar to usb device, re-initialize mt76x0e device after resume in order to fix mt7630e hang during suspend/resume Reported-by: Luca Trombin <luca.trombin@gmail.com> Fixes: c2a4d9fbabfb9 ("mt76x0: inital split between pci and usb") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/4812f9611624b34053c1592fd9c175b67d4ffcb4.1620406022.git.lorenzo@kernel.org
2021-04-12mt76: mt76x0u: Add support for TP-Link T2UHP(UN) v1Eric Y.Y. Wong
There are two variants of TP-Link Archer T2UHP V1, which are US and UN: https://www.tp-link.com/us/support/download/archer-t2uhp/ https://www.tp-link.com/hk/support/download/archer-t2uhp/v1/ From the driver source code provided by the vendor: https://www.tp-link.com/hk/support/download/archer-t2uhp/v1/#Driver eric@eric-VirtualBox:~/src$ grep -n USB_DEVICE.*0x2357 DPA_mt7610u_wifi_sta_v3004_rev1_20140529/NETIF/common/rtusb_dev_id.c 45: {USB_DEVICE(0x2357,0x0105)}, /* T1Uv1 */ 46: {USB_DEVICE(0x2357,0x010B)}, /* T2UHP_UN_v1 */ 47: {USB_DEVICE(0x2357,0x0123)}, /* T2UHP_US_v1 */ eric@eric-VirtualBox:~/src$ lsusb -d 2357: Bus 001 Device 003: ID 2357:010b TP-Link WiFi eric@eric-VirtualBox:~/src$ sudo modprobe mt76x0u eric@eric-VirtualBox:~/src$ sudo sh -c "echo 2357 010b > /sys/bus/usb/drivers/mt76x0u/new_id" [snip] eric@eric-VirtualBox:~/src$ ifconfig -a enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether 08:00:27:74:d9:ee txqueuelen 1000 (Ethernet) RX packets 78 bytes 16146 (16.1 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 75 bytes 8413 (8.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 56 bytes 5496 (5.4 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 56 bytes 5496 (5.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlx18d6c71b6e3e: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.106 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::21c7:2d90:e47d:ee48 prefixlen 64 scopeid 0x20<link> ether 18:d6:c7:1b:6e:3e txqueuelen 1000 (Ethernet) RX packets 37 bytes 5345 (5.3 KB) RX errors 0 dropped 7 overruns 0 frame 0 TX packets 77 bytes 10513 (10.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eric@eric-VirtualBox:~/src$ dmesg | tail -n 30 12:51:25.551584 main Log opened 2021-03-01T12:51:25.551572000Z [ 46.855763] 12:51:25.551995 main OS Product: Linux [ 46.855838] 12:51:25.552075 main OS Release: 5.4.0-66-generic [ 46.855897] 12:51:25.552150 main OS Version: #74-Ubuntu SMP Wed Jan 27 22:54:38 UTC 2021 [ 46.855971] 12:51:25.552207 main Executable: /opt/VBoxGuestAdditions-6.1.16/sbin/VBoxService 12:51:25.552208 main Process ID: 898 12:51:25.552209 main Package type: LINUX_64BITS_GENERIC [ 46.858699] 12:51:25.554921 main 6.1.16 r140961 started. Verbose level = 0 [ 46.863116] 12:51:25.559319 main vbglR3GuestCtrlDetectPeekGetCancelSupport: Supported (#1) [ 140.687550] usb 1-2: new high-speed USB device number 3 using xhci_hcd [ 140.838279] usb 1-2: New USB device found, idVendor=2357, idProduct=010b, bcdDevice= 1.00 [ 140.838281] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 140.838283] usb 1-2: Product: WiFi [ 140.838284] usb 1-2: Manufacturer: MediaTek [ 140.838285] usb 1-2: SerialNumber: 1.0 [ 178.374187] cfg80211: Loading compiled-in X.509 certificates for regulatory database [ 178.378370] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' [ 178.417507] usbcore: registered new interface driver mt76x0u [ 178.557165] usb 1-2: reset high-speed USB device number 3 using xhci_hcd [ 178.720436] mt76x0u 1-2:1.0: ASIC revision: 76100002 MAC revision: 76502000 [ 180.156077] mt76x0u 1-2:1.0: EEPROM ver:02 fae:04 [ 181.190558] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht' [ 181.225560] mt76x0u 1-2:1.0 wlx18d6c71b6e3e: renamed from wlan0 [ 188.660826] wlx18d6c71b6e3e: authenticate with d0:17:c2:e0:d7:9c [ 189.447781] wlx18d6c71b6e3e: send auth to d0:17:c2:e0:d7:9c (try 1/3) [ 189.618282] wlx18d6c71b6e3e: authenticated [ 189.619008] wlx18d6c71b6e3e: associate with d0:17:c2:e0:d7:9c (try 1/3) [ 189.715268] wlx18d6c71b6e3e: RX AssocResp from d0:17:c2:e0:d7:9c (capab=0x1011 status=0 aid=8) [ 189.734720] wlx18d6c71b6e3e: associated [ 190.233239] IPv6: ADDRCONF(NETDEV_CHANGE): wlx18d6c71b6e3e: link becomes ready Signed-off-by: Eric Y.Y. Wong <eric.wongyeungyan@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-11mt76: use PCI_VENDOR_ID_MEDIATEK to avoid open codedRyder Lee
Use PCI standard defines. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-01-26mt76: move mac_work in mt76_core moduleLorenzo Bianconi
Move mac_work delayed_work and mac_work_count in mt76_phy since it is used by all drivers. This is a preliminary patch to create a common mcu library used by mt7615 and mt7921 drivers Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: move hw mac_addr in mt76_phyLorenzo Bianconi
This is a preliminary patch to properly support mt7915 dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: move band capabilities in mt76_phyLorenzo Bianconi
This is a preliminary patch to move properly support mt7915 dbdc Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: mt76u: rely on woker APIs for rx workLorenzo Bianconi
In order to improve parallelism, convert rx path in mt76-usb module to mt76 workers APIs Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: fix memory leak if device probing failsLorenzo Bianconi
Run mt76_free_device instead of ieee80211_free_hw if device probing fails in order to remove the already allocated mt76 workqueue Fixes: a86f1d01f5ce5 ("mt76: move mt76 workqueue in common code") Fixes: f1d962369d568 ("mt76: mt7915: implement HE per-rate tx power support") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-12-04mt76: implement .mcu_parse_response in struct mt76_mcu_opsFelix Fietkau
Do not free skb inside that function Preparation for further cleanup Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: mt76x0: Move tables used only by init.c to their own header fileLee Jones
Taking the same approach as initvals_phy.h. Fixes the following W=1 kernel build warning(s): drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:218:35: warning: ‘mt76x0_dcoc_tab’ defined but not used [-Wunused-const-variable=] 218 | static const struct mt76_reg_pair mt76x0_dcoc_tab[] = { | ^~~~~~~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:86:35: warning: ‘mt76x0_bbp_init_tab’ defined but not used [-Wunused-const-variable=] 86 | static const struct mt76_reg_pair mt76x0_bbp_init_tab[] = { | ^~~~~~~~~~~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:48:35: warning: ‘mt76x0_mac_reg_table’ defined but not used [-Wunused-const-variable=] 48 | static const struct mt76_reg_pair mt76x0_mac_reg_table[] = { | ^~~~~~~~~~~~~~~~~~~~ drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:14:35: warning: ‘common_mac_reg_table’ defined but not used [-Wunused-const-variable=] 14 | static const struct mt76_reg_pair common_mac_reg_table[] = { | ^~~~~~~~~~~~~~~~~~~~ Cc: Felix Fietkau <nbd@nbd.name> Cc: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> Cc: Ryder Lee <ryder.lee@mediatek.com> Cc: Kalle Valo <kvalo@codeaurora.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Jakub Kicinski <kuba@kernel.org> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Stanislaw Gruszka <stf_xl@wp.pl> Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org Cc: linux-mediatek@lists.infradead.org Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: Use fallthrough pseudo-keywordGustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: convert from tx tasklet to tx worker threadFelix Fietkau
This improves performance by allowing the scheduler to move the tx scheduling work to idle CPUs. Since tx scheduling work is very latency sensitive and kept short via AQL, sched_set_fifo_low is used to keep worker priority above normal tasks Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-09-24mt76: set interrupt mask register to 0 before requesting irqFelix Fietkau
Avoids spurious interrupts in case the hardware was running already Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-07-21mt76: move mt76 workqueue in common codeLorenzo Bianconi
Move mt76 workqueue from usb to common code in order to be reused adding low-power support for mt7663 chipset Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-12mt76: mt76x0: enable MCS 8 and MCS9Lorenzo Bianconi
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>
2020-05-12mt76: mt76x0: pci: add mt7610 PCI IDPawel Dembicki
Add mt7610 PCI id found on D-Link DWR-960 to pci_device_id table. Run-tested on D-Link DWR-960 with no-name half-size mPCIE card with mt7610e. Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-05-12mt76: mt76x02: fix handling MCU timeouts during hw restartFelix Fietkau
If a MCU timeout occurs before a hw restart completes, another hw restart is scheduled, and the station state gets corrupted. To speed up dealing with that, do not issue any MCU commands after the first timeout, and defer handling timeouts until the reset has completed. Also ignore errors in MCU commands during start/config to avoid making user space fail on this condition. If it happens, another restart is scheduled quickly, and that usually recovers the hardware properly. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-03-17mt76: remove variable 'val' set but not usedChen Wandun
Fixes gcc '-Wunused-but-set-variable' warning: drivers/net/wireless/mediatek/mt76/mt76x0/phy.c: In function mt76x0_phy_rf_init: drivers/net/wireless/mediatek/mt76/mt76x0/phy.c:1158:5: warning: variable val set but not used [-Wunused-but-set-variable] Fixes: 10de7a8b4ab9 ("mt76x0: phy files") Signed-off-by: Chen Wandun <chenwandun@huawei.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: avoid extra RCU synchronization on station removalFelix Fietkau
Use sta_pre_rcu_remove callback to clear wcid pointer earlier Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt76u: add {read/write}_extended utility routinesLorenzo Bianconi
Introduce extended utility routines to read/write data o usb bus. New devices (e.g. mt7663u) will rely on both upper and lower part of the register address. Add ext parameter to mt76u_init signature in order to reuse the code adding mt7663u support. Co-developed-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Sean Wang <sean.wang@mediatek.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: mt76u: move mcu buffer allocation in mt76x02u driversLorenzo Bianconi
Move mcu buffer allocation in mt76x2u/mt76x0u drivers since newer chipsets (e.g. mt7663u) does not rely on synchronous mcu communication 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>
2020-02-14mt76: mt76x02u: avoid overwrite max_tx_fragmentsLorenzo Bianconi
Starting from 'commit ee8040139ab1 ("mt76: do not overwrite max_tx_fragments if it has been set")' we can avoid overwriting max_tx_fragments for mt76x02u devices Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: add multiple wiphy support to mt76_get_min_avg_rssiFelix Fietkau
Allow tracking clients of both wiphys separately Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: move txpower and antenna mask to struct mt76_phyFelix Fietkau
Adds multiple wiphy support to mt76_get_txpower Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: move txpower_conf back to driver specific structsFelix Fietkau
Nothing in the core uses it Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: move state from struct mt76_dev to mt76_phyFelix Fietkau
Allows keeping per-wiphy state separate Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: move channel state to struct mt76_phyFelix Fietkau
Add support for an extra wiphy in mt76_set_channel and mt76_get_survey This is preparation for supporting multiple wiphys per device to support the concurrent dual-band feature of MT7615D Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-02-14mt76: add support for an extra wiphy in the main tx pathFelix Fietkau
This is preparation for supporting multiple wiphys per device to support the concurrent dual-band feature of MT7615D Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-12-02mt76: mt76x0: fix default mac address overwriteLorenzo Bianconi
Current implementation always use default eeprom mac address to configure device registers even if it is updated using mt76_eeprom_override. Fix it initializing macaddr filed of mt76_dev data structure with eeprom mac address and running mt76_eeprom_override before mt76x02_mac_setaddr Fixes: d1bc9bf2072c ("mt76: mt76x0: eeprom: add support for MAC address from OF") Tested-by: Kevin Schmidt <kevin.patrick.schmidt@googlemail.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2019-11-20mt76: move mt76_get_antenna in mt76_core moduleLorenzo Bianconi
Move mt76_get_antenna in mac80211.c in order to be reused by all drivers. Initialize .get_antenna function pointer for mt76x0, mt7603, mt7615 and mt76x2u drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20Revert "mt76: mt76x0e: don't use hw encryption for MT7630E"Stanislaw Gruszka
This reverts commit 34b0e9b767bfa09ae233ca0d6ceb299bf2e24600. Since commit 7bd0650be63c ("mt76: dma: fix buffer unmap with non-linear skbs") is no longer necessary to disable HW encryption for MT7630E. Disabling HW encryption helped previously because somehow fragmented skb's are not created if mac80211 encrypt frames, so buffer unmap bug of non-linear skbs was not triggered. Now since this bug is properly fixed by commit 7bd0650be63c ("mt76: dma: fix buffer unmap with non-linear skbs") , we can enable HW encryption back. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Acked-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: use mt76_dev in mt76_is_{mmio,usb}Lorenzo Bianconi
Convert mt76_is_mmio and mt76_is_usb to rely on mt76_dev instead of mt76x02_dev since this is a property not strictly related to hw chipset and it will be more reusable Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: mt76u: rely on a dedicated stats workqueueLorenzo Bianconi
rate controller and throughput are very sensitive to tx status timing. In order to improve performances when the system is heavily loaded, substitute stat_work delayed_work with a regular work_struct and create a mt76u dedicated workqueue for tx status reporting Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: mt76u: rely on usb_interface instead of usb_devLorenzo Bianconi
usb drivers are supposed to communicate using usb_interface instead mt76x{0,2}u is now registering through usb_device. Fix it by passing usb_intf device to mt76_alloc_device routine. Fixes: 112f980ac8926 ("mt76usb: use usb_dev private data") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Tested-By: Zero_Chaos <sidhayn@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: mt76x0: remove 350ms delay in mt76x0_phy_calibrateLorenzo Bianconi
Since mt76x0 does not save the phy calibration data it is not necessary to wait 350ms in mt76x0_phy_calibrate Tested-by: Sid Hayn <sidhayn@gmail.com> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2019-11-20mt76: mt76x0: eeprom: add support for MAC address from OFPawel Dembicki
mt76x0e driver only supports MAC addresses from calibration data eeprom. Many routers however do not have a valid stock address set in this field. This patch makes it possible to take a MAC address from OF (e.g. from mtd). Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com> [adjusted for kernel submission] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Signed-off-by: Felix Fietkau <nbd@nbd.name>