]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mcu.c
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Sun, 7 Oct 2018 09:45:18 +0000 (11:45 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 13 Oct 2018 15:39:16 +0000 (17:39 +0200)
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>
12 files changed:
drivers/net/wireless/mediatek/mt76/mt76x0/init.c
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
drivers/net/wireless/mediatek/mt76/mt76x0/phy.c
drivers/net/wireless/mediatek/mt76/mt76x02_mcu.c
drivers/net/wireless/mediatek/mt76/mt76x02_mcu.h
drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c
drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c
drivers/net/wireless/mediatek/mt76/mt76x2/pci_phy.c
drivers/net/wireless/mediatek/mt76/mt76x2/phy.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_init.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_mcu.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_phy.c

index ee2b8e885608a6c8af56e3eb924d16fc7db98fc6..abd8313f22e7847946b382a905fd074665605154 100644 (file)
@@ -280,7 +280,7 @@ int mt76x0_init_hardware(struct mt76x02_dev *dev)
                return -ETIMEDOUT;
 
        mt76x0_reset_csr_bbp(dev);
-       ret = mt76x02_mcu_function_select(&dev->mt76, Q_SELECT, 1, false);
+       ret = mt76x02_mcu_function_select(dev, Q_SELECT, 1, false);
        if (ret)
                return ret;
 
index 87997cddf0d6953c2fcd8ac1e6cdeff20ee7a627..4b29cd52aa44b5319bfc4a43b9229705e39db592 100644 (file)
@@ -167,7 +167,7 @@ static void mt76x0e_cleanup(struct mt76x02_dev *dev)
        mt76x0_chip_onoff(dev, false, false);
        mt76x0e_stop_hw(dev);
        mt76x02_dma_cleanup(dev);
-       mt76x02_mcu_cleanup(&dev->mt76);
+       mt76x02_mcu_cleanup(dev);
 }
 
 static void
index 4419c0078a6fa9e60257e762f501672b25405a0f..d5fe248e7839a8e23d04f8df341e8d789ae4f997 100644 (file)
@@ -602,7 +602,7 @@ mt76x0_bbp_set_bw(struct mt76x02_dev *dev, enum nl80211_chan_width width)
                return ;
        }
 
-       mt76x02_mcu_function_select(&dev->mt76, BW_SETTING, bw, false);
+       mt76x02_mcu_function_select(dev, BW_SETTING, bw, false);
 }
 
 void mt76x0_phy_set_txpower(struct mt76x02_dev *dev)
@@ -712,7 +712,7 @@ int mt76x0_phy_set_channel(struct mt76x02_dev *dev,
 
        mt76x0_vco_cal(dev, channel);
        if (scan)
-               mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXDCOC, 1, false);
+               mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1, false);
 
        mt76x0_phy_set_txpower(dev);
 
@@ -725,7 +725,7 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev)
        u8 channel = dev->mt76.chandef.chan->hw_value;
        int is_5ghz = (dev->mt76.chandef.chan->band == NL80211_BAND_5GHZ) ? 1 : 0;
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_R, 0, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0, false);
 
        mt76x0_vco_cal(dev, channel);
 
@@ -737,22 +737,20 @@ void mt76x0_phy_recalibrate_after_assoc(struct mt76x02_dev *dev)
        reg_val &= 0xffffff7e;
        mt76_wr(dev, 0x2124, reg_val);
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXDCOC, 0, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 0, false);
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_LC, is_5ghz, false);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_LOFT, is_5ghz, false);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TXIQ, is_5ghz, false);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TX_GROUP_DELAY,
-                             is_5ghz, false);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXIQ, is_5ghz, false);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RX_GROUP_DELAY,
-                             is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_LC, is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_LOFT, is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TX_GROUP_DELAY, is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQ, is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_RX_GROUP_DELAY, is_5ghz, false);
 
        mt76_wr(dev, 0x2124, reg_val);
        mt76_wr(dev, MT_TX_ALC_CFG_0, tx_alc);
        msleep(100);
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXDCOC, 1, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, 1, false);
 }
 
 void mt76x0_agc_save(struct mt76x02_dev *dev)
