Commit Graph
100 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau 4637f95417 mt76: move mt76_mcu_get_response in mt76-core
Move mt76_mcu_get_response in mt76-core module and remove duplicated
code. mt76_mcu_get_response will be reused adding support for mt7603
driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-02-07 14:48:44 +01:00
Lorenzo BianconiandFelix Fietkau 6e33ce6d73 mt76: move mt76_mcu_msg_alloc in mt76-core
Move mt76_mcu_msg_alloc in mt76-core module and remove duplicated code.
mt76_mcu_msg_alloc will be reused adding support for mt7603 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-02-07 14:48:34 +01:00
Lorenzo BianconiandFelix Fietkau 28d81ff90e mt76x0: eeprom: fix VHT mcs{8,9} rate power offset
Fix rate power configuration for VHT mcs 8 and 9 in
mt76x0_get_tx_power_per_rate. Moreover use the rate power
offset used for HT/VHT mcs 6 even for HT/VHT mcs 7

Fixes: b37bbc8c8251 ("mt76x0: remove eeprom dependency from mt76x0_set_tx_power_per_rate")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-02-07 14:47:57 +01:00
Lorenzo BianconiandFelix Fietkau bc7ce2a170 mt76x0: init: introduce mt76x0_init_txpower routine
Add mt76x0_init_txpower in order to initialize max_power per channel
at device bootstrap. Modify mt76x0_get_tx_power_per_rate and
mt76x0_get_power_info signature in order to compute tx power for
non-operating channels

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-01-30 15:14:44 +01:00
Lorenzo BianconiandFelix Fietkau 24bd2c0d6e mt76x0: phy: report target_power in debugfs
Initialize target_power variable in mt76x0_phy_set_txpower in order to
report target_power in debugfs

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-01-30 15:14:31 +01:00
Lorenzo BianconiandFelix Fietkau c989bac555 mt76x0: eeprom: fix chan_vs_power map in mt76x0_get_power_info
Report correct eeprom per channel power value.
Fix chan_vs_power map in mt76x0_get_power_info routine

Fixes: f2a2e819d672 ("mt76x0: remove eeprom dependency from mt76x0_get_power_info")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-01-30 15:14:19 +01:00
Lorenzo BianconiandFelix Fietkau 63a79ff71f mt76: do not report out-of-range rx nss
Take into account device rx stream in mt76x02_mac_process_rate
in order to not report wrong number of rx spatial stream to mac80211.
The issue has been reported on mt76x0 device which is 1x1:1 however
the hw sometimes reports rx nss equal to 2

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-21 21:48:35 +01:00
Lorenzo BianconiandFelix Fietkau a946b78acf mt76: add led support to mt76x0e driver
Move mt76x02 led support in mt76x02-lib module in order to
add tpt led trigger to mt76x0e driver

