Commit Graph
63 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau ea133325fa mt76: mt7663: introduce 802.11 PS support in sta mode
Enable 802.11 power-save support available in mt7663 firmware

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-17 14:46:00 +02:00
Lorenzo BianconiandFelix Fietkau d4e6e225bc mt76: mt7615: move core shared code in mt7615-common module
Create mt7615-common module in order to collect shared code between usb
and mmio code. Move the following source files in mt7615-common module:
- main.c
- init.c
- mcu.c
- mac.c
- debugfs.c
- eeprom.c
- trace.c

Create the following source files for mmio only source code and move them
in mt7615e module:
- pci_init.c
- dma.c
- pci_mac.c

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-17 14:46:00 +02:00
Lorenzo BianconiandFelix Fietkau a7035bce85 mt76: mt7615: fix possible deadlock in mt7615_stop
make mac_work per phy instead of per device and fix a possible deadlock
in mt7615_stop since mt7615_mac_work runs holding mt76 mutex

Fixes: fdd2e570764c2 ("mt76: mt7615: add dual-phy support for mac80211 ops")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-17 14:46:00 +02:00
Felix Fietkau 05b23d7478 mt76: mt7615: rework IRQ handling to prepare for MSI support
With MSI interrupts, IRQs must not be enabled from within the IRQ handler,
because that can lead to lost events.
Defer IRQ processing to a tasklet, which is also responsible for enabling
IRQs (to avoid race conditions against the handler)

Co-developed-by: Soul Huang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 19:54:25 +02:00
Felix Fietkau 8fb1cd20a7 mt76: mt7615: set hw scan limits only for firmware with offload support
They do not apply to software scan

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 12:35:22 +02:00
Felix Fietkau 08b8bd2bc9 mt76: mt7615: disable hw/sched scan ops for non-offload firmware
Avoid having to attempt hw scan and fall back to software for every scan
on devices/firmware without hw scan support

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 12:26:05 +02:00
Lorenzo BianconiandFelix Fietkau 25d812dddc mt76: mt7663: fix aggr range entry in debugfs
Fix register definitions for aggr range counter registers for mt7663
chipset

Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-08 17:59:38 +02:00
Lorenzo BianconiandFelix Fietkau 02c9ec4a15 mt76: mt7615: add address parameter to mt7615_eeprom_init
Introduce address parameter to mt7615_eeprom_init routine in order to be
reused adding usb support to mt7615 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:12 +02:00
Sean WangandFelix Fietkau ea4f4d216d mt76: mt7615: remove unnecessary register operations
Remove mt76_wr(dev, MT_CSR(0x010), 0x8208) that would cause
MT_PCIE_IRQ_ENABLE to be disabled; MT_PCIE_IRQ_ENABLE should always keep
on enabled when the driver is running.

0x44064 is a not existing address

Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:12 +02:00
Lorenzo BianconiandFelix Fietkau 12ecd5ba21 mt76: mt7615: introduce scheduled scan support
Introduce scheduled scan support for mt7663e devices

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:11 +02:00
Lorenzo BianconiandFelix Fietkau e6a3f3ffe5 mt76: mt7615: introduce hw scan support
Introduce hw scan support to mt7663e driver

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:11 +02:00
Sean WangandFelix Fietkau 67182f36e3 mt76: mt7663: keep Rx filters as the default
Keep Rx filters default value if the firmware supports offload and
low power features.

