summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt76x2.h
Commit message (Collapse)AuthorAgeFilesLines
* mt76x2: move mt76x2_phy_tssi_compensate in mt76x2-common moduleLorenzo Bianconi2018-09-191-0/+1
| | | | | | | | Move mt76x2_phy_tssi_compensate routine in mt76x2-common module since it is shared between mt76x2 and mt76x2u drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76{0,2} mcu shared code in mt76x02_mcu.cLorenzo Bianconi2018-09-191-4/+0Star
| | | | | | | | Move shared mt76x2/mt76x0 mcu shared code in a common file and remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: introduce mmio data structure in mt76_devLorenzo Bianconi2018-09-191-10/+0Star
| | | | | | | | | Introduce mt76_mmio data structure in mt76_dev and move mt76x2_mcu in mt76_mmio. This is a preliminary patch to unify mcu code between mt76x02{e,u} drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x2: remove leftover mt76u_buf data structure in mt76x2_mcuLorenzo Bianconi2018-09-191-1/+0Star
| | | | | | | Remove unused usb buffer in mt76x2_mcu data structure Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x2: use mt76_dev instead of mt76x2_dev in mt76x2_tx_queue_mcuLorenzo Bianconi2018-09-191-1/+1
| | | | | | | | | Use mt76_dev data structure instead of mt76x2_dev one in mt76x2_tx_queue_mcu routine. This is a preliminary patch to share mcu code between mt76x2e and mt76x0e Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76 rate definitions in mt76x02-lib moduleLorenzo Bianconi2018-09-191-2/+0Star
| | | | | | | | | | Move mt76x2_rate definition in mt76x02-lib module and rename it in mt76x02_rates in order to be reused in mt76x0 driver. Moreover remove unused mt76_rate definition Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76x2_tx_complete routine in mt76x02-lib moduleLorenzo Bianconi2018-09-191-1/+0Star
| | | | | | | | | Move mt76x2_tx_complete routine in mt76x02-lib module and rename it in mt76x02_tx_complete in order to be used in mt76x0 driver Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x2: change mt76x2_tx_complete routine signatureLorenzo Bianconi2018-09-191-1/+1
| | | | | | | | | Use mt76_dev instead of mt76x2_dev in mt76x2_tx_complete signature in order to be reused in mt76x0 driver Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify {insert/remove}_hdr_padStanislaw Gruszka2018-09-191-1/+0Star
| | | | | | | Merge insert/remove _hdr_pad from mt76x0 and mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify send_tx_status and related helpersStanislaw Gruszka2018-09-191-2/+0Star
| | | | | | | Merge send_tx_status and helper functions from mt76x0 and mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify load_tx_statusStanislaw Gruszka2018-09-191-2/+0Star
| | | | | | | Unify load/fetch tx status from mt76x0 and mt76x2 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify sta_rate_tbl_update and related helpersStanislaw Gruszka2018-09-191-4/+1Star
| | | | | | | | | Use common sta_rate_tbl_update on mt76x0 and mt76x2. mt76x0 do not have support TPC (transmision power control) implmented, msta->wcid.max_txpwr_adj is only set for mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify set_keyStanislaw Gruszka2018-09-191-3/+0Star
| | | | | | | Merge mt76x0 and mt76x2 set_key mac80211 callback. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify ampdu_actionStanislaw Gruszka2018-09-191-2/+0Star
| | | | | | | | Use mt76x2_ampdu_action as common function, mt76x0 ampdu_action was diffrent, but mt76x2 version should work for this driver as well. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: pratially unify add_interfaceStanislaw Gruszka2018-09-191-3/+0Star
| | | | | | | | Create common mt76x02_vif_init function and use int on drivers add_interface callback. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move wcid fields to common mt76_dev structStanislaw Gruszka2018-09-191-5/+0Star
| | | | | | | | All current MT devices including new MT7603 type chips support 128 WCIDs, we can unify wcid data in common mt76_dev structure. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify sta structure part 2Stanislaw Gruszka2018-09-041-17/+3Star
| | | | | | | Second part of unifying mt76x02_sta structure between mt76x0 and mt76x2. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: unify mt76x02_vif structStanislaw Gruszka2018-09-041-7/+1Star
| | | | | | | Private vif structures definitions are the same for mt76x2 and mt76x0. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: create new mt76x02-lib module for common mt76x{0,2} codeStanislaw Gruszka2018-09-041-5/+0Star
| | | | | | | | | Move rxfilter and mutex to common structure. Create mt76x02-lib.ko for mt76x0 and mt76x2 common functions and create new unified mt76x02_configure_filter() function there. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: rename mt76x2_regs.hStanislaw Gruszka2018-09-041-1/+1
| | | | | | | | MAC registers are the same for mt76x0 and mt76x2. Rename mt76x2_regs.h file to reflect that. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: unify wait_for_macStanislaw Gruszka2018-09-041-17/+0Star
| | | | | | | | Create new mt76x02_mac.h for common mac functions of mt76x0 and mt76x2 and unity wait_for_mac for both drivers. 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-021-0/+4
| | | | | | | | | 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 mt76x2_phy_common to mt76x2-common moduleLorenzo Bianconi2018-08-021-0/+9
| | | | | | | | 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-021-0/+21
| | | | | | | | 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-021-0/+6
| | | | | | | | 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-021-1/+6
| | | | | | | | 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-021-0/+2
| | | | | | | | 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>
* mt76x2: introduce mt76x2_init_device routineLorenzo Bianconi2018-08-021-0/+1
| | | | | | | | 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-021-0/+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: add frame protection supportLorenzo Bianconi2018-07-301-0/+1
| | | | | | | | 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>
* mt76: track ewma rssi for gain adjustment per stationFelix Fietkau2018-06-271-3/+7
| | | | | | | | 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-271-0/+1
| | | | | | | | 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 beacon timer driftFelix Fietkau2018-06-271-1/+4
| | | | | | | | | | | | The beacon timer drifts by 1 microsecond every TBTT. After 20 minutes with a beacon interval of 100, the drift will be almost 12 ms, enough to cause weird issues for devices in powersave mode. Since the beacon timer is configured in units of 1/16 TU (64 us), we need to adjust it once every 64 beacons and only for one beacon. Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: fix sending encrypted broadcast packets for secondary interfacesFelix Fietkau2018-05-231-0/+3
| | | | | | | | For encryption to work properly, the BSS index needs to be initialized for the WCID entry used for the interface. Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: fix is_mt7612 routineLorenzo Bianconi2018-04-301-2/+1Star
| | | | | | | | | | | | Fix is_mt7612 routine since asic version is set in mt76_dev revision field and not in mt76x2_dev one. Moreover remove mt76x2_dev rev field since it is never used in the driver Fixes: 7bc04215a66b ('mt76: add driver code for MT76x2e') Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Acked-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76x2: add mac80211 {set,get}_antenna callbacksLorenzo Bianconi2018-03-131-0/+1
| | | | | | | | | | Add capability to select tx/rx antennas. Possible values are: - 1: to use only the first antenna - 2: to use only the second antenna - 3: to use both of them Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: implement AP_LINK_PSFelix Fietkau2018-02-011-0/+2
| | | | | | | | | | | With software A-MPDU reordering in place, frames that notify mac80211 of powersave changes are reordered as well, which can cause connection stalls. Fix this by implementing powersave state processing in the driver. Fixes: aee5b8cf2477 ("mt76: implement A-MPDU rx reordering in the driver code") Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: pass the per-vif wcid to the core for multicast rxFelix Fietkau2018-01-261-0/+1
| | | | | | | Preparation for adding software rx CCMP PN validation Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* mt76: add driver code for MT76x2eFelix Fietkau2017-12-071-0/+227
MT76x2e is a 2x2 PCIe 802.11ac chipset by MediaTek. This driver has full support for AP, station, ad-hoc, mesh and monitor mode. Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>