summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76
Commit message (Collapse)AuthorAgeFilesLines
* mt76: fix build for MediaTek MT7610U USB wireless dongleValdis Kletnieks2018-08-091-0/+1
| | | | | | | | | | The mt76x0 driver requires the mt76 core driver to actually function. So add a 'select' to avoid embarrassing 'symbol unknown' errors when attempting to modprobe it in a module tree that doesn't include mt76.ko Signed-off-by: Valdis Kletnieks <valdis.kletnieks@vt.edu> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: Remove VLA usageKees Cook2018-08-091-3/+3
| | | | | | | | | | | | | Even with "const" variables, the compiler will generate warnings about VLA usage. In the quest to remove all VLAs from the kernel[1], this uses a #define instead of a const to do the array sizing. [1] https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qPXydAacU1RqZWA@mail.gmail.com Fixes: e87b5039511a ("mt76x0: eeprom files") Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: perform mt76x0_mac_set_ampdu_factorStanislaw Gruszka2018-08-091-2/+0
| | | | | | | | | Remove return added accidentally in mt76x0_mac_set_ampdu_factor. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: a77443498137 ("mt76x0: mac files") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: correct type for eeprom gain valueStanislaw Gruszka2018-08-091-1/+1
| | | | | | | | | Change type to u8 to allow sanity check agaist 0xff; Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Fixes: e87b5039511a ("mt76x0: eeprom files") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: rename trace symbolsStanislaw Gruszka2018-08-048-94/+35
| | | | | | | | | | | | | Rename trace symbols that conflict with mt7601u and remove some definitions that are not used. Patch fixes build errors like this: ld: drivers/net/wireless/mediatek/mt76/mt76x0/trace.o:(__tracepoints+0x0): multiple definition of `__tracepoint_set_shared_key'; drivers/net/wireless/mediatek/mt7601u/trace.o:(__tracepoints+0x0): first defined here Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: 7b4859026ccd ("mt76x0: core files") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: rename mt76_* functionsStanislaw Gruszka2018-08-047-26/+26
| | | | | | | | | | | | | mt76_* functions conflicts with mt7601u driver what prevents to build those drivers in the kernel or use both drivers modules at once. Patch fixes build errors like this: ld: drivers/net/wireless/mediatek/mt76/mt76x0/mac.o:(.opd+0x30): multiple definition of `mt76_mac_tx_rate_val'; drivers/net/wireless/mediatek/mt7601u/mac.o:(.opd+0x30): first defined here Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: 7b4859026ccd ("mt76x0: core files") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: load firmware from mediatek subdirStanislaw Gruszka2018-08-021-1/+1
| | | | | | | | Firmware blob will be located in mediatek subdirectory. Add "u" suffix to indicate this is USB device firmware. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: disable HW before probeStanislaw Gruszka2018-08-023-1/+6
| | | | | | | | Disable HW before probe, otherwise after reboot we will fail to initialize MCU. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: Kconfig and Makefile for mt76x0 driverStanislaw Gruszka2018-08-023-0/+15
| | | | | | | | Add Kconfig and Makefiles for mt76x0 driver. Now the driver can be build. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add more statesStanislaw Gruszka2018-08-021-0/+2
| | | | | | | Add states needed for mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: main fileStanislaw Gruszka2018-08-021-0/+403
| | | | | | | Add main file of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: dma and tx filesStanislaw Gruszka2018-08-023-0/+918
| | | | | | | Add dma and tx files of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: trace and debugfs filesStanislaw Gruszka2018-08-023-0/+553
| | | | | | | Add trace and debugfs files of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: eeprom filesStanislaw Gruszka2018-08-022-0/+594
| | | | | | | Add eeprom files of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: init filesStanislaw Gruszka2018-08-022-0/+1002
| | | | | | | Add init files of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: phy filesStanislaw Gruszka2018-08-023-0/+1861
| | | | | | | Add phy files of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: mcu filesStanislaw Gruszka2018-08-022-0/+757
| | | | | | | Add mcu files of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: usb filesStanislaw Gruszka2018-08-022-0/+438
| | | | | | | Add usb files of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: mac filesStanislaw Gruszka2018-08-022-0/+814
| | | | | | | Add mac files of mt76x0 driver. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x0: core filesStanislaw Gruszka2018-08-024-0/+1062
| | | | | | | | | | Core files of mt76x0 driver. mt76x0 driver adds support for Mediatek MT7610U based USB Wi-Fi dongles. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add driver code for MT76x2u based devicesLorenzo Bianconi2018-08-0212-0/+1891
| | | | | | | | | MT76x2u is a 2x2 USB 802.11ac chipset by MediaTek. This driver currently support station mode Tested-by: <cug_yangyuancong@hotmail.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add usb support to mt76 layerLorenzo Bianconi2018-08-028-1/+1336
| | | | | | | | This will be used by drivers for MT76x2u based devices Tested-by: <cug_yangyuancong@hotmail.com> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: move mt76x2_debugfs in mt76-common moduleLorenzo Bianconi2018-08-022-2/+4
| | | | | | | | Move mt76x2_debugfs code in mt76-common module since it is shared between mt76x2 and mt76x2u Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add mt76x2_phy_common to mt76x2-common moduleLorenzo Bianconi2018-08-024-329/+359
| | | | | | | | Move phy related code shared between mt76x2 and mt76x2u in mt76x2-common module Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add mt76x2_common to mt76x2-common moduleLorenzo Bianconi2018-08-025-329/+372
| | | | | | | | Move core related code shared between mt76x2 and mt76x2u in mt76x2-common module Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add mt76x2_init_common to mt76x2-common moduleLorenzo Bianconi2018-08-024-239/+267
| | | | | | | | Move init related code shared between mt76x2 and mt76x2u in mt76x2-common module Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add mt76x2_mac_common to mt76x2-common moduleLorenzo Bianconi2018-08-026-674/+706
| | | | | | | | Move mac related code shared between mt76x2 and mt76x2u in mt76x2-common module Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add mt76x2_tx_common to mt76x2-common moduleLorenzo Bianconi2018-08-024-124/+152
| | | | | | | | Move tx related code shared between mt76x2 and mt76x2u in mt76x2-common module Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: introduce mt76x2-common moduleLorenzo Bianconi2018-08-024-3/+22
| | | | | | | | | In order to remove usb dependency from pcie code, add mt76x2-common as a container of shared code between mt76x2 and mt76x2u. Add eeprom code to mt76x2-common module Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: introduce tx_queue_skb function pointer in mt76_bus_opsLorenzo Bianconi2018-08-023-4/+11
| | | | | | | | | | Add tx_queue_skb function pointer in mt76_bus_ops since mt76x2u based devices do not map mt76x2_txwi on dma buffers and it is not possible to reuse mt76_dma_tx_queue_skb() routine to enqueue tx frames to hw buffers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: rename mt76_tx_queue_skb in mt76_dma_tx_queue_skbLorenzo Bianconi2018-08-024-83/+85
| | | | | | | | Move mt76_dma_tx_queue_skb routine in dma.c. Remove static qualifier from mt76_get_txwi definition Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: add buffer len to mt76x2_mac_write_txwi signatureLorenzo Bianconi2018-08-023-5/+5
| | | | | | | | | | Add frame length to mt76x2_mac_write_txwi routine signature and do not fetch it from skb since txwi data structure is added at the beginning of the skb for usb based devices and mt76x2_mac_write_txwi will be shared between pci and usb related code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: add napi struct to mt76_rx_poll_complete/mt76_rx_complete signaturesLorenzo Bianconi2018-08-024-11/+10
| | | | | | | | | in order to reuse mt76_rx_complete routine supporting mt76x2u based devices add napi struct to mt76_rx_poll_complete and mt76_rx_complete routine signatures and do not fetch it according to the rx queue index Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: introduce mt76x2_mac_load_tx_status routineLorenzo Bianconi2018-08-021-17/+30
| | | | | | | | | | Add mt76x2_mac_load_tx_status routine since tx stats register map is shared between usb and pci based devices but usb devices do not have a tx stat irq line as pcie ones and it is necessary to load tx statistics using a workqueue Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: move interface_modes definition in mt76x2_initLorenzo Bianconi2018-08-022-8/+8
| | | | | | | | | Move wiphy interface_modes definition in mt76x2_init in order to reuse mt76_register_device routine supporting mt76x2u based chipsets since mt76x2u currently supports just sta mode Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: introduce mt76x2_init_device routineLorenzo Bianconi2018-08-022-26/+33
| | | | | | | | Add mt76x2_init_device routine in order to reuse common pcie/usb mac80211 initialization code supporting mt76x2u based device Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: move utility routines in mt76x2.hLorenzo Bianconi2018-08-023-37/+40
| | | | | | | | | In order to reuse them supporting mt76x2u based devices, move mt76x2_wait_for_mac, wait_for_wpdma and mt76x2_channel_silent in mt76x2.h Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: move mt76x2_fw_header and mt76x2_patch_header definitions in mcu.hLorenzo Bianconi2018-08-022-17/+17
| | | | | | | | move mt76x2_fw_header and mt76x2_patch_header definitions in mcu.h in order to reuse them in mt76x2u mcu related code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: move MT_TXD_INFO, MT_MCU_MSG and MT_RX_FCE_INFO defs in dma.hLorenzo Bianconi2018-08-022-38/+38
| | | | | | | | | Since MT_TXD_INFO, MT_MCU_MSG and MT_RX_FCE_INFO definitions are in common between mt76x2u, mt76x2 and mt76x0u move them in dma.h in order to reuse usb code supporting mt76x2u and mt76x0u based devices Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: fix CCK protection control frame rateLorenzo Bianconi2018-07-301-3/+9
| | | | | | | | Use 11M as tx rate for CCK protection control frames Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e") Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: add frame protection supportLorenzo Bianconi2018-07-303-0/+47
| | | | | | | | Introduce mac80211 rts threshold handler in order to add frame protection support to mt76x2 driver Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: debugfs: add sw pulse statistics to dfs debugfsLorenzo Bianconi2018-07-043-1/+25
| | | | | | | | Add sw pattern detector statistics to mt76x2 debugfs. Moreover track down number of allocated sequence by the detector Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: dfs: add sw pattern detectorLorenzo Bianconi2018-07-042-1/+260
| | | | | | | | | | Add sw DFS pattern detector support for mt76x2 based devices. Dfs pattern supported: - short pulse radar patterns - staggered radar patterns Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: dfs: add sw event ring bufferLorenzo Bianconi2018-07-042-3/+163
| | | | | | | | Introduce sw event ring buffer to queue DFS pulses loaded from the hw. Radar pulses will be used in DFS sw detector Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: introduce mt76_{incr,decr} utility routinesLorenzo Bianconi2018-07-041-0/+12
| | | | | | | | Add mt76_{incr,decr} utility routines to increment/decrement a value with wrap-around (they will be used by mt76x2 DFS sw detector) Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: improve gain adjustment in noisy environmentsFelix Fietkau2018-06-271-10/+16
| | | | | | | | | | | | | | | | When switching between low gain (high RSSI) and high gain settings, it can take a few seconds to adjust to the current environment. This can lead to short periods of time with extreme packet loss. When switching from low_gain=1 to low_gain=2, start with the same gain adjustment value instead of the lowest to avoid spikes of huge numbers of false CCA events Also avoid resetting adjustment values on switching between low_gain values 0 and 1, since it affects only the upper limit of vga adjustment Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: track ewma rssi for gain adjustment per stationFelix Fietkau2018-06-274-20/+83
| | | | | | | | This preserves more sensitivity when weak stations are active and avoids counting signal measurements from other unrelated networks Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add a debugfs file to dump agc calibration informationFelix Fietkau2018-06-273-0/+16
| | | | | | | | Useful for debugging gain adjustment issues triggered by signal strength changes. Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: fix variable gain adjustment rangeFelix Fietkau2018-06-271-1/+1
| | | | | | | | The range should only be limited to 4 for really weak signals, for all other gain settings the range is 16. Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: clear false CCA counters after changing gain settingsFelix Fietkau2018-06-271-0/+3
| | | | | | | | They will be read on the next calibration step without gain change and must not count earlier events Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>