Lines Matching +full:segment +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) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
94 gpios),
1719 req.mem_cfg_mode = ab->qmi.target_mem_mode; in ath11k_qmi_host_cap_send()
1724 if (ab->hw_params.m3_fw_support) { in ath11k_qmi_host_cap_send()
1737 req.cal_done = ab->qmi.cal_done; in ath11k_qmi_host_cap_send()
1739 if (ab->hw_params.internal_sleep_clock) { in ath11k_qmi_host_cap_send()
1742 /* Notify firmware that this is non-qualcomm platform. */ in ath11k_qmi_host_cap_send()
1747 * non-qualcomm platforms should select internal sleep in ath11k_qmi_host_cap_send()
1753 if (ab->hw_params.global_reset) in ath11k_qmi_host_cap_send()
1760 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_host_cap_send()
1765 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_host_cap_send()
1782 ret = -EINVAL; in ath11k_qmi_host_cap_send()
1794 struct qmi_handle *handle = &ab->qmi.handle; in ath11k_qmi_fw_ind_register_send()
1800 return -ENOMEM; in ath11k_qmi_fw_ind_register_send()
1804 ret = -ENOMEM; in ath11k_qmi_fw_ind_register_send()
1808 req->client_id_valid = 1; in ath11k_qmi_fw_ind_register_send()
1809 req->client_id = QMI_WLANFW_CLIENT_ID; in ath11k_qmi_fw_ind_register_send()
1810 req->fw_ready_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1811 req->fw_ready_enable = 1; in ath11k_qmi_fw_ind_register_send()
1812 req->cal_done_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1813 req->cal_done_enable = 1; in ath11k_qmi_fw_ind_register_send()
1814 req->fw_init_done_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1815 req->fw_init_done_enable = 1; in ath11k_qmi_fw_ind_register_send()
1817 req->pin_connect_result_enable_valid = 0; in ath11k_qmi_fw_ind_register_send()
1818 req->pin_connect_result_enable = 0; in ath11k_qmi_fw_ind_register_send()
1824 if (!ab->hw_params.fixed_fw_mem) { in ath11k_qmi_fw_ind_register_send()
1825 req->request_mem_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1826 req->request_mem_enable = 1; in ath11k_qmi_fw_ind_register_send()
1827 req->fw_mem_ready_enable_valid = 1; in ath11k_qmi_fw_ind_register_send()
1828 req->fw_mem_ready_enable = 1; in ath11k_qmi_fw_ind_register_send()
1838 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_fw_ind_register_send()
1855 if (resp->resp.result != QMI_RESULT_SUCCESS_V01) { in ath11k_qmi_fw_ind_register_send()
1857 resp->resp.result, resp->resp.error); in ath11k_qmi_fw_ind_register_send()
1858 ret = -EINVAL; in ath11k_qmi_fw_ind_register_send()
1879 return -ENOMEM; in ath11k_qmi_respond_fw_mem_request()
1888 if (!(ab->hw_params.fixed_mem_region || in ath11k_qmi_respond_fw_mem_request()
1889 test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) && in ath11k_qmi_respond_fw_mem_request()
1890 ab->qmi.target_mem_delayed) { in ath11k_qmi_respond_fw_mem_request()
1893 ab->qmi.mem_seg_count); in ath11k_qmi_respond_fw_mem_request()
1897 req->mem_seg_len = ab->qmi.mem_seg_count; in ath11k_qmi_respond_fw_mem_request()
1899 for (i = 0; i < req->mem_seg_len ; i++) { in ath11k_qmi_respond_fw_mem_request()
1900 req->mem_seg[i].addr = ab->qmi.target_mem[i].paddr; in ath11k_qmi_respond_fw_mem_request()
1901 req->mem_seg[i].size = ab->qmi.target_mem[i].size; in ath11k_qmi_respond_fw_mem_request()
1902 req->mem_seg[i].type = ab->qmi.target_mem[i].type; in ath11k_qmi_respond_fw_mem_request()
1905 &ab->qmi.target_mem[i].paddr, in ath11k_qmi_respond_fw_mem_request()
1906 ab->qmi.target_mem[i].size, in ath11k_qmi_respond_fw_mem_request()
1907 ab->qmi.target_mem[i].type); in ath11k_qmi_respond_fw_mem_request()
1911 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_respond_fw_mem_request()
1919 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_respond_fw_mem_request()
1945 ret = -EINVAL; in ath11k_qmi_respond_fw_mem_request()
1957 for (i = 0; i < ab->qmi.mem_seg_count; i++) { in ath11k_qmi_free_target_mem_chunk()
1958 if ((ab->hw_params.fixed_mem_region || in ath11k_qmi_free_target_mem_chunk()
1959 test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) && in ath11k_qmi_free_target_mem_chunk()
1960 ab->qmi.target_mem[i].iaddr) in ath11k_qmi_free_target_mem_chunk()
1961 iounmap(ab->qmi.target_mem[i].iaddr); in ath11k_qmi_free_target_mem_chunk()
1963 if (!ab->qmi.target_mem[i].vaddr) in ath11k_qmi_free_target_mem_chunk()
1966 dma_free_coherent(ab->dev, in ath11k_qmi_free_target_mem_chunk()
1967 ab->qmi.target_mem[i].prev_size, in ath11k_qmi_free_target_mem_chunk()
1968 ab->qmi.target_mem[i].vaddr, in ath11k_qmi_free_target_mem_chunk()
1969 ab->qmi.target_mem[i].paddr); in ath11k_qmi_free_target_mem_chunk()
1970 ab->qmi.target_mem[i].vaddr = NULL; in ath11k_qmi_free_target_mem_chunk()
1979 ab->qmi.target_mem_delayed = false; in ath11k_qmi_alloc_target_mem_chunk()
1981 for (i = 0; i < ab->qmi.mem_seg_count; i++) { in ath11k_qmi_alloc_target_mem_chunk()
1982 chunk = &ab->qmi.target_mem[i]; in ath11k_qmi_alloc_target_mem_chunk()
1987 if (chunk->vaddr) { in ath11k_qmi_alloc_target_mem_chunk()
1988 if (chunk->prev_type == chunk->type && in ath11k_qmi_alloc_target_mem_chunk()
1989 chunk->prev_size == chunk->size) in ath11k_qmi_alloc_target_mem_chunk()
1993 dma_free_coherent(ab->dev, chunk->prev_size, in ath11k_qmi_alloc_target_mem_chunk()
1994 chunk->vaddr, chunk->paddr); in ath11k_qmi_alloc_target_mem_chunk()
1995 chunk->vaddr = NULL; in ath11k_qmi_alloc_target_mem_chunk()
1998 chunk->vaddr = dma_alloc_coherent(ab->dev, in ath11k_qmi_alloc_target_mem_chunk()
1999 chunk->size, in ath11k_qmi_alloc_target_mem_chunk()
2000 &chunk->paddr, in ath11k_qmi_alloc_target_mem_chunk()
2002 if (!chunk->vaddr) { in ath11k_qmi_alloc_target_mem_chunk()
2003 if (ab->qmi.mem_seg_count <= ATH11K_QMI_FW_MEM_REQ_SEGMENT_CNT) { in ath11k_qmi_alloc_target_mem_chunk()
2006 chunk->size, in ath11k_qmi_alloc_target_mem_chunk()
2007 chunk->type); in ath11k_qmi_alloc_target_mem_chunk()
2009 ab->qmi.target_mem_delayed = true; in ath11k_qmi_alloc_target_mem_chunk()
2014 chunk->size, in ath11k_qmi_alloc_target_mem_chunk()
2015 chunk->type); in ath11k_qmi_alloc_target_mem_chunk()
2016 return -EINVAL; in ath11k_qmi_alloc_target_mem_chunk()
2018 chunk->prev_type = chunk->type; in ath11k_qmi_alloc_target_mem_chunk()
2019 chunk->prev_size = chunk->size; in ath11k_qmi_alloc_target_mem_chunk()
2027 struct device *dev = ab->dev; in ath11k_qmi_assign_target_mem_chunk()
2033 for (i = 0, idx = 0; i < ab->qmi.mem_seg_count; i++) { in ath11k_qmi_assign_target_mem_chunk()
2034 switch (ab->qmi.target_mem[i].type) { in ath11k_qmi_assign_target_mem_chunk()
2036 hremote_node = of_parse_phandle(dev->of_node, "memory-region", 0); in ath11k_qmi_assign_target_mem_chunk()
2040 return -ENODEV; in ath11k_qmi_assign_target_mem_chunk()
2051 if (res.end - res.start + 1 < ab->qmi.target_mem[i].size) { in ath11k_qmi_assign_target_mem_chunk()
2054 return -EINVAL; in ath11k_qmi_assign_target_mem_chunk()
2057 ab->qmi.target_mem[idx].paddr = res.start; in ath11k_qmi_assign_target_mem_chunk()
2058 ab->qmi.target_mem[idx].iaddr = in ath11k_qmi_assign_target_mem_chunk()
2059 ioremap(ab->qmi.target_mem[idx].paddr, in ath11k_qmi_assign_target_mem_chunk()
2060 ab->qmi.target_mem[i].size); in ath11k_qmi_assign_target_mem_chunk()
2061 if (!ab->qmi.target_mem[idx].iaddr) in ath11k_qmi_assign_target_mem_chunk()
2062 return -EIO; in ath11k_qmi_assign_target_mem_chunk()
2064 ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; in ath11k_qmi_assign_target_mem_chunk()
2065 host_ddr_sz = ab->qmi.target_mem[i].size; in ath11k_qmi_assign_target_mem_chunk()
2066 ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; in ath11k_qmi_assign_target_mem_chunk()
2070 ab->qmi.target_mem[idx].paddr = ab->hw_params.bdf_addr; in ath11k_qmi_assign_target_mem_chunk()
2071 ab->qmi.target_mem[idx].vaddr = NULL; in ath11k_qmi_assign_target_mem_chunk()
2072 ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; in ath11k_qmi_assign_target_mem_chunk()
2073 ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; in ath11k_qmi_assign_target_mem_chunk()
2077 if (ab->qmi.target_mem[i].size > ATH11K_QMI_CALDB_SIZE) { in ath11k_qmi_assign_target_mem_chunk()
2079 return -EINVAL; in ath11k_qmi_assign_target_mem_chunk()
2084 ab->qmi.target_mem[idx].paddr = in ath11k_qmi_assign_target_mem_chunk()
2086 ab->qmi.target_mem[idx].iaddr = in ath11k_qmi_assign_target_mem_chunk()
2087 ioremap(ab->qmi.target_mem[idx].paddr, in ath11k_qmi_assign_target_mem_chunk()
2088 ab->qmi.target_mem[i].size); in ath11k_qmi_assign_target_mem_chunk()
2089 if (!ab->qmi.target_mem[idx].iaddr) in ath11k_qmi_assign_target_mem_chunk()
2090 return -EIO; in ath11k_qmi_assign_target_mem_chunk()
2092 ab->qmi.target_mem[idx].paddr = in ath11k_qmi_assign_target_mem_chunk()
2096 ab->qmi.target_mem[idx].paddr = 0; in ath11k_qmi_assign_target_mem_chunk()
2097 ab->qmi.target_mem[idx].vaddr = NULL; in ath11k_qmi_assign_target_mem_chunk()
2099 ab->qmi.target_mem[idx].size = ab->qmi.target_mem[i].size; in ath11k_qmi_assign_target_mem_chunk()
2100 ab->qmi.target_mem[idx].type = ab->qmi.target_mem[i].type; in ath11k_qmi_assign_target_mem_chunk()
2105 ab->qmi.target_mem[i].type); in ath11k_qmi_assign_target_mem_chunk()
2109 ab->qmi.mem_seg_count = idx; in ath11k_qmi_assign_target_mem_chunk()
2123 if (!ab->hw_params.hybrid_bus_type) in ath11k_qmi_request_device_info()
2126 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_request_device_info()
2131 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_request_device_info()
2152 ret = -EINVAL; in ath11k_qmi_request_device_info()
2159 ret = -EINVAL; in ath11k_qmi_request_device_info()
2167 ret = -EINVAL; in ath11k_qmi_request_device_info()
2171 bar_addr_va = devm_ioremap(ab->dev, resp.bar_addr, resp.bar_size); in ath11k_qmi_request_device_info()
2175 ab->mem_len = 0; in ath11k_qmi_request_device_info()
2176 ret = -EIO; in ath11k_qmi_request_device_info()
2180 ab->mem = bar_addr_va; in ath11k_qmi_request_device_info()
2181 ab->mem_len = resp.bar_size; in ath11k_qmi_request_device_info()
2183 if (!ab->hw_params.ce_remap) in ath11k_qmi_request_device_info()
2184 ab->mem_ce = ab->mem; in ath11k_qmi_request_device_info()
2204 ret = qmi_txn_init(&ab->qmi.handle, &txn, qmi_wlanfw_cap_resp_msg_v01_ei, in ath11k_qmi_request_target_cap()
2211 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_request_target_cap()
2231 ret = -EINVAL; in ath11k_qmi_request_target_cap()
2236 ab->qmi.target.chip_id = resp.chip_info.chip_id; in ath11k_qmi_request_target_cap()
2237 ab->qmi.target.chip_family = resp.chip_info.chip_family; in ath11k_qmi_request_target_cap()
2241 ab->qmi.target.board_id = resp.board_info.board_id; in ath11k_qmi_request_target_cap()
2243 ab->qmi.target.board_id = 0xFF; in ath11k_qmi_request_target_cap()
2246 ab->qmi.target.soc_id = resp.soc_info.soc_id; in ath11k_qmi_request_target_cap()
2249 ab->qmi.target.fw_version = resp.fw_version_info.fw_version; in ath11k_qmi_request_target_cap()
2250 strscpy(ab->qmi.target.fw_build_timestamp, in ath11k_qmi_request_target_cap()
2252 sizeof(ab->qmi.target.fw_build_timestamp)); in ath11k_qmi_request_target_cap()
2256 strscpy(ab->qmi.target.fw_build_id, resp.fw_build_id, in ath11k_qmi_request_target_cap()
2257 sizeof(ab->qmi.target.fw_build_id)); in ath11k_qmi_request_target_cap()
2260 ab->qmi.target.eeprom_caldata = in ath11k_qmi_request_target_cap()
2265 fw_build_id = ab->qmi.target.fw_build_id; in ath11k_qmi_request_target_cap()
2271 ab->qmi.target.chip_id, ab->qmi.target.chip_family, in ath11k_qmi_request_target_cap()
2272 ab->qmi.target.board_id, ab->qmi.target.soc_id); in ath11k_qmi_request_target_cap()
2275 ab->qmi.target.fw_version, in ath11k_qmi_request_target_cap()
2276 ab->qmi.target.fw_build_timestamp, in ath11k_qmi_request_target_cap()
2304 return -ENOMEM; in ath11k_qmi_load_file_target_mem()
2308 if (ab->hw_params.fixed_bdf_addr) { in ath11k_qmi_load_file_target_mem()
2309 bdf_addr = ioremap(ab->hw_params.bdf_addr, ab->hw_params.fw.board_size); in ath11k_qmi_load_file_target_mem()
2312 ret = -EIO; in ath11k_qmi_load_file_target_mem()
2318 req->valid = 1; in ath11k_qmi_load_file_target_mem()
2319 req->file_id_valid = 1; in ath11k_qmi_load_file_target_mem()
2320 req->file_id = ab->qmi.target.board_id; in ath11k_qmi_load_file_target_mem()
2321 req->total_size_valid = 1; in ath11k_qmi_load_file_target_mem()
2322 req->total_size = remaining; in ath11k_qmi_load_file_target_mem()
2323 req->seg_id_valid = 1; in ath11k_qmi_load_file_target_mem()
2324 req->data_valid = 1; in ath11k_qmi_load_file_target_mem()
2325 req->bdf_type = type; in ath11k_qmi_load_file_target_mem()
2326 req->bdf_type_valid = 1; in ath11k_qmi_load_file_target_mem()
2327 req->end_valid = 1; in ath11k_qmi_load_file_target_mem()
2328 req->end = 0; in ath11k_qmi_load_file_target_mem()
2331 req->data_len = QMI_WLANFW_MAX_DATA_SIZE_V01; in ath11k_qmi_load_file_target_mem()
2333 req->data_len = remaining; in ath11k_qmi_load_file_target_mem()
2334 req->end = 1; in ath11k_qmi_load_file_target_mem()
2337 if (ab->hw_params.fixed_bdf_addr || in ath11k_qmi_load_file_target_mem()
2339 req->data_valid = 0; in ath11k_qmi_load_file_target_mem()
2340 req->end = 1; in ath11k_qmi_load_file_target_mem()
2341 req->data_len = ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE; in ath11k_qmi_load_file_target_mem()
2343 memcpy(req->data, temp, req->data_len); in ath11k_qmi_load_file_target_mem()
2346 if (ab->hw_params.fixed_bdf_addr) { in ath11k_qmi_load_file_target_mem()
2348 bdf_addr += ab->hw_params.fw.cal_offset; in ath11k_qmi_load_file_target_mem()
2353 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_load_file_target_mem()
2362 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_load_file_target_mem()
2381 ret = -EINVAL; in ath11k_qmi_load_file_target_mem()
2385 if (ab->hw_params.fixed_bdf_addr || in ath11k_qmi_load_file_target_mem()
2389 remaining -= req->data_len; in ath11k_qmi_load_file_target_mem()
2390 temp += req->data_len; in ath11k_qmi_load_file_target_mem()
2391 req->seg_id++; in ath11k_qmi_load_file_target_mem()
2398 if (ab->hw_params.fixed_bdf_addr) in ath11k_qmi_load_file_target_mem()
2410 struct device *dev = ab->dev; in ath11k_qmi_load_bdf_qmi()
2440 fw_size = min_t(u32, ab->hw_params.fw.board_size, bd.len); in ath11k_qmi_load_bdf_qmi()
2452 if (ab->qmi.target.eeprom_caldata) { in ath11k_qmi_load_bdf_qmi()
2459 /* cal-<bus>-<id>.bin */ in ath11k_qmi_load_bdf_qmi()
2460 snprintf(filename, sizeof(filename), "cal-%s-%s.bin", in ath11k_qmi_load_bdf_qmi()
2461 ath11k_bus_str(ab->hif.bus), dev_name(dev)); in ath11k_qmi_load_bdf_qmi()
2483 fw_size = min_t(u32, ab->hw_params.fw.board_size, fw_entry->size); in ath11k_qmi_load_bdf_qmi()
2484 tmp = fw_entry->data; in ath11k_qmi_load_bdf_qmi()
2496 if (!ab->qmi.target.eeprom_caldata) in ath11k_qmi_load_bdf_qmi()
2507 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath11k_qmi_m3_load()
2514 if (m3_mem->vaddr) in ath11k_qmi_m3_load()
2518 if (ab->fw.m3_data && ab->fw.m3_len > 0) { in ath11k_qmi_m3_load()
2519 /* firmware-N.bin had a m3 firmware file so use that */ in ath11k_qmi_m3_load()
2520 m3_data = ab->fw.m3_data; in ath11k_qmi_m3_load()
2521 m3_len = ab->fw.m3_len; in ath11k_qmi_m3_load()
2523 /* No m3 file in firmware-N.bin so try to request old in ath11k_qmi_m3_load()
2535 m3_data = fw->data; in ath11k_qmi_m3_load()
2536 m3_len = fw->size; in ath11k_qmi_m3_load()
2539 m3_mem->vaddr = dma_alloc_coherent(ab->dev, in ath11k_qmi_m3_load()
2540 m3_len, &m3_mem->paddr, in ath11k_qmi_m3_load()
2542 if (!m3_mem->vaddr) { in ath11k_qmi_m3_load()
2544 fw->size); in ath11k_qmi_m3_load()
2545 ret = -ENOMEM; in ath11k_qmi_m3_load()
2549 memcpy(m3_mem->vaddr, m3_data, m3_len); in ath11k_qmi_m3_load()
2550 m3_mem->size = m3_len; in ath11k_qmi_m3_load()
2562 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath11k_qmi_m3_free()
2564 if (!ab->hw_params.m3_fw_support || !m3_mem->vaddr) in ath11k_qmi_m3_free()
2567 dma_free_coherent(ab->dev, m3_mem->size, in ath11k_qmi_m3_free()
2568 m3_mem->vaddr, m3_mem->paddr); in ath11k_qmi_m3_free()
2569 m3_mem->vaddr = NULL; in ath11k_qmi_m3_free()
2570 m3_mem->size = 0; in ath11k_qmi_m3_free()
2575 struct m3_mem_region *m3_mem = &ab->qmi.m3_mem; in ath11k_qmi_wlanfw_m3_info_send()
2584 if (ab->hw_params.m3_fw_support) { in ath11k_qmi_wlanfw_m3_info_send()
2591 req.addr = m3_mem->paddr; in ath11k_qmi_wlanfw_m3_info_send()
2592 req.size = m3_mem->size; in ath11k_qmi_wlanfw_m3_info_send()
2598 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_wlanfw_m3_info_send()
2605 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_wlanfw_m3_info_send()
2625 ret = -EINVAL; in ath11k_qmi_wlanfw_m3_info_send()
2647 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_wlanfw_mode_send()
2654 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_wlanfw_mode_send()
2667 if (mode == ATH11K_FIRMWARE_MODE_OFF && ret == -ENETRESET) { in ath11k_qmi_wlanfw_mode_send()
2668 ath11k_warn(ab, "WLFW service is dis-connected\n"); in ath11k_qmi_wlanfw_mode_send()
2679 ret = -EINVAL; in ath11k_qmi_wlanfw_mode_send()
2696 ce_cfg = (struct ce_pipe_config *)ab->qmi.ce_cfg.tgt_ce; in ath11k_qmi_wlanfw_wlan_cfg_send()
2697 svc_cfg = (struct service_to_pipe *)ab->qmi.ce_cfg.svc_to_ce_map; in ath11k_qmi_wlanfw_wlan_cfg_send()
2701 return -ENOMEM; in ath11k_qmi_wlanfw_wlan_cfg_send()
2705 req->host_version_valid = 1; in ath11k_qmi_wlanfw_wlan_cfg_send()
2706 strscpy(req->host_version, ATH11K_HOST_VERSION_STRING, in ath11k_qmi_wlanfw_wlan_cfg_send()
2707 sizeof(req->host_version)); in ath11k_qmi_wlanfw_wlan_cfg_send()
2709 req->tgt_cfg_valid = 1; in ath11k_qmi_wlanfw_wlan_cfg_send()
2711 req->tgt_cfg_len = ab->qmi.ce_cfg.tgt_ce_len; in ath11k_qmi_wlanfw_wlan_cfg_send()
2712 for (pipe_num = 0; pipe_num < req->tgt_cfg_len ; pipe_num++) { in ath11k_qmi_wlanfw_wlan_cfg_send()
2713 req->tgt_cfg[pipe_num].pipe_num = ce_cfg[pipe_num].pipenum; in ath11k_qmi_wlanfw_wlan_cfg_send()
2714 req->tgt_cfg[pipe_num].pipe_dir = ce_cfg[pipe_num].pipedir; in ath11k_qmi_wlanfw_wlan_cfg_send()
2715 req->tgt_cfg[pipe_num].nentries = ce_cfg[pipe_num].nentries; in ath11k_qmi_wlanfw_wlan_cfg_send()
2716 req->tgt_cfg[pipe_num].nbytes_max = ce_cfg[pipe_num].nbytes_max; in ath11k_qmi_wlanfw_wlan_cfg_send()
2717 req->tgt_cfg[pipe_num].flags = ce_cfg[pipe_num].flags; in ath11k_qmi_wlanfw_wlan_cfg_send()
2720 req->svc_cfg_valid = 1; in ath11k_qmi_wlanfw_wlan_cfg_send()
2722 req->svc_cfg_len = ab->qmi.ce_cfg.svc_to_ce_map_len; in ath11k_qmi_wlanfw_wlan_cfg_send()
2723 for (pipe_num = 0; pipe_num < req->svc_cfg_len; pipe_num++) { in ath11k_qmi_wlanfw_wlan_cfg_send()
2724 req->svc_cfg[pipe_num].service_id = svc_cfg[pipe_num].service_id; in ath11k_qmi_wlanfw_wlan_cfg_send()
2725 req->svc_cfg[pipe_num].pipe_dir = svc_cfg[pipe_num].pipedir; in ath11k_qmi_wlanfw_wlan_cfg_send()
2726 req->svc_cfg[pipe_num].pipe_num = svc_cfg[pipe_num].pipenum; in ath11k_qmi_wlanfw_wlan_cfg_send()
2728 req->shadow_reg_valid = 0; in ath11k_qmi_wlanfw_wlan_cfg_send()
2731 if (ab->hw_params.supports_shadow_regs) { in ath11k_qmi_wlanfw_wlan_cfg_send()
2732 req->shadow_reg_v2_valid = 1; in ath11k_qmi_wlanfw_wlan_cfg_send()
2733 req->shadow_reg_v2_len = min_t(u32, in ath11k_qmi_wlanfw_wlan_cfg_send()
2734 ab->qmi.ce_cfg.shadow_reg_v2_len, in ath11k_qmi_wlanfw_wlan_cfg_send()
2736 memcpy(&req->shadow_reg_v2, ab->qmi.ce_cfg.shadow_reg_v2, in ath11k_qmi_wlanfw_wlan_cfg_send()
2737 sizeof(u32) * req->shadow_reg_v2_len); in ath11k_qmi_wlanfw_wlan_cfg_send()
2739 req->shadow_reg_v2_valid = 0; in ath11k_qmi_wlanfw_wlan_cfg_send()
2742 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_wlanfw_wlan_cfg_send()
2749 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_wlanfw_wlan_cfg_send()
2769 ret = -EINVAL; in ath11k_qmi_wlanfw_wlan_cfg_send()
2788 ret = qmi_txn_init(&ab->qmi.handle, &txn, in ath11k_qmi_wlanfw_wlan_ini_send()
2793 ret = qmi_send_request(&ab->qmi.handle, NULL, &txn, in ath11k_qmi_wlanfw_wlan_ini_send()
2813 ret = -EINVAL; in ath11k_qmi_wlanfw_wlan_ini_send()
2840 if (ab->hw_params.fw_wmi_diag_event) { in ath11k_qmi_firmware_start()
2868 ab->hw_params.cbcal_restart_fw == 0) in ath11k_qmi_fwreset_from_cold_boot()
2873 time_left = wait_event_timeout(ab->qmi.cold_boot_waitq, in ath11k_qmi_fwreset_from_cold_boot()
2874 (ab->qmi.cal_done == 1), in ath11k_qmi_fwreset_from_cold_boot()
2879 return -ETIMEDOUT; in ath11k_qmi_fwreset_from_cold_boot()
2903 time_left = wait_event_timeout(ab->qmi.cold_boot_waitq, in ath11k_qmi_process_coldboot_calibration()
2904 (ab->qmi.cal_done == 1), in ath11k_qmi_process_coldboot_calibration()
2925 return -ENOMEM; in ath11k_qmi_driver_event_post()
2927 event->type = type; in ath11k_qmi_driver_event_post()
2928 event->data = data; in ath11k_qmi_driver_event_post()
2930 spin_lock(&qmi->event_lock); in ath11k_qmi_driver_event_post()
2931 list_add_tail(&event->list, &qmi->event_list); in ath11k_qmi_driver_event_post()
2932 spin_unlock(&qmi->event_lock); in ath11k_qmi_driver_event_post()
2934 queue_work(qmi->event_wq, &qmi->event_work); in ath11k_qmi_driver_event_post()
2941 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_event_mem_request()
2955 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_event_load_bdf()
2971 if (ab->hw_params.supports_regdb) in ath11k_qmi_event_load_bdf()
2985 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_event_server_arrive()
3001 if (!ab->hw_params.fixed_fw_mem) in ath11k_qmi_event_server_arrive()
3019 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_mem_request_cb()
3025 if (msg->mem_seg_len == 0 || in ath11k_qmi_msg_mem_request_cb()
3026 msg->mem_seg_len > ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01) in ath11k_qmi_msg_mem_request_cb()
3027 ath11k_warn(ab, "invalid memory segment length: %u\n", in ath11k_qmi_msg_mem_request_cb()
3028 msg->mem_seg_len); in ath11k_qmi_msg_mem_request_cb()
3030 ab->qmi.mem_seg_count = msg->mem_seg_len; in ath11k_qmi_msg_mem_request_cb()
3032 for (i = 0; i < qmi->mem_seg_count ; i++) { in ath11k_qmi_msg_mem_request_cb()
3033 ab->qmi.target_mem[i].type = msg->mem_seg[i].type; in ath11k_qmi_msg_mem_request_cb()
3034 ab->qmi.target_mem[i].size = msg->mem_seg[i].size; in ath11k_qmi_msg_mem_request_cb()
3036 msg->mem_seg[i].type, msg->mem_seg[i].size); in ath11k_qmi_msg_mem_request_cb()
3039 if (ab->hw_params.fixed_mem_region || in ath11k_qmi_msg_mem_request_cb()
3040 test_bit(ATH11K_FLAG_FIXED_MEM_RGN, &ab->dev_flags)) { in ath11k_qmi_msg_mem_request_cb()
3065 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_mem_ready_cb()
3077 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_fw_ready_cb()
3081 if (!ab->qmi.cal_done) { in ath11k_qmi_msg_fw_ready_cb()
3082 ab->qmi.cal_done = 1; in ath11k_qmi_msg_fw_ready_cb()
3083 wake_up(&ab->qmi.cold_boot_waitq); in ath11k_qmi_msg_fw_ready_cb()
3096 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_cold_boot_cal_done_cb()
3098 ab->qmi.cal_done = 1; in ath11k_qmi_msg_cold_boot_cal_done_cb()
3099 wake_up(&ab->qmi.cold_boot_waitq); in ath11k_qmi_msg_cold_boot_cal_done_cb()
3110 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_msg_fw_init_done_cb()
3163 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_ops_new_server()
3164 struct sockaddr_qrtr *sq = &qmi->sq; in ath11k_qmi_ops_new_server()
3167 sq->sq_family = AF_QIPCRTR; in ath11k_qmi_ops_new_server()
3168 sq->sq_node = service->node; in ath11k_qmi_ops_new_server()
3169 sq->sq_port = service->port; in ath11k_qmi_ops_new_server()
3171 ret = kernel_connect(qmi_hdl->sock, (struct sockaddr *)sq, in ath11k_qmi_ops_new_server()
3188 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_ops_del_server()
3204 struct ath11k_base *ab = qmi->ab; in ath11k_qmi_driver_event_work()
3207 spin_lock(&qmi->event_lock); in ath11k_qmi_driver_event_work()
3208 while (!list_empty(&qmi->event_list)) { in ath11k_qmi_driver_event_work()
3209 event = list_first_entry(&qmi->event_list, in ath11k_qmi_driver_event_work()
3211 list_del(&event->list); in ath11k_qmi_driver_event_work()
3212 spin_unlock(&qmi->event_lock); in ath11k_qmi_driver_event_work()
3214 if (test_bit(ATH11K_FLAG_UNREGISTERING, &ab->dev_flags)) { in ath11k_qmi_driver_event_work()
3219 switch (event->type) { in ath11k_qmi_driver_event_work()
3223 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3226 set_bit(ATH11K_FLAG_CRASH_FLUSH, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3227 set_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3229 if (!ab->is_reset) in ath11k_qmi_driver_event_work()
3235 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3240 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3248 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3253 clear_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3254 if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) { in ath11k_qmi_driver_event_work()
3255 if (ab->is_reset) in ath11k_qmi_driver_event_work()
3257 queue_work(ab->workqueue, &ab->restart_work); in ath11k_qmi_driver_event_work()
3261 if (ab->qmi.cal_done == 0 && in ath11k_qmi_driver_event_work()
3266 &ab->dev_flags); in ath11k_qmi_driver_event_work()
3267 clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3270 set_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3273 set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3283 if (ab->hw_params.cbcal_restart_fw) in ath11k_qmi_driver_event_work()
3287 &ab->dev_flags); in ath11k_qmi_driver_event_work()
3288 clear_bit(ATH11K_FLAG_RECOVERY, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3290 set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags); in ath11k_qmi_driver_event_work()
3296 ath11k_warn(ab, "invalid qmi event type: %d", event->type); in ath11k_qmi_driver_event_work()
3300 spin_lock(&qmi->event_lock); in ath11k_qmi_driver_event_work()
3302 spin_unlock(&qmi->event_lock); in ath11k_qmi_driver_event_work()
3309 memset(&ab->qmi.target, 0, sizeof(struct target_info)); in ath11k_qmi_init_service()
3310 memset(&ab->qmi.target_mem, 0, sizeof(struct target_mem_chunk)); in ath11k_qmi_init_service()
3311 ab->qmi.ab = ab; in ath11k_qmi_init_service()
3313 ab->qmi.target_mem_mode = ab->hw_params.fw_mem_mode; in ath11k_qmi_init_service()
3314 ret = qmi_handle_init(&ab->qmi.handle, ATH11K_QMI_RESP_LEN_MAX, in ath11k_qmi_init_service()
3321 ab->qmi.event_wq = alloc_ordered_workqueue("ath11k_qmi_driver_event", 0); in ath11k_qmi_init_service()
3322 if (!ab->qmi.event_wq) { in ath11k_qmi_init_service()
3324 return -EFAULT; in ath11k_qmi_init_service()
3327 INIT_LIST_HEAD(&ab->qmi.event_list); in ath11k_qmi_init_service()
3328 spin_lock_init(&ab->qmi.event_lock); in ath11k_qmi_init_service()
3329 INIT_WORK(&ab->qmi.event_work, ath11k_qmi_driver_event_work); in ath11k_qmi_init_service()
3331 ret = qmi_add_lookup(&ab->qmi.handle, ATH11K_QMI_WLFW_SERVICE_ID_V01, in ath11k_qmi_init_service()
3333 ab->qmi.service_ins_id); in ath11k_qmi_init_service()
3336 destroy_workqueue(ab->qmi.event_wq); in ath11k_qmi_init_service()
3345 qmi_handle_release(&ab->qmi.handle); in ath11k_qmi_deinit_service()
3346 cancel_work_sync(&ab->qmi.event_work); in ath11k_qmi_deinit_service()
3347 destroy_workqueue(ab->qmi.event_wq); in ath11k_qmi_deinit_service()