Lines Matching refs:dev

25 int mt76x02u_mac_start(struct mt76x02_dev *dev)
27 mt76x02_mac_reset_counters(dev);
29 mt76_wr(dev, MT_MAC_SYS_CTRL, MT_MAC_SYS_CTRL_ENABLE_TX);
30 if (!mt76x02_wait_for_wpdma(&dev->mt76, 200000))
33 mt76_wr(dev, MT_RX_FILTR_CFG, dev->mt76.rxfilter);
35 mt76_wr(dev, MT_MAC_SYS_CTRL,
39 if (!mt76x02_wait_for_wpdma(&dev->mt76, 50))
69 struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev, mt76);
70 int pid, len = tx_info->skb->len, ep = q2ep(dev->mphy.q_tx[qid]->hw_idx);
80 mt76x02_mac_write_txwi(dev, txwi, tx_info->skb, wcid, sta, len);
128 static void mt76x02u_start_pre_tbtt_timer(struct mt76x02_dev *dev)
134 tbtt = mt76_get_field(dev, MT_TBTT_TIMER, MT_TBTT_TIMER_VAL);
138 queue_work(system_highpri_wq, &dev->pre_tbtt_work);
143 hrtimer_start(&dev->pre_tbtt_timer, time, HRTIMER_MODE_REL);
146 static void mt76x02u_restart_pre_tbtt_timer(struct mt76x02_dev *dev)
152 tbtt = mt76_get_field(dev, MT_TBTT_TIMER, MT_TBTT_TIMER_VAL);
155 dw0 = mt76_rr(dev, MT_TSF_TIMER_DW0);
156 dw1 = mt76_rr(dev, MT_TSF_TIMER_DW1);
158 dev_dbg(dev->mt76.dev, "TSF: %llu us TBTT %u us\n", tsf, tbtt);
161 time = ((1000000000ull * dev->mt76.beacon_int) >> 10);
169 hrtimer_start(&dev->pre_tbtt_timer, time, HRTIMER_MODE_REL);
172 static void mt76x02u_stop_pre_tbtt_timer(struct mt76x02_dev *dev)
175 hrtimer_cancel(&dev->pre_tbtt_timer);
176 cancel_work_sync(&dev->pre_tbtt_work);
178 } while (hrtimer_active(&dev->pre_tbtt_timer));
183 struct mt76x02_dev *dev =
189 if (!dev->mt76.beacon_mask)
192 if (mt76_hw(dev)->conf.flags & IEEE80211_CONF_OFFCHANNEL)
195 mt76x02_resync_beacon_timer(dev);
198 mt76_set(dev, MT_BCN_BYPASS_MASK, 0xffff);
199 dev->beacon_data_count = 0;
201 ieee80211_iterate_active_interfaces(mt76_hw(dev),
203 mt76x02_update_beacon_iter, dev);
205 mt76_csa_check(&dev->mt76);
207 if (dev->mt76.csa_complete) {
208 mt76_csa_finish(&dev->mt76);
212 nbeacons = hweight8(dev->mt76.beacon_mask);
213 mt76x02_enqueue_buffered_bc(dev, &data, N_BCN_SLOTS - nbeacons);
216 mt76x02_mac_set_beacon(dev, skb);
219 mt76_wr(dev, MT_BCN_BYPASS_MASK,
220 0xff00 | ~(0xff00 >> dev->beacon_data_count));
222 mt76x02u_restart_pre_tbtt_timer(dev);
227 struct mt76x02_dev *dev =
230 queue_work(system_highpri_wq, &dev->pre_tbtt_work);
235 static void mt76x02u_pre_tbtt_enable(struct mt76x02_dev *dev, bool en)
237 if (en && dev->mt76.beacon_mask &&
238 !hrtimer_active(&dev->pre_tbtt_timer))
239 mt76x02u_start_pre_tbtt_timer(dev);
241 mt76x02u_stop_pre_tbtt_timer(dev);
244 static void mt76x02u_beacon_enable(struct mt76x02_dev *dev, bool en)
246 if (WARN_ON_ONCE(!dev->mt76.beacon_int))
250 mt76x02u_start_pre_tbtt_timer(dev);
253 void mt76x02u_init_beacon_config(struct mt76x02_dev *dev)
261 dev->beacon_ops = &beacon_ops;
263 hrtimer_init(&dev->pre_tbtt_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
264 dev->pre_tbtt_timer.function = mt76x02u_pre_tbtt_interrupt;
265 INIT_WORK(&dev->pre_tbtt_work, mt76x02u_pre_tbtt_work);
267 mt76x02_init_beacon_config(dev);
271 void mt76x02u_exit_beacon_config(struct mt76x02_dev *dev)
273 if (!test_bit(MT76_REMOVED, &dev->mphy.state))
274 mt76_clear(dev, MT_BEACON_TIME_CFG,
280 mt76x02u_stop_pre_tbtt_timer(dev);