Lines Matching +full:fw +full:- +full:gpios

1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
108 gpios),
1733 req.mem_cfg_mode = ab->qmi.target_mem_mode; in ath11k_qmi_host_cap_send()
1738 if (ab->hw_params.m3_fw_support) { in ath11k_qmi_host_cap_send()
1751 req.cal_done = ab->qmi.cal_done; in ath11k_qmi_host_cap_send()
1753 if (ab->hw_params.internal_sleep_clock) { in ath11k_qmi_host_cap_send()
1756 /* Notify firmware that this is non-qualcomm platform. */ in ath11k_qmi_host_cap_send()
1761 * non-qualcomm platforms should select internal sleep in ath11k_qmi_host_cap_send()
1767 if (ab->hw_params.global_reset) in ath11k_qmi_host_cap_send()
1774 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_host_cap_send()
1779 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_host_cap_send()
1796 ret = -EINVAL; in ath11k_qmi_host_cap_send()
1808 struct qmi_handle *handle = &ab->qmi.handle; in ath11k_qmi_fw_ind_register_send()
1814 return -ENOMEM; in ath11k_qmi_fw_ind_register_send()
1818 ret = -ENOMEM; in ath11k_qmi_fw_ind_register_send()
1822 req->client_id_valid = 1; in ath11k_qmi_fw_ind_register_send()
1823 req->client_id = QMI_WLANFW_CLIENT_ID; in ath11k_qmi_fw_ind_register_send()
1824 req->fw_ready_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1825 req->fw_ready_enable = 1; in ath11k_qmi_fw_ind_register_send()
1826 req->cal_done_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1827 req->cal_done_enable = 1; in ath11k_qmi_fw_ind_register_send()
1828 req->fw_init_done_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1829 req->fw_init_done_enable = 1; in ath11k_qmi_fw_ind_register_send()
1831 req->pin_connect_result_enable_valid = 0; in ath11k_qmi_fw_ind_register_send()
1832 req->pin_connect_result_enable = 0; in ath11k_qmi_fw_ind_register_send()
1838 if (!ab->hw_params.fixed_fw_mem) { in ath11k_qmi_fw_ind_register_send()
1839 req->request_mem_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1840 req->request_mem_enable = 1; in ath11k_qmi_fw_ind_register_send()
1841 req->fw_mem_ready_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1842 req->fw_mem_ready_enable = 1; in ath11k_qmi_fw_ind_register_send()
1852 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_fw_ind_register_send()
1865 ath11k_warn(ab, "failed to register fw indication: %d\n", ret); in ath11k_qmi_fw_ind_register_send()
1869 if (resp->resp.result != QMI_RESULT_SUCCESS_V01) { in ath11k_qmi_fw_ind_register_send()
1871 resp->resp.result, resp->resp.error); in ath11k_qmi_fw_ind_register_send()
1872 ret = -EINVAL; in ath11k_qmi_fw_ind_register_send()
1893 return -ENOMEM; in ath11k_qmi_respond_fw_mem_request()
1897 /* For QCA6390 by default FW requests a block of ~4M contiguous in ath11k_qmi_respond_fw_mem_request()
1899 * failure to FW and FW will then request multiple blocks of small in ath11k_qmi_respond_fw_mem_request()
1902 if (!(ab->hw_params.fixed_mem_region || in ath11k_qmi_respond_fw_mem_request()
1903 test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) && in ath11k_qmi_respond_fw_mem_request()
1904 ab->qmi.target_mem_delayed) { in ath11k_qmi_respond_fw_mem_request()
1907 ab->qmi.mem_seg_count); in ath11k_qmi_respond_fw_mem_request()
1911 req->mem_seg_len = ab->qmi.mem_seg_count; in ath11k_qmi_respond_fw_mem_request()
1913 for (i = 0; i < req->mem_seg_len ; i++) { in ath11k_qmi_respond_fw_mem_request()
1914 req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr; in ath11k_qmi_respond_fw_mem_request()
1915 req->mem_seg[i].size = ab->qmi.target_mem[i].size; in ath11k_qmi_respond_fw_mem_request()
1916 req->mem_seg[i].type = ab->qmi.target_mem[i].type; in ath11k_qmi_respond_fw_mem_request()
1919 &ab->qmi.target_mem[i].paddr, in ath11k_qmi_respond_fw_mem_request()
1920 ab->qmi.target_mem[i].size, in ath11k_qmi_respond_fw_mem_request()
1921 ab->qmi.target_mem[i].type); in ath11k_qmi_respond_fw_mem_request()
1925 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_respond_fw_mem_request()
1933 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_respond_fw_mem_request()
1959 ret = -EINVAL; in ath11k_qmi_respond_fw_mem_request()
1971 for (i = 0; i < ab->qmi.mem_seg_count; i++) { in ath11k_qmi_free_target_mem_chunk()
1972 if ((ab->hw_params.fixed_mem_region || in ath11k_qmi_free_target_mem_chunk()
1973 test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) && in ath11k_qmi_free_target_mem_chunk()
1974 ab->qmi.target_mem[i].iaddr) in ath11k_qmi_free_target_mem_chunk()
1975 iounmap(ab->qmi.target_mem[i].iaddr); in ath11k_qmi_free_target_mem_chunk()
1977 if (!ab->qmi.target_mem[i].vaddr) in ath11k_qmi_free_target_mem_chunk()
1980 dma_free_coherent(ab->dev, in ath11k_qmi_free_target_mem_chunk()
1981 ab->qmi.target_mem[i].prev_size, in ath11k_qmi_free_target_mem_chunk()
1982 ab->qmi.target_mem[i].vaddr, in ath11k_qmi_free_target_mem_chunk()
1983 ab->qmi.target_mem[i].paddr); in ath11k_qmi_free_target_mem_chunk()
1984 ab->qmi.target_mem[i].vaddr = NULL; in ath11k_qmi_free_target_mem_chunk()
1993 ab->qmi.target_mem_delayed = false; in ath11k_qmi_alloc_target_mem_chunk()
1995 for (i = 0; i < ab->qmi.mem_seg_count; i++) { in ath11k_qmi_alloc_target_mem_chunk()
1996 chunk = &ab->qmi.target_mem[i]; in ath11k_qmi_alloc_target_mem_chunk()
1999 * in such case, no need to allocate memory for FW again. in ath11k_qmi_alloc_target_mem_chunk()
2001 if (chunk->vaddr) { in ath11k_qmi_alloc_target_mem_chunk()
2002 if (chunk->prev_type == chunk->type && in ath11k_qmi_alloc_target_mem_chunk()
2003 chunk->prev_size == chunk->size) in ath11k_qmi_alloc_target_mem_chunk()
2007 dma_free_coherent(ab->dev, chunk->prev_size, in ath11k_qmi_alloc_target_mem_chunk()
2008 chunk->vaddr, chunk->paddr); in ath11k_qmi_alloc_target_mem_chunk()
2009 chunk->vaddr = NULL; in ath11k_qmi_alloc_target_mem_chunk()
2012 chunk->vaddr = dma_alloc_coherent(ab->dev, in ath11k_qmi_alloc_target_mem_chunk()
2013 chunk->size, in ath11k_qmi_alloc_target_mem_chunk()
2014 &chunk->paddr, in ath11k_qmi_alloc_target_mem_chunk()
2016 if (!chunk->vaddr) { in ath11k_qmi_alloc_target_mem_chunk()
2017 if (ab->qmi.mem_seg_count <= ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT) { in ath11k_qmi_alloc_target_mem_chunk()
2020 chunk->size, in ath11k_qmi_alloc_target_mem_chunk()
2021 chunk->type); in ath11k_qmi_alloc_target_mem_chunk()
2023 ab->qmi.target_mem_delayed = true; in ath11k_qmi_alloc_target_mem_chunk()
2028 chunk->size, in ath11k_qmi_alloc_target_mem_chunk()
2029 chunk->type); in ath11k_qmi_alloc_target_mem_chunk()
2030 return -EINVAL; in ath11k_qmi_alloc_target_mem_chunk()
2032 chunk->prev_type = chunk->type; in ath11k_qmi_alloc_target_mem_chunk()
2033 chunk->prev_size = chunk->size; in ath11k_qmi_alloc_target_mem_chunk()
2042 struct device *dev = ab->dev; in ath11k_qmi_assign_target_mem_chunk()
2051 for (i = 0, idx = 0; i < ab->qmi.mem_seg_count; i++) { in ath11k_qmi_assign_target_mem_chunk()
2052 switch (ab->qmi.target_mem[i].type) { in ath11k_qmi_assign_target_mem_chunk()
2055 hremote_node = of_parse_phandle(dev->of_node, "memory-region", 0); in ath11k_qmi_assign_target_mem_chunk()
2059 return -ENODEV; in ath11k_qmi_assign_target_mem_chunk()
2070 if (res.end - res.start + 1 < ab->qmi.target_mem[i].size) { in ath11k_qmi_assign_target_mem_chunk()
2073 return -EINVAL; in ath11k_qmi_assign_target_mem_chunk()
2076 ab->qmi.target_mem[idx].paddr = res.start; in ath11k_qmi_assign_target_mem_chunk()
2077 ab->qmi.target_mem[idx].iaddr = in ath11k_qmi_assign_target_mem_chunk()
2078 ioremap(ab->qmi.target_mem[idx].paddr, in ath11k_qmi_assign_target_mem_chunk()
2079 ab->qmi.target_mem[i].size); in ath11k_qmi_assign_target_mem_chunk()
2080 if (!ab->qmi.target_mem[idx].iaddr) in ath11k_qmi_assign_target_mem_chunk()
2081 return -EIO; in ath11k_qmi_assign_target_mem_chunk()
2083 ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; in ath11k_qmi_assign_target_mem_chunk()
2084 host_ddr_sz = ab->qmi.target_mem[i].size; in ath11k_qmi_assign_target_mem_chunk()
2085 ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; in ath11k_qmi_assign_target_mem_chunk()
2090 ab->qmi.target_mem[idx].paddr = ab->hw_params.bdf_addr; in ath11k_qmi_assign_target_mem_chunk()
2091 ab->qmi.target_mem[idx].vaddr = NULL; in ath11k_qmi_assign_target_mem_chunk()
2092 ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; in ath11k_qmi_assign_target_mem_chunk()
2093 ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; in ath11k_qmi_assign_target_mem_chunk()
2098 if (ab->qmi.target_mem[i].size > ATH11K_QMI_CALDB_SIZE) { in ath11k_qmi_assign_target_mem_chunk()
2100 return -EINVAL; in ath11k_qmi_assign_target_mem_chunk()
2105 ab->qmi.target_mem[idx].paddr = in ath11k_qmi_assign_target_mem_chunk()
2107 ab->qmi.target_mem[idx].iaddr = in ath11k_qmi_assign_target_mem_chunk()
2108 ioremap(ab->qmi.target_mem[idx].paddr, in ath11k_qmi_assign_target_mem_chunk()
2109 ab->qmi.target_mem[i].size); in ath11k_qmi_assign_target_mem_chunk()
2110 if (!ab->qmi.target_mem[idx].iaddr) in ath11k_qmi_assign_target_mem_chunk()
2111 return -EIO; in ath11k_qmi_assign_target_mem_chunk()
2113 ab->qmi.target_mem[idx].paddr = in ath11k_qmi_assign_target_mem_chunk()
2117 ab->qmi.target_mem[idx].paddr = 0; in ath11k_qmi_assign_target_mem_chunk()
2118 ab->qmi.target_mem[idx].vaddr = NULL; in ath11k_qmi_assign_target_mem_chunk()
2120 ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; in ath11k_qmi_assign_target_mem_chunk()
2121 ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; in ath11k_qmi_assign_target_mem_chunk()
2127 ab->qmi.target_mem[i].type); in ath11k_qmi_assign_target_mem_chunk()
2131 ab->qmi.mem_seg_count = idx; in ath11k_qmi_assign_target_mem_chunk()
2145 if (!ab->hw_params.hybrid_bus_type) in ath11k_qmi_request_device_info()
2148 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_request_device_info()
2153 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_request_device_info()
2174 ret = -EINVAL; in ath11k_qmi_request_device_info()
2181 ret = -EINVAL; in ath11k_qmi_request_device_info()
2194 ret = -EINVAL; in ath11k_qmi_request_device_info()
2198 bar_addr_va = devm_ioremap(ab->dev, resp.bar_addr, resp.bar_size); in ath11k_qmi_request_device_info()
2202 ab->mem_len = 0; in ath11k_qmi_request_device_info()
2203 ret = -EIO; in ath11k_qmi_request_device_info()
2207 ab->mem = bar_addr_va; in ath11k_qmi_request_device_info()
2208 ab->mem_len = resp.bar_size; in ath11k_qmi_request_device_info()
2228 ret = qmi_txn_init(&ab->qmi.handle, &txn, qmi_wlanfw_cap_resp_msg_v01_ei, in ath11k_qmi_request_target_cap()
2235 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_request_target_cap()
2255 ret = -EINVAL; in ath11k_qmi_request_target_cap()
2260 ab->qmi.target.chip_id = resp.chip_info.chip_id; in ath11k_qmi_request_target_cap()
2261 ab->qmi.target.chip_family = resp.chip_info.chip_family; in ath11k_qmi_request_target_cap()
2265 ab->qmi.target.board_id = resp.board_info.board_id; in ath11k_qmi_request_target_cap()
2267 ab->qmi.target.board_id = 0xFF; in ath11k_qmi_request_target_cap()
2270 ab->qmi.target.soc_id = resp.soc_info.soc_id; in ath11k_qmi_request_target_cap()
2273 ab->qmi.target.fw_version = resp.fw_version_info.fw_version; in ath11k_qmi_request_target_cap()
2274 strscpy(ab->qmi.target.fw_build_timestamp, in ath11k_qmi_request_target_cap()
2276 sizeof(ab->qmi.target.fw_build_timestamp)); in ath11k_qmi_request_target_cap()
2280 strscpy(ab->qmi.target.fw_build_id, resp.fw_build_id, in ath11k_qmi_request_target_cap()
2281 sizeof(ab->qmi.target.fw_build_id)); in ath11k_qmi_request_target_cap()
2284 ab->qmi.target.eeprom_caldata = in ath11k_qmi_request_target_cap()
2289 fw_build_id = ab->qmi.target.fw_build_id; in ath11k_qmi_request_target_cap()
2295 ab->qmi.target.chip_id, ab->qmi.target.chip_family, in ath11k_qmi_request_target_cap()
2296 ab->qmi.target.board_id, ab->qmi.target.soc_id); in ath11k_qmi_request_target_cap()
2299 ab->qmi.target.fw_version, in ath11k_qmi_request_target_cap()
2300 ab->qmi.target.fw_build_timestamp, in ath11k_qmi_request_target_cap()
2332 return -ENOMEM; in ath11k_qmi_load_file_target_mem()
2336 if (ab->hw_params.fixed_bdf_addr) { in ath11k_qmi_load_file_target_mem()
2337 bdf_addr = ioremap(ab->hw_params.bdf_addr, ab->hw_params.fw.board_size); in ath11k_qmi_load_file_target_mem()
2340 ret = -EIO; in ath11k_qmi_load_file_target_mem()
2346 req->valid = 1; in ath11k_qmi_load_file_target_mem()
2347 req->file_id_valid = 1; in ath11k_qmi_load_file_target_mem()
2348 req->file_id = ab->qmi.target.board_id; in ath11k_qmi_load_file_target_mem()
2349 req->total_size_valid = 1; in ath11k_qmi_load_file_target_mem()
2350 req->total_size = remaining; in ath11k_qmi_load_file_target_mem()
2351 req->seg_id_valid = 1; in ath11k_qmi_load_file_target_mem()
2352 req->data_valid = 1; in ath11k_qmi_load_file_target_mem()
2353 req->bdf_type = type; in ath11k_qmi_load_file_target_mem()
2354 req->bdf_type_valid = 1; in ath11k_qmi_load_file_target_mem()
2355 req->end_valid = 1; in ath11k_qmi_load_file_target_mem()
2356 req->end = 0; in ath11k_qmi_load_file_target_mem()
2359 req->data_len = QMI_WLANFW_MAX_DATA_SIZE_V01; in ath11k_qmi_load_file_target_mem()
2361 req->data_len = remaining; in ath11k_qmi_load_file_target_mem()
2362 req->end = 1; in ath11k_qmi_load_file_target_mem()
2365 if (ab->hw_params.fixed_bdf_addr || in ath11k_qmi_load_file_target_mem()
2367 req->data_valid = 0; in ath11k_qmi_load_file_target_mem()
2368 req->end = 1; in ath11k_qmi_load_file_target_mem()
2369 req->data_len = ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE; in ath11k_qmi_load_file_target_mem()
2371 memcpy(req->data, temp, req->data_len); in ath11k_qmi_load_file_target_mem()
2374 if (ab->hw_params.fixed_bdf_addr) { in ath11k_qmi_load_file_target_mem()
2376 bdf_addr += ab->hw_params.fw.cal_offset; in ath11k_qmi_load_file_target_mem()
2381 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_load_file_target_mem()
2390 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_load_file_target_mem()
2409 ret = -EINVAL; in ath11k_qmi_load_file_target_mem()
2413 if (ab->hw_params.fixed_bdf_addr || in ath11k_qmi_load_file_target_mem()
2417 remaining -= req->data_len; in ath11k_qmi_load_file_target_mem()
2418 temp += req->data_len; in ath11k_qmi_load_file_target_mem()
2419 req->seg_id++; in ath11k_qmi_load_file_target_mem()
2426 if (ab->hw_params.fixed_bdf_addr) in ath11k_qmi_load_file_target_mem()
2438 struct device *dev = ab->dev; in ath11k_qmi_load_bdf_qmi()
2468 fw_size = min_t(u32, ab->hw_params.fw.board_size, bd.len); in ath11k_qmi_load_bdf_qmi()
2480 if (ab->qmi.target.eeprom_caldata) { in ath11k_qmi_load_bdf_qmi()
2487 /* cal-<bus>-<id>.bin */ in ath11k_qmi_load_bdf_qmi()
2488 snprintf(filename, sizeof(filename), "cal-%s-%s.bin", in ath11k_qmi_load_bdf_qmi()
2489 ath11k_bus_str(ab->hif.bus), dev_name(dev)); in ath11k_qmi_load_bdf_qmi()
2511 fw_size = min_t(u32, ab->hw_params.fw.board_size, fw_entry->size); in ath11k_qmi_load_bdf_qmi()
2512 tmp = fw_entry->data; in ath11k_qmi_load_bdf_qmi()
2524 if (!ab->qmi.target.eeprom_caldata) in ath11k_qmi_load_bdf_qmi()
2535 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath11k_qmi_m3_load()
2536 const struct firmware *fw; in ath11k_qmi_m3_load() local
2540 fw = ath11k_core_firmware_request(ab, ATH11K_M3_FILE); in ath11k_qmi_m3_load()
2541 if (IS_ERR(fw)) { in ath11k_qmi_m3_load()
2542 ret = PTR_ERR(fw); in ath11k_qmi_m3_load()
2549 if (m3_mem->vaddr || m3_mem->size) in ath11k_qmi_m3_load()
2552 m3_mem->vaddr = dma_alloc_coherent(ab->dev, in ath11k_qmi_m3_load()
2553 fw->size, &m3_mem->paddr, in ath11k_qmi_m3_load()
2555 if (!m3_mem->vaddr) { in ath11k_qmi_m3_load()
2557 fw->size); in ath11k_qmi_m3_load()
2558 release_firmware(fw); in ath11k_qmi_m3_load()
2559 return -ENOMEM; in ath11k_qmi_m3_load()
2563 memcpy(m3_mem->vaddr, fw->data, fw->size); in ath11k_qmi_m3_load()
2564 m3_mem->size = fw->size; in ath11k_qmi_m3_load()
2565 release_firmware(fw); in ath11k_qmi_m3_load()
2572 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath11k_qmi_m3_free()
2574 if (!ab->hw_params.m3_fw_support || !m3_mem->vaddr) in ath11k_qmi_m3_free()
2577 dma_free_coherent(ab->dev, m3_mem->size, in ath11k_qmi_m3_free()
2578 m3_mem->vaddr, m3_mem->paddr); in ath11k_qmi_m3_free()
2579 m3_mem->vaddr = NULL; in ath11k_qmi_m3_free()
2580 m3_mem->size = 0; in ath11k_qmi_m3_free()
2585 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath11k_qmi_wlanfw_m3_info_send()
2594 if (ab->hw_params.m3_fw_support) { in ath11k_qmi_wlanfw_m3_info_send()
2601 req.addr = m3_mem->paddr; in ath11k_qmi_wlanfw_m3_info_send()
2602 req.size = m3_mem->size; in ath11k_qmi_wlanfw_m3_info_send()
2608 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_wlanfw_m3_info_send()
2615 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_wlanfw_m3_info_send()
2635 ret = -EINVAL; in ath11k_qmi_wlanfw_m3_info_send()
2657 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_wlanfw_mode_send()
2664 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_wlanfw_mode_send()
2677 if (mode == ATH11K_FIRMWARE_MODE_OFF && ret == -ENETRESET) { in ath11k_qmi_wlanfw_mode_send()
2678 ath11k_warn(ab, "WLFW service is dis-connected\n"); in ath11k_qmi_wlanfw_mode_send()
2689 ret = -EINVAL; in ath11k_qmi_wlanfw_mode_send()
2712 ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; in ath11k_qmi_wlanfw_wlan_cfg_send()
2713 svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; in ath11k_qmi_wlanfw_wlan_cfg_send()
2715 ce_cfg = (const struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; in ath11k_qmi_wlanfw_wlan_cfg_send()
2716 svc_cfg = (const struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; in ath11k_qmi_wlanfw_wlan_cfg_send()
2721 return -ENOMEM; in ath11k_qmi_wlanfw_wlan_cfg_send()
2725 req->host_version_valid = 1; in ath11k_qmi_wlanfw_wlan_cfg_send()
2726 strscpy(req->host_version, ATH11K_HOST_VERSION_STRING, in ath11k_qmi_wlanfw_wlan_cfg_send()
2727 sizeof(req->host_version)); in ath11k_qmi_wlanfw_wlan_cfg_send()
2729 req->tgt_cfg_valid = 1; in ath11k_qmi_wlanfw_wlan_cfg_send()
2731 req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len; in ath11k_qmi_wlanfw_wlan_cfg_send()
2732 for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) { in ath11k_qmi_wlanfw_wlan_cfg_send()
2733 req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum; in ath11k_qmi_wlanfw_wlan_cfg_send()
2734 req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir; in ath11k_qmi_wlanfw_wlan_cfg_send()
2735 req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries; in ath11k_qmi_wlanfw_wlan_cfg_send()
2736 req->tgt_cfg[pipe_num].nbytes_max = ce_cfg[pipe_num].nbytes_max; in ath11k_qmi_wlanfw_wlan_cfg_send()
2737 req->tgt_cfg[pipe_num].flags = ce_cfg[pipe_num].flags; in ath11k_qmi_wlanfw_wlan_cfg_send()
2740 req->svc_cfg_valid = 1; in ath11k_qmi_wlanfw_wlan_cfg_send()
2742 req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len; in ath11k_qmi_wlanfw_wlan_cfg_send()
2743 for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) { in ath11k_qmi_wlanfw_wlan_cfg_send()
2744 req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id; in ath11k_qmi_wlanfw_wlan_cfg_send()
2745 req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir; in ath11k_qmi_wlanfw_wlan_cfg_send()
2746 req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum; in ath11k_qmi_wlanfw_wlan_cfg_send()
2748 req->shadow_reg_valid = 0; in ath11k_qmi_wlanfw_wlan_cfg_send()
2751 if (ab->hw_params.supports_shadow_regs) { in ath11k_qmi_wlanfw_wlan_cfg_send()
2752 req->shadow_reg_v2_valid = 1; in ath11k_qmi_wlanfw_wlan_cfg_send()
2753 req->shadow_reg_v2_len = min_t(u32, in ath11k_qmi_wlanfw_wlan_cfg_send()
2754 ab->qmi.ce_cfg.shadow_reg_v2_len, in ath11k_qmi_wlanfw_wlan_cfg_send()
2756 memcpy(&req->shadow_reg_v2, ab->qmi.ce_cfg.shadow_reg_v2, in ath11k_qmi_wlanfw_wlan_cfg_send()
2757 sizeof(u32) * req->shadow_reg_v2_len); in ath11k_qmi_wlanfw_wlan_cfg_send()
2759 req->shadow_reg_v2_valid = 0; in ath11k_qmi_wlanfw_wlan_cfg_send()
2762 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_wlanfw_wlan_cfg_send()
2769 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_wlanfw_wlan_cfg_send()
2789 ret = -EINVAL; in ath11k_qmi_wlanfw_wlan_cfg_send()
2808 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_wlanfw_wlan_ini_send()
2813 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_wlanfw_wlan_ini_send()
2833 ret = -EINVAL; in ath11k_qmi_wlanfw_wlan_ini_send()
2860 if (ab->hw_params.fw_wmi_diag_event) { in ath11k_qmi_firmware_start()
2863 ath11k_warn(ab, "qmi failed to send wlan fw ini:%d\n", ret); in ath11k_qmi_firmware_start()
2876 ath11k_warn(ab, "qmi failed to send wlan fw mode: %d\n", ret); in ath11k_qmi_firmware_start()
2888 ab->hw_params.cbcal_restart_fw == 0) in ath11k_qmi_fwreset_from_cold_boot()
2893 timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, in ath11k_qmi_fwreset_from_cold_boot()
2894 (ab->qmi.cal_done == 1), in ath11k_qmi_fwreset_from_cold_boot()
2899 return -ETIMEDOUT; in ath11k_qmi_fwreset_from_cold_boot()
2917 ath11k_warn(ab, "qmi failed to send wlan fw mode: %d\n", ret); in ath11k_qmi_process_coldboot_calibration()
2923 timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, in ath11k_qmi_process_coldboot_calibration()
2924 (ab->qmi.cal_done == 1), in ath11k_qmi_process_coldboot_calibration()
2945 return -ENOMEM; in ath11k_qmi_driver_event_post()
2947 event->type = type; in ath11k_qmi_driver_event_post()
2948 event->data = data; in ath11k_qmi_driver_event_post()
2950 spin_lock(&qmi->event_lock); in ath11k_qmi_driver_event_post()
2951 list_add_tail(&event->list, &qmi->event_list); in ath11k_qmi_driver_event_post()
2952 spin_unlock(&qmi->event_lock); in ath11k_qmi_driver_event_post()
2954 queue_work(qmi->event_wq, &qmi->event_work); in ath11k_qmi_driver_event_post()
2961 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_event_mem_request()
2966 ath11k_warn(ab, "qmi failed to respond fw mem req: %d\n", ret); in ath11k_qmi_event_mem_request()
2975 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_event_load_bdf()
2991 if (ab->hw_params.supports_regdb) in ath11k_qmi_event_load_bdf()
3005 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_event_server_arrive()
3021 if (!ab->hw_params.fixed_fw_mem) in ath11k_qmi_event_server_arrive()
3039 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_mem_request_cb()
3045 if (msg->mem_seg_len == 0 || in ath11k_qmi_msg_mem_request_cb()
3046 msg->mem_seg_len > ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01) in ath11k_qmi_msg_mem_request_cb()
3048 msg->mem_seg_len); in ath11k_qmi_msg_mem_request_cb()
3050 ab->qmi.mem_seg_count = msg->mem_seg_len; in ath11k_qmi_msg_mem_request_cb()
3052 for (i = 0; i < qmi->mem_seg_count ; i++) { in ath11k_qmi_msg_mem_request_cb()
3053 ab->qmi.target_mem[i].type = msg->mem_seg[i].type; in ath11k_qmi_msg_mem_request_cb()
3054 ab->qmi.target_mem[i].size = msg->mem_seg[i].size; in ath11k_qmi_msg_mem_request_cb()
3056 msg->mem_seg[i].type, msg->mem_seg[i].size); in ath11k_qmi_msg_mem_request_cb()
3059 if (ab->hw_params.fixed_mem_region || in ath11k_qmi_msg_mem_request_cb()
3060 test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) { in ath11k_qmi_msg_mem_request_cb()
3085 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_mem_ready_cb()
3097 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_fw_ready_cb()
3101 if (!ab->qmi.cal_done) { in ath11k_qmi_msg_fw_ready_cb()
3102 ab->qmi.cal_done = 1; in ath11k_qmi_msg_fw_ready_cb()
3103 wake_up(&ab->qmi.cold_boot_waitq); in ath11k_qmi_msg_fw_ready_cb()
3116 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_cold_boot_cal_done_cb()
3118 ab->qmi.cal_done = 1; in ath11k_qmi_msg_cold_boot_cal_done_cb()
3119 wake_up(&ab->qmi.cold_boot_waitq); in ath11k_qmi_msg_cold_boot_cal_done_cb()
3130 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_fw_init_done_cb()
3183 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_ops_new_server()
3184 struct sockaddr_qrtr *sq = &qmi->sq; in ath11k_qmi_ops_new_server()
3187 sq->sq_family = AF_QIPCRTR; in ath11k_qmi_ops_new_server()
3188 sq->sq_node = service->node; in ath11k_qmi_ops_new_server()
3189 sq->sq_port = service->port; in ath11k_qmi_ops_new_server()
3191 ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)sq, in ath11k_qmi_ops_new_server()
3198 ath11k_dbg(ab, ATH11K_DBG_QMI, "wifi fw qmi service connected\n"); in ath11k_qmi_ops_new_server()
3208 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_ops_del_server()
3210 ath11k_dbg(ab, ATH11K_DBG_QMI, "wifi fw del server\n"); in ath11k_qmi_ops_del_server()
3224 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_driver_event_work()
3227 spin_lock(&qmi->event_lock); in ath11k_qmi_driver_event_work()
3228 while (!list_empty(&qmi->event_list)) { in ath11k_qmi_driver_event_work()
3229 event = list_first_entry(&qmi->event_list, in ath11k_qmi_driver_event_work()
3231 list_del(&event->list); in ath11k_qmi_driver_event_work()
3232 spin_unlock(&qmi->event_lock); in ath11k_qmi_driver_event_work()
3234 if (test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags)) { in ath11k_qmi_driver_event_work()
3239 switch (event->type) { in ath11k_qmi_driver_event_work()
3243 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3246 set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3247 set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3249 if (!ab->is_reset) in ath11k_qmi_driver_event_work()
3255 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3260 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3268 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3273 clear_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3274 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) { in ath11k_qmi_driver_event_work()
3276 queue_work(ab->workqueue, &ab->restart_work); in ath11k_qmi_driver_event_work()
3280 if (ab->qmi.cal_done == 0 && in ath11k_qmi_driver_event_work()
3285 &ab->dev_flags); in ath11k_qmi_driver_event_work()
3286 clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3289 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3292 set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3297 /* For targets requiring a FW restart upon cold in ath11k_qmi_driver_event_work()
3299 * FW ready; such targets will receive FW init in ath11k_qmi_driver_event_work()
3300 * done message after FW restart. in ath11k_qmi_driver_event_work()
3302 if (ab->hw_params.cbcal_restart_fw) in ath11k_qmi_driver_event_work()
3306 &ab->dev_flags); in ath11k_qmi_driver_event_work()
3307 clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3309 set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3315 ath11k_warn(ab, "invalid qmi event type: %d", event->type); in ath11k_qmi_driver_event_work()
3319 spin_lock(&qmi->event_lock); in ath11k_qmi_driver_event_work()
3321 spin_unlock(&qmi->event_lock); in ath11k_qmi_driver_event_work()
3328 memset(&ab->qmi.target, 0, sizeof(struct target_info)); in ath11k_qmi_init_service()
3329 memset(&ab->qmi.target_mem, 0, sizeof(struct target_mem_chunk)); in ath11k_qmi_init_service()
3330 ab->qmi.ab = ab; in ath11k_qmi_init_service()
3332 ab->qmi.target_mem_mode = ab->hw_params.fw_mem_mode; in ath11k_qmi_init_service()
3333 ret = qmi_handle_init(&ab->qmi.handle, ATH11K_QMI_RESP_LEN_MAX, in ath11k_qmi_init_service()
3340 ab->qmi.event_wq = alloc_ordered_workqueue("ath11k_qmi_driver_event", 0); in ath11k_qmi_init_service()
3341 if (!ab->qmi.event_wq) { in ath11k_qmi_init_service()
3343 return -EFAULT; in ath11k_qmi_init_service()
3346 INIT_LIST_HEAD(&ab->qmi.event_list); in ath11k_qmi_init_service()
3347 spin_lock_init(&ab->qmi.event_lock); in ath11k_qmi_init_service()
3348 INIT_WORK(&ab->qmi.event_work, ath11k_qmi_driver_event_work); in ath11k_qmi_init_service()
3350 ret = qmi_add_lookup(&ab->qmi.handle, ATH11K_QMI_WLFW_SERVICE_ID_V01, in ath11k_qmi_init_service()
3352 ab->qmi.service_ins_id); in ath11k_qmi_init_service()
3355 destroy_workqueue(ab->qmi.event_wq); in ath11k_qmi_init_service()
3364 qmi_handle_release(&ab->qmi.handle); in ath11k_qmi_deinit_service()
3365 cancel_work_sync(&ab->qmi.event_work); in ath11k_qmi_deinit_service()
3366 destroy_workqueue(ab->qmi.event_wq); in ath11k_qmi_deinit_service()