History log of /linux-master/drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
Revision Date Author Comments
# 6e1abc51 05-Dec-2022 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt76x0: fix oob access in mt76x0_phy_get_target_power

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>


# f4cfd3f9 22-Nov-2022 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt76x0: remove dead code in mt76x0_phy_get_target_power

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>


# b376d963 28-Sep-2022 Felix Fietkau <nbd@nbd.name>

wifi: mt76: move mt76_rate_power from core to mt76x02 driver code

Its layout and code is mt76x02 specific

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 48dbce5c 12-Nov-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move band capabilities in mt76_phy

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>


# aab662cc 31-Aug-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

mt76: Use fallthrough pseudo-keyword

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>


# 373954ef 04-Mar-2020 Chen Wandun <chenwandun@huawei.com>

mt76: remove variable 'val' set but not used

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>


# 8af63fed 16-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: add multiple wiphy support to mt76_get_min_avg_rssi

Allow tracking clients of both wiphys separately

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# beaaeb6b 15-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: move txpower and antenna mask to struct mt76_phy

Adds multiple wiphy support to mt76_get_txpower

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9e5f6dd7 15-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: move txpower_conf back to driver specific structs

Nothing in the core uses it

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 011849e0 15-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: move state from struct mt76_dev to mt76_phy

Allows keeping per-wiphy state separate

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 96747a51 12-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: move channel state to struct mt76_phy

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>


# 61c51a74 29-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: use mt76_dev in mt76_is_{mmio,usb}

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>


# 2ec1e82b 18-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x0: remove 350ms delay in mt76x0_phy_calibrate

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>


# 0c168e10 23-Aug-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: mt76x0: remove unneeded return value on set channel

We allways return 0 from mt76x0_phy_set_channel(), no need to pass
return value upward.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 187617c5 23-Aug-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: mt76x0: remove redundant chandef copy

We set dev->mt76.chandef in mt76_set_channel() already.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ff97c52a 24-Jul-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt76x02: fix some checkpatch warnings

This fixes the following checkpatch warnings:

ERROR: code indent should use tabs where possible
CHECK: Alignment should match open parenthesis
CHECK: No space is necessary after a cast
CHECK: Please don't use multiple blank lines
CHECK: Avoid precedence issues in macro
WARNING: Statements should start on a tabstop
WARNING: Unnecessary space before function pointer arguments

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 10ece008 24-Jun-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x0: fix RF frontend initialization for external PA

When loading EEPROM data from flash, the RF frontend settings need to be
initialized from flash data. Without this, the chip loads the wrong values
from its internal eFuse ROM.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1802d0be 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license version 2 as
published by the free software foundation this program is
distributed in the hope that it will be useful but without any
warranty without even the implied warranty of merchantability or
fitness for a particular purpose see the gnu general public license
for more details

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 655 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4606a26c 25-Feb-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x02: fix ED/CCA enabling/disabling

ED/CCA needs to be disable before stopping the MAC to avoid hangs from tx
being blocked. It must only be enabled again after the MAC has been started
again.
In many places this wasn't done properly, so fix this by always clearing
the relevant ED/CCA bits in mt76x2_mac_stop and set it up again after
channel change or calibration is done

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1ffe410e 28-Jan-2019 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0bee1ff6 28-Jan-2019 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 20c06572 03-Feb-2019 Felix Fietkau <nbd@nbd.name>

mt76: explicitly disable energy detect cca during scan

Avoid reusing the previous channel's tx blocking state

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 05672636 26-Jan-2019 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# ef13edc0 05-Dec-2018 Felix Fietkau <nbd@nbd.name>

mt76: move mt76x02_phy_get_min_avg_rssi to mt76 core

This will be used by mt7603 as well

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f82ce8d9 12-Dec-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4ece1e0a 09-Nov-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: remove wait argument from mt76x02_mcu_calibrate

We always wait for CMD_CALIBRATION_OP mcu message, but wait argument is used
for do additional MT_MCU_COM_REG0 register operations, which are needed
for mt76x2e devices and we can use appropriate check instead of wait argument.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4784a3cc 01-Nov-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: assure we update gain after scan

Assure that after we initialize dev->cal.low_gain to -1 this
will cause update gain calibration. Otherwise this might or
might not happen depending on value of second bit of low_gain
and values read from registers in mt76x02_phy_adjust_vga_gain().

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f1b8ee35 01-Nov-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: run calibration after scanning

If we are associated and scanning is performed, sw_scan_complete callback
is done after we get back to operating channel, so we do not perform
queue cal work. Fix this queue cal work from sw_scan_complete().

On mt76x0 we have to restore gain in MT_BBP(AGC, 8) register after
scanning, as it was multiple times modified by channel switch code.
So queue cal work without any delay to set AGC gain value.

Similar like in mt76x2 init AGC gain only when set operating channel
and just check before queuing cal work in sw_scan_complete() if
initialization was already done.

