summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
Commit message (Collapse)AuthorAgeFilesLines
* mt76: move mt76_get_antenna in mt76_core moduleLorenzo Bianconi2019-11-201-0/+1
| | | | | | | | | 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>
* Revert "mt76: mt76x0e: don't use hw encryption for MT7630E"Stanislaw Gruszka2019-11-201-14/+1
| | | | | | | | | | | | | | | | | 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>
* mt76: mt76x02: track approximate tx airtime for airtime fairness and surveyFelix Fietkau2019-11-201-0/+1
| | | | | | | Estimate by calculating duration for EWMA packet size + estimated A-MPDU length on tx status events Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt76x02: move MT_CH_TIME_CFG init to mt76x02_mac_cc_resetFelix Fietkau2019-11-201-9/+0
| | | | | | Reduces code duplication and adds missing bits for USB variants Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: track rx airtime for airtime fairness and surveyFelix Fietkau2019-11-201-1/+2
| | | | | | | | | Report total rx airtime for valid stations as BSS rx time in survey mt7615 is left out for now, it will be supported later by reading hardware counters instead of calculating airtime in software Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: rename mt76_driver_ops txwi_flags to drv_flags and include tx aligned4Felix Fietkau2019-11-201-1/+1
| | | | | | This reduces the struct size and is useful for adding more flags later Signed-off-by: Felix Fietkau <nbd@nbd.name>
* Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller2019-09-151-1/+14
|\ | | | | | | | | | | Minor overlapping changes in the btusb and ixgbe drivers. Signed-off-by: David S. Miller <davem@davemloft.net>
| * mt76: mt76x0e: don't use hw encryption for MT7630EStanislaw Gruszka2019-09-031-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 41634aa8d6db ("mt76: only schedule txqs from the tx tasklet") I can observe firmware hangs on MT7630E on station mode: tx stop functioning after minor activity (rx keep working) and on module unload device fail to stop with messages: [ 5446.141413] mt76x0e 0000:06:00.0: TX DMA did not stop [ 5449.176764] mt76x0e 0000:06:00.0: TX DMA did not stop Loading module again results in failure to associate with AP. Only machine power off / power on cycle can make device work again. It's unclear why commit 41634aa8d6db causes the problem, but it is related to HW encryption. Since issue is a firmware hang, that is super hard to debug, just disable HW encryption as fix for the issue. Fixes: 41634aa8d6db ("mt76: only schedule txqs from the tx tasklet") Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
* | mt76: add default implementation for mt76_sw_scan/mt76_sw_scan_completeLorenzo Bianconi2019-09-051-1/+1
| | | | | | | | | | | | | | | | | | Introduce a default implementation for mt76_sw_scan and mt76_sw_scan_complete in mt76 module and remove duplicated code since most of the drivers share the same implementation Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* | mt76: switch to SPDX tag instead of verbose boilerplate textRyder Lee2019-09-051-12/+1
|/ | | | | | | | | No functional change intended. Add SPDX identifiers to all remaining files in /mt76. Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move pre_tbtt_tasklet in mt76_devLorenzo Bianconi2019-05-011-1/+1
| | | | | | | | Move pre_tbtt_tasklet tasklet in mt76_dev data structure since it is used by all drivers Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt76x02: remove bogus mutex usageStanislaw Gruszka2019-05-011-6/+0
| | | | | | | | | | | | mac80211 .start(), .stop() callbacks are never called concurrently with other callbacks. The only concurencly is with mt76 works which we cancel on stop() and schedule on start(). This fixes possible deadlock on cancel_delayed_work_sync(&dev->mac_work) as mac_work also take mutex. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mac_work in mt76_devLorenzo Bianconi2019-05-011-2/+2
| | | | | | | | | Move mac_work delayed work in mt76_dev data structure since it is used by all drivers and it will be reused adding mac work to mt7615 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: introduce mt76_free_device routineLorenzo Bianconi2019-05-011-1/+1
| | | | | | | | Move mt76_tx_free in mt76_free_device routine in order to unmap all txwi descriptors at module unload Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: unify set_timStanislaw Gruszka2019-05-011-8/+1
| | | | | | | | All mt76 drivers (now also USB drivers) require empty .set_tim callback. Add it to common mt76 module and use on all drivers. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x02: introduce mt76x02_beacon.cStanislaw Gruszka2019-05-011-0/+2
| | | | | | | | | Move most of beaconing code into separate file and separate beacon initialization for USB and MMIO as pre TBTT implementation for USB will be different. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mmio: move mt76_insert_hdr_pad in mt76_dma_tx_queue_skbLorenzo Bianconi2019-05-011-0/+1
| | | | | | | | | Introduce tx_aligned4_skbs in mt76_driver_ops and move mt76_insert_hdr_pad in mt76_dma_tx_queue_skb. This is a preliminary patch in order to unify tx dma mapping for mt76x02 and new chipsets Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: remove mt76x0u_alloc_device routineLorenzo Bianconi2019-02-181-6/+11
| | | | | | | | Remove mt76x0u_alloc_device since it just runs mt76_alloc_device. Move mt76_alloc_device call in mt76x0u_probe and in mt76x0e_probe Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: run MAC work every 100msFelix Fietkau2019-02-181-1/+1
| | | | | | | ED/CCA Tx blocking checks need to be run every 100 ms in order to avoid triggering too late and keeping tx blocking on for too long Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76x02_get_txpower to mt76 coreFelix Fietkau2019-01-171-1/+1
| | | | | | It will be reused by mt7603 later Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: add energy detect CCA support to mt76x{0,2}e driversLorenzo Bianconi2019-01-111-0/+1
| | | | | | | | | | | Ported from the reference driver. Should fix compliance with ETSI regulatories on preventing transmission while energy detect values are above the threshold. The code has been tested using an ath9k device running tx99 as noise generator Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: fix ACS supportLorenzo Bianconi2019-01-111-0/+8
| | | | | | | | | Fix Automatic Channel Selection (ACS) support in mt76x0e driver configuring properly MT_CH_TIME_CFG register Fixes: 6250318694ca ("mt76x0: pci: add get_survey support") Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: replace sta_add/remove ops with common sta_state functionFelix Fietkau2018-11-301-2/+3
| | | | | | | Allows adding unassociated stations from mac80211 Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
* mt76: move mt76x02_bss_info_changed in mt76x02-lib moduleLorenzo Bianconi2018-11-301-1/+1
| | | | | | | | Unify drv_bss_info_changed mac80211 callback and remove duplicated code in mt76x0 and mt76x2 drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move tx protection routines in mt76x02-lib moduleLorenzo Bianconi2018-11-301-0/+1
| | | | | | | | | | Move mt76x02_set_rts_threshold and mt76x02_mac_set_tx_protection routines in mt76x02-lib module and remove duplicated code in mt76x0 and mt76x2 drivers. Remove pci_mac.c and mt76x0/mac.c since now are empty files Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76x02_set_tx_ackto in mt76x02-lib moduleLorenzo Bianconi2018-11-301-0/+1
| | | | | | | | | | Move mt76x02_set_tx_ackto and mt76x02_set_coverage_class routines in mt76x02-lib module in order to be reused by mt76x0 driver. This is a preliminary patch to unify drv_bss_info_changed mac80211 callback between mt76x0 and mt76x2 drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: enable AP supportLorenzo Bianconi2018-11-301-0/+17
| | | | | | | | | Add missing mac80211 callbacks to mt76x0e_ops data structure and add mt76x02_beacon utility routines in mt76x0_bss_info_changed in order to enable/disable beacon transmission Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76x02_sta_ps in mt76x02-lib moduleLorenzo Bianconi2018-11-301-0/+1
| | | | | | | | Move mt76x02_sta_ps utility routine in mt76x02_util.c in order to be reused by mt76x0 driver adding AP support Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76x02_get_txpower in mt76x02_util.cLorenzo Bianconi2018-11-301-0/+1
| | | | | | | | Move mt76x02_get_txpower utility routine in mt76x02-lib module in order to be reused by mt76x0 and mt76x2u drivers Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76x02_sw_scan and mt76x02_sw_scan_complete in mt76x02-lib moduleLorenzo Bianconi2018-11-301-2/+2
| | | | | | | | | Move mt76x02_sw_scan and mt76x02_sw_scan_complete utility routines in mt76x02_util.c in order to be reused by mt76x0 and mt76x2u drivers and remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: add pre_tbtt_tasklet supportLorenzo Bianconi2018-11-301-0/+1
| | | | | | | | Enable/disable pre_tbtt_tasklet in mt76x0 driver in order to add AP support Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: add missing MODULE_FIRMWARE macroLorenzo Bianconi2018-11-301-0/+2
| | | | | | | Add missing firmware declaration for mt76x0e driver Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: add get_survey supportLorenzo Bianconi2018-11-301-0/+2
| | | | | | | | Move mt76x02_update_channel routine in mt76x02-lib module in order to be reused by mt76x0 driver adding get_survey support Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: introduce mt76x0_phy_calirate routineLorenzo Bianconi2018-10-131-0/+1
| | | | | | | | Add mt76x0_phy_calirate routine in order to perform phy calibration for mt76x0e devices. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: mt76x0e: another fix for the external PA current settingFelix Fietkau2018-10-131-10/+3
| | | | | | | | - Use the register number define instead of a magic value - Fix inverted bit test (override needs to be applied if the bit is not set) Fixes: 2b2cb40bcd7d ("mt76x0: pci: add hw initialization at bootstrap") Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: fix set external PA I/O currentYueHaibing2018-10-131-3/+3
| | | | | | | | | | | | | | | Fixes gcc '-Wunused-but-set-variable' warning: drivers/net/wireless/mediatek/mt76/mt76x0/pci.c: In function 'mt76x0e_register_device': drivers/net/wireless/mediatek/mt76/mt76x0/pci.c:107:8: warning: variable 'data' set but not used [-Wunused-but-set-variable] It seems correct value to write is 'data' Fixes: 2b2cb40bcd7d ("mt76x0: pci: add hw initialization at bootstrap") Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: add mt76x0_register_device in mt76x0e_register_deviceLorenzo Bianconi2018-10-131-1/+19
| | | | | | | | | | Run mt76x0_register_device routine in mt76x0e_register_device in order to register the device to the mac80211 layer. Moreover init mt76_driver_ops data structure and register interrupt line Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: add missing mac80211 callbacksLorenzo Bianconi2018-10-131-1/+10
| | | | | | | Add missing mac80211 callbacks in mt76x0e_ops data structure Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: use mt76x02_dev instead of mt76_dev in mt76x02_eeprom.cLorenzo Bianconi2018-10-131-1/+1
| | | | | | | | Use mt76x02_dev data structure as reference in mt76x02_eeprom.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mcu.cLorenzo Bianconi2018-10-131-1/+1
| | | | | | | | Use mt76x02_dev data structure as reference in mt76x02_mcu.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move tx_tasklet management in mt76x02-lib moudleLorenzo Bianconi2018-10-051-1/+1
| | | | | | | | Move tx_tasklet management in mt76x02_mmio.c in order to be reused by mt76x0 driver and remove duplicated code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mmio.cLorenzo Bianconi2018-10-051-3/+3
| | | | | | | | Use mt76x02_dev data structure as reference in mt76x02_mmio.c instead of mt76_dev Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: rename mt76x02_util.h in mt76x02.hLorenzo Bianconi2018-10-051-2/+0
| | | | | | | | | Rename mt76x02_util.h header file in mt76x02.h since now contains all mt76x02 related definitions and not just utility routines declarations Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76: move mt76x02_tx in mt76x02-lib moduleLorenzo Bianconi2018-10-051-1/+1
| | | | | | | | | Move mt76x02_tx shared routine in mt76x02-lib module and remove duplicated code. Moreover remove mt76x0/tx.c since it is an empty file Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: merge mt76x0_dev in mt76x02_devLorenzo Bianconi2018-10-051-8/+8
| | | | | | | | | | Merge mt76x0_dev data structure in mt76x02_dev one and remove duplicated code. Remove unused definition in mt76x0.h. Moreover merge mt76x0_caldata and mt76x02_rx_freq_cal data structures. This is a preliminary patch for rxwi unification. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: add mt76x0e_cleanup routineLorenzo Bianconi2018-10-051-6/+20
| | | | | | | | Add mt76x0e_cleanup routine to tidy up the device during device removal Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: add mt76x0e_{start/stop} callbacksLorenzo Bianconi2018-10-011-0/+34
| | | | | | | | | Introduce mt76x0e_start and mt76x0e_stop mac80211 callbacks to start/stop device mac opening/closing the netdevice Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: add ieee80211_ops ops pointer to mt76x0_alloc_device signatureLorenzo Bianconi2018-10-011-1/+21
| | | | | | | | | | | | Add ieee80211_ops ops pointer to mt76x0_alloc_device routine signature in order to specify mac80211 callbacks and remove usb dependency from mt76x0 generic code. Move mt76x0_ops callbacks in usb module in order to remove leftover usb dependency in mt76x0 generic code. Introduce mt76x0e_ops mac80211 callbacks for pci code Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: add hw initialization at bootstrapLorenzo Bianconi2018-10-011-1/+46
| | | | | | | | Add mt76x0e_register_device routine in pci.c to initialize the device during hw probe. Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mt76x0: pci: move mcu code in pci_mcu.cLorenzo Bianconi2018-10-011-112/+1
| | | | | | | | | Move pci mcu code in a dedicated source file in order to improve maintainability and facilitate new device support development Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
OpenPOWER on IntegriCloud