]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
mt76: mt76x02u: enable survey support
authorLorenzo Bianconi <lorenzo@kernel.org>
Mon, 5 Aug 2019 06:55:51 +0000 (08:55 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 5 Sep 2019 15:42:31 +0000 (17:42 +0200)
Introduce channel survey support for mt76x2u and mt76x0u drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c

index e743e5ef7ee41e8d2b6af35d2b8787ba6765cfcc..d2d9218810264dde04c937a745495d8980d42b1e 100644 (file)
@@ -135,6 +135,7 @@ static const struct ieee80211_ops mt76x0u_ops = {
        .set_rts_threshold = mt76x02_set_rts_threshold,
        .wake_tx_queue = mt76_wake_tx_queue,
        .get_txpower = mt76_get_txpower,
+       .get_survey = mt76_get_survey,
        .set_tim = mt76_set_tim,
        .release_buffered_frames = mt76_release_buffered_frames,
 };
@@ -164,6 +165,13 @@ static int mt76x0u_init_hardware(struct mt76x02_dev *dev, bool reset)
                FIELD_PREP(MT_TXOP_TRUN_EN, 0x3f) |
                FIELD_PREP(MT_TXOP_EXT_CCA_DLY, 0x58));
 
+       mt76_wr(dev, MT_CH_TIME_CFG,
+               MT_CH_TIME_CFG_TIMER_EN |
+               MT_CH_TIME_CFG_TX_AS_BUSY |
+               MT_CH_TIME_CFG_RX_AS_BUSY |
+               MT_CH_TIME_CFG_NAV_AS_BUSY |
+               MT_CH_TIME_CFG_EIFS_AS_BUSY);
+
        return 0;
 }
 
@@ -203,6 +211,7 @@ static int mt76x0u_probe(struct usb_interface *usb_intf,
                         const struct usb_device_id *id)
 {
        static const struct mt76_driver_ops drv_ops = {
+               .update_survey = mt76x02_update_channel,
                .tx_prepare_skb = mt76x02u_tx_prepare_skb,
                .tx_complete_skb = mt76x02u_tx_complete_skb,
                .tx_status_data = mt76x02_tx_status_data,
index 0b76341738a6055a762f92a77a546bbc0a84f918..da5e0f9a8baeb9722cac32e4d93da48ff8107693 100644 (file)
@@ -25,6 +25,7 @@ static int mt76x2u_probe(struct usb_interface *intf,
                         const struct usb_device_id *id)
 {
        static const struct mt76_driver_ops drv_ops = {
+               .update_survey = mt76x02_update_channel,
                .tx_prepare_skb = mt76x02u_tx_prepare_skb,
                .tx_complete_skb = mt76x02u_tx_complete_skb,
                .tx_status_data = mt76x02_tx_status_data,
index 2910068f4e79504ec0e7ad55459c605a6457c855..e305b374c90418a209138ddbcd015057a01ea6bb 100644 (file)
@@ -184,6 +184,13 @@ int mt76x2u_init_hardware(struct mt76x02_dev *dev)
        mt76x02_phy_set_rxpath(dev);
        mt76x02_phy_set_txdac(dev);
 
+       mt76_wr(dev, MT_CH_TIME_CFG,
+               MT_CH_TIME_CFG_TIMER_EN |
+               MT_CH_TIME_CFG_TX_AS_BUSY |
+               MT_CH_TIME_CFG_RX_AS_BUSY |
+               MT_CH_TIME_CFG_NAV_AS_BUSY |
+               MT_CH_TIME_CFG_EIFS_AS_BUSY);
+
        return mt76x2u_mac_stop(dev);
 }
 
index 6a36b67510e3203cbb70edce1bfff56ba0d94964..1b692fba5a891f8baac6e8a0bcfbd3a2e4af704b 100644 (file)
@@ -48,6 +48,10 @@ mt76x2u_set_channel(struct mt76x02_dev *dev,
 
        err = mt76x2u_phy_set_channel(dev, chandef);
 
+       /* channel cycle counters read-and-clear */
+       mt76_rr(dev, MT_CH_IDLE);
+       mt76_rr(dev, MT_CH_BUSY);
+
        mt76x2_mac_resume(dev);
 
        clear_bit(MT76_RESET, &dev->mt76.state);
@@ -114,6 +118,7 @@ const struct ieee80211_ops mt76x2u_ops = {
        .sw_scan_complete = mt76x02_sw_scan_complete,
        .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
        .get_txpower = mt76_get_txpower,
+       .get_survey = mt76_get_survey,
        .set_tim = mt76_set_tim,
        .release_buffered_frames = mt76_release_buffered_frames,
 };