Fixes: bbd10586f0df ("mt76x0: phy: do not run calibration during channel switch")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3d2d61b5 26-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: remove wait argument from mt76x02_mcu_function_select

Remove wait argument from mt76x02_mcu_function_select and wait for
response when function is not Q_SELECT, what is the same behaviour
like in vendor driver.

Note this change behaviour for PCIe devices for Q_SELECT function
form wait to no-wait, and for mt76x0u BW_SETTING from no-wait to wait.
But the change is in align with vendor driver.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ad3f993a 25-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: use band parameter for LC calibration

We use always 1 as band parameter for MCU_CAL_LC, this break 2GHz,
we should use 0 for this band instead.

Patch fixes problems happened sometimes when try to associate with 2GHz
AP and manifest by errors like below:

[14680.920823] wlan0: authenticate with 18:31:bf:c0:51:b0
[14681.109506] wlan0: send auth to 18:31:bf:c0:51:b0 (try 1/3)
[14681.310454] wlan0: send auth to 18:31:bf:c0:51:b0 (try 2/3)
[14681.518469] wlan0: send auth to 18:31:bf:c0:51:b0 (try 3/3)
[14681.726499] wlan0: authentication with 18:31:bf:c0:51:b0 timed out

Fixes: 9aec146d0f6b ("mt76x0: pci: introduce mt76x0_phy_calirate routine")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 07e54852 29-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3548a9dd 29-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0464cbfc 27-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b983a5b9 31-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: do not overwrite other MT_BBP(AGC, 8) fields

MT_BBP(AGC, 8) register has values depend on band in
mt76x0_bbp_switch_tab, so we should not overwrite other fields
than MT_BBP_AGC_GAIN when setting gain.

This can fix performance issues when connecting to 2.4GHz AP.

Fixes: 4636a2544c3b ("mt76x0: phy: align channel gain logic to mt76x2 one")
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 801ccc8a 22-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: pci: add DFS support

Introduce dfs support in mt76x0e driver and unlock radar channels

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ef442b73 17-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: antenna select corrections

Update mt76x0_phy_ant_select() to conform vendor driver, most notably
add dual antenna mode support, read configuration from EEPROM and
move ant select out of channel config to init phase. Plus small MT7630E
quirk for MT_CMB_CTRL register which vendor driver dedicated to this
chip do.

This make MT7630E workable with mt76x0e driver and do not cause any
problems on MT7610U for me.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e0168dc6 17-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# cadc83ef 18-Oct-2018 Felix Fietkau <nbd@nbd.name>

mt76: mt76x0: handle chip specific initval differences

Some RF registers need different values for various chips.
For at least mt76x0_rf_central_tab registers, overwriting them later does
not work, as the wrong values can cause the entire system to hang on some
devices with MT7610E

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a83150ea 16-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: do not perform MCU calibration for MT7630

Driver works better for MT7630 without MCU calibration, which
looks like it can hangs the firmware. Vendor driver do not
perform it for MT7630 as well.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1163bdb6 15-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d3caa060 14-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9c410782 14-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# bbd10586 11-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4636a254 11-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 66a34c66 11-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 592ebc9c 11-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9aec146d 11-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3eaf05de 11-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 370c6415 11-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 032c08f4 11-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7859c543 09-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4df94273 09-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 26a9daa6 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# bfdff5d0 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 499cd0aa 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

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 <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a14054ce 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: phy: fix bank check in mt76x0_rf_csr_{wr,rr}

Fix typo in bank check in mt76x0_rf_csr_{wr,rr} routines.
This issue has never been hit since mt76x0_rf_csr_{wr,rr}
are actually used just by pci code

Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 69cacac3 03-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: use bus helper to identify rf access method

Use mt76_is_usb() to identify RF access method instead of
MT76_STATE_MCU_RUNNING flag and add warning since MCU has
to be initialized before we can access RF registers via MCU.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f2761e53 03-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: correct RF reg pairs write for PCIe

We have to use RF CSR method for PCIe.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6f223a3d 03-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: correct RF access via RF_CSR register.

PCIe version don't use MCU for RF registers access. We need
to correct RF CSR method to support up to 127 RF registers.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# bed25905 03-Oct-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: print BBP version only for debug

Use dev_dbg to print BBP version.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9ba1e0e6 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: unify rxwi parsing between mt76x2 and mt76x0 drivers

Unify rxwi parsing between mt76x2 and mt76x0. Remove the following
routines:
- mt76x0_phy_get_rssi
- mt76x0_queue_rx_skb
- mt76x0_mac_process_rx
Moreover remove mt76x2/common.c and mt76x0/mac.h since are empty files
Enable CCMP PN sw validation

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b2d871c0 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: merge mt76x0_dev in mt76x02_dev

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>


# 46a74187 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove hw_atomic_mutex mutex in mt76x0_dev

