Lines Matching full:wilc

15 static void wilc_wlan_txq_remove(struct wilc *wilc, u8 q_num,  in wilc_wlan_txq_remove()  argument
19 wilc->txq_entries -= 1; in wilc_wlan_txq_remove()
20 wilc->txq[q_num].count--; in wilc_wlan_txq_remove()
24 wilc_wlan_txq_remove_from_head(struct wilc *wilc, u8 q_num) in wilc_wlan_txq_remove_from_head() argument
29 spin_lock_irqsave(&wilc->txq_spinlock, flags); in wilc_wlan_txq_remove_from_head()
31 if (!list_empty(&wilc->txq[q_num].txq_head.list)) { in wilc_wlan_txq_remove_from_head()
32 tqe = list_first_entry(&wilc->txq[q_num].txq_head.list, in wilc_wlan_txq_remove_from_head()
35 wilc->txq_entries -= 1; in wilc_wlan_txq_remove_from_head()
36 wilc->txq[q_num].count--; in wilc_wlan_txq_remove_from_head()
38 spin_unlock_irqrestore(&wilc->txq_spinlock, flags); in wilc_wlan_txq_remove_from_head()
47 struct wilc *wilc = vif->wilc; in wilc_wlan_txq_add_to_tail() local
49 spin_lock_irqsave(&wilc->txq_spinlock, flags); in wilc_wlan_txq_add_to_tail()
51 list_add_tail(&tqe->list, &wilc->txq[q_num].txq_head.list); in wilc_wlan_txq_add_to_tail()
52 wilc->txq_entries += 1; in wilc_wlan_txq_add_to_tail()
53 wilc->txq[q_num].count++; in wilc_wlan_txq_add_to_tail()
55 spin_unlock_irqrestore(&wilc->txq_spinlock, flags); in wilc_wlan_txq_add_to_tail()
57 complete(&wilc->txq_event); in wilc_wlan_txq_add_to_tail()
64 struct wilc *wilc = vif->wilc; in wilc_wlan_txq_add_to_head() local
66 mutex_lock(&wilc->txq_add_to_head_cs); in wilc_wlan_txq_add_to_head()
68 spin_lock_irqsave(&wilc->txq_spinlock, flags); in wilc_wlan_txq_add_to_head()
70 list_add(&tqe->list, &wilc->txq[q_num].txq_head.list); in wilc_wlan_txq_add_to_head()
71 wilc->txq_entries += 1; in wilc_wlan_txq_add_to_head()
72 wilc->txq[q_num].count++; in wilc_wlan_txq_add_to_head()
74 spin_unlock_irqrestore(&wilc->txq_spinlock, flags); in wilc_wlan_txq_add_to_head()
75 mutex_unlock(&wilc->txq_add_to_head_cs); in wilc_wlan_txq_add_to_head()
76 complete(&wilc->txq_event); in wilc_wlan_txq_add_to_head()
127 struct wilc *wilc = vif->wilc; in tcp_process() local
133 spin_lock_irqsave(&wilc->txq_spinlock, flags); in tcp_process()
169 spin_unlock_irqrestore(&wilc->txq_spinlock, flags); in tcp_process()
175 struct wilc *wilc = vif->wilc; in wilc_wlan_txq_filter_dup_tcp_ack() local
181 spin_lock_irqsave(&wilc->txq_spinlock, flags); in wilc_wlan_txq_filter_dup_tcp_ack()
202 wilc_wlan_txq_remove(wilc, tqe->q_num, tqe); in wilc_wlan_txq_filter_dup_tcp_ack()
220 spin_unlock_irqrestore(&wilc->txq_spinlock, flags); in wilc_wlan_txq_filter_dup_tcp_ack()
223 wait_for_completion_timeout(&wilc->txq_event, in wilc_wlan_txq_filter_dup_tcp_ack()
238 struct wilc *wilc = vif->wilc; in wilc_wlan_txq_add_cfg_pkt() local
241 if (wilc->quit) { in wilc_wlan_txq_add_cfg_pkt()
243 complete(&wilc->cfg_event); in wilc_wlan_txq_add_cfg_pkt()
249 complete(&wilc->cfg_event); in wilc_wlan_txq_add_cfg_pkt()
267 static bool is_ac_q_limit(struct wilc *wl, u8 q_num) in is_ac_q_limit()
314 static inline u8 ac_classify(struct wilc *wilc, struct sk_buff *skb) in ac_classify() argument
353 static inline int ac_balance(struct wilc *wl, u8 *ratio) in ac_balance()
370 static inline void ac_update_fw_ac_pkt_info(struct wilc *wl, u32 reg) in ac_update_fw_ac_pkt_info()
383 static inline u8 ac_change(struct wilc *wilc, u8 *ac) in ac_change() argument
386 if (wilc->txq[*ac].fw.acm == 0) in ac_change()
401 struct wilc *wilc; in wilc_wlan_txq_add_net_pkt() local
404 wilc = vif->wilc; in wilc_wlan_txq_add_net_pkt()
406 if (wilc->quit) { in wilc_wlan_txq_add_net_pkt()
411 if (!wilc->initialized) { in wilc_wlan_txq_add_net_pkt()
429 q_num = ac_classify(wilc, tx_data->skb); in wilc_wlan_txq_add_net_pkt()
431 if (ac_change(wilc, &q_num)) { in wilc_wlan_txq_add_net_pkt()
437 if (is_ac_q_limit(wilc, q_num)) { in wilc_wlan_txq_add_net_pkt()
447 return wilc->txq_entries; in wilc_wlan_txq_add_net_pkt()
456 struct wilc *wilc; in wilc_wlan_txq_add_mgmt_pkt() local
458 wilc = vif->wilc; in wilc_wlan_txq_add_mgmt_pkt()
460 if (wilc->quit) { in wilc_wlan_txq_add_mgmt_pkt()
465 if (!wilc->initialized) { in wilc_wlan_txq_add_mgmt_pkt()
487 static struct txq_entry_t *wilc_wlan_txq_get_first(struct wilc *wilc, u8 q_num) in wilc_wlan_txq_get_first() argument
492 spin_lock_irqsave(&wilc->txq_spinlock, flags); in wilc_wlan_txq_get_first()
494 if (!list_empty(&wilc->txq[q_num].txq_head.list)) in wilc_wlan_txq_get_first()
495 tqe = list_first_entry(&wilc->txq[q_num].txq_head.list, in wilc_wlan_txq_get_first()
498 spin_unlock_irqrestore(&wilc->txq_spinlock, flags); in wilc_wlan_txq_get_first()
503 static struct txq_entry_t *wilc_wlan_txq_get_next(struct wilc *wilc, in wilc_wlan_txq_get_next() argument
509 spin_lock_irqsave(&wilc->txq_spinlock, flags); in wilc_wlan_txq_get_next()
511 if (!list_is_last(&tqe->list, &wilc->txq[q_num].txq_head.list)) in wilc_wlan_txq_get_next()
515 spin_unlock_irqrestore(&wilc->txq_spinlock, flags); in wilc_wlan_txq_get_next()
520 static void wilc_wlan_rxq_add(struct wilc *wilc, struct rxq_entry_t *rqe) in wilc_wlan_rxq_add() argument
522 if (wilc->quit) in wilc_wlan_rxq_add()
525 mutex_lock(&wilc->rxq_cs); in wilc_wlan_rxq_add()
526 list_add_tail(&rqe->list, &wilc->rxq_head.list); in wilc_wlan_rxq_add()
527 mutex_unlock(&wilc->rxq_cs); in wilc_wlan_rxq_add()
530 static struct rxq_entry_t *wilc_wlan_rxq_remove(struct wilc *wilc) in wilc_wlan_rxq_remove() argument
534 mutex_lock(&wilc->rxq_cs); in wilc_wlan_rxq_remove()
535 if (!list_empty(&wilc->rxq_head.list)) { in wilc_wlan_rxq_remove()
536 rqe = list_first_entry(&wilc->rxq_head.list, struct rxq_entry_t, in wilc_wlan_rxq_remove()
540 mutex_unlock(&wilc->rxq_cs); in wilc_wlan_rxq_remove()
544 static int chip_allow_sleep_wilc1000(struct wilc *wilc) in chip_allow_sleep_wilc1000() argument
547 const struct wilc_hif_func *hif_func = wilc->hif_func; in chip_allow_sleep_wilc1000()
554 if (wilc->io_type == WILC_HIF_SDIO) { in chip_allow_sleep_wilc1000()
571 ret = hif_func->hif_read_reg(wilc, to_host_from_fw_reg, &reg); in chip_allow_sleep_wilc1000()
581 ret = hif_func->hif_read_reg(wilc, wakeup_reg, &reg); in chip_allow_sleep_wilc1000()
586 ret = hif_func->hif_write_reg(wilc, wakeup_reg, reg); in chip_allow_sleep_wilc1000()
591 ret = hif_func->hif_read_reg(wilc, from_host_to_fw_reg, &reg); in chip_allow_sleep_wilc1000()
596 ret = hif_func->hif_write_reg(wilc, from_host_to_fw_reg, reg); in chip_allow_sleep_wilc1000()
604 static int chip_allow_sleep_wilc3000(struct wilc *wilc) in chip_allow_sleep_wilc3000() argument
608 const struct wilc_hif_func *hif_func = wilc->hif_func; in chip_allow_sleep_wilc3000()
610 if (wilc->io_type == WILC_HIF_SDIO) { in chip_allow_sleep_wilc3000()
611 ret = hif_func->hif_read_reg(wilc, WILC_SDIO_WAKEUP_REG, &reg); in chip_allow_sleep_wilc3000()
614 ret = hif_func->hif_write_reg(wilc, WILC_SDIO_WAKEUP_REG, in chip_allow_sleep_wilc3000()
619 ret = hif_func->hif_read_reg(wilc, WILC_SPI_WAKEUP_REG, &reg); in chip_allow_sleep_wilc3000()
622 ret = hif_func->hif_write_reg(wilc, WILC_SPI_WAKEUP_REG, in chip_allow_sleep_wilc3000()
630 static int chip_allow_sleep(struct wilc *wilc) in chip_allow_sleep() argument
632 if (is_wilc1000(wilc->chipid)) in chip_allow_sleep()
633 return chip_allow_sleep_wilc1000(wilc); in chip_allow_sleep()
635 return chip_allow_sleep_wilc3000(wilc); in chip_allow_sleep()
638 static int chip_wakeup_wilc1000(struct wilc *wilc) in chip_wakeup_wilc1000() argument
645 const struct wilc_hif_func *hif_func = wilc->hif_func; in chip_wakeup_wilc1000()
647 if (wilc->io_type == WILC_HIF_SDIO) { in chip_wakeup_wilc1000()
664 ret = hif_func->hif_write_reg(wilc, from_host_to_fw_reg, in chip_wakeup_wilc1000()
670 ret = hif_func->hif_write_reg(wilc, wakeup_reg, in chip_wakeup_wilc1000()
676 ret = hif_func->hif_read_reg(wilc, clk_status_reg, in chip_wakeup_wilc1000()
694 if (wilc->io_type == WILC_HIF_SPI) in chip_wakeup_wilc1000()
695 wilc->hif_func->hif_reset(wilc); in chip_wakeup_wilc1000()
700 static int chip_wakeup_wilc3000(struct wilc *wilc) in chip_wakeup_wilc3000() argument
706 const struct wilc_hif_func *hif_func = wilc->hif_func; in chip_wakeup_wilc3000()
708 if (wilc->io_type == WILC_HIF_SDIO) { in chip_wakeup_wilc3000()
720 hif_func->hif_read_reg(wilc, wakeup_reg, &wakeup_reg_val); in chip_wakeup_wilc3000()
722 hif_func->hif_write_reg(wilc, wakeup_reg, wakeup_reg_val | in chip_wakeup_wilc3000()
725 hif_func->hif_read_reg(wilc, clk_status_reg, in chip_wakeup_wilc3000()
741 hif_func->hif_read_reg(wilc, clk_status_reg, in chip_wakeup_wilc3000()
748 hif_func->hif_write_reg(wilc, wakeup_reg, in chip_wakeup_wilc3000()
755 dev_err(wilc->dev, "clocks still OFF. Wake up failed\n"); in chip_wakeup_wilc3000()
760 static int chip_wakeup(struct wilc *wilc) in chip_wakeup() argument
762 if (is_wilc1000(wilc->chipid)) in chip_wakeup()
763 return chip_wakeup_wilc1000(wilc); in chip_wakeup()
765 return chip_wakeup_wilc3000(wilc); in chip_wakeup()
768 static inline int acquire_bus(struct wilc *wilc, enum bus_acquire acquire) in acquire_bus() argument
772 mutex_lock(&wilc->hif_cs); in acquire_bus()
773 if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP && wilc->power_save_mode) { in acquire_bus()
774 ret = chip_wakeup(wilc); in acquire_bus()
776 mutex_unlock(&wilc->hif_cs); in acquire_bus()
782 static inline int release_bus(struct wilc *wilc, enum bus_release release) in release_bus() argument
786 if (release == WILC_BUS_RELEASE_ALLOW_SLEEP && wilc->power_save_mode) in release_bus()
787 ret = chip_allow_sleep(wilc); in release_bus()
788 mutex_unlock(&wilc->hif_cs); in release_bus()
793 int host_wakeup_notify(struct wilc *wilc) in host_wakeup_notify() argument
795 int ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in host_wakeup_notify()
800 wilc->hif_func->hif_write_reg(wilc, is_wilc1000(wilc->chipid) ? in host_wakeup_notify()
803 return release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); in host_wakeup_notify()
807 int host_sleep_notify(struct wilc *wilc) in host_sleep_notify() argument
809 int ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in host_sleep_notify()
814 wilc->hif_func->hif_write_reg(wilc, is_wilc1000(wilc->chipid) ? in host_sleep_notify()
817 return release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); in host_sleep_notify()
821 int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) in wilc_wlan_handle_txq() argument
838 u32 *vmm_table = wilc->vmm_table; in wilc_wlan_handle_txq()
842 u8 *txb = wilc->tx_buffer; in wilc_wlan_handle_txq()
846 if (wilc->quit) in wilc_wlan_handle_txq()
849 if (ac_balance(wilc, ac_desired_ratio)) in wilc_wlan_handle_txq()
852 mutex_lock(&wilc->txq_add_to_head_cs); in wilc_wlan_handle_txq()
854 srcu_idx = srcu_read_lock(&wilc->srcu); in wilc_wlan_handle_txq()
855 wilc_for_each_vif(wilc, vif) in wilc_wlan_handle_txq()
857 srcu_read_unlock(&wilc->srcu, srcu_idx); in wilc_wlan_handle_txq()
860 tqe_q[ac] = wilc_wlan_txq_get_first(wilc, ac); in wilc_wlan_handle_txq()
903 tqe_q[ac] = wilc_wlan_txq_get_next(wilc, in wilc_wlan_handle_txq()
915 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in wilc_wlan_handle_txq()
920 func = wilc->hif_func; in wilc_wlan_handle_txq()
922 ret = func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg); in wilc_wlan_handle_txq()
927 ac_update_fw_ac_pkt_info(wilc, reg); in wilc_wlan_handle_txq()
934 ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, 0); in wilc_wlan_handle_txq()
937 } while (!wilc->quit); in wilc_wlan_handle_txq()
944 ret = func->hif_block_tx(wilc, in wilc_wlan_handle_txq()
951 if (is_wilc1000(wilc->chipid)) { in wilc_wlan_handle_txq()
952 ret = func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x2); in wilc_wlan_handle_txq()
957 ret = func->hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg); in wilc_wlan_handle_txq()
966 ret = func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0); in wilc_wlan_handle_txq()
971 ret = func->hif_write_reg(wilc, WILC_CORTUS_INTERRUPT_BASE, 1); in wilc_wlan_handle_txq()
976 ret = func->hif_read_reg(wilc, WILC_CORTUS_INTERRUPT_BASE, &reg); in wilc_wlan_handle_txq()
981 ret = func->hif_read_reg(wilc, WILC_HOST_VMM_CTL, &reg); in wilc_wlan_handle_txq()
991 ret = func->hif_write_reg(wilc, WILC_HOST_VMM_CTL, 0x0); in wilc_wlan_handle_txq()
999 ret = func->hif_read_reg(wilc, WILC_HOST_TX_CTRL, &reg); in wilc_wlan_handle_txq()
1003 ret = func->hif_write_reg(wilc, WILC_HOST_TX_CTRL, reg); in wilc_wlan_handle_txq()
1019 ret = release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); in wilc_wlan_handle_txq()
1034 tqe = wilc_wlan_txq_remove_from_head(wilc, vmm_entries_ac[i]); in wilc_wlan_handle_txq()
1081 wilc->txq[i].fw.count += ac_pkt_num_to_chip[i]; in wilc_wlan_handle_txq()
1083 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in wilc_wlan_handle_txq()
1087 ret = func->hif_clear_int_ext(wilc, ENABLE_TX_VMM); in wilc_wlan_handle_txq()
1091 ret = func->hif_block_tx_ext(wilc, 0, txb, offset); in wilc_wlan_handle_txq()
1094 rv = release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); in wilc_wlan_handle_txq()
1099 mutex_unlock(&wilc->txq_add_to_head_cs); in wilc_wlan_handle_txq()
1102 *txq_count = wilc->txq_entries; in wilc_wlan_handle_txq()
1106 static void wilc_wlan_handle_rx_buff(struct wilc *wilc, u8 *buffer, int size) in wilc_wlan_handle_rx_buff() argument
1128 wilc_wfi_mgmt_rx(wilc, buff_ptr, pkt_len, in wilc_wlan_handle_rx_buff()
1132 wilc_frmw_to_host(wilc, buff_ptr, pkt_len, in wilc_wlan_handle_rx_buff()
1139 wilc_wlan_cfg_indicate_rx(wilc, buff_ptr, in wilc_wlan_handle_rx_buff()
1143 if (wilc->cfg_seq_no == rsp.seq_no) in wilc_wlan_handle_rx_buff()
1144 complete(&wilc->cfg_event); in wilc_wlan_handle_rx_buff()
1146 wilc_mac_indicate(wilc); in wilc_wlan_handle_rx_buff()
1154 static void wilc_wlan_handle_rxq(struct wilc *wilc) in wilc_wlan_handle_rxq() argument
1160 while (!wilc->quit) { in wilc_wlan_handle_rxq()
1161 rqe = wilc_wlan_rxq_remove(wilc); in wilc_wlan_handle_rxq()
1167 wilc_wlan_handle_rx_buff(wilc, buffer, size); in wilc_wlan_handle_rxq()
1171 if (wilc->quit) in wilc_wlan_handle_rxq()
1172 complete(&wilc->cfg_event); in wilc_wlan_handle_rxq()
1175 static void wilc_unknown_isr_ext(struct wilc *wilc) in wilc_unknown_isr_ext() argument
1177 wilc->hif_func->hif_clear_int_ext(wilc, 0); in wilc_unknown_isr_ext()
1180 static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) in wilc_wlan_handle_isr_ext() argument
1182 u32 offset = wilc->rx_buffer_offset; in wilc_wlan_handle_isr_ext()
1192 wilc->hif_func->hif_read_size(wilc, &size); in wilc_wlan_handle_isr_ext()
1203 buffer = &wilc->rx_buffer[offset]; in wilc_wlan_handle_isr_ext()
1205 wilc->hif_func->hif_clear_int_ext(wilc, DATA_INT_CLR | ENABLE_RX_VMM); in wilc_wlan_handle_isr_ext()
1206 ret = wilc->hif_func->hif_block_rx_ext(wilc, 0, buffer, size); in wilc_wlan_handle_isr_ext()
1211 wilc->rx_buffer_offset = offset; in wilc_wlan_handle_isr_ext()
1218 wilc_wlan_rxq_add(wilc, rqe); in wilc_wlan_handle_isr_ext()
1219 wilc_wlan_handle_rxq(wilc); in wilc_wlan_handle_isr_ext()
1222 void wilc_handle_isr(struct wilc *wilc) in wilc_handle_isr() argument
1227 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in wilc_handle_isr()
1229 dev_err_ratelimited(wilc->dev, "Cannot acquire bus\n"); in wilc_handle_isr()
1233 wilc->hif_func->hif_read_int(wilc, &int_status); in wilc_handle_isr()
1236 wilc_wlan_handle_isr_ext(wilc, int_status); in wilc_handle_isr()
1239 wilc_unknown_isr_ext(wilc); in wilc_handle_isr()
1241 ret = release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); in wilc_handle_isr()
1243 dev_err_ratelimited(wilc->dev, "Cannot release bus\n"); in wilc_handle_isr()
1247 int wilc_wlan_firmware_download(struct wilc *wilc, const u8 *buffer, in wilc_wlan_firmware_download() argument
1266 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in wilc_wlan_firmware_download()
1270 wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); in wilc_wlan_firmware_download()
1272 ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); in wilc_wlan_firmware_download()
1273 wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); in wilc_wlan_firmware_download()
1277 ret = release_bus(wilc, WILC_BUS_RELEASE_ONLY); in wilc_wlan_firmware_download()
1284 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in wilc_wlan_firmware_download()
1296 ret = wilc->hif_func->hif_block_tx(wilc, addr, in wilc_wlan_firmware_download()
1305 rv = release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); in wilc_wlan_firmware_download()
1323 int wilc_wlan_start(struct wilc *wilc) in wilc_wlan_start() argument
1329 if (wilc->io_type == WILC_HIF_SDIO) { in wilc_wlan_start()
1332 } else if (wilc->io_type == WILC_HIF_SPI) { in wilc_wlan_start()
1335 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY); in wilc_wlan_start()
1339 ret = wilc->hif_func->hif_write_reg(wilc, WILC_VMM_CORE_CFG, reg); in wilc_wlan_start()
1344 if (wilc->io_type == WILC_HIF_SDIO && wilc->dev_irq_num) in wilc_wlan_start()
1347 if (is_wilc3000(wilc->chipid)) in wilc_wlan_start()
1350 ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_1, reg); in wilc_wlan_start()
1354 wilc->hif_func->hif_sync_ext(wilc, NUM_INT_EXT); in wilc_wlan_start()
1356 ret = wilc->hif_func->hif_read_reg(wilc, WILC_CHIPID, &chipid); in wilc_wlan_start()
1360 wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); in wilc_wlan_start()
1363 wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); in wilc_wlan_start()
1364 wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); in wilc_wlan_start()
1368 ret = wilc->hif_func->hif_write_reg(wilc, WILC_GLB_RESET_0, reg); in wilc_wlan_start()
1369 wilc->hif_func->hif_read_reg(wilc, WILC_GLB_RESET_0, &reg); in wilc_wlan_start()
1372 rv = release_bus(wilc, WILC_BUS_RELEASE_ONLY); in wilc_wlan_start()
1376 int wilc_wlan_stop(struct wilc *wilc, struct wilc_vif *vif) in wilc_wlan_stop() argument
1381 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in wilc_wlan_stop()
1385 ret = wilc->hif_func->hif_read_reg(wilc, GLOBAL_MODE_CONTROL, &reg); in wilc_wlan_stop()
1390 ret = wilc->hif_func->hif_write_reg(wilc, GLOBAL_MODE_CONTROL, reg); in wilc_wlan_stop()
1394 ret = wilc->hif_func->hif_read_reg(wilc, PWR_SEQ_MISC_CTRL, &reg); in wilc_wlan_stop()
1399 ret = wilc->hif_func->hif_write_reg(wilc, PWR_SEQ_MISC_CTRL, reg); in wilc_wlan_stop()
1403 ret = wilc->hif_func->hif_read_reg(wilc, WILC_GP_REG_0, &reg); in wilc_wlan_stop()
1409 ret = wilc->hif_func->hif_write_reg(wilc, WILC_GP_REG_0, in wilc_wlan_stop()
1419 rv = release_bus(wilc, WILC_BUS_RELEASE_ONLY); in wilc_wlan_stop()
1430 struct wilc *wilc = vif->wilc; in wilc_wlan_cleanup() local
1432 wilc->quit = 1; in wilc_wlan_cleanup()
1434 while ((tqe = wilc_wlan_txq_remove_from_head(wilc, ac))) { in wilc_wlan_cleanup()
1441 while ((rqe = wilc_wlan_rxq_remove(wilc))) in wilc_wlan_cleanup()
1444 kfree(wilc->vmm_table); in wilc_wlan_cleanup()
1445 wilc->vmm_table = NULL; in wilc_wlan_cleanup()
1446 kfree(wilc->rx_buffer); in wilc_wlan_cleanup()
1447 wilc->rx_buffer = NULL; in wilc_wlan_cleanup()
1448 kfree(wilc->tx_buffer); in wilc_wlan_cleanup()
1449 wilc->tx_buffer = NULL; in wilc_wlan_cleanup()
1450 wilc->hif_func->hif_deinit(wilc); in wilc_wlan_cleanup()
1456 struct wilc *wilc = vif->wilc; in wilc_wlan_cfg_commit() local
1457 struct wilc_cfg_frame *cfg = &wilc->cfg_frame; in wilc_wlan_cfg_commit()
1458 int t_len = wilc->cfg_frame_offset + sizeof(struct wilc_cfg_cmd_hdr); in wilc_wlan_cfg_commit()
1465 cfg->hdr.seq_no = wilc->cfg_seq_no % 256; in wilc_wlan_cfg_commit()
1468 wilc->cfg_seq_no = cfg->hdr.seq_no; in wilc_wlan_cfg_commit()
1481 struct wilc *wilc = vif->wilc; in wilc_wlan_cfg_set() local
1483 mutex_lock(&wilc->cfg_cmd_lock); in wilc_wlan_cfg_set()
1486 wilc->cfg_frame_offset = 0; in wilc_wlan_cfg_set()
1488 offset = wilc->cfg_frame_offset; in wilc_wlan_cfg_set()
1489 ret_size = wilc_wlan_cfg_set_wid(wilc->cfg_frame.frame, offset, in wilc_wlan_cfg_set()
1492 wilc->cfg_frame_offset = offset; in wilc_wlan_cfg_set()
1495 mutex_unlock(&wilc->cfg_cmd_lock); in wilc_wlan_cfg_set()
1499 netdev_dbg(vif->ndev, "%s: seqno[%d]\n", __func__, wilc->cfg_seq_no); in wilc_wlan_cfg_set()
1504 if (!wait_for_completion_timeout(&wilc->cfg_event, in wilc_wlan_cfg_set()
1510 wilc->cfg_frame_offset = 0; in wilc_wlan_cfg_set()
1511 wilc->cfg_seq_no += 1; in wilc_wlan_cfg_set()
1512 mutex_unlock(&wilc->cfg_cmd_lock); in wilc_wlan_cfg_set()
1522 struct wilc *wilc = vif->wilc; in wilc_wlan_cfg_get() local
1524 mutex_lock(&wilc->cfg_cmd_lock); in wilc_wlan_cfg_get()
1527 wilc->cfg_frame_offset = 0; in wilc_wlan_cfg_get()
1529 offset = wilc->cfg_frame_offset; in wilc_wlan_cfg_get()
1530 ret_size = wilc_wlan_cfg_get_wid(wilc->cfg_frame.frame, offset, wid); in wilc_wlan_cfg_get()
1532 wilc->cfg_frame_offset = offset; in wilc_wlan_cfg_get()
1535 mutex_unlock(&wilc->cfg_cmd_lock); in wilc_wlan_cfg_get()
1542 if (!wait_for_completion_timeout(&wilc->cfg_event, in wilc_wlan_cfg_get()
1547 wilc->cfg_frame_offset = 0; in wilc_wlan_cfg_get()
1548 wilc->cfg_seq_no += 1; in wilc_wlan_cfg_get()
1549 mutex_unlock(&wilc->cfg_cmd_lock); in wilc_wlan_cfg_get()
1572 wids[i].size = wilc_wlan_cfg_get_val(vif->wilc, in wilc_send_config_pkt()
1594 int wilc_get_chipid(struct wilc *wilc) in wilc_get_chipid() argument
1599 if (wilc->chipid == 0) { in wilc_get_chipid()
1600 wilc->hif_func->hif_read_reg(wilc, WILC3000_CHIP_ID, &chipid); in wilc_get_chipid()
1602 wilc->hif_func->hif_read_reg(wilc, WILC_CHIPID, &chipid); in wilc_get_chipid()
1603 wilc->hif_func->hif_read_reg(wilc, WILC_RF_REVISION_ID, in wilc_get_chipid()
1607 wilc->chipid = 0; in wilc_get_chipid()
1621 wilc->chipid = chipid; in wilc_get_chipid()
1633 struct wilc *wilc = vif->wilc; in init_chip() local
1635 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_AND_WAKEUP); in init_chip()
1639 ret = wilc_get_chipid(wilc); in init_chip()
1643 if ((wilc->chipid & 0xfff) != 0xa0) { in init_chip()
1644 ret = wilc->hif_func->hif_read_reg(wilc, in init_chip()
1652 ret = wilc->hif_func->hif_write_reg(wilc, in init_chip()
1659 ret = wilc->hif_func->hif_write_reg(wilc, in init_chip()
1668 if (is_wilc3000(wilc->chipid)) { in init_chip()
1669 ret = wilc->hif_func->hif_read_reg(wilc, WILC3000_BOOTROM_STATUS, &reg); in init_chip()
1675 ret = wilc->hif_func->hif_write_reg(wilc, WILC3000_CORTUS_BOOT_REGISTER_2, in init_chip()
1684 rv = release_bus(wilc, WILC_BUS_RELEASE_ALLOW_SLEEP); in init_chip()
1689 int wilc_load_mac_from_nv(struct wilc *wl) in wilc_load_mac_from_nv()
1744 struct wilc *wilc; in wilc_wlan_init() local
1746 wilc = vif->wilc; in wilc_wlan_init()
1748 wilc->quit = 0; in wilc_wlan_init()
1750 if (!wilc->hif_func->hif_is_init(wilc)) { in wilc_wlan_init()
1751 ret = acquire_bus(wilc, WILC_BUS_ACQUIRE_ONLY); in wilc_wlan_init()
1755 ret = wilc->hif_func->hif_init(wilc, false); in wilc_wlan_init()
1757 ret = wilc_get_chipid(wilc); in wilc_wlan_init()
1758 rv = release_bus(wilc, WILC_BUS_RELEASE_ONLY); in wilc_wlan_init()
1764 if (!is_wilc1000(wilc->chipid) && !is_wilc3000(wilc->chipid)) { in wilc_wlan_init()
1765 netdev_err(dev, "Unsupported chipid: %x\n", wilc->chipid); in wilc_wlan_init()
1770 netdev_dbg(dev, "chipid (%08x)\n", wilc->chipid); in wilc_wlan_init()
1773 if (!wilc->vmm_table) in wilc_wlan_init()
1774 wilc->vmm_table = kcalloc(WILC_VMM_TBL_SIZE, sizeof(u32), GFP_KERNEL); in wilc_wlan_init()
1776 if (!wilc->vmm_table) { in wilc_wlan_init()
1781 if (!wilc->tx_buffer) in wilc_wlan_init()
1782 wilc->tx_buffer = kmalloc(WILC_TX_BUFF_SIZE, GFP_KERNEL); in wilc_wlan_init()
1784 if (!wilc->tx_buffer) { in wilc_wlan_init()
1789 if (!wilc->rx_buffer) in wilc_wlan_init()
1790 wilc->rx_buffer = kmalloc(WILC_RX_BUFF_SIZE, GFP_KERNEL); in wilc_wlan_init()
1792 if (!wilc->rx_buffer) { in wilc_wlan_init()
1805 kfree(wilc->vmm_table); in wilc_wlan_init()
1806 wilc->vmm_table = NULL; in wilc_wlan_init()
1807 kfree(wilc->rx_buffer); in wilc_wlan_init()
1808 wilc->rx_buffer = NULL; in wilc_wlan_init()
1809 kfree(wilc->tx_buffer); in wilc_wlan_init()
1810 wilc->tx_buffer = NULL; in wilc_wlan_init()