Lines Matching refs:rt2x00dev
38 static bool rt2800usb_hwcrypt_disabled(struct rt2x00_dev *rt2x00dev) in rt2800usb_hwcrypt_disabled() argument
48 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; in rt2800usb_start_queue() local
53 reg = rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800usb_start_queue()
55 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg); in rt2800usb_start_queue()
58 reg = rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG); in rt2800usb_start_queue()
62 rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg); in rt2800usb_start_queue()
71 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; in rt2800usb_stop_queue() local
76 reg = rt2x00usb_register_read(rt2x00dev, MAC_SYS_CTRL); in rt2800usb_stop_queue()
78 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg); in rt2800usb_stop_queue()
81 reg = rt2x00usb_register_read(rt2x00dev, BCN_TIME_CFG); in rt2800usb_stop_queue()
85 rt2x00usb_register_write(rt2x00dev, BCN_TIME_CFG, reg); in rt2800usb_stop_queue()
94 static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, in rt2800usb_tx_sta_fifo_read_completed() argument
100 rt2x00_warn(rt2x00dev, "TX status read failed %d\n", in rt2800usb_tx_sta_fifo_read_completed()
108 if (!kfifo_put(&rt2x00dev->txstatus_fifo, tx_status)) in rt2800usb_tx_sta_fifo_read_completed()
109 rt2x00_warn(rt2x00dev, "TX status FIFO overrun\n"); in rt2800usb_tx_sta_fifo_read_completed()
111 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); in rt2800usb_tx_sta_fifo_read_completed()
118 if (rt2800_txstatus_timeout(rt2x00dev)) in rt2800usb_tx_sta_fifo_read_completed()
119 queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work); in rt2800usb_tx_sta_fifo_read_completed()
121 if (rt2800_txstatus_pending(rt2x00dev)) { in rt2800usb_tx_sta_fifo_read_completed()
123 hrtimer_start(&rt2x00dev->txstatus_timer, in rt2800usb_tx_sta_fifo_read_completed()
130 clear_bit(TX_STATUS_READING, &rt2x00dev->flags); in rt2800usb_tx_sta_fifo_read_completed()
136 if (rt2800_txstatus_pending(rt2x00dev) && in rt2800usb_tx_sta_fifo_read_completed()
137 !test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) in rt2800usb_tx_sta_fifo_read_completed()
143 static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev) in rt2800usb_async_read_tx_status() argument
146 if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags)) in rt2800usb_async_read_tx_status()
150 hrtimer_start(&rt2x00dev->txstatus_timer, in rt2800usb_async_read_tx_status()
157 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; in rt2800usb_tx_dma_done() local
159 rt2800usb_async_read_tx_status(rt2x00dev); in rt2800usb_tx_dma_done()
164 struct rt2x00_dev *rt2x00dev = in rt2800usb_tx_sta_fifo_timeout() local
167 rt2x00usb_register_read_async(rt2x00dev, TX_STA_FIFO, in rt2800usb_tx_sta_fifo_timeout()
176 static int rt2800usb_autorun_detect(struct rt2x00_dev *rt2x00dev) in rt2800usb_autorun_detect() argument
190 ret = rt2x00usb_vendor_request(rt2x00dev, USB_DEVICE_MODE, in rt2800usb_autorun_detect()
205 static char *rt2800usb_get_firmware_name(struct rt2x00_dev *rt2x00dev) in rt2800usb_get_firmware_name() argument
210 static int rt2800usb_write_firmware(struct rt2x00_dev *rt2x00dev, in rt2800usb_write_firmware() argument
221 if (rt2x00_rt(rt2x00dev, RT2860) || in rt2800usb_write_firmware()
222 rt2x00_rt(rt2x00dev, RT2872) || in rt2800usb_write_firmware()
223 rt2x00_rt(rt2x00dev, RT3070)) { in rt2800usb_write_firmware()
234 retval = rt2800usb_autorun_detect(rt2x00dev); in rt2800usb_write_firmware()
238 rt2x00_info(rt2x00dev, in rt2800usb_write_firmware()
240 __clear_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags); in rt2800usb_write_firmware()
242 rt2x00usb_register_multiwrite(rt2x00dev, FIRMWARE_IMAGE_BASE, in rt2800usb_write_firmware()
246 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CID, ~0); in rt2800usb_write_firmware()
247 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_STATUS, ~0); in rt2800usb_write_firmware()
253 status = rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, in rt2800usb_write_firmware()
257 rt2x00_err(rt2x00dev, "Failed to write Firmware to device\n"); in rt2800usb_write_firmware()
262 rt2x00usb_register_write(rt2x00dev, H2M_MAILBOX_CSR, 0); in rt2800usb_write_firmware()
270 static int rt2800usb_init_registers(struct rt2x00_dev *rt2x00dev) in rt2800usb_init_registers() argument
277 if (rt2800_wait_csr_ready(rt2x00dev)) in rt2800usb_init_registers()
280 reg = rt2x00usb_register_read(rt2x00dev, PBF_SYS_CTRL); in rt2800usb_init_registers()
281 rt2x00usb_register_write(rt2x00dev, PBF_SYS_CTRL, reg & ~0x00002000); in rt2800usb_init_registers()
286 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, reg); in rt2800usb_init_registers()
288 rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0, in rt2800usb_init_registers()
291 rt2x00usb_register_write(rt2x00dev, MAC_SYS_CTRL, 0x00000000); in rt2800usb_init_registers()
296 static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev) in rt2800usb_enable_radio() argument
300 if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev))) in rt2800usb_enable_radio()
311 ((rt2x00dev->rx->limit * DATA_FRAME_SIZE) in rt2800usb_enable_radio()
315 rt2x00usb_register_write(rt2x00dev, USB_DMA_CFG, reg); in rt2800usb_enable_radio()
317 return rt2800_enable_radio(rt2x00dev); in rt2800usb_enable_radio()
320 static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev) in rt2800usb_disable_radio() argument
322 rt2800_disable_radio(rt2x00dev); in rt2800usb_disable_radio()
325 static int rt2800usb_set_state(struct rt2x00_dev *rt2x00dev, in rt2800usb_set_state() argument
329 rt2800_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 2); in rt2800usb_set_state()
331 rt2800_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0xff, 2); in rt2800usb_set_state()
336 static int rt2800usb_set_device_state(struct rt2x00_dev *rt2x00dev, in rt2800usb_set_device_state() argument
348 rt2800usb_set_state(rt2x00dev, STATE_AWAKE); in rt2800usb_set_device_state()
350 retval = rt2800usb_enable_radio(rt2x00dev); in rt2800usb_set_device_state()
357 rt2800usb_disable_radio(rt2x00dev); in rt2800usb_set_device_state()
358 rt2800usb_set_state(rt2x00dev, STATE_SLEEP); in rt2800usb_set_device_state()
368 retval = rt2800usb_set_state(rt2x00dev, state); in rt2800usb_set_device_state()
376 rt2x00_err(rt2x00dev, "Device failed to enter state %d (%d)\n", in rt2800usb_set_device_state()
458 struct rt2x00_dev *rt2x00dev = in rt2800usb_work_txdone() local
461 while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) || in rt2800usb_work_txdone()
462 rt2800_txstatus_timeout(rt2x00dev)) { in rt2800usb_work_txdone()
464 rt2800_txdone(rt2x00dev, UINT_MAX); in rt2800usb_work_txdone()
466 rt2800_txdone_nostatus(rt2x00dev); in rt2800usb_work_txdone()
473 if (rt2800_txstatus_pending(rt2x00dev)) in rt2800usb_work_txdone()
474 rt2800usb_async_read_tx_status(rt2x00dev); in rt2800usb_work_txdone()
515 rt2x00_err(entry->queue->rt2x00dev, in rt2800usb_fill_rxdone()
582 static int rt2800usb_efuse_detect(struct rt2x00_dev *rt2x00dev) in rt2800usb_efuse_detect() argument
586 retval = rt2800usb_autorun_detect(rt2x00dev); in rt2800usb_efuse_detect()
591 return rt2800_efuse_detect(rt2x00dev); in rt2800usb_efuse_detect()
594 static int rt2800usb_read_eeprom(struct rt2x00_dev *rt2x00dev) in rt2800usb_read_eeprom() argument
598 retval = rt2800usb_efuse_detect(rt2x00dev); in rt2800usb_read_eeprom()
602 retval = rt2800_read_eeprom_efuse(rt2x00dev); in rt2800usb_read_eeprom()
604 retval = rt2x00usb_eeprom_read(rt2x00dev, rt2x00dev->eeprom, in rt2800usb_read_eeprom()
610 static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev) in rt2800usb_probe_hw() argument
614 retval = rt2800_probe_hw(rt2x00dev); in rt2800usb_probe_hw()
621 rt2x00dev->txstatus_timer.function = rt2800usb_tx_sta_fifo_timeout; in rt2800usb_probe_hw()
626 INIT_WORK(&rt2x00dev->txdone_work, rt2800usb_work_txdone); in rt2800usb_probe_hw()
715 struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; in rt2800usb_queue_init() local
718 rt2800_get_txwi_rxwi_size(rt2x00dev, &txwi_size, &rxwi_size); in rt2800usb_queue_init()