Commit Graph
1001 Commits
Author SHA1 Message Date
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
Felix Fietkau 2b79bb762a mt76: mt76x0e: another fix for the external PA current setting
- 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 <[email protected]>
2018-10-09 10:50:49 +02:00
YueHaibingandFelix Fietkau acfc5a9b93 mt76x0: pci: fix set external PA I/O current
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 <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
2018-10-09 10:50:49 +02:00
Stanislaw GruszkaandFelix Fietkau 5e6907f272 mt76x0: remove dma.h
dma.h is not used any longer.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Stanislaw GruszkaandFelix Fietkau 4f3685e11b mt76: reserve enough room for USB tx skbs
Reserve enough room for USB skb, so we don not need to check
the room every time we send frame.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +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
Lorenzo BianconiandFelix Fietkau 9c272ff025 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Stanislaw GruszkaandFelix Fietkau c83abb86cb 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Stanislaw GruszkaandFelix Fietkau c438e67e7d mt76x0: correct RF reg pairs write for PCIe
We have to use RF CSR method for PCIe.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Stanislaw GruszkaandFelix Fietkau 02d23855e8 mt76: allow to identify bus
Add helpers to identify bus type.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Stanislaw GruszkaandFelix Fietkau ddc9e0554e 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Stanislaw GruszkaandFelix Fietkau c50dca8142 mt76x0: print BBP version only for debug
Use dev_dbg to print BBP version.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:47:02 +02:00
Felix Fietkau 96fa353e79 mt76: do not store aggregation sequence number for null-data frames
Fixes a rare corner case where a BlockAckReq might get the wrong
sequence number.

Signed-off-by: Felix Fietkau <[email protected]>
2018-10-08 13:46:42 +02:00
Lorenzo BianconiandFelix Fietkau e61671e0d3 mt76: move irq handler in mt76x02-lib moudle
Move mt76x02_irq_handler handler in mt76x02_mmio.c in order to be
reused in mt76x0 driver. Move mt76x02_rx_poll_complete routine in
mt76x02-lib module. Moreover remove pci_core.c and mt76x2/trace.{c,h}
since are empty files

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 20:03:54 +02:00
Lorenzo BianconiandFelix Fietkau 3d2cfe3533 mt76: move tx_tasklet management in mt76x02-lib moudle
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 20:03:54 +02:00
Lorenzo BianconiandFelix Fietkau 99e04864d9 mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mmio.c
Use mt76x02_dev data structure as reference in mt76x02_mmio.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 20:03:54 +02:00
Lorenzo BianconiandFelix Fietkau 9730290287 mt76: move mt76x02_tx_complete in mt76x02-lib module
Move mt76x02_tx_complete mt76x02-lib module in order to
be reused by mt76x0 drivers for irq unification.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 20:00:30 +02:00
Lorenzo BianconiandFelix Fietkau 3770c54128 mt76: move mt76x02_mac_poll_tx_status in mt76x02-lib moudle
Move mt76x02_mac_poll_tx_status in mt76x02_mac.c in order to
be reused by mt76x0 drivers for irq unification.
Moreover introduce mt76x02_trace source file to define mt76x02
trace points

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 20:00:30 +02:00
Lorenzo BianconiandFelix Fietkau 9a3952131b mt76: usb: move mt76x02u_tx_complete_skb in mt76x02_usb_core.c
Move mt76x02u_tx_complete_skb and mt76x02u_remove_dma_hdr since they
are used just by usb code

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:45 +02:00
Lorenzo BianconiandFelix Fietkau 45b8f5e36f mt76: move mt76x02_tx_prepare_skb in mt76x02_txrx.c
Move mt76x02_tx_prepare_skb routine in mt76x02-lib module in order
to be reused by mt76x0 driver in tx datapath

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:45 +02:00
Lorenzo BianconiandFelix Fietkau 608708acf1 mt76: move tpc routines in mt76x02-lib module
Move mt76x02_tx_get_txpwr_adj and mt76x02_tx_set_txpwr_auto routines
in mt76x02-lib module since they are shared between mt76x0 and mt76x2
drivers. Moreover remove get_txpwr_adj function pointer

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:45 +02:00
Lorenzo BianconiandFelix Fietkau fd9174f830 mt76x2: remove leftover function declatarions
Remove following function declarations since they have been moved
to mt76x02-lib module:
- mt76x2_sta_add
- mt76x2_sta_remove
- mt76x2_remove_interface
- mt76x2_conf_tx
- mt76x2_txq_init

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:45 +02:00
Lorenzo BianconiandFelix Fietkau 9c874cd3b5 mt76: rename mt76x02_util.h in mt76x02.h
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:45 +02:00
Lorenzo BianconiandFelix Fietkau 159f76741f mt76: move txrx shared routines in mt76x02_txrx.c
Add mt76x02_txrx.c source file in order to contain tx/rx shared
routines for mt76x0 and mt76x2 drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:45 +02:00
Lorenzo BianconiandFelix Fietkau ec3d8290c7 mt76: move mt76x02_tx in mt76x02-lib module
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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau 724d54760b 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau e236ba5514 mt76: move mt76x02_mac_process_rx in mt76x02-lib module
Move mt76x02_mac_process_rx utility routine in mt76x02-lib
in order to by reused by mt76x0 driver for rxwi parsing.
Add stream number check in mt76x02_mac_process_rx since mt76x0
chipsets are 1x1:1

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau d5d1e59b9f 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau abd1daa150 mt76x2: move mt76x2_dev in mt76x02_util.h
Move mt76x2_dev in mt76x02_util.h and rename it in mt76x02_dev
in order to be shared between mt76x2 and mt76x0 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau a56efc55c1 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau 330fbe3567 mt76x0: remove unused variable in mt76x0_dev
Remove no longer used mac_lock spinlock and data array
in mt76x0_dev data structure

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau c26f9fd6c9 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00
Lorenzo BianconiandFelix Fietkau 2742847325 mt76: move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid in mt76x02_util.h
Move mt76x02_rx_get_sta and mt76x02_rx_get_sta_wcid utility routines in
mt76x02-lib module since it will be used by mt76x0 driver in order to
unify rxwi parsing

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-10-05 19:59:24 +02:00