Remove hw_atomic_mutex mutex in mt76x0_dev data structure
since mt76x0_phy_set_channel is already protected by mt76_dev
mutex while mt76x0_chip_onoff is used just at device probe or
cleanup

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ac85ab8c 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: mac: use sta ewma estimation for rssi tracking

Use shared mt76x02 utility routines for rssi tracking.
Moreover remove no longer used con_mon_lock spinlock
and following variable:
- ap_bssid
- bcn_freq_off
- bcn_phy_mode
- avg_rssi

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6034b2b0 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move set_{tx,rx}_path routines in mt76x02-lib module

Move mt76x02_phy_set_rxpath and mt76x02_phy_tx_dac routines in
mt76x02_phy.c since they are shared between mt76x2 and mt76x0 drivers.
Moreover move chainmask variable from mt76x2/mt76x0 to mt76_dev data
structure

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4468e92c 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: phy: set antenna parameter according to wireless band

Move mt76x0_ant_select routine in __mt76x0_phy_set_channel in order to
configure antenna parameters according to the current wireless channel

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1f4db1fd 22-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: phy: introduce mt76x0_phy_set_txpower routine

Add mt76x0_phy_set_txpower routine in order to configure
base and per rate tx power gain. Moreover take into account
txpower_conf in order to limit the tx power gain according to
the bound provided by mac80211

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f2a2e819 22-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove eeprom dependency from mt76x0_get_power_info

In order to unify eeprom parsing between mt76x0 and mt76x2 drivers,
remove eeprom pointer dependency from mt76x0_get_power_info routine.
Remove mt76x0_eeprom_params since it is now an empty structure

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b37bbc8c 22-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove eeprom dependency from mt76x0_set_tx_power_per_rate

In order to unify eeprom parsing between mt76x0 and mt76x2 drivers,
remove eeprom pointer dependency from mt76x0_set_tx_power_per_rate.
Moreover use mt76_rate_power to store power vs rate calibration data.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0050507c 22-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: remove mt76x0_phy_set_tx_power and mt76x0_extra_power_over_mac

Remove mt76x0_extra_power_over_mac and mt76x0_phy_set_tx_power routines
since they are not actually used and tx power handling will be unified
with mt76x2 driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 77d0f465 20-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: unify freq offset parsing

Unify frequency offset parsing with mt76x2 driver using
eeprom utility routines available in mt76x02-lib module

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2c0db839 20-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: unify temperature offset parsing

Unify temperature offset parsing with mt76x2 driver using
eeprom utility routines available in mt76x02-lib module

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 564d7f0a 20-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: unify rssi_offset parsing

Unify rssi_offset parsing with mt76x2 driver using eeprom utility
routines available in mt76x02-lib module

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2daa6758 20-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: unify lna_gain parsing

Unify lna gain parsing with mt76x2 driver using eeprom utility
routines available in mt76x02-lib module

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 443569a5 20-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x2_ext_pa_enabled routine in mt76x02_eeprom.c

Move mt76x2_ext_pa_enabled utility routine in mt76x02_eeprom.c
and remove duplicated code. This is a preliminary patch to
unify eeprom code between mt76x2 and mt76x0 driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# edaa580b 09-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move shared mcu_calibrate routine in mt76x02-lib module

Move mcu_calibrate routine in mt76x02-lib module since it is
shared between USB and PCI code. Moreover remove duplicated
code

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 36fd09dd 09-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76{0,2} mcu shared code in mt76x02_mcu.c

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>


# 17507157 09-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: usb: use common helpers for mcu_alloc_msg()/mcu_send_msg()

Use mcu common helpers instead of usb specific routines.
Add static qualifier to the following functions:
- mt76u_mcu_msg_alloc
- __mt76u_mcu_send_msg
- mt76u_mcu_send_msg
- mt76u_mcu_wr_rp
- mt76u_mcu_rd_rp
- mt76u_wr_rp
- mt76u_rd_rp
This is a preliminary patch to move mt76x02 usb mcu code in
mt76x02-usb module

Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f1638c7c 09-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: add usb implementation of {wr,rd}_rp

Add USB implementation for read and write reg pair routines.
The actual implementation can use mcu related routines according to
MCU state

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 473f0a76 07-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: run vco calibration for each channel configuration

According to vendor sdk, vco calibration has to be executed
for each channel configuration whereas mcu calibration has to be
performed during channel scanning. This patch fixes the mt76x0
monitor mode issue since in that configuration vco calibration
was never executed

Fixes: 10de7a8b4ab9 ("mt76x0: phy files")
Tested-by: Sid Hayn <sidhayn@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5944cd02 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify txwi and rxwi structures

txwi and rxwi are the same for mt76x0 and mt76x2.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e800a333 03-Aug-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: rename trace symbols

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>


# 10de7a8b 31-Jul-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x0: phy files

Add phy files of mt76x0 driver.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>