Signed-off-by: Sean Wang <[email protected]>
Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:11 +02:00
Lorenzo BianconiandFelix Fietkau d2d7bf2243 mt76: mt7615: make scs configurable per phy
Make scs configurable per phy since most of the chipsets do not
support dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:11 +02:00
Lorenzo BianconiandFelix Fietkau 2097f74f66 mt76: mt7615: introduce mt7663e support
Introduce support for mt7663e 802.11ac 2x2:2 chipset to mt7615 driver.

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Co-developed-by: Ryder Lee <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-17 17:50:15 +01:00
Lorenzo BianconiandFelix Fietkau 1674285926 mt76: mt7615: introduce mt7615_init_mac_chain routine
Introduce mt7615_init_mac_chain routine to configure per band mac
register since new devices (e.g. mt7663e) do not support dbdc

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-17 17:50:15 +01:00
Lorenzo BianconiandFelix Fietkau 9d1d2ee9ad mt76: mt7615: introduce mt7615_init_device routine
Add mt7615_init_device routine in order to be reused adding support for
mt7663 in mt7615 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-17 17:50:15 +01:00
Felix Fietkau 81476f11b6 mt76: mt7615: fix antenna mask initialization in DBDC mode
Update wiphy available antenna mask, and fix chainmask setting on 3x3 hardware

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-25 13:15:38 +01:00
Felix Fietkau 1881241c7e mt76: fix rounding issues on converting per-chain and combined txpower
Unify code converting between the different txpower values. Always add/remove
the combined txpower delta before dividing half-dB values.
Also fix the combined txpower delta values. The correct half-dB delta for
3 chains is 9, not 8.

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-11 21:01:03 +01:00
Felix Fietkau fd216cb5b2 mt76: mt7615: fix monitor mode on second PHY
The second PHY receives no packets unless there is an active vif present.
Set the WANT_MONITOR_VIF flag to deal with that

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-02 16:24:11 +01:00
Felix Fietkau 0f06914acf mt76: mt7615: implement hardware reset support
When the firmware detects a problem, it needs the host to stop/reset DMA and
resume it again when the hardware state has been reset.

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-31 16:37:02 +01:00
Felix Fietkau 6cd5c381ea mt76: mt7615: disable DBDC on MT7622
It is only supported on MT7615

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:38 +01:00
Felix Fietkau 79808e6232 mt76: mt7615: implement DMA support for MT7622
MT7622 does not have the CR4 microcontroller sitting in the data path.
Because of that, it uses the chip's native tx descriptor format instead of
something parsed and converted by the firmware.

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:38 +01:00
Felix Fietkau 80d3681b40 mt76: mt7615: implement probing and firmware loading on MT7622
MT7622 does not have a CR4 microcontroller, so it only uses its own N9
firmware.

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:37 +01:00
Lorenzo BianconiandFelix Fietkau fd1fa68606 mt76: move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76_phy_init
Move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76-core module since now all
drivers support Channel Switch Announcement

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-27 17:47:51 +01:00
Felix Fietkau 161d1c73c6 mt7615: use local MAC address for the second PHY
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-16 10:42:57 +01:00
Felix Fietkau 43db699b1a mt76: mt7615: increment the MAC address of the secondary PHY (DBDC)
The hardware does not support using the same MAC address for interfaces,
even if they are on different bands.
In the future this will be made configurable via device tree

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-13 22:17:00 +01:00
Ryder LeeandFelix Fietkau 15e1c29ed8 mt76: mt7615: add missing settings for simultaneous dual-band support
MT7615 supports dual-wiphy which means that it can run on 2.4G and 5GHz
channels simultaneously, and driver should configure each band.

Add missing register settings, and refine band related definitions to
avoid duplicate codes.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-27 15:15:07 +01:00
Lorenzo BianconiandFelix Fietkau ae25a4bf99 mt76: mt7615: introduce LED support
Initialize brightness_set and blink_set callbacks to
mt7615_led_set_brightness and mt7615_led_set_blink in order to enable
LED support in mt7615 driver

Tested-by: Deng Qingfang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 16:09:15 +01:00
Ryder LeeandFelix Fietkau d5fdd2e7ce mt76: mt7615: fix MT7615_CFEND_RATE_DEFAULT value
Fix default CFEND_RATE and replace hardcode values.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-22 15:17:43 +01:00
Lorenzo BianconiandFelix Fietkau a589d095ee mt76: mt7615: add set_coverage class support
Add the capability to configure acktimeout for mt7615 driver. Moreover
configure slottime according to the value provided by mac80211

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-12-13 23:16:36 +01:00
Felix Fietkau ea41ad8bdb mt76: mt7615: defer mcu initialization via workqueue
Loading the mcu firmware and waiting for it to boot takes a long time,
which adds a significant amount to the system boot time.
Fix this by running the mcu init from a workqueue and waiting for it to
complete before starting the phy or issuing mcu commands via debugfs

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-05 11:36:53 +01:00
Felix Fietkau 993683d62f mt76: mt7615: add support for registering a second wiphy via debugfs
This is only used for testing for now. In the future it will be possible to
enable the second PHY through an proper API via device tree

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 6265fd1954 mt76: mt7615: move radio/mac initialization to .start/stop callbacks
Run initialization per phy

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 705a0fcdc3 mt76: mt7615: add multiple wiphy support to the dfs support code
There are two DFS detectors on the chip. When using 160 MHz channel bandwidth
(not supported in dual-wiphy mode), both are used. Otherwise, one detector is
used per wiphy.
Rework the code to start/stop them separately per phy and to indicate the
radar event on the right phy based on the detector index

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 0954c37d01 mt76: mt7615: remove useless MT_HW_RDD0/1 enum
Writing 0/1 is shorter and just as clear

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau bdcd45dd04 mt76: mt7615: add missing register init for dual-wiphy support
Initialize low-power beacon mode setting

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau e6659d12d0 mt76: mt7615: add dual-phy support for mac80211 ops
Allows them to be used by a separately registered wiphy later

