2 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #include <linux/module.h>
19 #include <linux/firmware.h>
30 unsigned int ath10k_debug_mask;
31 static bool uart_print;
32 static unsigned int ath10k_p2p;
33 module_param_named(debug_mask, ath10k_debug_mask, uint, 0644);
34 module_param(uart_print, bool, 0644);
35 module_param_named(p2p, ath10k_p2p, uint, 0644);
36 MODULE_PARM_DESC(debug_mask, "Debugging mask");
37 MODULE_PARM_DESC(uart_print, "Uart target debugging");
38 MODULE_PARM_DESC(p2p, "Enable ath10k P2P support");
40 static const struct ath10k_hw_params ath10k_hw_params_list[] = {
42 .id = QCA988X_HW_2_0_VERSION,
43 .name = "qca988x hw2.0",
44 .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
46 .dir = QCA988X_HW_2_0_FW_DIR,
47 .fw = QCA988X_HW_2_0_FW_FILE,
48 .otp = QCA988X_HW_2_0_OTP_FILE,
49 .board = QCA988X_HW_2_0_BOARD_DATA_FILE,
54 static void ath10k_send_suspend_complete(struct ath10k *ar)
56 ath10k_dbg(ATH10K_DBG_BOOT, "boot suspend complete\n");
58 complete(&ar->target_suspend);
61 static int ath10k_init_connect_htc(struct ath10k *ar)
65 status = ath10k_wmi_connect_htc_service(ar);
70 status = ath10k_htc_start(&ar->htc);
74 /* Wait for WMI event to be ready */
75 status = ath10k_wmi_wait_for_service_ready(ar);
77 ath10k_warn("wmi service ready event not received");
82 ath10k_dbg(ATH10K_DBG_BOOT, "boot wmi ready\n");
86 ath10k_htc_stop(&ar->htc);
91 static int ath10k_init_configure_target(struct ath10k *ar)
96 /* tell target which HTC version it is used*/
97 ret = ath10k_bmi_write32(ar, hi_app_host_interest,
98 HTC_PROTOCOL_VERSION);
100 ath10k_err("settings HTC version failed\n");
104 /* set the firmware mode to STA/IBSS/AP */
105 ret = ath10k_bmi_read32(ar, hi_option_flag, ¶m_host);
107 ath10k_err("setting firmware mode (1/2) failed\n");
111 /* TODO following parameters need to be re-visited. */
113 param_host |= (1 << HI_OPTION_NUM_DEV_SHIFT);
115 /* FIXME: Why FW_MODE_AP ??.*/
116 param_host |= (HI_OPTION_FW_MODE_AP << HI_OPTION_FW_MODE_SHIFT);
117 /* mac_addr_method */
118 param_host |= (1 << HI_OPTION_MAC_ADDR_METHOD_SHIFT);
119 /* firmware_bridge */
120 param_host |= (0 << HI_OPTION_FW_BRIDGE_SHIFT);
122 param_host |= (0 << HI_OPTION_FW_SUBMODE_SHIFT);
124 ret = ath10k_bmi_write32(ar, hi_option_flag, param_host);
126 ath10k_err("setting firmware mode (2/2) failed\n");
130 /* We do all byte-swapping on the host */
131 ret = ath10k_bmi_write32(ar, hi_be, 0);
133 ath10k_err("setting host CPU BE mode failed\n");
137 /* FW descriptor/Data swap flags */
138 ret = ath10k_bmi_write32(ar, hi_fw_swap, 0);
141 ath10k_err("setting FW data/desc swap flags failed\n");
148 static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
153 const struct firmware *fw;
157 return ERR_PTR(-ENOENT);
162 snprintf(filename, sizeof(filename), "%s/%s", dir, file);
163 ret = request_firmware(&fw, filename, ar->dev);
170 static int ath10k_push_board_ext_data(struct ath10k *ar)
172 u32 board_data_size = QCA988X_BOARD_DATA_SZ;
173 u32 board_ext_data_size = QCA988X_BOARD_EXT_DATA_SZ;
174 u32 board_ext_data_addr;
177 ret = ath10k_bmi_read32(ar, hi_board_ext_data, &board_ext_data_addr);
179 ath10k_err("could not read board ext data addr (%d)\n", ret);
183 ath10k_dbg(ATH10K_DBG_BOOT,
184 "boot push board extended data addr 0x%x\n",
185 board_ext_data_addr);
187 if (board_ext_data_addr == 0)
190 if (ar->board_len != (board_data_size + board_ext_data_size)) {
191 ath10k_err("invalid board (ext) data sizes %zu != %d+%d\n",
192 ar->board_len, board_data_size, board_ext_data_size);
196 ret = ath10k_bmi_write_memory(ar, board_ext_data_addr,
197 ar->board_data + board_data_size,
198 board_ext_data_size);
200 ath10k_err("could not write board ext data (%d)\n", ret);
204 ret = ath10k_bmi_write32(ar, hi_board_ext_data_config,
205 (board_ext_data_size << 16) | 1);
207 ath10k_err("could not write board ext data bit (%d)\n", ret);
214 static int ath10k_download_board_data(struct ath10k *ar)
216 u32 board_data_size = QCA988X_BOARD_DATA_SZ;
220 ret = ath10k_push_board_ext_data(ar);
222 ath10k_err("could not push board ext data (%d)\n", ret);
226 ret = ath10k_bmi_read32(ar, hi_board_data, &address);
228 ath10k_err("could not read board data addr (%d)\n", ret);
232 ret = ath10k_bmi_write_memory(ar, address, ar->board_data,
233 min_t(u32, board_data_size,
236 ath10k_err("could not write board data (%d)\n", ret);
240 ret = ath10k_bmi_write32(ar, hi_board_data_initialized, 1);
242 ath10k_err("could not write board data bit (%d)\n", ret);
250 static int ath10k_download_and_run_otp(struct ath10k *ar)
252 u32 result, address = ar->hw_params.patch_load_addr;
255 /* OTP is optional */
257 if (!ar->otp_data || !ar->otp_len) {
258 ath10k_warn("Not running otp, calibration will be incorrect!\n");
262 ath10k_dbg(ATH10K_DBG_BOOT, "boot upload otp to 0x%x len %zd\n",
263 address, ar->otp_len);
265 ret = ath10k_bmi_fast_download(ar, address, ar->otp_data, ar->otp_len);
267 ath10k_err("could not write otp (%d)\n", ret);
271 ret = ath10k_bmi_execute(ar, address, 0, &result);
273 ath10k_err("could not execute otp (%d)\n", ret);
277 ath10k_dbg(ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
280 ath10k_err("otp calibration failed: %d", result);
287 static int ath10k_download_fw(struct ath10k *ar)
292 address = ar->hw_params.patch_load_addr;
294 ret = ath10k_bmi_fast_download(ar, address, ar->firmware_data,
297 ath10k_err("could not write fw (%d)\n", ret);
305 static void ath10k_core_free_firmware_files(struct ath10k *ar)
307 if (ar->board && !IS_ERR(ar->board))
308 release_firmware(ar->board);
310 if (ar->otp && !IS_ERR(ar->otp))
311 release_firmware(ar->otp);
313 if (ar->firmware && !IS_ERR(ar->firmware))
314 release_firmware(ar->firmware);
317 ar->board_data = NULL;
325 ar->firmware_data = NULL;
326 ar->firmware_len = 0;
329 static int ath10k_core_fetch_firmware_api_1(struct ath10k *ar)
333 if (ar->hw_params.fw.fw == NULL) {
334 ath10k_err("firmware file not defined\n");
338 if (ar->hw_params.fw.board == NULL) {
339 ath10k_err("board data file not defined");
343 ar->board = ath10k_fetch_fw_file(ar,
344 ar->hw_params.fw.dir,
345 ar->hw_params.fw.board);
346 if (IS_ERR(ar->board)) {
347 ret = PTR_ERR(ar->board);
348 ath10k_err("could not fetch board data (%d)\n", ret);
352 ar->board_data = ar->board->data;
353 ar->board_len = ar->board->size;
355 ar->firmware = ath10k_fetch_fw_file(ar,
356 ar->hw_params.fw.dir,
357 ar->hw_params.fw.fw);
358 if (IS_ERR(ar->firmware)) {
359 ret = PTR_ERR(ar->firmware);
360 ath10k_err("could not fetch firmware (%d)\n", ret);
364 ar->firmware_data = ar->firmware->data;
365 ar->firmware_len = ar->firmware->size;
367 /* OTP may be undefined. If so, don't fetch it at all */
368 if (ar->hw_params.fw.otp == NULL)
371 ar->otp = ath10k_fetch_fw_file(ar,
372 ar->hw_params.fw.dir,
373 ar->hw_params.fw.otp);
374 if (IS_ERR(ar->otp)) {
375 ret = PTR_ERR(ar->otp);
376 ath10k_err("could not fetch otp (%d)\n", ret);
380 ar->otp_data = ar->otp->data;
381 ar->otp_len = ar->otp->size;
386 ath10k_core_free_firmware_files(ar);
390 static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name)
392 size_t magic_len, len, ie_len;
393 int ie_id, i, index, bit, ret;
394 struct ath10k_fw_ie *hdr;
398 /* first fetch the firmware file (firmware-*.bin) */
399 ar->firmware = ath10k_fetch_fw_file(ar, ar->hw_params.fw.dir, name);
400 if (IS_ERR(ar->firmware)) {
401 ath10k_err("Could not fetch firmware file '%s': %ld\n",
402 name, PTR_ERR(ar->firmware));
403 return PTR_ERR(ar->firmware);
406 data = ar->firmware->data;
407 len = ar->firmware->size;
409 /* magic also includes the null byte, check that as well */
410 magic_len = strlen(ATH10K_FIRMWARE_MAGIC) + 1;
412 if (len < magic_len) {
413 ath10k_err("firmware image too small to contain magic: %zu\n",
419 if (memcmp(data, ATH10K_FIRMWARE_MAGIC, magic_len) != 0) {
420 ath10k_err("Invalid firmware magic\n");
425 /* jump over the padding */
426 magic_len = ALIGN(magic_len, 4);
432 while (len > sizeof(struct ath10k_fw_ie)) {
433 hdr = (struct ath10k_fw_ie *)data;
435 ie_id = le32_to_cpu(hdr->id);
436 ie_len = le32_to_cpu(hdr->len);
439 data += sizeof(*hdr);
442 ath10k_err("Invalid length for FW IE %d (%zu < %zu)\n",
449 case ATH10K_FW_IE_FW_VERSION:
450 if (ie_len > sizeof(ar->hw->wiphy->fw_version) - 1)
453 memcpy(ar->hw->wiphy->fw_version, data, ie_len);
454 ar->hw->wiphy->fw_version[ie_len] = '\0';
456 ath10k_dbg(ATH10K_DBG_BOOT,
457 "found fw version %s\n",
458 ar->hw->wiphy->fw_version);
460 case ATH10K_FW_IE_TIMESTAMP:
461 if (ie_len != sizeof(u32))
464 timestamp = (__le32 *)data;
466 ath10k_dbg(ATH10K_DBG_BOOT, "found fw timestamp %d\n",
467 le32_to_cpup(timestamp));
469 case ATH10K_FW_IE_FEATURES:
470 ath10k_dbg(ATH10K_DBG_BOOT,
471 "found firmware features ie (%zd B)\n",
474 for (i = 0; i < ATH10K_FW_FEATURE_COUNT; i++) {
481 if (data[index] & (1 << bit)) {
482 ath10k_dbg(ATH10K_DBG_BOOT,
483 "Enabling feature bit: %i\n",
485 __set_bit(i, ar->fw_features);
489 ath10k_dbg_dump(ATH10K_DBG_BOOT, "features", "",
491 sizeof(ar->fw_features));
493 case ATH10K_FW_IE_FW_IMAGE:
494 ath10k_dbg(ATH10K_DBG_BOOT,
495 "found fw image ie (%zd B)\n",
498 ar->firmware_data = data;
499 ar->firmware_len = ie_len;
502 case ATH10K_FW_IE_OTP_IMAGE:
503 ath10k_dbg(ATH10K_DBG_BOOT,
504 "found otp image ie (%zd B)\n",
508 ar->otp_len = ie_len;
512 ath10k_warn("Unknown FW IE: %u\n",
513 le32_to_cpu(hdr->id));
517 /* jump over the padding */
518 ie_len = ALIGN(ie_len, 4);
524 if (!ar->firmware_data || !ar->firmware_len) {
525 ath10k_warn("No ATH10K_FW_IE_FW_IMAGE found from %s, skipping\n",
531 /* now fetch the board file */
532 if (ar->hw_params.fw.board == NULL) {
533 ath10k_err("board data file not defined");
538 ar->board = ath10k_fetch_fw_file(ar,
539 ar->hw_params.fw.dir,
540 ar->hw_params.fw.board);
541 if (IS_ERR(ar->board)) {
542 ret = PTR_ERR(ar->board);
543 ath10k_err("could not fetch board data (%d)\n", ret);
547 ar->board_data = ar->board->data;
548 ar->board_len = ar->board->size;
553 ath10k_core_free_firmware_files(ar);
557 static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
561 ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API2_FILE);
567 ret = ath10k_core_fetch_firmware_api_1(ar);
574 ath10k_dbg(ATH10K_DBG_BOOT, "using fw api %d\n", ar->fw_api);
579 static int ath10k_init_download_firmware(struct ath10k *ar)
583 ret = ath10k_download_board_data(ar);
587 ret = ath10k_download_and_run_otp(ar);
591 ret = ath10k_download_fw(ar);
598 static int ath10k_init_uart(struct ath10k *ar)
603 * Explicitly setting UART prints to zero as target turns it on
604 * based on scratch registers.
606 ret = ath10k_bmi_write32(ar, hi_serial_enable, 0);
608 ath10k_warn("could not disable UART prints (%d)\n", ret);
615 ret = ath10k_bmi_write32(ar, hi_dbg_uart_txpin, 7);
617 ath10k_warn("could not enable UART prints (%d)\n", ret);
621 ret = ath10k_bmi_write32(ar, hi_serial_enable, 1);
623 ath10k_warn("could not enable UART prints (%d)\n", ret);
627 /* Set the UART baud rate to 19200. */
628 ret = ath10k_bmi_write32(ar, hi_desired_baud_rate, 19200);
630 ath10k_warn("could not set the baud rate (%d)\n", ret);
634 ath10k_info("UART prints enabled\n");
638 static int ath10k_init_hw_params(struct ath10k *ar)
640 const struct ath10k_hw_params *uninitialized_var(hw_params);
643 for (i = 0; i < ARRAY_SIZE(ath10k_hw_params_list); i++) {
644 hw_params = &ath10k_hw_params_list[i];
646 if (hw_params->id == ar->target_version)
650 if (i == ARRAY_SIZE(ath10k_hw_params_list)) {
651 ath10k_err("Unsupported hardware version: 0x%x\n",
656 ar->hw_params = *hw_params;
658 ath10k_dbg(ATH10K_DBG_BOOT, "Hardware name %s version 0x%x\n",
659 ar->hw_params.name, ar->target_version);
664 static void ath10k_core_restart(struct work_struct *work)
666 struct ath10k *ar = container_of(work, struct ath10k, restart_work);
668 mutex_lock(&ar->conf_mutex);
671 case ATH10K_STATE_ON:
673 ar->state = ATH10K_STATE_RESTARTING;
674 ieee80211_restart_hw(ar->hw);
676 case ATH10K_STATE_OFF:
677 /* this can happen if driver is being unloaded
678 * or if the crash happens during FW probing */
679 ath10k_warn("cannot restart a device that hasn't been started\n");
681 case ATH10K_STATE_RESTARTING:
682 case ATH10K_STATE_RESTARTED:
683 ar->state = ATH10K_STATE_WEDGED;
685 case ATH10K_STATE_WEDGED:
686 ath10k_warn("device is wedged, will not restart\n");
690 mutex_unlock(&ar->conf_mutex);
693 struct ath10k *ath10k_core_create(void *hif_priv, struct device *dev,
694 const struct ath10k_hif_ops *hif_ops)
698 ar = ath10k_mac_create();
702 ar->ath_common.priv = ar;
703 ar->ath_common.hw = ar->hw;
705 ar->p2p = !!ath10k_p2p;
708 ar->hif.priv = hif_priv;
709 ar->hif.ops = hif_ops;
711 init_completion(&ar->scan.started);
712 init_completion(&ar->scan.completed);
713 init_completion(&ar->scan.on_channel);
714 init_completion(&ar->target_suspend);
716 init_completion(&ar->install_key_done);
717 init_completion(&ar->vdev_setup_done);
719 setup_timer(&ar->scan.timeout, ath10k_reset_scan, (unsigned long)ar);
721 ar->workqueue = create_singlethread_workqueue("ath10k_wq");
725 mutex_init(&ar->conf_mutex);
726 spin_lock_init(&ar->data_lock);
728 INIT_LIST_HEAD(&ar->peers);
729 init_waitqueue_head(&ar->peer_mapping_wq);
731 init_completion(&ar->offchan_tx_completed);
732 INIT_WORK(&ar->offchan_tx_work, ath10k_offchan_tx_work);
733 skb_queue_head_init(&ar->offchan_tx_queue);
735 INIT_WORK(&ar->wmi_mgmt_tx_work, ath10k_mgmt_over_wmi_tx_work);
736 skb_queue_head_init(&ar->wmi_mgmt_tx_queue);
738 INIT_WORK(&ar->restart_work, ath10k_core_restart);
743 ath10k_mac_destroy(ar);
746 EXPORT_SYMBOL(ath10k_core_create);
748 void ath10k_core_destroy(struct ath10k *ar)
750 flush_workqueue(ar->workqueue);
751 destroy_workqueue(ar->workqueue);
753 ath10k_mac_destroy(ar);
755 EXPORT_SYMBOL(ath10k_core_destroy);
757 int ath10k_core_start(struct ath10k *ar)
761 lockdep_assert_held(&ar->conf_mutex);
763 ath10k_bmi_start(ar);
765 if (ath10k_init_configure_target(ar)) {
770 status = ath10k_init_download_firmware(ar);
774 status = ath10k_init_uart(ar);
778 ar->htc.htc_ops.target_send_suspend_complete =
779 ath10k_send_suspend_complete;
781 status = ath10k_htc_init(ar);
783 ath10k_err("could not init HTC (%d)\n", status);
787 status = ath10k_bmi_done(ar);
791 status = ath10k_wmi_attach(ar);
793 ath10k_err("WMI attach failed: %d\n", status);
797 status = ath10k_hif_start(ar);
799 ath10k_err("could not start HIF: %d\n", status);
803 status = ath10k_htc_wait_target(&ar->htc);
805 ath10k_err("failed to connect to HTC: %d\n", status);
809 status = ath10k_htt_attach(ar);
811 ath10k_err("could not attach htt (%d)\n", status);
815 status = ath10k_init_connect_htc(ar);
819 ath10k_dbg(ATH10K_DBG_BOOT, "firmware %s booted\n",
820 ar->hw->wiphy->fw_version);
822 status = ath10k_wmi_cmd_init(ar);
824 ath10k_err("could not send WMI init command (%d)\n", status);
825 goto err_disconnect_htc;
828 status = ath10k_wmi_wait_for_unified_ready(ar);
830 ath10k_err("wmi unified ready event not received\n");
832 goto err_disconnect_htc;
835 status = ath10k_htt_attach_target(&ar->htt);
837 goto err_disconnect_htc;
839 status = ath10k_debug_start(ar);
841 goto err_disconnect_htc;
843 ar->free_vdev_map = (1 << TARGET_NUM_VDEVS) - 1;
844 INIT_LIST_HEAD(&ar->arvifs);
846 if (!test_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags))
847 ath10k_info("%s (0x%x) fw %s api %d htt %d.%d\n",
848 ar->hw_params.name, ar->target_version,
849 ar->hw->wiphy->fw_version, ar->fw_api,
850 ar->htt.target_version_major,
851 ar->htt.target_version_minor);
853 __set_bit(ATH10K_FLAG_FIRST_BOOT_DONE, &ar->dev_flags);
858 ath10k_htc_stop(&ar->htc);
860 ath10k_htt_detach(&ar->htt);
864 ath10k_wmi_detach(ar);
868 EXPORT_SYMBOL(ath10k_core_start);
870 int ath10k_wait_for_suspend(struct ath10k *ar, u32 suspend_opt)
874 reinit_completion(&ar->target_suspend);
876 ret = ath10k_wmi_pdev_suspend_target(ar, suspend_opt);
878 ath10k_warn("could not suspend target (%d)\n", ret);
882 ret = wait_for_completion_timeout(&ar->target_suspend, 1 * HZ);
885 ath10k_warn("suspend timed out - target pause event never came\n");
892 void ath10k_core_stop(struct ath10k *ar)
894 lockdep_assert_held(&ar->conf_mutex);
896 /* try to suspend target */
897 ath10k_wait_for_suspend(ar, WMI_PDEV_SUSPEND_AND_DISABLE_INTR);
898 ath10k_debug_stop(ar);
899 ath10k_htc_stop(&ar->htc);
900 ath10k_htt_detach(&ar->htt);
901 ath10k_wmi_detach(ar);
903 EXPORT_SYMBOL(ath10k_core_stop);
905 /* mac80211 manages fw/hw initialization through start/stop hooks. However in
906 * order to know what hw capabilities should be advertised to mac80211 it is
907 * necessary to load the firmware (and tear it down immediately since start
908 * hook will try to init it again) before registering */
909 static int ath10k_core_probe_fw(struct ath10k *ar)
911 struct bmi_target_info target_info;
914 ret = ath10k_hif_power_up(ar);
916 ath10k_err("could not start pci hif (%d)\n", ret);
920 memset(&target_info, 0, sizeof(target_info));
921 ret = ath10k_bmi_get_target_info(ar, &target_info);
923 ath10k_err("could not get target info (%d)\n", ret);
924 ath10k_hif_power_down(ar);
928 ar->target_version = target_info.version;
929 ar->hw->wiphy->hw_version = target_info.version;
931 ret = ath10k_init_hw_params(ar);
933 ath10k_err("could not get hw params (%d)\n", ret);
934 ath10k_hif_power_down(ar);
938 ret = ath10k_core_fetch_firmware_files(ar);
940 ath10k_err("could not fetch firmware files (%d)\n", ret);
941 ath10k_hif_power_down(ar);
945 mutex_lock(&ar->conf_mutex);
947 ret = ath10k_core_start(ar);
949 ath10k_err("could not init core (%d)\n", ret);
950 ath10k_core_free_firmware_files(ar);
951 ath10k_hif_power_down(ar);
952 mutex_unlock(&ar->conf_mutex);
956 ath10k_core_stop(ar);
958 mutex_unlock(&ar->conf_mutex);
960 ath10k_hif_power_down(ar);
964 static int ath10k_core_check_chip_id(struct ath10k *ar)
966 u32 hw_revision = MS(ar->chip_id, SOC_CHIP_ID_REV);
968 ath10k_dbg(ATH10K_DBG_BOOT, "boot chip_id 0x%08x hw_revision 0x%x\n",
969 ar->chip_id, hw_revision);
971 /* Check that we are not using hw1.0 (some of them have same pci id
972 * as hw2.0) before doing anything else as ath10k crashes horribly
973 * due to missing hw1.0 workarounds. */
974 switch (hw_revision) {
975 case QCA988X_HW_1_0_CHIP_ID_REV:
976 ath10k_err("ERROR: qca988x hw1.0 is not supported\n");
979 case QCA988X_HW_2_0_CHIP_ID_REV:
980 /* known hardware revision, continue normally */
984 ath10k_warn("Warning: hardware revision unknown (0x%x), expect problems\n",
992 int ath10k_core_register(struct ath10k *ar, u32 chip_id)
996 ar->chip_id = chip_id;
998 status = ath10k_core_check_chip_id(ar);
1000 ath10k_err("Unsupported chip id 0x%08x\n", ar->chip_id);
1004 status = ath10k_core_probe_fw(ar);
1006 ath10k_err("could not probe fw (%d)\n", status);
1010 status = ath10k_mac_register(ar);
1012 ath10k_err("could not register to mac80211 (%d)\n", status);
1013 goto err_release_fw;
1016 status = ath10k_debug_create(ar);
1018 ath10k_err("unable to initialize debugfs\n");
1019 goto err_unregister_mac;
1025 ath10k_mac_unregister(ar);
1027 ath10k_core_free_firmware_files(ar);
1030 EXPORT_SYMBOL(ath10k_core_register);
1032 void ath10k_core_unregister(struct ath10k *ar)
1034 /* We must unregister from mac80211 before we stop HTC and HIF.
1035 * Otherwise we will fail to submit commands to FW and mac80211 will be
1036 * unhappy about callback failures. */
1037 ath10k_mac_unregister(ar);
1039 ath10k_core_free_firmware_files(ar);
1041 ath10k_debug_destroy(ar);
1043 EXPORT_SYMBOL(ath10k_core_unregister);
1045 MODULE_AUTHOR("Qualcomm Atheros");
1046 MODULE_DESCRIPTION("Core module for QCA988X PCIe devices.");
1047 MODULE_LICENSE("Dual BSD/GPL");