Lines Matching refs:dev
24 static u32 mt7663u_rr(struct mt76_dev *dev, u32 addr) in mt7663u_rr() argument
28 mutex_lock(&dev->usb.usb_ctrl_mtx); in mt7663u_rr()
29 ret = ___mt76u_rr(dev, MT_VEND_READ_EXT, in mt7663u_rr()
31 mutex_unlock(&dev->usb.usb_ctrl_mtx); in mt7663u_rr()
36 static void mt7663u_wr(struct mt76_dev *dev, u32 addr, u32 val) in mt7663u_wr() argument
38 mutex_lock(&dev->usb.usb_ctrl_mtx); in mt7663u_wr()
39 ___mt76u_wr(dev, MT_VEND_WRITE_EXT, in mt7663u_wr()
41 mutex_unlock(&dev->usb.usb_ctrl_mtx); in mt7663u_wr()
44 static u32 mt7663u_rmw(struct mt76_dev *dev, u32 addr, in mt7663u_rmw() argument
47 mutex_lock(&dev->usb.usb_ctrl_mtx); in mt7663u_rmw()
48 val |= ___mt76u_rr(dev, MT_VEND_READ_EXT, in mt7663u_rmw()
50 ___mt76u_wr(dev, MT_VEND_WRITE_EXT, in mt7663u_rmw()
52 mutex_unlock(&dev->usb.usb_ctrl_mtx); in mt7663u_rmw()
57 static void mt7663u_copy(struct mt76_dev *dev, u32 offset, in mt7663u_copy() argument
60 struct mt76_usb *usb = &dev->usb; in mt7663u_copy()
70 ret = __mt76u_vendor_request(dev, MT_VEND_WRITE_EXT, in mt7663u_copy()
85 struct mt7615_dev *dev = hw->priv; in mt7663u_stop() local
87 clear_bit(MT76_STATE_RUNNING, &dev->mphy.state); in mt7663u_stop()
92 mt76u_stop_tx(&dev->mt76); in mt7663u_stop()
95 static void mt7663u_cleanup(struct mt7615_dev *dev) in mt7663u_cleanup() argument
97 clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state); in mt7663u_cleanup()
98 mt76u_queues_deinit(&dev->mt76); in mt7663u_cleanup()
103 struct mt7615_dev *dev; in mt7663u_init_work() local
105 dev = container_of(work, struct mt7615_dev, mcu_work); in mt7663u_init_work()
106 if (mt7663u_mcu_init(dev)) in mt7663u_init_work()
109 mt7615_init_work(dev); in mt7663u_init_work()
137 struct mt7615_dev *dev; in mt7663u_probe() local
141 ops = devm_kmemdup(&usb_intf->dev, &mt7615_ops, sizeof(mt7615_ops), in mt7663u_probe()
148 mdev = mt76_alloc_device(&usb_intf->dev, sizeof(*dev), ops, &drv_ops); in mt7663u_probe()
152 dev = container_of(mdev, struct mt7615_dev, mt76); in mt7663u_probe()
156 usb_set_intfdata(usb_intf, dev); in mt7663u_probe()
158 INIT_WORK(&dev->mcu_work, mt7663u_init_work); in mt7663u_probe()
159 dev->reg_map = mt7663_usb_sdio_reg_map; in mt7663u_probe()
160 dev->ops = ops; in mt7663u_probe()
165 mdev->rev = (mt76_rr(dev, MT_HW_CHIPID) << 16) | in mt7663u_probe()
166 (mt76_rr(dev, MT_HW_REV) & 0xff); in mt7663u_probe()
167 dev_dbg(mdev->dev, "ASIC revision: %04x\n", mdev->rev); in mt7663u_probe()
169 if (!mt76_poll_msec(dev, MT_CONN_ON_MISC, MT_TOP_MISC2_FW_PWR_ON, in mt7663u_probe()
171 ret = mt7663u_mcu_power_on(dev); in mt7663u_probe()
175 set_bit(MT76_STATE_POWER_OFF, &dev->mphy.state); in mt7663u_probe()
178 ret = mt76u_alloc_mcu_queue(&dev->mt76); in mt7663u_probe()
182 ret = mt76u_alloc_queues(&dev->mt76); in mt7663u_probe()
186 ret = mt7663_usb_sdio_register_device(dev); in mt7663u_probe()
193 mt76u_queues_deinit(&dev->mt76); in mt7663u_probe()
197 mt76_free_device(&dev->mt76); in mt7663u_probe()
204 struct mt7615_dev *dev = usb_get_intfdata(usb_intf); in mt7663u_disconnect() local
206 if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state)) in mt7663u_disconnect()
209 ieee80211_unregister_hw(dev->mt76.hw); in mt7663u_disconnect()
210 mt7663u_cleanup(dev); in mt7663u_disconnect()
215 mt76_free_device(&dev->mt76); in mt7663u_disconnect()
221 struct mt7615_dev *dev = usb_get_intfdata(intf); in mt7663u_suspend() local
223 if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state) && in mt7663u_suspend()
224 mt7615_firmware_offload(dev)) { in mt7663u_suspend()
227 err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, true); in mt7663u_suspend()
232 mt76u_stop_rx(&dev->mt76); in mt7663u_suspend()
233 mt76u_stop_tx(&dev->mt76); in mt7663u_suspend()
240 struct mt7615_dev *dev = usb_get_intfdata(intf); in mt7663u_resume() local
243 err = mt76u_vendor_request(&dev->mt76, MT_VEND_FEATURE_SET, in mt7663u_resume()
249 err = mt76u_resume_rx(&dev->mt76); in mt7663u_resume()
253 if (!test_bit(MT76_STATE_SUSPEND, &dev->mphy.state) && in mt7663u_resume()
254 mt7615_firmware_offload(dev)) in mt7663u_resume()
255 err = mt76_connac_mcu_set_hif_suspend(&dev->mt76, false); in mt7663u_resume()