Tested-by: LGA1150 <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-01-11 15:24:32 +01:00
Lorenzo BianconiandFelix Fietkau eca96cd856 mt76: use proper name for __MT76x02_H macro
Use proper name for __MT76x02_H macro in mt76x02.h

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-11 15:24:32 +01:00
Lorenzo BianconiandFelix Fietkau 7d4a95c8dd mt76: dma: avoid indirect call in mt76_dma_tx_queue_skb
Call mt76_dma_add_buf routine directly in mt76_dma_tx_queue_skb
and avoid indirect call if not necessary

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-31 15:45:10 +01:00
Lorenzo BianconiandFelix Fietkau 3598046d01 mt76: mmio: introduce mt76x02_check_tx_hang watchdog
Port mt76x02_check_tx_hang watchdog from vendor driver in order to
perform a device reset when tx mac/dma logic hangs. Tx mac/dma stuck
has been observed when the device is heavy loaded or in a noisy
environment. Moreover introduce wdt delayed work in order to run
tx_hang watchdog. For the moment run mt76x02_check_tx_hang watchdog
just on mt76x2 devices since the issue has not been observed on mt76x0
driver yet

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 16:16:41 +01:00
Lorenzo BianconiandFelix Fietkau c78e317701 mt76: dma: do not build skb if reported len does not fit in buf_size
Precompute data length in order to avoid to allocate the related
skb data structure if reported length does not fit in queue buf_size

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 16:15:53 +01:00
Lorenzo BianconiandFelix Fietkau 876d0e95bc mt76: mac: minor optimizations in mt76x02_mac_tx_rate_val
Do not set bw variable to zero for legacy rates since it is already
initialized to zero. Moreover set nss to 1 just for legacy rates
since nss will be properly set for VHT/HT rates

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 9661da4580 mt76: add energy detect CCA support to mt76x{0,2}e drivers
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 <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 51b6daf6b2 mt76x2: init: set default value for MT_TX_LINK_CFG
Update default value for MT_TX_LINK_CFG according to vendor driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 37b2ad3449 mt76: dfs: run mt76x02_dfs_set_domain atomically
Grab mt76_dev mutex in mt76x02_dfs_set_domain since it runs
concurrently with mt76x{0,2}_set_channel routines

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 10f57cf795 mt76x2: add static qualifier to mt76x2_init_hardware
Add static qualifier to mt76x2_init_hardware routine since it is
used just in pci_init.c

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 40dad3240f mt76x0: pci: fix ACS support
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 <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 6be90b667a mt76: usb: avoid queue/status spinlocks while passing tx status to mac80211
As already done for pcie code in commit 79d1c94c9c78 ("mt76: avoid
queue/status spinlocks while passing tx status to mac80211") make sure
that no tx related spinlocks are taken during the ieee80211_tx_status call

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 9c9fae34bc mt76: mac: run mt76x02_mac_work routine atomically
Grab mt76_dev mutex in mt76x02_mac_work handler since it runs
concurrently with mt76x{0,2}_set_channel routines

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 1d2819e39e mt76: fix typo in mt76x02_check_mac_err routine
Reconfigure properly MT_MAC_SYS_CTRL register after mac sw-reset
in mt76x02_check_mac_err routine

Fixes: 73556561ab9f ("mt76x0: use mt76x02_mac_work as stats handler")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 0490bd2126 mt76: usb: do not build the skb if reported len does not fit in buf_size
Precompute data length in order to avoid to allocate the related
skb data structure if reported length does not fit in queue buf_size

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau e67e551496 mt76: dma: remove napi from mt76_dma_rx_fill signature
Remove napi from mt76_dma_rx_fill routine signature since
it is a leftover of a previous implementation and it is no
longer used

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau fa7335bbe3 mt76: fix potential NULL pointer dereference in mt76_stop_tx_queues
Starting from mac80211 commit adf8ed01e4fd ("mac80211: add an optional
TXQ for other PS-buffered frames") and commit 0eeb2b674f05 ("mac80211:
add an option for station management TXQ") a new per-sta queue has been
introduced for bufferable management frames.
sta->txq[IEEE80211_NUM_TIDS] is initialized just if the driver reports
the following hw flags:
- IEEE80211_HW_STA_MMPDU_TXQ
- IEEE80211_HW_BUFF_MMPDU_TXQ
This can produce a NULL pointer dereference in mt76_stop_tx_queues
since mt76 iterates on all available sta tx queues assuming they are
initialized by mac80211. This issue has been spotted analyzing the code
(it has not triggered any crash yet)

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-17 18:15:00 +01:00
Lorenzo BianconiandFelix Fietkau 96b3b3d60d mt76x2u: main: fix typo setting sta_state mac80211 callback
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-16 13:33:14 +01:00
Lorenzo BianconiandFelix Fietkau 3fc95d7464 mt76x2u: init: remove mt76x2u_init_beacon_offsets routine
Remove mt76x2u_init_beacon_offsets routine since the driver supports
just STA mode

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau 9fe0fe8594 mt76x2u: main: use mt76x02_bss_info_changed utility routine
Initialize bss_info_changed mac80211 callback to
mt76x02_bss_info_changed utility routine and remove duplicated code.
Use 8 as WCID index for sta interface

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau c1d67b47d4 mt76x2u: phy: run phy_channel_calibrate after channel switch
Perform channel calibration after each channel switch and not only after
connection establishment since NetworkManager perform multiple frequency
scanning if RSSI in lower a given threshold

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau f75efd81f8 mt76x2u: phy: add TX_SHAPING calibration
Add MCU_CAL_TX_SHAPING calibration in mt76x2u_phy_channel_calibrate
routine since now mt76x2 and mt76x2u driver run the same firmware

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau 4248446224 mt76x0: pci: enable VHT rates in IBSS mode
Enable VHT tx rates in ad-hoc mode for mt76x0e driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau 0bfa98eb08 mt76: introduce mt76x02_config_mac_addr_list routine
Add mt76x02_config_mac_addr_list routine in order to set
the mac address list supported by the driver. Initialize
wiphy->addresses/n_addresses for mt76x0e driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:41 +01:00
Lorenzo BianconiandFelix Fietkau df5c797b21 mt76: fix uninitialized mutex access setting rts threshold
Fix following crash due to a leftover uninitialized mutex access
in mt76x2_set_rts_threshold routine.

[   31.018059] Call Trace:
[   31.018341]  register_lock_class+0x51f/0x530
[   31.018828]  __lock_acquire+0x6c/0x1580
[   31.019247]  lock_acquire+0x88/0x120
[   31.021089]  __mutex_lock+0x4a/0x4f0
[   31.023343]  mt76x2_set_rts_threshold+0x28/0x50
[   31.023831]  ieee80211_set_wiphy_params+0x16d/0x4e0
[   31.024344]  nl80211_set_wiphy+0x72b/0xbc0
[   31.024781]  genl_family_rcv_msg+0x192/0x3a0
[   31.025233]  genl_rcv_msg+0x42/0x89
[   31.026079]  netlink_rcv_skb+0x38/0x100
[   31.026475]  genl_rcv+0x1f/0x30
[   31.026804]  netlink_unicast+0x19c/0x250
[   31.027212]  netlink_sendmsg+0x1ed/0x390
[   31.027615]  sock_sendmsg+0x31/0x40
[   31.027973]  ___sys_sendmsg+0x23c/0x280
[   31.030414]  __sys_sendmsg+0x42/0x80
[   31.030783]  do_syscall_64+0x4a/0x170
[   31.031160]  entry_SYSCALL_64_after_hwframe+0x49/0xbe
[   31.031677] RIP: 0033:0x7f3498b39ba7
[   31.033953] RSP: 002b:00007fffe19675b8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
[   31.034883] RAX: ffffffffffffffda RBX: 00000000012d5350 RCX: 00007f3498b39ba7
[   31.035756] RDX: 0000000000000000 RSI: 00007fffe19675f0 RDI: 0000000000000003
[   31.036587] RBP: 00000000012da740 R08: 0000000000000002 R09: 0000000000000000
[   31.037422] R10: 0000000000000006 R11: 0000000000000246 R12: 00000000012da880
[   31.038252] R13: 00007fffe19675f0 R14: 00007fffe19678c0 R15: 00000000012da880

Fixes: 108a4861ef19 ("mt76: create new mt76x02-lib module for common
mt76x{0,2} code")
Reported-by: [email protected]
Reported-by: [email protected]
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-13 20:56:18 +01:00
Lorenzo BianconiandFelix Fietkau eb53745a3a mt76x0: dfs: fix IBI_R11 configuration on non-radar channels
Fix IBI_R11 configuration on non-radar channels for mt76x0e
driver. This patch improve system stability under heavy load.
Moreover use IBI_R11 name and remove magic numbers for
0x212c register

Fixes: 0c3b3abc9251 ("mt76x0: pci: add DFS support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-05 10:21:24 +01:00
Lorenzo BianconiandFelix Fietkau a78802c63b mt76x0: phy: use tssi reported value to configure tx power if available
Use tssi calibrated value to configure tx power gain if tssi is enabled
in eeprom data

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau 57b441dcae mt76x0: phy: introduce tssi calibration support
Run mt76x0 tssi calibration process if enabled in eeprom data.
Perform calibration procedure every 4s

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau bd568d9b39 mt76: move mt76x02_eeprom_copy in mt76x02-lib module
Move mt76x02_eeprom_copy utility routine in mt76x02-lib module
in order to be reused by mt76x0 driver adding tssi calibration
support

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau c7aa8f4ef8 mt76x2u: init: use common routines for wcid/key initialization
Use mt76x02_mac_wcid_setup and mt76x02_mac_shared_key_setup for
shared keys and wcid table initialization and remove duplicated
code

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau d0eb03e387 mt76x2u: init: remove not useful configuration
Remove MT_TSO_CTRL and MT_HEADER_TRANS_CTRL_REG initialization since
it is already done in mt76_write_mac_initvals routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau 097b2bd05c mt76x0: init: use mt76x02_mac_wcid_setup for wcid configuration
Use mt76x02_mac_wcid_setup utility routine for wcid init configuration
and remove duplicated code. This patch fixes a mt76x0 AP issue since
hw key table selection was set to pairwise by default

Fixes: dbad2adcb2c7 ("mt76x0: pci: enable AP support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau 1f24db9140 mt76x2: move wcid_tx_rate conf at bootstrap
Move WCID tx rate configuration at device bootstrap since
the related register are always set to 0

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau add66a0a09 mt76x0: init: use mt76x02_mac_shared_key_setup in mt76x0_init_hardware
Use mt76x02_mac_shared_key_setup utility routine for shared key
initialization and remove duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau 2ae2046e70 mt76x0: phy: use mt76_poll_msec in mt76x0_phy_temp_sensor
Use mt76_poll_msec utility routine for CORE_R34 register polling
instead of mt76_poll in order to allow the hw to complete requested
calibration since on slow devices (e.g. mt7620 based boards) calibration
takes longer than 2ms

Fixes: 66a34c66e0cb ("mt76x0: phy: add phy/vco temperature compensation")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-11-01 18:04:15 +01:00
Lorenzo BianconiandFelix Fietkau ba9d4247f2 mt76x0: pci: add DFS support
Introduce dfs support in mt76x0e driver and unlock radar channels

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:14:20 +02:00
Lorenzo BianconiandFelix Fietkau d21a83574b mt76: move dfs support in mt76x02-lib module
Move mt76x2 DFS support in mt76x02-lib module in order to
be reused by mt76x0 driver and unlock DFS frequencies

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:14:20 +02:00
Lorenzo BianconiandFelix Fietkau 5bca2de885 mt76: move mt76x02_bss_info_changed in mt76x02-lib module
Unify drv_bss_info_changed mac80211 callback and remove duplicated
code in mt76x0 and mt76x2 drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau fe5a1494c1 mt76: move tx protection routines in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau 41d7ef7bbd mt76x0: update init vals for MT_TX_PROT registers
Add missing VHT MT_TX_PROT register init values

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau 3b86d9964b mt76: move mt76x02_set_tx_ackto in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau c181d973ef mt76x0: pci: enable AP support
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau e684281389 mt76: introduce mt76x02_init_beacon_config routine
Add mt76x02_init_beacon_config utility routine in mt76x02-lib
module in order to be reused by mt76x0 driver configuring
BSSID registers and remove duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau aa1d6bd6bc mt76: move mt76x02_sta_ps in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau 2d736cff1d mt76: move mt76x02_get_txpower in mt76x02_util.c
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau acd4c99e87 mt76: move mt76x02_sw_scan and mt76x02_sw_scan_complete in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau 8486047738 mt76x0: pci: add pre_tbtt_tasklet support
Enable/disable pre_tbtt_tasklet in mt76x0 driver in order
to add AP support

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau 6b69650ea3 mt76: move tx beacon routines in mt76x02-lib module
Move mt76x02_tx beacon utility routines in mt76x02_mmio.c
in order to be reused by mt76x0 driver adding AP support

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau a4a08c33a9 mt76: move mac beacon routines in mt76x02-lib module
Move mt76x02_beacon mac routines in mt76x02_mac.c in
order to be reused by mt76x0 driver adding AP support

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau aa6ebf9da5 mt76: move mt76x02_init_device in mt76x02-lib module
Move mt76x02_init_device routine in mt76x02_util.c in order to be
reused by mt76x0 driver and remove duplicated code. Move interface
combo definition supported by the driver in mt76x02_init_device routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau d4391ae2f0 mt76: move mt76x02_mac_set_short_preamble in mt76x02_mac.c
Move mt76x02_mac_set_short_preamble routine in mt76x02-lib module
since it is shared between mt76x0 and mt76x2 drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau 5d8c4bfc9c mt76x0: align mt76x0u and mt76x0e fw version
Unify firmware version used on mt76x0e and mt76x0u drivers.
Fallback to mt7610u fw if mt7610e one is not available

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau 97e026924a mt76x0: mac: remove mt76x0_mac_set_ampdu_factor
Remove no longer used mt76x0_mac_set_ampdu_factor routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau 3c54612f7f mt76x0: pci: add missing MODULE_FIRMWARE macro
Add missing firmware declaration for mt76x0e driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 11:13:45 +02:00
Lorenzo BianconiandFelix Fietkau dade10933e mt76x0: init: simplify mt76x0_init_mac_registers
Simplify mt76x0_init_mac_registers routine using mt76_set, mt76_clear
and mt76_rmw utility routines

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-23 09:49:40 +02:00
Lorenzo BianconiandFelix Fietkau 1a2b2dc1c9 mt76: usb: fix static tracepoints
Add submit_urb and rx_urb static tracepoints in mt76-usb module.
Move trace_mac_txstat_fetch in mt76x02_mac_load_tx_status routine
in order to be available to usb drivers. Moreover remove
no longer used mt76x0/trace.{c,h}

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-10-23 09:49:40 +02:00
Lorenzo BianconiandFelix Fietkau 4671af45a3 mt76x0: phy: unify calibration between mt76x0u and mt76x0e
Align phy calibration logic between mt76x0u and mt76x0e drivers
This patch improves connection stability with low SNR

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:51:14 +02:00
Lorenzo BianconiandFelix Fietkau b228a45394 mt76x2u: introduce mac workqueue support
Add mac workqueue support to mt76x2u driver in order
to compute device statistics and add mac stuck routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:51:14 +02:00
Lorenzo BianconiandFelix Fietkau 6aae25b98e mt76x0: use mt76x02_mac_work as stats handler
Use mt76x02_mac_work utility routine as stats workqueue handler
and remove duplicated code. Moreover run mac stuck check in
mt76x02_mac_work for client interfaces.
Remove no longer used avg_ampdu_len and mt76x02_mac_stats data
structure in mt76x02_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:51:14 +02:00
Lorenzo BianconiandFelix Fietkau 4f3b608389 mt76x0: use shared debugfs implementation
Use mt76x02 debugfs implementation and remove duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:51:14 +02:00
Lorenzo BianconiandFelix Fietkau ecec6ba54d mt76: move mt76x02_debugfs in mt76x02-lib module
Move mt76x02_debugfs in mt76x02-lib module in order to
be reused by mt76x0 driver and remove duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:51:14 +02:00
Lorenzo BianconiandFelix Fietkau 9e493f7500 mt76: move mt76x02_mac_work routine in mt76x02-lib module
Move mt76x02_mac_work routine in mt76x02_mac.c in order to be reused by
mt76x0 driver to read device statistics

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:49:15 +02:00
Lorenzo BianconiandFelix Fietkau eab7ab1450 mt76x0: pci: add get_survey support
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:49:15 +02:00
Lorenzo BianconiandFelix Fietkau da129c9508 mt76x0: phy: improve code readability in initvals_phy.h
Improve initvals_phy.h code readability (there are no actual changes
of original values)

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:49:15 +02:00
Lorenzo BianconiandFelix Fietkau b6694e6ccc mt76x0: phy: simplify rf configuration routines
Simplify mt76x0_phy_vco_cal and mt76x0_phy_set_chan_rf_params
routines using mt76x0_rf_wr, mt76x0_rf_set and mt76x0_rf_clear
helper routines. Moreover over get rid of magic numbers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:49:15 +02:00
Lorenzo BianconiandFelix Fietkau bcbecd23eb mt76x0: phy: use proper name convention
Use mt76x0_phy as prefix for routines in mt76x0/phy.c
Moreover use mt76x0_rf_set to enable vco calibration in
mt76x0_phy_vco_cal

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-16 12:49:15 +02:00
Lorenzo BianconiandFelix Fietkau 1f3f767371 mt76x2u: align channel gain logic to mt76x2 one
Update vga tuning algorithm to the one used in mt76x2 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-10-15 14:03:14 +02:00
Lorenzo BianconiandFelix Fietkau cf859ad3cf mt76x2: align mt76x2 and mt76x2u firmware
Unify firmware version used on mt76x2e and mt76x2u drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-10-15 14:03:14 +02:00
Lorenzo BianconiandFelix Fietkau 98f8ef7e4e mt76x0: phy: do not run calibration during channel switch
Do not perform phy/vga calibration during channel switch.
Moreover remove mt76x0_agc_save and mt76x0_agc_restore routines
since they are no longer necessary. Furthermore run mt76_set_channel
in order to check if there are pending frames during channel switch

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau 87fcb31e5b mt76x0: phy: align channel gain logic to mt76x2 one
Update vga tuning algorithm to the one used in mt76x2 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau 2715e7c988 mt76: introduce mt76x02_init_agc_gain routine
Add mt76x02_init_agc_gain routine in mt76x02-lib moudule in
order to be reused by mt76x0 for vga initalization

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau eaf975179f mt76: move mt76x02_phy_adjust_vga_gain in mt76/mt76x02_phy.c
Move mt76x02_phy_adjust_vga_gain routine in mt76x02-lib module
in order to be reused by mt76x0 driver for vga calibration

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau cc34ce9534 mt76: move rssi_gain_thresh routines in mt76x02-lib module
Move mt76x2_get_rssi_gain_thresh and mt76x2_get_low_rssi_gain_thresh
routines in mt76x02-lib module in order to be reused by mt76x0 driver
for dynamic vga calibration

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau a48481d54a mt76x0: phy: add phy/vco temperature compensation
Introduce phy/vco temperature calibration.
Moreover fix configuration of register 67 on bank0
during temperature reading and use mt76_poll utility routine
to poll core34 register.
Furthermore temperature compensation needs to be disabled
if the device supports tssi compensation.
This issue has never been hit since temperature reading is not
actually used by usb code.

Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau 62a1bc5f32 mt76x0: eeprom: introduce mt76x0_tssi_enabled routine
Add mt76x0_tssi_enabled in order to check if tssi compensation
is enabled since mt76x0 condition differs from mt76x2 one.
Moreover move back mt76x02_temp_tx_alc_enabled and mt76x02_tssi_enabled
routines in mt76x2/eeprom.h since they are mt76x2 specific

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau a514b7594c mt76x0: phy: update set_channel for mt76x0e devices
Do not run mt76x0_vco_cal and mt76x0_bbp_set_bw routines and
configure MT_TX_SW_CFG0 register for pcie devices in
mt76x0_phy_set_channel function.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau 7269fb46e7 mt76x0: pci: introduce mt76x0_phy_calirate routine
Add mt76x0_phy_calirate routine in order to perform
phy calibration for mt76x0e devices.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau 3eaa34f9a1 mt76x0: pci: rename mt76x0_phy_calibrate
Rename mt76x0_phy_calibrate routine in mt76x0_phy_calibration_work
in order to not collide with calibration routine for mt76x0e

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau f82134f75a mt76: move mt76x02_phy_set_band in mt76x02-lib module
Move mt76x02_phy_set_band routine in mt76x02_phy.c since
it is shared between mt76x0 and mt76x2 drivers and remove
duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau 1775717f55 mt76: move mt76x02_phy_set_bw in mt76x02-lib module
Move mt76x02_phy_set_bw routine in mt76x02_phy.c since
it is shared between mt76x0 and mt76x2 drivers and remove
duplicated code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau e9e949b9b2 mt76x0: phy: remove channel parameter from mt76x0_phy_set_chan_bbp_params
Remove unused channel parameter from mt76x0_phy_set_chan_bbp_params
routine signature

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-15 14:03:01 +02:00
Lorenzo BianconiandFelix Fietkau 8a0acfd09a mt76x0: phy: fix restore phase in mt76x0_phy_recalibrate_after_assoc
Fix restore value configured in MT_BBP(IBI, 9) register in
mt76x0_phy_recalibrate_after_assoc routine.

Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-10-09 14:23:15 +02:00
Lorenzo BianconiandFelix Fietkau f0951c22ec mt76x0: pci: add mt76x0_register_device in mt76x0e_register_device
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 4de98cdaf9 mt76: disable ldpc coding for mt76x0 devices
Disable ldpc coding for mt76x0 devices. Morover remove
mt76x02_mac_fill_txwi routine since it is used just in
mt76x02_mac_write_txwi

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 72546ed0b7 mt76x0: pci: add missing mac80211 callbacks
Add missing mac80211 callbacks in mt76x0e_ops data structure

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 06276cc7f1 mt76x0: pci: report firmware version using ethtool
Report via ethtool fw_ver and build_ver members of mt76x02_fw_header
data structure similarly to what is reported in the syslog

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 48950cb615 mt76: use mt76x02_dev instead of mt76_dev in mt76x02_eeprom.c
Use mt76x02_dev data structure as reference in mt76x02_eeprom.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau f37bd25c4d mt76: use mt76x02_dev instead of mt76_dev in mt76x02_txrx.c
Use mt76x02_dev data structure as reference in mt76x02_txrx.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau fd9b2b0fdf mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mac.c
Use mt76x02_dev data structure as reference in mt76x02_mac.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 08ecb5f019 mt76: use mt76x02_dev instead of mt76_dev in mt76x02_usb_mcu.c
Use mt76x02_dev data structure as reference in mt76x02_usb_mcu.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 29bc2ae085 mt76: use mt76x02_dev instead of mt76_dev in mt76x02_util.c
Use mt76x02_dev data structure as reference in mt76x02_util.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 214eab7c5b mt76: use mt76x02_dev instead of mt76_dev in mt76x02_phy.c
Use mt76x02_dev data structure as reference in mt76x02_phy.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Lorenzo BianconiandFelix Fietkau 1945d571f4 mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mcu.c
Use mt76x02_dev data structure as reference in mt76x02_mcu.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00