index 6d565133b7afd346f3c4d2cd43d81ac40f8e3a0d..1b853bb723fb468f0986be791aededd4ff28b87c 100644 (file)
@@ -19,9 +19,7 @@
 #include <linux/firmware.h>
 #include <linux/delay.h>
 
-#include "mt76.h"
 #include "mt76x02_mcu.h"
-#include "mt76x02_dma.h"
 
 struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len)
 {
@@ -37,7 +35,7 @@ struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len)
 EXPORT_SYMBOL_GPL(mt76x02_mcu_msg_alloc);
 
 static struct sk_buff *
-mt76x02_mcu_get_response(struct mt76_dev *dev, unsigned long expires)
+mt76x02_mcu_get_response(struct mt76x02_dev *dev, unsigned long expires)
 {
        unsigned long timeout;
 
@@ -45,17 +43,17 @@ mt76x02_mcu_get_response(struct mt76_dev *dev, unsigned long expires)
                return NULL;
 
        timeout = expires - jiffies;
-       wait_event_timeout(dev->mmio.mcu.wait,
-                          !skb_queue_empty(&dev->mmio.mcu.res_q),
+       wait_event_timeout(dev->mt76.mmio.mcu.wait,
+                          !skb_queue_empty(&dev->mt76.mmio.mcu.res_q),
                           timeout);
-       return skb_dequeue(&dev->mmio.mcu.res_q);
+       return skb_dequeue(&dev->mt76.mmio.mcu.res_q);
 }
 
 static int
-mt76x02_tx_queue_mcu(struct mt76_dev *dev, enum mt76_txq_id qid,
+mt76x02_tx_queue_mcu(struct mt76x02_dev *dev, enum mt76_txq_id qid,
                     struct sk_buff *skb, int cmd, int seq)
 {
-       struct mt76_queue *q = &dev->q_tx[qid];
+       struct mt76_queue *q = &dev->mt76.q_tx[qid];
        struct mt76_queue_buf buf;
        dma_addr_t addr;
        u32 tx_info;
@@ -66,24 +64,26 @@ mt76x02_tx_queue_mcu(struct mt76_dev *dev, enum mt76_txq_id qid,
                  FIELD_PREP(MT_MCU_MSG_PORT, CPU_TX_PORT) |
                  FIELD_PREP(MT_MCU_MSG_LEN, skb->len);
 
-       addr = dma_map_single(dev->dev, skb->data, skb->len,
+       addr = dma_map_single(dev->mt76.dev, skb->data, skb->len,
                              DMA_TO_DEVICE);
-       if (dma_mapping_error(dev->dev, addr))
+       if (dma_mapping_error(dev->mt76.dev, addr))
                return -ENOMEM;
 
        buf.addr = addr;
        buf.len = skb->len;
+
        spin_lock_bh(&q->lock);
-       dev->queue_ops->add_buf(dev, q, &buf, 1, tx_info, skb, NULL);
-       dev->queue_ops->kick(dev, q);
+       mt76_queue_add_buf(dev, q, &buf, 1, tx_info, skb, NULL);
+       mt76_queue_kick(dev, q);
        spin_unlock_bh(&q->lock);
 
        return 0;
 }
 
-int mt76x02_mcu_msg_send(struct mt76_dev *dev, struct sk_buff *skb,
+int mt76x02_mcu_msg_send(struct mt76_dev *mdev, struct sk_buff *skb,
                         int cmd, bool wait_resp)
 {
+       struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
        unsigned long expires = jiffies + HZ;
        int ret;
        u8 seq;
@@ -91,11 +91,11 @@ int mt76x02_mcu_msg_send(struct mt76_dev *dev, struct sk_buff *skb,
        if (!skb)
                return -EINVAL;
 
-       mutex_lock(&dev->mmio.mcu.mutex);
+       mutex_lock(&mdev->mmio.mcu.mutex);
 
-       seq = ++dev->mmio.mcu.msg_seq & 0xf;
+       seq = ++mdev->mmio.mcu.msg_seq & 0xf;
        if (!seq)
-               seq = ++dev->mmio.mcu.msg_seq & 0xf;
+               seq = ++mdev->mmio.mcu.msg_seq & 0xf;
 
        ret = mt76x02_tx_queue_mcu(dev, MT_TXQ_MCU, skb, cmd, seq);
        if (ret)
@@ -107,7 +107,7 @@ int mt76x02_mcu_msg_send(struct mt76_dev *dev, struct sk_buff *skb,
 
                skb = mt76x02_mcu_get_response(dev, expires);
                if (!skb) {
-                       dev_err(dev->dev,
+                       dev_err(mdev->dev,
                                "MCU message %d (seq %d) timed out\n", cmd,
                                seq);
                        ret = -ETIMEDOUT;
@@ -125,13 +125,13 @@ int mt76x02_mcu_msg_send(struct mt76_dev *dev, struct sk_buff *skb,
        }
 
 out:
-       mutex_unlock(&dev->mmio.mcu.mutex);
+       mutex_unlock(&mdev->mmio.mcu.mutex);
 
        return ret;
 }
 EXPORT_SYMBOL_GPL(mt76x02_mcu_msg_send);
 
-int mt76x02_mcu_function_select(struct mt76_dev *dev,
+int mt76x02_mcu_function_select(struct mt76x02_dev *dev,
                                enum mcu_function func,
                                u32 val, bool wait_resp)
 {
@@ -144,13 +144,12 @@ int mt76x02_mcu_function_select(struct mt76_dev *dev,
            .value = cpu_to_le32(val),
        };
 
-       skb = dev->mcu_ops->mcu_msg_alloc(&msg, sizeof(msg));
-       return dev->mcu_ops->mcu_send_msg(dev, skb, CMD_FUN_SET_OP,
-                                         wait_resp);
+       skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg));
+       return mt76_mcu_send_msg(dev, skb, CMD_FUN_SET_OP, wait_resp);
 }
 EXPORT_SYMBOL_GPL(mt76x02_mcu_function_select);
 
-int mt76x02_mcu_set_radio_state(struct mt76_dev *dev, bool on,
+int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on,
                                bool wait_resp)
 {
        struct sk_buff *skb;
@@ -162,13 +161,12 @@ int mt76x02_mcu_set_radio_state(struct mt76_dev *dev, bool on,
                .level = cpu_to_le32(0),
        };
 
-       skb = dev->mcu_ops->mcu_msg_alloc(&msg, sizeof(msg));
-       return dev->mcu_ops->mcu_send_msg(dev, skb, CMD_POWER_SAVING_OP,
-                                         wait_resp);
+       skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg));
+       return mt76_mcu_send_msg(dev, skb, CMD_POWER_SAVING_OP, wait_resp);
 }
 EXPORT_SYMBOL_GPL(mt76x02_mcu_set_radio_state);
 
-int mt76x02_mcu_calibrate(struct mt76_dev *dev, int type,
+int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type,
                          u32 param, bool wait)
 {
        struct sk_buff *skb;
@@ -182,44 +180,44 @@ int mt76x02_mcu_calibrate(struct mt76_dev *dev, int type,
        int ret;
 
        if (wait)
-               dev->bus->rmw(dev, MT_MCU_COM_REG0, BIT(31), 0);
+               mt76_rmw(dev, MT_MCU_COM_REG0, BIT(31), 0);
 
-       skb = dev->mcu_ops->mcu_msg_alloc(&msg, sizeof(msg));
-       ret = dev->mcu_ops->mcu_send_msg(dev, skb, CMD_CALIBRATION_OP, true);
+       skb = mt76_mcu_msg_alloc(dev, &msg, sizeof(msg));
+       ret = mt76_mcu_send_msg(dev, skb, CMD_CALIBRATION_OP, true);
        if (ret)
                return ret;
 
        if (wait &&
-           WARN_ON(!__mt76_poll_msec(dev, MT_MCU_COM_REG0,
-                                     BIT(31), BIT(31), 100)))
+           WARN_ON(!mt76_poll_msec(dev, MT_MCU_COM_REG0,
+                                   BIT(31), BIT(31), 100)))
                return -ETIMEDOUT;
 
        return 0;
 }
 EXPORT_SYMBOL_GPL(mt76x02_mcu_calibrate);
 
-int mt76x02_mcu_cleanup(struct mt76_dev *dev)
+int mt76x02_mcu_cleanup(struct mt76x02_dev *dev)
 {
        struct sk_buff *skb;
 
-       dev->bus->wr(dev, MT_MCU_INT_LEVEL, 1);
+       mt76_wr(dev, MT_MCU_INT_LEVEL, 1);
        usleep_range(20000, 30000);
 
-       while ((skb = skb_dequeue(&dev->mmio.mcu.res_q)) != NULL)
+       while ((skb = skb_dequeue(&dev->mt76.mmio.mcu.res_q)) != NULL)
                dev_kfree_skb(skb);
 
        return 0;
 }
 EXPORT_SYMBOL_GPL(mt76x02_mcu_cleanup);
 
-void mt76x02_set_ethtool_fwver(struct mt76_dev *dev,
+void mt76x02_set_ethtool_fwver(struct mt76x02_dev *dev,
                               const struct mt76x02_fw_header *h)
 {
        u16 bld = le16_to_cpu(h->build_ver);
        u16 ver = le16_to_cpu(h->fw_ver);
 
-       snprintf(dev->hw->wiphy->fw_version,
-                sizeof(dev->hw->wiphy->fw_version),
+       snprintf(dev->mt76.hw->wiphy->fw_version,
+                sizeof(dev->mt76.hw->wiphy->fw_version),
                 "%d.%d.%02d-b%x",
                 (ver >> 12) & 0xf, (ver >> 8) & 0xf, ver & 0xf, bld);
 }
index ce664f8b1c9419b1e35c3e09bc458a4bb7893939..2d8fd2514570414447f7533a0a5511f0e716597d 100644 (file)
@@ -17,6 +17,8 @@
 #ifndef __MT76x02_MCU_H
 #define __MT76x02_MCU_H
 
+#include "mt76x02.h"
+
 #define MT_MCU_RESET_CTL               0x070C
 #define MT_MCU_INT_LEVEL               0x0718
 #define MT_MCU_COM_REG0                        0x0730
@@ -94,18 +96,18 @@ struct mt76x02_patch_header {
        u8 pad[2];
 };
 
-int mt76x02_mcu_cleanup(struct mt76_dev *dev);
-int mt76x02_mcu_calibrate(struct mt76_dev *dev, int type,
+int mt76x02_mcu_cleanup(struct mt76x02_dev *dev);
+int mt76x02_mcu_calibrate(struct mt76x02_dev *dev, int type,
                          u32 param, bool wait);
 struct sk_buff *mt76x02_mcu_msg_alloc(const void *data, int len);
-int mt76x02_mcu_msg_send(struct mt76_dev *dev, struct sk_buff *skb,
+int mt76x02_mcu_msg_send(struct mt76_dev *mdev, struct sk_buff *skb,
                         int cmd, bool wait_resp);
-int mt76x02_mcu_function_select(struct mt76_dev *dev,
+int mt76x02_mcu_function_select(struct mt76x02_dev *dev,
                                enum mcu_function func,
                                u32 val, bool wait_resp);
-int mt76x02_mcu_set_radio_state(struct mt76_dev *dev, bool on,
+int mt76x02_mcu_set_radio_state(struct mt76x02_dev *dev, bool on,
                                bool wait_resp);
-void mt76x02_set_ethtool_fwver(struct mt76_dev *dev,
+void mt76x02_set_ethtool_fwver(struct mt76x02_dev *dev,
                               const struct mt76x02_fw_header *h);
 
 #endif /* __MT76x02_MCU_H */
index f229c6eb65dcc1385ff9a72906600692f567c172..620a8c93c222b7f96b1a57bde697a186dbec0f23 100644 (file)
@@ -337,7 +337,7 @@ void mt76x2_stop_hardware(struct mt76x02_dev *dev)
 {
        cancel_delayed_work_sync(&dev->cal_work);
        cancel_delayed_work_sync(&dev->mac_work);
-       mt76x02_mcu_set_radio_state(&dev->mt76, false, true);
+       mt76x02_mcu_set_radio_state(dev, false, true);
        mt76x2_mac_stop(dev, false);
 }
 
@@ -347,7 +347,7 @@ void mt76x2_cleanup(struct mt76x02_dev *dev)
        tasklet_disable(&dev->pre_tbtt_tasklet);
        mt76x2_stop_hardware(dev);
        mt76x02_dma_cleanup(dev);
-       mt76x02_mcu_cleanup(&dev->mt76);
+       mt76x02_mcu_cleanup(dev);
 }
 
 struct mt76x02_dev *mt76x2_alloc_device(struct device *pdev)
index 898aa229671cd8210784dd3dc6225e9282be8714..563e2c4594098305bd0c8fe5bd13e19cbbc723fd 100644 (file)
@@ -152,8 +152,8 @@ mt76pci_load_firmware(struct mt76x02_dev *dev)
                return -ETIMEDOUT;
        }
 
+       mt76x02_set_ethtool_fwver(dev, hdr);
        dev_info(dev->mt76.dev, "Firmware running!\n");
-       mt76x02_set_ethtool_fwver(&dev->mt76, hdr);
 
        release_firmware(fw);
 
@@ -183,6 +183,6 @@ int mt76x2_mcu_init(struct mt76x02_dev *dev)
        if (ret)
                return ret;
 
-       mt76x02_mcu_function_select(&dev->mt76, Q_SELECT, 1, true);
+       mt76x02_mcu_function_select(dev, Q_SELECT, 1, true);
        return 0;
 }
index 40ea5f7480fb6aa070a98eb509f389cb0cb72fba..bdc6fba217b142a2bea590658928d72dd407ef6f 100644 (file)
@@ -38,7 +38,7 @@ mt76x2_phy_tssi_init_cal(struct mt76x02_dev *dev)
        if (mt76x02_ext_pa_enabled(&dev->mt76, chan->band))
                flag |= BIT(8);
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TSSI, flag, true);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TSSI, flag, true);
        dev->cal.tssi_cal_done = true;
        return true;
 }
@@ -62,13 +62,13 @@ mt76x2_phy_channel_calibrate(struct mt76x02_dev *dev, bool mac_stopped)
                mt76x2_mac_stop(dev, false);
 
        if (is_5ghz)
-               mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_LC, 0, true);
+               mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 0, true);
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TX_LOFT, is_5ghz, true);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TXIQ, is_5ghz, true);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXIQC_FI, is_5ghz, true);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TEMP_SENSOR, 0, true);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TX_SHAPING, 0, true);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TX_LOFT, is_5ghz, true);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz, true);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQC_FI, is_5ghz, true);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TEMP_SENSOR, 0, true);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TX_SHAPING, 0, true);
 
        if (!mac_stopped)
                mt76x2_mac_resume(dev);
