Lines Matching +full:rx +full:- +full:common +full:- +full:refclk +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
3 * mac80211 glue code for mac80211 ST-Ericsson CW1200 drivers
5 * Copyright (c) 2010, ST-Ericsson
10 * Copyright (c) 2007-2009, Christian Lamparter <chunkeey@web.de>
14 * - the islsm (softmac prism54) driver, which is:
15 * Copyright 2004-2006 Jean-Baptiste Note <jbnote@gmail.com>, et al.
16 * - stlc45xx driver
17 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
40 MODULE_DESCRIPTION("Softmac ST-Ericsson CW1200 common code");
58 MODULE_PARM_DESC(cw1200_power_mode, "WSM power mode. 0 == active, 1 == doze, 2 == quiescent (defau…
94 #define cw1200_a_rates_size (ARRAY_SIZE(cw1200_rates) - 4)
242 static int cw1200_ba_rx_tids = -1;
243 static int cw1200_ba_tx_tids = -1;
246 MODULE_PARM_DESC(cw1200_ba_rx_tids, "Block ACK RX TIDs");
268 priv = hw->priv; in cw1200_init_common()
269 priv->hw = hw; in cw1200_init_common()
270 priv->hw_type = -1; in cw1200_init_common()
271 priv->mode = NL80211_IFTYPE_UNSPECIFIED; in cw1200_init_common()
272 priv->rates = cw1200_rates; /* TODO: fetch from FW */ in cw1200_init_common()
273 priv->mcs_rates = cw1200_n_rates; in cw1200_init_common()
274 if (cw1200_ba_rx_tids != -1) in cw1200_init_common()
275 priv->ba_rx_tid_mask = cw1200_ba_rx_tids; in cw1200_init_common()
277 priv->ba_rx_tid_mask = 0xFF; /* Enable RX BLKACK for all TIDs */ in cw1200_init_common()
278 if (cw1200_ba_tx_tids != -1) in cw1200_init_common()
279 priv->ba_tx_tid_mask = cw1200_ba_tx_tids; in cw1200_init_common()
281 priv->ba_tx_tid_mask = 0xff; /* Enable TX BLKACK for all TIDs */ in cw1200_init_common()
292 hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | in cw1200_init_common()
300 hw->wiphy->wowlan = &cw1200_wowlan_support; in cw1200_init_common()
303 hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; in cw1200_init_common()
305 hw->queues = 4; in cw1200_init_common()
307 priv->rts_threshold = -1; in cw1200_init_common()
309 hw->max_rates = 8; in cw1200_init_common()
310 hw->max_rate_tries = 15; in cw1200_init_common()
311 hw->extra_tx_headroom = WSM_TX_EXTRA_HEADROOM + in cw1200_init_common()
314 hw->sta_data_size = sizeof(struct cw1200_sta_priv); in cw1200_init_common()
316 hw->wiphy->bands[NL80211_BAND_2GHZ] = &cw1200_band_2ghz; in cw1200_init_common()
318 hw->wiphy->bands[NL80211_BAND_5GHZ] = &cw1200_band_5ghz; in cw1200_init_common()
322 struct ieee80211_supported_band *sband = hw->wiphy->bands[band]; in cw1200_init_common()
325 for (i = 0; i < sband->n_channels; i++) { in cw1200_init_common()
326 sband->channels[i].flags = 0; in cw1200_init_common()
327 sband->channels[i].max_antenna_gain = 0; in cw1200_init_common()
328 sband->channels[i].max_power = 30; in cw1200_init_common()
332 hw->wiphy->max_scan_ssids = 2; in cw1200_init_common()
333 hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; in cw1200_init_common()
341 if (hw->wiphy->perm_addr[3] == 0 && in cw1200_init_common()
342 hw->wiphy->perm_addr[4] == 0 && in cw1200_init_common()
343 hw->wiphy->perm_addr[5] == 0) { in cw1200_init_common()
344 get_random_bytes(&hw->wiphy->perm_addr[3], 3); in cw1200_init_common()
347 mutex_init(&priv->wsm_cmd_mux); in cw1200_init_common()
348 mutex_init(&priv->conf_mutex); in cw1200_init_common()
349 priv->workqueue = create_singlethread_workqueue("cw1200_wq"); in cw1200_init_common()
350 if (!priv->workqueue) { in cw1200_init_common()
355 sema_init(&priv->scan.lock, 1); in cw1200_init_common()
356 INIT_WORK(&priv->scan.work, cw1200_scan_work); in cw1200_init_common()
357 INIT_DELAYED_WORK(&priv->scan.probe_work, cw1200_probe_work); in cw1200_init_common()
358 INIT_DELAYED_WORK(&priv->scan.timeout, cw1200_scan_timeout); in cw1200_init_common()
359 INIT_DELAYED_WORK(&priv->clear_recent_scan_work, in cw1200_init_common()
361 INIT_DELAYED_WORK(&priv->join_timeout, cw1200_join_timeout); in cw1200_init_common()
362 INIT_WORK(&priv->unjoin_work, cw1200_unjoin_work); in cw1200_init_common()
363 INIT_WORK(&priv->join_complete_work, cw1200_join_complete_work); in cw1200_init_common()
364 INIT_WORK(&priv->wep_key_work, cw1200_wep_key_work); in cw1200_init_common()
365 INIT_WORK(&priv->tx_policy_upload_work, tx_policy_upload_work); in cw1200_init_common()
366 spin_lock_init(&priv->event_queue_lock); in cw1200_init_common()
367 INIT_LIST_HEAD(&priv->event_queue); in cw1200_init_common()
368 INIT_WORK(&priv->event_handler, cw1200_event_handler); in cw1200_init_common()
369 INIT_DELAYED_WORK(&priv->bss_loss_work, cw1200_bss_loss_work); in cw1200_init_common()
370 INIT_WORK(&priv->bss_params_work, cw1200_bss_params_work); in cw1200_init_common()
371 spin_lock_init(&priv->bss_loss_lock); in cw1200_init_common()
372 spin_lock_init(&priv->ps_state_lock); in cw1200_init_common()
373 INIT_WORK(&priv->set_cts_work, cw1200_set_cts_work); in cw1200_init_common()
374 INIT_WORK(&priv->set_tim_work, cw1200_set_tim_work); in cw1200_init_common()
375 INIT_WORK(&priv->multicast_start_work, cw1200_multicast_start_work); in cw1200_init_common()
376 INIT_WORK(&priv->multicast_stop_work, cw1200_multicast_stop_work); in cw1200_init_common()
377 INIT_WORK(&priv->link_id_work, cw1200_link_id_work); in cw1200_init_common()
378 INIT_DELAYED_WORK(&priv->link_id_gc_work, cw1200_link_id_gc_work); in cw1200_init_common()
379 INIT_WORK(&priv->linkid_reset_work, cw1200_link_id_reset); in cw1200_init_common()
380 INIT_WORK(&priv->update_filtering_work, cw1200_update_filtering_work); in cw1200_init_common()
381 INIT_WORK(&priv->set_beacon_wakeup_period_work, in cw1200_init_common()
383 timer_setup(&priv->mcast_timeout, cw1200_mcast_timeout, 0); in cw1200_init_common()
385 if (cw1200_queue_stats_init(&priv->tx_queue_stats, in cw1200_init_common()
389 destroy_workqueue(priv->workqueue); in cw1200_init_common()
395 if (cw1200_queue_init(&priv->tx_queue[i], in cw1200_init_common()
396 &priv->tx_queue_stats, i, 16, in cw1200_init_common()
398 for (; i > 0; i--) in cw1200_init_common()
399 cw1200_queue_deinit(&priv->tx_queue[i - 1]); in cw1200_init_common()
400 cw1200_queue_stats_deinit(&priv->tx_queue_stats); in cw1200_init_common()
401 destroy_workqueue(priv->workqueue); in cw1200_init_common()
407 init_waitqueue_head(&priv->channel_switch_done); in cw1200_init_common()
408 init_waitqueue_head(&priv->wsm_cmd_wq); in cw1200_init_common()
409 init_waitqueue_head(&priv->wsm_startup_done); in cw1200_init_common()
410 init_waitqueue_head(&priv->ps_mode_switch_done); in cw1200_init_common()
411 wsm_buf_init(&priv->wsm_cmd_buf); in cw1200_init_common()
412 spin_lock_init(&priv->wsm_cmd.lock); in cw1200_init_common()
413 priv->wsm_cmd.done = 1; in cw1200_init_common()
421 struct cw1200_common *priv = dev->priv; in cw1200_register_common()
425 err = cw1200_pm_init(&priv->pm_state, priv); in cw1200_register_common()
438 cw1200_pm_deinit(&priv->pm_state); in cw1200_register_common()
445 pr_info("Registered as '%s'\n", wiphy_name(dev->wiphy)); in cw1200_register_common()
456 struct cw1200_common *priv = dev->priv; in cw1200_unregister_common()
461 del_timer_sync(&priv->mcast_timeout); in cw1200_unregister_common()
466 mutex_destroy(&priv->conf_mutex); in cw1200_unregister_common()
468 wsm_buf_deinit(&priv->wsm_cmd_buf); in cw1200_unregister_common()
470 destroy_workqueue(priv->workqueue); in cw1200_unregister_common()
471 priv->workqueue = NULL; in cw1200_unregister_common()
473 if (priv->sdd) { in cw1200_unregister_common()
474 release_firmware(priv->sdd); in cw1200_unregister_common()
475 priv->sdd = NULL; in cw1200_unregister_common()
479 cw1200_queue_deinit(&priv->tx_queue[i]); in cw1200_unregister_common()
481 cw1200_queue_stats_deinit(&priv->tx_queue_stats); in cw1200_unregister_common()
483 cw1200_pm_deinit(&priv->pm_state); in cw1200_unregister_common()
514 pr_err("Unknown Refclk freq (0x%04x), using 26000KHz\n", in cw1200_dpll_from_clk()
527 int err = -EINVAL; in cw1200_core_probe()
530 struct wsm_operational_mode mode = { in cw1200_core_probe() local
539 priv = dev->priv; in cw1200_core_probe()
540 priv->hw_refclk = ref_clk; in cw1200_core_probe()
542 priv->hw_refclk = cw1200_refclk; in cw1200_core_probe()
544 priv->sdd_path = (char *)sdd_path; in cw1200_core_probe()
546 priv->sdd_path = cw1200_sdd_path; in cw1200_core_probe()
548 priv->hwbus_ops = hwbus_ops; in cw1200_core_probe()
549 priv->hwbus_priv = hwbus; in cw1200_core_probe()
550 priv->pdev = pdev; in cw1200_core_probe()
551 SET_IEEE80211_DEV(priv->hw, pdev); in cw1200_core_probe()
564 if (wait_event_interruptible_timeout(priv->wsm_startup_done, in cw1200_core_probe()
565 priv->firmware_ready, in cw1200_core_probe()
568 in QUEUE mode properly. in cw1200_core_probe()
571 err = -ETIMEDOUT; in cw1200_core_probe()
575 /* Set low-power mode. */ in cw1200_core_probe()
576 wsm_set_operational_mode(priv, &mode); in cw1200_core_probe()
578 /* Enable multi-TX confirmation */ in cw1200_core_probe()
600 self->hwbus_ops->lock(self->hwbus_priv); in cw1200_core_release()
602 self->hwbus_ops->unlock(self->hwbus_priv); in cw1200_core_release()
605 cw1200_unregister_common(self->hw); in cw1200_core_release()
606 cw1200_free_common(self->hw); in cw1200_core_release()