Lines Matching refs:wl

46 void wl1251_enable_interrupts(struct wl1251 *wl)  in wl1251_enable_interrupts()  argument
48 wl->if_ops->enable_irq(wl); in wl1251_enable_interrupts()
51 void wl1251_disable_interrupts(struct wl1251 *wl) in wl1251_disable_interrupts() argument
53 wl->if_ops->disable_irq(wl); in wl1251_disable_interrupts()
56 static int wl1251_power_off(struct wl1251 *wl) in wl1251_power_off() argument
58 return wl->if_ops->power(wl, false); in wl1251_power_off()
61 static int wl1251_power_on(struct wl1251 *wl) in wl1251_power_on() argument
63 return wl->if_ops->power(wl, true); in wl1251_power_on()
66 static int wl1251_fetch_firmware(struct wl1251 *wl) in wl1251_fetch_firmware() argument
69 struct device *dev = wiphy_dev(wl->hw->wiphy); in wl1251_fetch_firmware()
86 wl->fw_len = fw->size; in wl1251_fetch_firmware()
87 wl->fw = vmalloc(wl->fw_len); in wl1251_fetch_firmware()
89 if (!wl->fw) { in wl1251_fetch_firmware()
95 memcpy(wl->fw, fw->data, wl->fw_len); in wl1251_fetch_firmware()
105 static int wl1251_fetch_nvs(struct wl1251 *wl) in wl1251_fetch_nvs() argument
108 struct device *dev = wiphy_dev(wl->hw->wiphy); in wl1251_fetch_nvs()
125 wl->nvs_len = fw->size; in wl1251_fetch_nvs()
126 wl->nvs = kmemdup(fw->data, wl->nvs_len, GFP_KERNEL); in wl1251_fetch_nvs()
128 if (!wl->nvs) { in wl1251_fetch_nvs()
142 static void wl1251_fw_wakeup(struct wl1251 *wl) in wl1251_fw_wakeup() argument
147 wl1251_write_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR, elp_reg); in wl1251_fw_wakeup()
148 elp_reg = wl1251_read_elp(wl, HW_ACCESS_ELP_CTRL_REG_ADDR); in wl1251_fw_wakeup()
154 static int wl1251_chip_wakeup(struct wl1251 *wl) in wl1251_chip_wakeup() argument
158 ret = wl1251_power_on(wl); in wl1251_chip_wakeup()
163 wl->if_ops->reset(wl); in wl1251_chip_wakeup()
167 wl1251_set_partition(wl, in wl1251_chip_wakeup()
174 wl1251_fw_wakeup(wl); in wl1251_chip_wakeup()
179 wl->chip_id = wl1251_reg_read32(wl, CHIP_ID_B); in wl1251_chip_wakeup()
183 switch (wl->chip_id) { in wl1251_chip_wakeup()
186 wl->chip_id); in wl1251_chip_wakeup()
190 wl->chip_id); in wl1251_chip_wakeup()
194 wl1251_error("unsupported chip id: 0x%x", wl->chip_id); in wl1251_chip_wakeup()
199 if (wl->fw == NULL) { in wl1251_chip_wakeup()
200 ret = wl1251_fetch_firmware(wl); in wl1251_chip_wakeup()
205 if (wl->nvs == NULL && !wl->use_eeprom) { in wl1251_chip_wakeup()
207 ret = wl1251_fetch_nvs(wl); in wl1251_chip_wakeup()
220 struct wl1251 *wl = in wl1251_irq_work() local
224 mutex_lock(&wl->mutex); in wl1251_irq_work()
228 if (wl->state == WL1251_STATE_OFF) in wl1251_irq_work()
231 ret = wl1251_ps_elp_wakeup(wl); in wl1251_irq_work()
235 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, WL1251_ACX_INTR_ALL); in wl1251_irq_work()
237 intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_CLEAR); in wl1251_irq_work()
241 if (wl->data_path) { in wl1251_irq_work()
242 wl->rx_counter = wl1251_mem_read32( in wl1251_irq_work()
243 wl, wl->data_path->rx_control_addr); in wl1251_irq_work()
246 switch ((wl->rx_counter - wl->rx_handled) & 0xf) { in wl1251_irq_work()
266 wl->rx_counter - wl->rx_handled); in wl1251_irq_work()
270 wl->rx_handled = wl->rx_counter; in wl1251_irq_work()
273 wl->rx_counter); in wl1251_irq_work()
276 intr &= wl->intr_mask; in wl1251_irq_work()
285 wl1251_rx(wl); in wl1251_irq_work()
290 wl1251_rx(wl); in wl1251_irq_work()
295 wl1251_tx_complete(wl); in wl1251_irq_work()
300 wl1251_event_handle(wl, 0); in wl1251_irq_work()
305 wl1251_event_handle(wl, 1); in wl1251_irq_work()
315 intr = wl1251_reg_read32(wl, ACX_REG_INTERRUPT_CLEAR); in wl1251_irq_work()
319 wl1251_reg_write32(wl, ACX_REG_INTERRUPT_MASK, ~(wl->intr_mask)); in wl1251_irq_work()
320 wl1251_ps_elp_sleep(wl); in wl1251_irq_work()
323 mutex_unlock(&wl->mutex); in wl1251_irq_work()
326 static int wl1251_join(struct wl1251 *wl, u8 bss_type, u8 channel, in wl1251_join() argument
331 ret = wl1251_acx_frame_rates(wl, DEFAULT_HW_GEN_TX_RATE, in wl1251_join()
333 wl->tx_mgmt_frm_rate, in wl1251_join()
334 wl->tx_mgmt_frm_mod); in wl1251_join()
342 if (is_zero_ether_addr(wl->bssid)) in wl1251_join()
343 wl->rx_config &= ~CFG_BSSID_FILTER_EN; in wl1251_join()
345 ret = wl1251_cmd_join(wl, bss_type, channel, beacon_interval, in wl1251_join()
350 ret = wl1251_event_wait(wl, JOIN_EVENT_COMPLETE_ID, 100); in wl1251_join()
362 struct wl1251 *wl = hw->priv; in wl1251_op_tx() local
365 skb_queue_tail(&wl->tx_queue, skb); in wl1251_op_tx()
372 ieee80211_queue_work(wl->hw, &wl->tx_work); in wl1251_op_tx()
378 if (skb_queue_len(&wl->tx_queue) >= WL1251_TX_QUEUE_HIGH_WATERMARK) { in wl1251_op_tx()
381 spin_lock_irqsave(&wl->wl_lock, flags); in wl1251_op_tx()
382 ieee80211_stop_queues(wl->hw); in wl1251_op_tx()
383 wl->tx_queue_stopped = true; in wl1251_op_tx()
384 spin_unlock_irqrestore(&wl->wl_lock, flags); in wl1251_op_tx()
390 struct wl1251 *wl = hw->priv; in wl1251_op_start() local
396 mutex_lock(&wl->mutex); in wl1251_op_start()
398 if (wl->state != WL1251_STATE_OFF) { in wl1251_op_start()
400 wl->state); in wl1251_op_start()
405 ret = wl1251_chip_wakeup(wl); in wl1251_op_start()
409 ret = wl1251_boot(wl); in wl1251_op_start()
413 ret = wl1251_hw_init(wl); in wl1251_op_start()
417 ret = wl1251_acx_station_id(wl); in wl1251_op_start()
421 wl->state = WL1251_STATE_ON; in wl1251_op_start()
423 wl1251_info("firmware booted (%s)", wl->fw_ver); in wl1251_op_start()
426 wiphy->hw_version = wl->chip_id; in wl1251_op_start()
427 strncpy(wiphy->fw_version, wl->fw_ver, sizeof(wiphy->fw_version)); in wl1251_op_start()
431 wl1251_power_off(wl); in wl1251_op_start()
433 mutex_unlock(&wl->mutex); in wl1251_op_start()
440 struct wl1251 *wl = hw->priv; in wl1251_op_stop() local
446 mutex_lock(&wl->mutex); in wl1251_op_stop()
448 WARN_ON(wl->state != WL1251_STATE_ON); in wl1251_op_stop()
450 if (wl->scanning) { in wl1251_op_stop()
451 ieee80211_scan_completed(wl->hw, true); in wl1251_op_stop()
452 wl->scanning = false; in wl1251_op_stop()
455 wl->state = WL1251_STATE_OFF; in wl1251_op_stop()
457 wl1251_disable_interrupts(wl); in wl1251_op_stop()
459 mutex_unlock(&wl->mutex); in wl1251_op_stop()
461 cancel_work_sync(&wl->irq_work); in wl1251_op_stop()
462 cancel_work_sync(&wl->tx_work); in wl1251_op_stop()
463 cancel_delayed_work_sync(&wl->elp_work); in wl1251_op_stop()
465 mutex_lock(&wl->mutex); in wl1251_op_stop()
468 wl1251_tx_flush(wl); in wl1251_op_stop()
469 wl1251_power_off(wl); in wl1251_op_stop()
471 eth_zero_addr(wl->bssid); in wl1251_op_stop()
472 wl->listen_int = 1; in wl1251_op_stop()
473 wl->bss_type = MAX_BSS_TYPE; in wl1251_op_stop()
475 wl->data_in_count = 0; in wl1251_op_stop()
476 wl->rx_counter = 0; in wl1251_op_stop()
477 wl->rx_handled = 0; in wl1251_op_stop()
478 wl->rx_current_buffer = 0; in wl1251_op_stop()
479 wl->rx_last_id = 0; in wl1251_op_stop()
480 wl->next_tx_complete = 0; in wl1251_op_stop()
481 wl->elp = false; in wl1251_op_stop()
482 wl->station_mode = STATION_ACTIVE_MODE; in wl1251_op_stop()
483 wl->psm_entry_retry = 0; in wl1251_op_stop()
484 wl->tx_queue_stopped = false; in wl1251_op_stop()
485 wl->power_level = WL1251_DEFAULT_POWER_LEVEL; in wl1251_op_stop()
486 wl->rssi_thold = 0; in wl1251_op_stop()
487 wl->channel = WL1251_DEFAULT_CHANNEL; in wl1251_op_stop()
488 wl->monitor_present = false; in wl1251_op_stop()
489 wl->joined = false; in wl1251_op_stop()
491 wl1251_debugfs_reset(wl); in wl1251_op_stop()
493 mutex_unlock(&wl->mutex); in wl1251_op_stop()
499 struct wl1251 *wl = hw->priv; in wl1251_op_add_interface() local
509 mutex_lock(&wl->mutex); in wl1251_op_add_interface()
510 if (wl->vif) { in wl1251_op_add_interface()
515 wl->vif = vif; in wl1251_op_add_interface()
519 wl->bss_type = BSS_TYPE_STA_BSS; in wl1251_op_add_interface()
522 wl->bss_type = BSS_TYPE_IBSS; in wl1251_op_add_interface()
529 if (!ether_addr_equal_unaligned(wl->mac_addr, vif->addr)) { in wl1251_op_add_interface()
530 memcpy(wl->mac_addr, vif->addr, ETH_ALEN); in wl1251_op_add_interface()
531 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); in wl1251_op_add_interface()
532 ret = wl1251_acx_station_id(wl); in wl1251_op_add_interface()
538 mutex_unlock(&wl->mutex); in wl1251_op_add_interface()
545 struct wl1251 *wl = hw->priv; in wl1251_op_remove_interface() local
547 mutex_lock(&wl->mutex); in wl1251_op_remove_interface()
549 wl->vif = NULL; in wl1251_op_remove_interface()
550 eth_zero_addr(wl->bssid); in wl1251_op_remove_interface()
551 mutex_unlock(&wl->mutex); in wl1251_op_remove_interface()
554 static int wl1251_build_null_data(struct wl1251 *wl) in wl1251_build_null_data() argument
561 if (wl->bss_type == BSS_TYPE_IBSS) { in wl1251_build_null_data()
565 skb = ieee80211_nullfunc_get(wl->hw, wl->vif); in wl1251_build_null_data()
572 ret = wl1251_cmd_template_set(wl, CMD_NULL_DATA, ptr, size); in wl1251_build_null_data()
582 static int wl1251_build_qos_null_data(struct wl1251 *wl) in wl1251_build_qos_null_data() argument
588 memcpy(template.addr1, wl->bssid, ETH_ALEN); in wl1251_build_qos_null_data()
589 memcpy(template.addr2, wl->mac_addr, ETH_ALEN); in wl1251_build_qos_null_data()
590 memcpy(template.addr3, wl->bssid, ETH_ALEN); in wl1251_build_qos_null_data()
599 return wl1251_cmd_template_set(wl, CMD_QOS_NULL_DATA, &template, in wl1251_build_qos_null_data()
603 static bool wl1251_can_do_pm(struct ieee80211_conf *conf, struct wl1251 *wl) in wl1251_can_do_pm() argument
605 return (conf->flags & IEEE80211_CONF_PS) && !wl->monitor_present; in wl1251_can_do_pm()
610 struct wl1251 *wl = hw->priv; in wl1251_op_config() local
624 mutex_lock(&wl->mutex); in wl1251_op_config()
626 ret = wl1251_ps_elp_wakeup(wl); in wl1251_op_config()
634 wl->monitor_present = true; in wl1251_op_config()
637 wl->monitor_present = false; in wl1251_op_config()
641 ret = wl1251_acx_feature_cfg(wl, mode); in wl1251_op_config()
646 if (channel != wl->channel) { in wl1251_op_config()
647 wl->channel = channel; in wl1251_op_config()
656 if (wl->vif == NULL) { in wl1251_op_config()
657 wl->joined = false; in wl1251_op_config()
658 ret = wl1251_cmd_data_path_rx(wl, wl->channel, 1); in wl1251_op_config()
660 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_config()
661 wl->beacon_int, wl->dtim_period); in wl1251_op_config()
667 if (wl1251_can_do_pm(conf, wl) && !wl->psm_requested) { in wl1251_op_config()
670 wl->psm_requested = true; in wl1251_op_config()
672 wl->dtim_period = conf->ps_dtim_period; in wl1251_op_config()
674 ret = wl1251_acx_wr_tbtt_and_dtim(wl, wl->beacon_int, in wl1251_op_config()
675 wl->dtim_period); in wl1251_op_config()
680 ret = wl1251_ps_set_mode(wl, STATION_POWER_SAVE_MODE); in wl1251_op_config()
683 } else if (!wl1251_can_do_pm(conf, wl) && wl->psm_requested) { in wl1251_op_config()
686 wl->psm_requested = false; in wl1251_op_config()
688 if (wl->station_mode != STATION_ACTIVE_MODE) { in wl1251_op_config()
689 ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); in wl1251_op_config()
695 if (changed & IEEE80211_CONF_CHANGE_IDLE && !wl->scanning) { in wl1251_op_config()
697 ret = wl1251_ps_set_mode(wl, STATION_IDLE); in wl1251_op_config()
701 ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); in wl1251_op_config()
704 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_config()
705 wl->beacon_int, wl->dtim_period); in wl1251_op_config()
711 if (conf->power_level != wl->power_level) { in wl1251_op_config()
712 ret = wl1251_acx_tx_power(wl, conf->power_level); in wl1251_op_config()
716 wl->power_level = conf->power_level; in wl1251_op_config()
720 wl1251_ps_elp_sleep(wl); in wl1251_op_config()
723 mutex_unlock(&wl->mutex); in wl1251_op_config()
739 struct wl1251 *wl = hw->priv; in wl1251_op_prepare_multicast() local
741 if (unlikely(wl->state == WL1251_STATE_OFF)) in wl1251_op_prepare_multicast()
779 struct wl1251 *wl = hw->priv; in wl1251_op_configure_filter() local
793 mutex_lock(&wl->mutex); in wl1251_op_configure_filter()
795 wl->rx_config = WL1251_DEFAULT_RX_CONFIG; in wl1251_op_configure_filter()
796 wl->rx_filter = WL1251_DEFAULT_RX_FILTER; in wl1251_op_configure_filter()
799 wl->rx_config |= CFG_BSSID_FILTER_EN; in wl1251_op_configure_filter()
800 wl->rx_config |= CFG_RX_ALL_GOOD; in wl1251_op_configure_filter()
807 wl->rx_config &= ~CFG_MC_FILTER_EN; in wl1251_op_configure_filter()
809 wl->rx_filter |= CFG_RX_FCS_ERROR; in wl1251_op_configure_filter()
811 wl->rx_config &= ~CFG_BSSID_FILTER_EN; in wl1251_op_configure_filter()
812 wl->rx_config &= ~CFG_SSID_FILTER_EN; in wl1251_op_configure_filter()
815 wl->rx_filter |= CFG_RX_CTL_EN; in wl1251_op_configure_filter()
816 if (*total & FIF_OTHER_BSS || is_zero_ether_addr(wl->bssid)) in wl1251_op_configure_filter()
817 wl->rx_config &= ~CFG_BSSID_FILTER_EN; in wl1251_op_configure_filter()
819 wl->rx_filter |= CFG_RX_PREQ_EN; in wl1251_op_configure_filter()
821 if (wl->state == WL1251_STATE_OFF) in wl1251_op_configure_filter()
824 ret = wl1251_ps_elp_wakeup(wl); in wl1251_op_configure_filter()
829 ret = wl1251_acx_group_address_tbl(wl, false, NULL, 0); in wl1251_op_configure_filter()
831 ret = wl1251_acx_group_address_tbl(wl, fp->enabled, in wl1251_op_configure_filter()
838 wl1251_acx_rx_config(wl, wl->rx_config, wl->rx_filter); in wl1251_op_configure_filter()
840 wl1251_ps_elp_sleep(wl); in wl1251_op_configure_filter()
843 mutex_unlock(&wl->mutex); in wl1251_op_configure_filter()
848 static int wl1251_set_key_type(struct wl1251 *wl, in wl1251_set_key_type() argument
892 struct wl1251 *wl = hw->priv; in wl1251_op_set_key() local
922 mutex_lock(&wl->mutex); in wl1251_op_set_key()
926 if (wl->monitor_present) { in wl1251_op_set_key()
940 ret = wl1251_ps_elp_wakeup(wl); in wl1251_op_set_key()
944 ret = wl1251_set_key_type(wl, wl_cmd, cmd, key, addr); in wl1251_op_set_key()
975 ret = wl1251_cmd_send(wl, CMD_SET_KEYS, wl_cmd, sizeof(*wl_cmd)); in wl1251_op_set_key()
982 wl1251_ps_elp_sleep(wl); in wl1251_op_set_key()
985 mutex_unlock(&wl->mutex); in wl1251_op_set_key()
998 struct wl1251 *wl = hw->priv; in wl1251_op_hw_scan() local
1011 mutex_lock(&wl->mutex); in wl1251_op_hw_scan()
1013 if (wl->scanning) { in wl1251_op_hw_scan()
1019 ret = wl1251_ps_elp_wakeup(wl); in wl1251_op_hw_scan()
1024 ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE); in wl1251_op_hw_scan()
1027 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_hw_scan()
1028 wl->beacon_int, wl->dtim_period); in wl1251_op_hw_scan()
1033 skb = ieee80211_probereq_get(wl->hw, wl->vif->addr, ssid, ssid_len, in wl1251_op_hw_scan()
1042 ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data, in wl1251_op_hw_scan()
1048 ret = wl1251_cmd_trigger_scan_to(wl, 0); in wl1251_op_hw_scan()
1052 wl->scanning = true; in wl1251_op_hw_scan()
1054 ret = wl1251_cmd_scan(wl, ssid, ssid_len, req->channels, in wl1251_op_hw_scan()
1058 wl->scanning = false; in wl1251_op_hw_scan()
1065 ret = wl1251_ps_set_mode(wl, STATION_IDLE); in wl1251_op_hw_scan()
1067 wl1251_ps_elp_sleep(wl); in wl1251_op_hw_scan()
1070 mutex_unlock(&wl->mutex); in wl1251_op_hw_scan()
1077 struct wl1251 *wl = hw->priv; in wl1251_op_set_rts_threshold() local
1080 mutex_lock(&wl->mutex); in wl1251_op_set_rts_threshold()
1082 ret = wl1251_ps_elp_wakeup(wl); in wl1251_op_set_rts_threshold()
1086 ret = wl1251_acx_rts_threshold(wl, (u16) value); in wl1251_op_set_rts_threshold()
1090 wl1251_ps_elp_sleep(wl); in wl1251_op_set_rts_threshold()
1093 mutex_unlock(&wl->mutex); in wl1251_op_set_rts_threshold()
1103 struct wl1251 *wl = hw->priv; in wl1251_op_bss_info_changed() local
1110 mutex_lock(&wl->mutex); in wl1251_op_bss_info_changed()
1112 ret = wl1251_ps_elp_wakeup(wl); in wl1251_op_bss_info_changed()
1117 ret = wl1251_acx_low_rssi(wl, bss_conf->cqm_rssi_thold, in wl1251_op_bss_info_changed()
1123 wl->rssi_thold = bss_conf->cqm_rssi_thold; in wl1251_op_bss_info_changed()
1127 memcmp(wl->bssid, bss_conf->bssid, ETH_ALEN)) { in wl1251_op_bss_info_changed()
1128 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); in wl1251_op_bss_info_changed()
1130 if (!is_zero_ether_addr(wl->bssid)) { in wl1251_op_bss_info_changed()
1131 ret = wl1251_build_null_data(wl); in wl1251_op_bss_info_changed()
1135 ret = wl1251_build_qos_null_data(wl); in wl1251_op_bss_info_changed()
1139 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_bss_info_changed()
1140 wl->beacon_int, wl->dtim_period); in wl1251_op_bss_info_changed()
1148 wl->beacon_int = bss_conf->beacon_int; in wl1251_op_bss_info_changed()
1150 skb = ieee80211_pspoll_get(wl->hw, wl->vif); in wl1251_op_bss_info_changed()
1154 ret = wl1251_cmd_template_set(wl, CMD_PS_POLL, in wl1251_op_bss_info_changed()
1161 ret = wl1251_acx_aid(wl, bss_conf->aid); in wl1251_op_bss_info_changed()
1166 wl->beacon_int = WL1251_DEFAULT_BEACON_INT; in wl1251_op_bss_info_changed()
1167 wl->dtim_period = WL1251_DEFAULT_DTIM_PERIOD; in wl1251_op_bss_info_changed()
1172 ret = wl1251_acx_slot(wl, SLOT_TIME_SHORT); in wl1251_op_bss_info_changed()
1174 ret = wl1251_acx_slot(wl, SLOT_TIME_LONG); in wl1251_op_bss_info_changed()
1183 wl1251_acx_set_preamble(wl, ACX_PREAMBLE_SHORT); in wl1251_op_bss_info_changed()
1185 wl1251_acx_set_preamble(wl, ACX_PREAMBLE_LONG); in wl1251_op_bss_info_changed()
1190 ret = wl1251_acx_cts_protect(wl, CTSPROTECT_ENABLE); in wl1251_op_bss_info_changed()
1192 ret = wl1251_acx_cts_protect(wl, CTSPROTECT_DISABLE); in wl1251_op_bss_info_changed()
1201 WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS); in wl1251_op_bss_info_changed()
1204 wl1251_acx_arp_ip_filter(wl, enable, addr); in wl1251_op_bss_info_changed()
1215 ret = wl1251_cmd_template_set(wl, CMD_BEACON, beacon->data, in wl1251_op_bss_info_changed()
1223 ret = wl1251_cmd_template_set(wl, CMD_PROBE_RESP, beacon->data, in wl1251_op_bss_info_changed()
1231 ret = wl1251_join(wl, wl->bss_type, wl->channel, in wl1251_op_bss_info_changed()
1232 wl->beacon_int, wl->dtim_period); in wl1251_op_bss_info_changed()
1239 wl1251_ps_elp_sleep(wl); in wl1251_op_bss_info_changed()
1242 mutex_unlock(&wl->mutex); in wl1251_op_bss_info_changed()
1311 struct wl1251 *wl = hw->priv; in wl1251_op_conf_tx() local
1314 mutex_lock(&wl->mutex); in wl1251_op_conf_tx()
1318 ret = wl1251_ps_elp_wakeup(wl); in wl1251_op_conf_tx()
1323 ret = wl1251_acx_ac_cfg(wl, wl1251_tx_get_queue(queue), in wl1251_op_conf_tx()
1334 ret = wl1251_acx_tid_cfg(wl, wl1251_tx_get_queue(queue), in wl1251_op_conf_tx()
1342 wl1251_ps_elp_sleep(wl); in wl1251_op_conf_tx()
1345 mutex_unlock(&wl->mutex); in wl1251_op_conf_tx()
1353 struct wl1251 *wl = hw->priv; in wl1251_op_get_survey() local
1361 survey->noise = wl->noise; in wl1251_op_get_survey()
1391 static int wl1251_read_eeprom_byte(struct wl1251 *wl, off_t offset, u8 *data) in wl1251_read_eeprom_byte() argument
1395 wl1251_reg_write32(wl, EE_ADDR, offset); in wl1251_read_eeprom_byte()
1396 wl1251_reg_write32(wl, EE_CTL, EE_CTL_READ); in wl1251_read_eeprom_byte()
1401 if (!(wl1251_reg_read32(wl, EE_CTL) & EE_CTL_READ)) in wl1251_read_eeprom_byte()
1410 *data = wl1251_reg_read32(wl, EE_DATA); in wl1251_read_eeprom_byte()
1414 static int wl1251_read_eeprom(struct wl1251 *wl, off_t offset, in wl1251_read_eeprom() argument
1420 wl1251_reg_write32(wl, EE_START, 0); in wl1251_read_eeprom()
1423 ret = wl1251_read_eeprom_byte(wl, offset + i, &data[i]); in wl1251_read_eeprom()
1431 static int wl1251_read_eeprom_mac(struct wl1251 *wl) in wl1251_read_eeprom_mac() argument
1436 wl1251_set_partition(wl, 0, 0, REGISTERS_BASE, REGISTERS_DOWN_SIZE); in wl1251_read_eeprom_mac()
1438 ret = wl1251_read_eeprom(wl, 0x1c, mac, sizeof(mac)); in wl1251_read_eeprom_mac()
1446 wl->mac_addr[i] = mac[ETH_ALEN - i - 1]; in wl1251_read_eeprom_mac()
1451 static int wl1251_register_hw(struct wl1251 *wl) in wl1251_register_hw() argument
1455 if (wl->mac80211_registered) in wl1251_register_hw()
1458 SET_IEEE80211_PERM_ADDR(wl->hw, wl->mac_addr); in wl1251_register_hw()
1460 ret = ieee80211_register_hw(wl->hw); in wl1251_register_hw()
1466 wl->mac80211_registered = true; in wl1251_register_hw()
1473 int wl1251_init_ieee80211(struct wl1251 *wl) in wl1251_init_ieee80211() argument
1478 wl->hw->extra_tx_headroom = sizeof(struct tx_double_buffer_desc) in wl1251_init_ieee80211()
1484 wl->hw->flags = IEEE80211_HW_SIGNAL_DBM | IEEE80211_HW_SUPPORTS_PS; in wl1251_init_ieee80211()
1486 wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in wl1251_init_ieee80211()
1488 wl->hw->wiphy->max_scan_ssids = 1; in wl1251_init_ieee80211()
1489 wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &wl1251_band_2ghz; in wl1251_init_ieee80211()
1491 wl->hw->queues = 4; in wl1251_init_ieee80211()
1493 if (wl->use_eeprom) in wl1251_init_ieee80211()
1494 wl1251_read_eeprom_mac(wl); in wl1251_init_ieee80211()
1496 ret = wl1251_register_hw(wl); in wl1251_init_ieee80211()
1500 wl1251_debugfs_init(wl); in wl1251_init_ieee80211()
1513 struct wl1251 *wl; in wl1251_alloc_hw() local
1517 hw = ieee80211_alloc_hw(sizeof(*wl), &wl1251_ops); in wl1251_alloc_hw()
1523 wl = hw->priv; in wl1251_alloc_hw()
1524 memset(wl, 0, sizeof(*wl)); in wl1251_alloc_hw()
1526 wl->hw = hw; in wl1251_alloc_hw()
1528 wl->data_in_count = 0; in wl1251_alloc_hw()
1530 skb_queue_head_init(&wl->tx_queue); in wl1251_alloc_hw()
1532 INIT_DELAYED_WORK(&wl->elp_work, wl1251_elp_work); in wl1251_alloc_hw()
1533 wl->channel = WL1251_DEFAULT_CHANNEL; in wl1251_alloc_hw()
1534 wl->monitor_present = false; in wl1251_alloc_hw()
1535 wl->joined = false; in wl1251_alloc_hw()
1536 wl->scanning = false; in wl1251_alloc_hw()
1537 wl->bss_type = MAX_BSS_TYPE; in wl1251_alloc_hw()
1538 wl->default_key = 0; in wl1251_alloc_hw()
1539 wl->listen_int = 1; in wl1251_alloc_hw()
1540 wl->rx_counter = 0; in wl1251_alloc_hw()
1541 wl->rx_handled = 0; in wl1251_alloc_hw()
1542 wl->rx_current_buffer = 0; in wl1251_alloc_hw()
1543 wl->rx_last_id = 0; in wl1251_alloc_hw()
1544 wl->rx_config = WL1251_DEFAULT_RX_CONFIG; in wl1251_alloc_hw()
1545 wl->rx_filter = WL1251_DEFAULT_RX_FILTER; in wl1251_alloc_hw()
1546 wl->elp = false; in wl1251_alloc_hw()
1547 wl->station_mode = STATION_ACTIVE_MODE; in wl1251_alloc_hw()
1548 wl->psm_requested = false; in wl1251_alloc_hw()
1549 wl->psm_entry_retry = 0; in wl1251_alloc_hw()
1550 wl->tx_queue_stopped = false; in wl1251_alloc_hw()
1551 wl->power_level = WL1251_DEFAULT_POWER_LEVEL; in wl1251_alloc_hw()
1552 wl->rssi_thold = 0; in wl1251_alloc_hw()
1553 wl->beacon_int = WL1251_DEFAULT_BEACON_INT; in wl1251_alloc_hw()
1554 wl->dtim_period = WL1251_DEFAULT_DTIM_PERIOD; in wl1251_alloc_hw()
1555 wl->vif = NULL; in wl1251_alloc_hw()
1558 wl->tx_frames[i] = NULL; in wl1251_alloc_hw()
1560 wl->next_tx_complete = 0; in wl1251_alloc_hw()
1562 INIT_WORK(&wl->irq_work, wl1251_irq_work); in wl1251_alloc_hw()
1563 INIT_WORK(&wl->tx_work, wl1251_tx_work); in wl1251_alloc_hw()
1569 memcpy(wl->mac_addr, nokia_oui, 3); in wl1251_alloc_hw()
1570 get_random_bytes(wl->mac_addr + 3, 3); in wl1251_alloc_hw()
1572 wl->state = WL1251_STATE_OFF; in wl1251_alloc_hw()
1573 mutex_init(&wl->mutex); in wl1251_alloc_hw()
1575 wl->tx_mgmt_frm_rate = DEFAULT_HW_GEN_TX_RATE; in wl1251_alloc_hw()
1576 wl->tx_mgmt_frm_mod = DEFAULT_HW_GEN_MODULATION_TYPE; in wl1251_alloc_hw()
1578 wl->rx_descriptor = kmalloc(sizeof(*wl->rx_descriptor), GFP_KERNEL); in wl1251_alloc_hw()
1579 if (!wl->rx_descriptor) { in wl1251_alloc_hw()
1589 int wl1251_free_hw(struct wl1251 *wl) in wl1251_free_hw() argument
1591 ieee80211_unregister_hw(wl->hw); in wl1251_free_hw()
1593 wl1251_debugfs_exit(wl); in wl1251_free_hw()
1595 kfree(wl->target_mem_map); in wl1251_free_hw()
1596 kfree(wl->data_path); in wl1251_free_hw()
1597 vfree(wl->fw); in wl1251_free_hw()
1598 wl->fw = NULL; in wl1251_free_hw()
1599 kfree(wl->nvs); in wl1251_free_hw()
1600 wl->nvs = NULL; in wl1251_free_hw()
1602 kfree(wl->rx_descriptor); in wl1251_free_hw()
1603 wl->rx_descriptor = NULL; in wl1251_free_hw()
1605 ieee80211_free_hw(wl->hw); in wl1251_free_hw()