@@ -364,14 +364,14 @@ int mt76x2_phy_set_channel(struct mt76x02_dev *dev,
                u8 val = mt76x02_eeprom_get(&dev->mt76, MT_EE_BT_RCAL_RESULT);
 
                if (val != 0xff)
-                       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_R, 0, true);
+                       mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0, true);
        }
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXDCOC, channel, true);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, channel, true);
 
        /* Rx LPF calibration */
        if (!dev->cal.init_cal_done)
-               mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RC, 0, true);
+               mt76x02_mcu_calibrate(dev, MCU_CAL_RC, 0, true);
 
        dev->cal.init_cal_done = true;
 
@@ -449,7 +449,7 @@ int mt76x2_phy_start(struct mt76x02_dev *dev)
 {
        int ret;
 
-       ret = mt76x02_mcu_set_radio_state(&dev->mt76, true, true);
+       ret = mt76x02_mcu_set_radio_state(dev, true, true);
        if (ret)
                return ret;
 
index f00aed915ee897fa72211e18b9ed6589b6e8c048..31bf0f8910283c7eba23c6d7c6390ecf4e20e861 100644 (file)
@@ -289,8 +289,7 @@ void mt76x2_phy_tssi_compensate(struct mt76x02_dev *dev, bool wait)
                        return;
 
                usleep_range(10000, 20000);
-               mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_DPD,
-                                     chan->hw_value, wait);
+               mt76x02_mcu_calibrate(dev, MCU_CAL_DPD, chan->hw_value, wait);
                dev->cal.dpd_cal_done = true;
        }
 }
