Lines Matching refs:dev

15 	struct mt76x02_dev *dev = hw->priv;  in mt76x0e_start()  local
17 mt76x02_mac_start(dev); in mt76x0e_start()
18 mt76x0_phy_calibrate(dev, true); in mt76x0e_start()
19 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->mphy.mac_work, in mt76x0e_start()
21 ieee80211_queue_delayed_work(dev->mt76.hw, &dev->cal_work, in mt76x0e_start()
23 set_bit(MT76_STATE_RUNNING, &dev->mphy.state); in mt76x0e_start()
28 static void mt76x0e_stop_hw(struct mt76x02_dev *dev) in mt76x0e_stop_hw() argument
30 cancel_delayed_work_sync(&dev->cal_work); in mt76x0e_stop_hw()
31 cancel_delayed_work_sync(&dev->mphy.mac_work); in mt76x0e_stop_hw()
32 clear_bit(MT76_RESTART, &dev->mphy.state); in mt76x0e_stop_hw()
34 if (!mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_BUSY, in mt76x0e_stop_hw()
36 dev_warn(dev->mt76.dev, "TX DMA did not stop\n"); in mt76x0e_stop_hw()
37 mt76_clear(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_TX_DMA_EN); in mt76x0e_stop_hw()
39 mt76x0_mac_stop(dev); in mt76x0e_stop_hw()
41 if (!mt76_poll(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_RX_DMA_BUSY, in mt76x0e_stop_hw()
43 dev_warn(dev->mt76.dev, "TX DMA did not stop\n"); in mt76x0e_stop_hw()
44 mt76_clear(dev, MT_WPDMA_GLO_CFG, MT_WPDMA_GLO_CFG_RX_DMA_EN); in mt76x0e_stop_hw()
49 struct mt76x02_dev *dev = hw->priv; in mt76x0e_stop() local
51 clear_bit(MT76_STATE_RUNNING, &dev->mphy.state); in mt76x0e_stop()
52 mt76x0e_stop_hw(dev); in mt76x0e_stop()
91 static int mt76x0e_init_hardware(struct mt76x02_dev *dev, bool resume) in mt76x0e_init_hardware() argument
95 mt76x0_chip_onoff(dev, true, false); in mt76x0e_init_hardware()
96 if (!mt76x02_wait_for_mac(&dev->mt76)) in mt76x0e_init_hardware()
99 mt76x02_dma_disable(dev); in mt76x0e_init_hardware()
100 err = mt76x0e_mcu_init(dev); in mt76x0e_init_hardware()
105 err = mt76x02_dma_init(dev); in mt76x0e_init_hardware()
110 err = mt76x0_init_hardware(dev); in mt76x0e_init_hardware()
114 mt76x02e_init_beacon_config(dev); in mt76x0e_init_hardware()
116 if (mt76_chip(&dev->mt76) == 0x7610) { in mt76x0e_init_hardware()
119 mt76_clear(dev, MT_COEXCFG0, BIT(0)); in mt76x0e_init_hardware()
121 val = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_0); in mt76x0e_init_hardware()
123 mt76_set(dev, MT_XO_CTRL7, 0xc03); in mt76x0e_init_hardware()
126 mt76_clear(dev, 0x110, BIT(9)); in mt76x0e_init_hardware()
127 mt76_set(dev, MT_MAX_LEN_CFG, BIT(13)); in mt76x0e_init_hardware()
132 static int mt76x0e_register_device(struct mt76x02_dev *dev) in mt76x0e_register_device() argument
136 err = mt76x0e_init_hardware(dev, false); in mt76x0e_register_device()
140 err = mt76x0_register_device(dev); in mt76x0e_register_device()
144 set_bit(MT76_STATE_INITIALIZED, &dev->mphy.state); in mt76x0e_register_device()
166 struct mt76x02_dev *dev; in mt76x0e_probe() local
180 ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in mt76x0e_probe()
186 mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt76x0e_ops, in mt76x0e_probe()
191 dev = container_of(mdev, struct mt76x02_dev, mt76); in mt76x0e_probe()
192 mutex_init(&dev->phy_mutex); in mt76x0e_probe()
196 mdev->rev = mt76_rr(dev, MT_ASIC_VERSION); in mt76x0e_probe()
197 dev_info(mdev->dev, "ASIC revision: %08x\n", mdev->rev); in mt76x0e_probe()
199 mt76_wr(dev, MT_INT_MASK_CSR, 0); in mt76x0e_probe()
201 ret = devm_request_irq(mdev->dev, pdev->irq, mt76x02_irq_handler, in mt76x0e_probe()
202 IRQF_SHARED, KBUILD_MODNAME, dev); in mt76x0e_probe()
206 ret = mt76x0e_register_device(dev); in mt76x0e_probe()
213 mt76_free_device(&dev->mt76); in mt76x0e_probe()
218 static void mt76x0e_cleanup(struct mt76x02_dev *dev) in mt76x0e_cleanup() argument
220 clear_bit(MT76_STATE_INITIALIZED, &dev->mphy.state); in mt76x0e_cleanup()
221 tasklet_disable(&dev->mt76.pre_tbtt_tasklet); in mt76x0e_cleanup()
222 mt76x0_chip_onoff(dev, false, false); in mt76x0e_cleanup()
223 mt76x0e_stop_hw(dev); in mt76x0e_cleanup()
224 mt76_dma_cleanup(&dev->mt76); in mt76x0e_cleanup()
225 mt76x02_mcu_cleanup(dev); in mt76x0e_cleanup()
232 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); in mt76x0e_remove() local
235 mt76x0e_cleanup(dev); in mt76x0e_remove()
243 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); in mt76x0e_suspend() local
248 mt76_queue_tx_cleanup(dev, mdev->phy.q_tx[i], true); in mt76x0e_suspend()
250 mt76_queue_tx_cleanup(dev, mdev->q_mcu[i], true); in mt76x0e_suspend()
256 mt76x02_dma_disable(dev); in mt76x0e_suspend()
257 mt76x02_mcu_cleanup(dev); in mt76x0e_suspend()
258 mt76x0_chip_onoff(dev, false, false); in mt76x0e_suspend()
269 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76); in mt76x0e_resume() local
282 mt76_queue_rx_reset(dev, i); in mt76x0e_resume()
291 return mt76x0e_init_hardware(dev, true); in mt76x0e_resume()