int wl1271_plt_stop(struct wl1271 *wl) { int ret = 0; mutex_lock(&wl->mutex); wl1271_notice("power down"); if (wl->state != WL1271_STATE_PLT) { wl1271_error("cannot power down because not in PLT " "state: %d", wl->state); ret = -EBUSY; goto out; } wl1271_disable_interrupts(wl); wl1271_power_off(wl); wl->state = WL1271_STATE_OFF; out: mutex_unlock(&wl->mutex); return ret; }
static void wl1271_op_stop(struct ieee80211_hw *hw) { struct wl1271 *wl = hw->priv; int i; wl1271_info("down"); wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); mutex_lock(&wl->mutex); WARN_ON(wl->state != WL1271_STATE_ON); if (wl->scanning) { mutex_unlock(&wl->mutex); ieee80211_scan_completed(wl->hw, true); mutex_lock(&wl->mutex); wl->scanning = false; } wl->state = WL1271_STATE_OFF; wl1271_disable_interrupts(wl); mutex_unlock(&wl->mutex); cancel_work_sync(&wl->irq_work); cancel_work_sync(&wl->tx_work); cancel_work_sync(&wl->filter_work); mutex_lock(&wl->mutex); wl1271_tx_flush(wl); wl1271_power_off(wl); memset(wl->bssid, 0, ETH_ALEN); memset(wl->ssid, 0, IW_ESSID_MAX_SIZE + 1); wl->ssid_len = 0; wl->listen_int = 1; wl->bss_type = MAX_BSS_TYPE; wl->rx_counter = 0; wl->elp = false; wl->psm = 0; wl->tx_queue_stopped = false; wl->power_level = WL1271_DEFAULT_POWER_LEVEL; wl->tx_blocks_available = 0; wl->tx_results_count = 0; wl->tx_packets_count = 0; wl->time_offset = 0; wl->session_counter = 0; for (i = 0; i < NUM_TX_QUEUES; i++) wl->tx_blocks_freed[i] = 0; wl1271_debugfs_reset(wl); mutex_unlock(&wl->mutex); }
static int wl1271_boot_enable_interrupts(struct wl1271 *wl) { int ret; wl1271_enable_interrupts(wl); ret = wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_INTR_ALL & ~(WL1271_INTR_MASK)); if (ret < 0) goto disable_interrupts; ret = wl1271_write32(wl, HI_CFG, HI_CFG_DEF_VAL); if (ret < 0) goto disable_interrupts; return ret; disable_interrupts: wl1271_disable_interrupts(wl); return ret; }
int wl1271_boot(struct wl1271 *wl) { int ret; /* polarity must be set before the firmware is loaded */ ret = wl1271_boot_write_irq_polarity(wl); if (ret < 0) goto out; /* upload NVS and firmware */ ret = wl1271_load_firmware(wl); if (ret) return ret; /* 10.5 start firmware */ ret = wl1271_boot_run_firmware(wl); if (ret < 0) goto out; ret = wl1271_write32(wl, ACX_REG_INTERRUPT_MASK, WL1271_ACX_ALL_EVENTS_VECTOR); if (ret < 0) goto out; /* Enable firmware interrupts now */ ret = wl1271_boot_enable_interrupts(wl); if (ret < 0) goto out; ret = wl1271_event_mbox_config(wl); if (ret < 0) goto disable_interrupts; return ret; disable_interrupts: wl1271_disable_interrupts(wl); out: return ret; }