index c82f16efa327cb878a11b2b96731ceb8332bedea..7578c7dcd62a4849191a793685a991998a641404 100644 (file)
@@ -303,7 +303,7 @@ void mt76x2u_stop_hw(struct mt76x02_dev *dev)
 
 void mt76x2u_cleanup(struct mt76x02_dev *dev)
 {
-       mt76x02_mcu_set_radio_state(&dev->mt76, false, false);
+       mt76x02_mcu_set_radio_state(dev, false, false);
        mt76x2u_stop_hw(dev);
        mt76u_queues_deinit(&dev->mt76);
        mt76u_mcu_deinit(&dev->mt76);
index 259ceae2a3a9a2c5c9bb4edf9422665ae0f432b9..0475bff454c0e7ee3a53913efc349c7ecdd30e74 100644 (file)
@@ -260,8 +260,8 @@ static int mt76x2u_mcu_load_firmware(struct mt76x02_dev *dev)
        mt76_set(dev, MT_MCU_COM_REG0, BIT(1));
        /* enable FCE to send in-band cmd */
        mt76_wr(dev, MT_FCE_PSE_CTRL, 0x1);
+       mt76x02_set_ethtool_fwver(dev, hdr);
        dev_dbg(dev->mt76.dev, "firmware running\n");
-       mt76x02_set_ethtool_fwver(&dev->mt76, hdr);
 
 out:
        release_firmware(fw);
@@ -283,10 +283,9 @@ int mt76x2u_mcu_init(struct mt76x02_dev *dev)
 {
        int err;
 
-       err = mt76x02_mcu_function_select(&dev->mt76, Q_SELECT,
-                                          1, false);
+       err = mt76x02_mcu_function_select(dev, Q_SELECT, 1, false);
        if (err < 0)
                return err;
 
-       return mt76x02_mcu_set_radio_state(&dev->mt76, true, false);
+       return mt76x02_mcu_set_radio_state(dev, true, false);
 }
index b11f8a6a625422d73284c806e39507e8ded06f8f..e0ffdd51dcedf575747cee336b6945315f060974 100644 (file)
@@ -29,12 +29,12 @@ void mt76x2u_phy_channel_calibrate(struct mt76x02_dev *dev)
        mt76x2u_mac_stop(dev);
 
        if (is_5ghz)
-               mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_LC, 0, false);
+               mt76x02_mcu_calibrate(dev, MCU_CAL_LC, 0, false);
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TX_LOFT, is_5ghz, false);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TXIQ, is_5ghz, false);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXIQC_FI, is_5ghz, false);
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TEMP_SENSOR, 0, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TX_LOFT, is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TXIQ, is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_RXIQC_FI, is_5ghz, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_TEMP_SENSOR, 0, false);
 
        mt76x2u_mac_resume(dev);
 }
