Lines Matching refs:dev

31 	struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);  in mt7921u_mcu_send_message()  local
46 mt7921_skb_add_usb_sdio_hdr(dev, skb, 0); in mt7921u_mcu_send_message()
50 ret = mt76u_bulk_msg(&dev->mt76, skb->data, skb->len, NULL, in mt7921u_mcu_send_message()
57 static int mt7921u_mcu_init(struct mt792x_dev *dev) in mt7921u_mcu_init() argument
68 dev->mt76.mcu_ops = &mcu_ops; in mt7921u_mcu_init()
70 mt76_set(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN); in mt7921u_mcu_init()
71 ret = mt7921_run_firmware(dev); in mt7921u_mcu_init()
75 set_bit(MT76_STATE_MCU_RUNNING, &dev->mphy.state); in mt7921u_mcu_init()
76 mt76_clear(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN); in mt7921u_mcu_init()
81 static int mt7921u_mac_reset(struct mt792x_dev *dev) in mt7921u_mac_reset() argument
85 mt76_txq_schedule_all(&dev->mphy); in mt7921u_mac_reset()
86 mt76_worker_disable(&dev->mt76.tx_worker); in mt7921u_mac_reset()
88 set_bit(MT76_RESET, &dev->mphy.state); in mt7921u_mac_reset()
89 set_bit(MT76_MCU_RESET, &dev->mphy.state); in mt7921u_mac_reset()
91 wake_up(&dev->mt76.mcu.wait); in mt7921u_mac_reset()
92 skb_queue_purge(&dev->mt76.mcu.res_q); in mt7921u_mac_reset()
94 mt76u_stop_rx(&dev->mt76); in mt7921u_mac_reset()
95 mt76u_stop_tx(&dev->mt76); in mt7921u_mac_reset()
97 mt792xu_wfsys_reset(dev); in mt7921u_mac_reset()
99 clear_bit(MT76_MCU_RESET, &dev->mphy.state); in mt7921u_mac_reset()
100 err = mt76u_resume_rx(&dev->mt76); in mt7921u_mac_reset()
104 err = mt792xu_mcu_power_on(dev); in mt7921u_mac_reset()
108 err = mt792xu_dma_init(dev, false); in mt7921u_mac_reset()
112 mt76_wr(dev, MT_SWDEF_MODE, MT_SWDEF_NORMAL_MODE); in mt7921u_mac_reset()
113 mt76_set(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN); in mt7921u_mac_reset()
115 err = mt7921_run_firmware(dev); in mt7921u_mac_reset()
119 mt76_clear(dev, MT_UDMA_TX_QSEL, MT_FW_DL_EN); in mt7921u_mac_reset()
121 err = mt7921_mcu_set_eeprom(dev); in mt7921u_mac_reset()
125 err = mt7921_mac_init(dev); in mt7921u_mac_reset()
129 err = __mt7921_start(&dev->phy); in mt7921u_mac_reset()
131 clear_bit(MT76_RESET, &dev->mphy.state); in mt7921u_mac_reset()
133 mt76_worker_enable(&dev->mt76.tx_worker); in mt7921u_mac_reset()
140 struct mt792x_dev *dev = mt792x_hw_dev(hw); in mt7921u_stop() local
142 mt76u_stop_tx(&dev->mt76); in mt7921u_stop()
182 struct mt792x_dev *dev; in mt7921u_probe() local
187 ops = mt792x_get_mac80211_ops(&usb_intf->dev, &mt7921_ops, in mt7921u_probe()
193 mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), ops, &drv_ops); in mt7921u_probe()
197 dev = container_of(mdev, struct mt792x_dev, mt76); in mt7921u_probe()
198 dev->fw_features = features; in mt7921u_probe()
199 dev->hif_ops = &hif_ops; in mt7921u_probe()
204 usb_set_intfdata(usb_intf, dev); in mt7921u_probe()
210 mdev->rev = (mt76_rr(dev, MT_HW_CHIPID) << 16) | in mt7921u_probe()
211 (mt76_rr(dev, MT_HW_REV) & 0xff); in mt7921u_probe()
212 dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev); in mt7921u_probe()
214 if (mt76_get_field(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_N9_RDY)) { in mt7921u_probe()
215 ret = mt792xu_wfsys_reset(dev); in mt7921u_probe()
220 ret = mt792xu_mcu_power_on(dev); in mt7921u_probe()
224 ret = mt76u_alloc_mcu_queue(&dev->mt76); in mt7921u_probe()
228 ret = mt76u_alloc_queues(&dev->mt76); in mt7921u_probe()
232 ret = mt792xu_dma_init(dev, false); in mt7921u_probe()
236 hw = mt76_hw(dev); in mt7921u_probe()
240 ret = mt7921_register_device(dev); in mt7921u_probe()
247 mt76u_queues_deinit(&dev->mt76); in mt7921u_probe()
252 mt76_free_device(&dev->mt76); in mt7921u_probe()
260 struct mt792x_dev *dev = usb_get_intfdata(intf); in mt7921u_suspend() local
261 struct mt76_connac_pm *pm = &dev->pm; in mt7921u_suspend()
265 flush_work(&dev->reset_work); in mt7921u_suspend()
267 err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true); in mt7921u_suspend()
271 mt76u_stop_rx(&dev->mt76); in mt7921u_suspend()
272 mt76u_stop_tx(&dev->mt76); in mt7921u_suspend()
280 mt792x_reset(&dev->mt76); in mt7921u_suspend()
287 struct mt792x_dev *dev = usb_get_intfdata(intf); in mt7921u_resume() local
288 struct mt76_connac_pm *pm = &dev->pm; in mt7921u_resume()
293 u32 val = mt76_rr(dev, MT_WF_SW_DEF_CR_USB_MCU_EVENT); in mt7921u_resume()
300 mt76_wr(dev, MT_WF_SW_DEF_CR_USB_MCU_EVENT, 0); in mt7921u_resume()
307 if (reinit || mt792x_dma_need_reinit(dev)) { in mt7921u_resume()
308 err = mt792xu_dma_init(dev, true); in mt7921u_resume()
313 err = mt76u_resume_rx(&dev->mt76); in mt7921u_resume()
317 err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); in mt7921u_resume()
322 mt792x_reset(&dev->mt76); in mt7921u_resume()