Commit Graph
1786 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau e226309c4b mt76: mt7615: rely on mt76_queues_read for mt7622
As previous devices, mt7622 relies on multiple hw queues while for
mt7615 we have just on per band hw queue and the mcu demux the traffic
according to the packet AC. In order to dump all configured hw queues,
rely on mt76_queues_read for mt7622 in mt7615 debugfs

Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-02-14 10:16:16 +01:00
Lorenzo BianconiandFelix Fietkau 4dbd56b869 mt76: mt76x0u: add support to TP-Link T2UHP
Introduce support to TP-Link T2UHP
https://wikidevi.com/wiki/TP-LINK_Archer_T2UHP

Tested-by: Sid Hayn <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-14 10:09:09 +01:00
Arnd BergmannandFelix Fietkau cc56c40016 mt76: fix LED link time failure
The mt76_led_cleanup() function is called unconditionally, which
leads to a link error when CONFIG_LEDS is a loadable module or
disabled but mt76 is built-in:

drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_unregister_device':
mac80211.c:(.text+0x2ac): undefined reference to `led_classdev_unregister'

Use the same trick that is guarding the registration, using an
IS_ENABLED() check for the CONFIG_MT76_LEDS symbol that indicates
whether LEDs can be used or not.

Fixes: 36f7e2b2bb1d ("mt76: do not use devm API for led classdev")
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Felix Fietkau <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2020-02-14 10:07:05 +01:00
Felix Fietkau c75cf513c6 mt76: do not set HOST_BROADCAST_PS_BUFFERING for mt7615
mt7615 handles powersave buffering in firmware

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-13 22:56:34 +01:00
Felix Fietkau 457a932036 mt76: mt7615: fix MT_TX_HW_QUEUE_EXT_PHY to deal with mac80211 changes
The size of info->hw_queue was reduced to 4 bits

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-13 22:51:34 +01:00
Felix Fietkau a205ce3e3e mt76: mt7615: fix ext_phy flag for stations
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-13 22:10:05 +01:00
Felix Fietkau fa14e7f331 mt76: mt7615: rework rx phy index handling
Overwriting the RMAC_CHFREQ register is not reliable enough, as the firmware
could potentially write it again.
Since there is no PHY index indication in the rx info, we need to use another
way:

If both PHYs are using different channels, find the PHY where chfreq matches
the register value.

The only corner case remaining is when both PHYs are using the same channel.
In that case, the per-packet noise value on the primary PHY will have
information belonging to the chains of the secondary PHY from the previous
received packet of that PHY. The secondary PHY will set noise to 0 for extra
chains.

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-13 21:25:11 +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 764e1d208a mt76: mt7615: fix tx power reporting
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-11 20:13:11 +01:00
Lorenzo BianconiandFelix Fietkau 9c43417db1 mt76: mt7615: fix max_nss in mt7615_eeprom_parse_hw_cap
Fix u8 cast reading max_nss from MT_TOP_STRAP_STA register in
mt7615_eeprom_parse_hw_cap routine

Fixes: acf5457fd99db ("mt76: mt7615: read {tx,rx} mask from eeprom")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-02-07 17:57:50 +01:00
Ryder LeeandFelix Fietkau d3af8bd3c7 mt76: mt7615: set proper length in strncmp
Use sizeof(hdr->fw_ver) as max len.

Signed-off-by: Ryder Lee <[email protected]>
2020-02-07 17:56:56 +01:00
Lorenzo BianconiandFelix Fietkau a67e42990d mt76: mt7615: fix msdu_id endianness in mt7615_write_hw_txp
Fix the following sparse warning in mt7615_write_hw_txp:

warning: incorrect type in assignment (different base types)
   expected restricted __le16
   got unsigned long

Signed-off-by: Lorenzo Bianconi <[email protected]>
2020-02-07 17:55:46 +01:00
Felix Fietkau d5a5e97b67 mt76: mt76x2: avoid starting the MAC too early
Do not set the tx/rx start bits in MT_MAC_SYS_CTRL from within initvals.
The driver sets these later when the hardware is ready

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-07 12:33:17 +01:00
Felix Fietkau bd0df1b017 mt76: avoid extra RCU synchronization on station removal
Use sta_pre_rcu_remove callback to clear wcid pointer earlier

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-07 12:33:17 +01:00
Ryder LeeandFelix Fietkau 721673759d mt76: mt7615: switch mt7615_mcu_set_rx_ba to v2 format
To adapt new firmware version.

Signed-off-by: Ryder Lee <[email protected]>
Tested-by: Shayne Chen <[email protected]>
2020-02-02 17:19:07 +01:00
Ryder LeeandFelix Fietkau 648ce1aaa4 mt76: mt7615: switch mt7615_mcu_set_tx_ba to v2 format
To adapt new firmware version.

Signed-off-by: Ryder Lee <[email protected]>
Tested-by: Shayne Chen <[email protected]>
2020-02-02 17:19:07 +01:00
Ryder LeeandFelix Fietkau 170b21f9ec mt76: mt7615: use new tag sta_rec_wtbl
In order to reduce command/event times, newer firmware adds a tag
sta_rec_wtbl to take care of WTBL operations.

MCU_EXT_CMD_WTBL_UPDATE is deprecated.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Tested-by: Sean Wang <[email protected]>
2020-02-02 17:19:07 +01:00
Ryder LeeandFelix Fietkau 77b9d85863 mt76: mt7615: add starec operating flow for firmware v2
Add fw_ver in mt7615_dev to check firmware version, and adjust
mt7615_mcu_send_sta_rec() to adapt firmware v2 changes.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Tested-by: Sean Wang <[email protected]>
2020-02-02 17:19:07 +01:00
Ryder LeeandFelix Fietkau f16433cd78 mt76: mt7615: add a helper to encapsulate sta_rec operation
Operating command is simpler and just as clear

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Tested-by: Sean Wang <[email protected]>
2020-02-02 17:19:07 +01:00
Ryder LeeandFelix Fietkau ff32af25f8 mt76: mt7615: simplify mcu_set_sta flow
Move mcu_add_wtbl and mcu_set_ht_cap into mcu_set_sta to simplify flow.

Signed-off-by: Ryder Lee <[email protected]>
2020-02-02 17:19:07 +01:00
Ryder LeeandFelix Fietkau 9f8c6c4a20 mt76: mt7615: simplify mcu_set_bmc flow
Move set_bmc_wtbl into sta_rec function to simplify flow.

Signed-off-by: Ryder Lee <[email protected]>
2020-02-02 17:19:07 +01:00
Felix Fietkau 269de7c229 firmware: fix version number for upcoming mt7615 mcu v2 support patches
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-02 17:11:59 +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 b9d9f91b15 mt76: mt7615: fix adding active monitor interfaces
Treat them the same as AP iftype internally for MCU commands

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-02 16:13:04 +01:00
Felix Fietkau db97358df4 mt76: mt7615: add support for testing hardware reset
Send an undersized corrupt packet to the DMA queue, which causes the
firmware to issue a full chip reset

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-31 16:37:02 +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 7882bbd25c mt76: mt7615: fix and rework tx power handling
Setting the tx power by manipulating EEPROM may in some cases not be enough,
since it only covers the base target power and not per-rate offsets.
In other cases, it could limit tx power of rates too much, possibly reducing
throughput or range.
Use firmware support for applying per-rate limit and power offsets for
different values of Nss.

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:12:44 +01:00
Shayne ChenandFelix Fietkau 68f38eea39 firmware: add firmware for MT7622 built-in WiFi
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:38 +01:00
Felix Fietkau f66b480434 mt76: mt7615: add Kconfig entry for MT7622
This enables building support for the MT7622 SoC built-in WLAN chip

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 14:04:38 +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 bddcbb25cd mt76: mt7615: decrease rx ring size for MT7622
Since it's 2.4 GHz only, it needs fewer buffers

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
Felix Fietkau fd3ae9a342 mt76: mt7615: disable 5 GHz on MT7622
It is not supported by the chip, so avoid issues with potentially wrong
EEPROM configurations.

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:40 +01:00
Felix Fietkau f0b02d8115 mt76: mt7615: add calibration free support for MT7622
MT7622 uses fewer efuse overrides than MT7615

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:40 +01:00
Felix Fietkau ab94a85efb mt76: mt7615: add eeprom support for MT7622
When sending EEPROM data to the MCU, MT7622 uses a longer buffer

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:33 +01:00
Felix Fietkau 13a4269a1b mt76: mt7615: add dma and tx queue initialization for MT7622
MT7622 queue mapping is different from MT7615 and requires an extra dma
scheduler init and a few register tweaks

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:34:20 +01:00
Felix Fietkau 92bafd4b1b mt76: mt7615: fix MT_INT_TX_DONE_ALL definition for MT7622
MT7622 uses more interrupt bits for queue tx completion events.
Enabling those extra bits is harmless on MT7615

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-30 13:33:18 +01:00
Felix Fietkau f84b590b64 mt76: mt7615: store N9 firmware version instead of CR4
CR4 is used very little, N9 is the main firmware that the driver interacts with

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-29 17:18:19 +01:00
Felix Fietkau 51b1eb7a49 mt76: mt7615: split up firmware loading functions
Preparation for adding MT7622 support

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-29 17:18:19 +01:00
Felix Fietkau 1c4ff4f2dc mt76: mt7615: move mmio related code from pci.c to mmio.c
Will be shared with MT7622 SoC support

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-29 17:18:19 +01:00
Felix Fietkau d15a4bbb3f mt76: mt7615: add __aligned(4) to txp structs
The beginning of the struct is guaranteed to be 4-byte aligned, and this
attribute allows the compiler to generate more efficient code

Signed-off-by: Felix Fietkau <[email protected]>
2020-01-29 17:14:46 +01:00
Felix Fietkau 60e2768960 firmware: update MT7615 CR4 firmware to 20190121161307
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-28 17:42:43 +01:00
Felix Fietkau 2db2bab099 firmware: update mt7615 N9 firmware to 20200107155603
Signed-off-by: Felix Fietkau <[email protected]>
2020-01-28 17:38:47 +01:00
Lorenzo BianconiandFelix Fietkau 82bedb2945 mt76: mt76u: introduce MT_DRV_RX_DMA_HDR flag
Define MT_DRV_RX_DMA_HDR flag in drv_flag in order to not skip rx frame
dma header since new devices (e.g. mt7663u) reports rx frame info in the
usb dma header

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-01-27 17:48:38 +01:00
Lorenzo BianconiandFelix Fietkau 23b3328e52 mt76: mt76u: add endpoint to mt76u_bulk_msg signature
This is a preliminary patch to support mt7663u usb dongles

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-01-27 17:48:38 +01:00
Lorenzo BianconiandFelix Fietkau e742618fc5 mt76: mt76u: introduce mt76u_skb_dma_info routine
Introduce mt76u_skb_dma_info utility routine in mt76-usb module in order
to be reused adding mt7663u support

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-01-27 17:48:38 +01:00
Lorenzo BianconiandFelix Fietkau 8c6cf328eb mt76: mt76u: take into account different queue mapping for 7663
7663u devices rely on a different endpoint mapping. Take it into account
in mt76u_alloc_tx routine

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-01-27 17:48:38 +01:00
Lorenzo BianconiandFelix Fietkau 39fb59ce92 mt76: mt76u: add {read/write}_extended utility routines
Introduce extended utility routines to read/write data o usb bus. New
devices (e.g. mt7663u) will rely on both upper and lower part of the
register address. Add ext parameter to mt76u_init signature in order to
reuse the code adding mt7663u support.

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-01-27 17:48:38 +01:00
Lorenzo BianconiandFelix Fietkau e2a39697fb mt76: mt76u: introduce mt76u_alloc_mcu_queue utility routine
Add mt76u_alloc_mcu_queue  utility routine to allocate mcu hw rx queue.
This is a preliminary patch to support new devices (e.g. mt7663u) that
rely on a hw queue for mcu messages

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-01-27 17:48:38 +01:00