@@ -180,15 +180,14 @@ int mt76x2u_phy_set_channel(struct mt76x02_dev *dev,
                u8 val = mt76x02_eeprom_get(&dev->mt76, MT_EE_BT_RCAL_RESULT);
 
                if (val != 0xff)
-                       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_R,
-                                             0, false);
+                       mt76x02_mcu_calibrate(dev, MCU_CAL_R, 0, false);
        }
 
-       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RXDCOC, channel, false);
+       mt76x02_mcu_calibrate(dev, MCU_CAL_RXDCOC, channel, false);
 
        /* Rx LPF calibration */
        if (!dev->cal.init_cal_done)
-               mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_RC, 0, false);
+               mt76x02_mcu_calibrate(dev, MCU_CAL_RC, 0, false);
        dev->cal.init_cal_done = true;
 
        mt76_wr(dev, MT_BBP(AGC, 61), 0xff64a4e2);
@@ -220,8 +219,7 @@ int mt76x2u_phy_set_channel(struct mt76x02_dev *dev,
                                flag |= BIT(0);
                        if (mt76x02_ext_pa_enabled(&dev->mt76, chan->band))
                                flag |= BIT(8);
-                       mt76x02_mcu_calibrate(&dev->mt76, MCU_CAL_TSSI,
-                                             flag, false);
+                       mt76x02_mcu_calibrate(dev, MCU_CAL_TSSI, flag, false);
                        dev->cal.tssi_cal_done = true;
                }
        }