Signed-off-by: Felix Fietkau <[email protected]>
2019-12-03 20:04:12 +01:00
Felix Fietkau 9e95fa6208 mt76: move txpower and antenna mask to struct mt76_phy
Adds multiple wiphy support to mt76_get_txpower

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:58:37 +01:00
Felix Fietkau a3e88bcf17 mt76: move state from struct mt76_dev to mt76_phy
Allows keeping per-wiphy state separate

Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:54:55 +01:00
Felix Fietkau ee36c8e217 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 <[email protected]>
2019-11-20 12:54:17 +01:00
Lorenzo BianconiandFelix Fietkau faf5e6fedd mt76: mt7615: read {tx,rx} mask from eeprom
Parse configured {tx,rx} mask from eeprom data instead of just setting it
to four tx-rx streams

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:27:21 +01:00
Lorenzo BianconiandFelix Fietkau e2f90adcc3 mt76: move interface_modes definition in mt76_core module
Move interface modes declaration in common code since now mt76
chipsets support all modes (NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP,
NL80211_IFTYPE_MESH_POINT and NL80211_IFTYPE_ADHOC)

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:26:32 +01:00
Lorenzo BianconiandFelix Fietkau cfdb75124e mt76: mt7615: add ibss support
Enable IFTYPE_ADHOC support on 7615 devices. The feature has been tested
using a mt76x2 device as wireless peer.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:26:32 +01:00
Lorenzo BianconiandFelix Fietkau e0731a82a1 mt76: move SUPPORTS_REORDERING_BUFFER hw property in mt76_register_device
Move SUPPORTS_REORDERING_BUFFER hw property configuration from chip
specific code to mt76_register_device since it is supported by all mt76
drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-11-20 12:26:32 +01:00
Lorenzo BianconiandFelix Fietkau 81f2be0c45 mt76: mt7615: track tx/rx airtime for airtime fairness
Poll per-station hardware counters available in WTBL after tx/rx
status events in order to report tx/rx airtime to mac80211 layer

Co-developed-by: Felix Fietkau <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-09-26 18:34:32 +02:00
Lorenzo BianconiandFelix Fietkau 028071d959 mt76: mt7615: report tx_time, bss_rx and busy time to mac80211
Report tx time/rx time and obss time from hw mib counters to fill survey
info requested by mac80211

Co-developed-by: Felix Fietkau <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-09-26 18:03:36 +02:00
Lorenzo BianconiandFelix Fietkau 63e8152540 mt76: mt7615: enable SCS by default
Enable Smart Carrier Sense algorithm by default in order to improve
performances in a noisy environment

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-09-26 12:04:20 +02:00
Felix Fietkau 8739f87e9a mt76: mt7615: fix control frame rx in monitor mode
Adjust filters and ensure frames don't get sent to MCU instead of host

Signed-off-by: Felix Fietkau <[email protected]>
2019-09-12 16:42:54 +02:00
Lorenzo BianconiandFelix Fietkau 2becd13be7 mt76: mt7615: add Smart Carrier Sense support
Introduce Smart Carrier Sense support in order to tune device
sensitivity according to RTS error rate and False CCA reported by the
radio

Tested-by: Ryder Lee <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-08-20 15:22:21 +02:00
Felix Fietkau 3d7f7384be mt76: mt7615: add missing register initialization
- initialize CCA signal source
- initialize clock for band 1 (7615D)
- initialize BAR rate

Signed-off-by: Felix Fietkau <[email protected]>
2019-07-16 18:12:43 +02:00