mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-21 03:13:17 +00:00
191 lines
5.5 KiB
Diff
191 lines
5.5 KiB
Diff
From ae444bf877fd94256a110d03582ddb045c541525 Mon Sep 17 00:00:00 2001
|
|
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
|
|
Date: Wed, 24 Aug 2022 11:25:31 -0800
|
|
Subject: [PATCH] ath12k: add bus param struct
|
|
|
|
Struct ath12k_bus_params was removed in upstream. Add it back.
|
|
|
|
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
|
|
|
|
--- a/drivers/net/wireless/ath/ath12k/core.c
|
|
+++ b/drivers/net/wireless/ath/ath12k/core.c
|
|
@@ -929,7 +929,8 @@ void ath12k_core_free(struct ath12k_base
|
|
}
|
|
|
|
struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
|
|
- enum ath12k_bus bus)
|
|
+ enum ath12k_bus bus,
|
|
+ const struct ath12k_bus_params *bus_params)
|
|
{
|
|
struct ath12k_base *ab;
|
|
|
|
@@ -964,6 +965,7 @@ struct ath12k_base *ath12k_core_alloc(st
|
|
init_completion(&ab->wow.wakeup_completed);
|
|
|
|
ab->dev = dev;
|
|
+ ab->bus_params = *bus_params;
|
|
ab->hif.bus = bus;
|
|
|
|
return ab;
|
|
--- a/drivers/net/wireless/ath/ath12k/core.h
|
|
+++ b/drivers/net/wireless/ath/ath12k/core.h
|
|
@@ -648,6 +648,11 @@ struct ath12k_board_data {
|
|
size_t len;
|
|
};
|
|
|
|
+struct ath12k_bus_params {
|
|
+ bool fixed_bdf_addr;
|
|
+ bool fixed_mem_region;
|
|
+};
|
|
+
|
|
struct ath12k_bp_stats {
|
|
/* Head Pointer reported by the last HTT Backpressure event for the ring */
|
|
u16 hp;
|
|
@@ -740,6 +745,7 @@ struct ath12k_base {
|
|
int bd_api;
|
|
|
|
const struct ath12k_hw_params *hw_params;
|
|
+ struct ath12k_bus_params bus_params;
|
|
|
|
const struct firmware *cal_file;
|
|
|
|
@@ -920,7 +926,8 @@ int ath12k_core_pre_init(struct ath12k_b
|
|
int ath12k_core_init(struct ath12k_base *ath12k);
|
|
void ath12k_core_deinit(struct ath12k_base *ath12k);
|
|
struct ath12k_base *ath12k_core_alloc(struct device *dev, size_t priv_size,
|
|
- enum ath12k_bus bus);
|
|
+ enum ath12k_bus bus,
|
|
+ const struct ath12k_bus_params *bus_params);
|
|
void ath12k_core_free(struct ath12k_base *ath12k);
|
|
int ath12k_core_fetch_board_data_api_1(struct ath12k_base *ab,
|
|
struct ath12k_board_data *bd,
|
|
--- a/drivers/net/wireless/ath/ath12k/pci.c
|
|
+++ b/drivers/net/wireless/ath/ath12k/pci.c
|
|
@@ -47,6 +47,10 @@ static const struct pci_device_id ath12k
|
|
|
|
MODULE_DEVICE_TABLE(pci, ath12k_pci_id_table);
|
|
|
|
+static const struct ath12k_bus_params ath12k_pci_bus_params = {
|
|
+ .fixed_bdf_addr = false,
|
|
+};
|
|
+
|
|
/* TODO: revisit IRQ mapping for new SRNG's */
|
|
static const struct ath12k_msi_config ath12k_msi_config[] = {
|
|
{
|
|
@@ -1143,7 +1147,8 @@ static int ath12k_pci_probe(struct pci_d
|
|
struct ath12k_pci *ab_pci;
|
|
int ret;
|
|
|
|
- ab = ath12k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH12K_BUS_PCI);
|
|
+ ab = ath12k_core_alloc(&pdev->dev, sizeof(*ab_pci), ATH12K_BUS_PCI,
|
|
+ &ath12k_pci_bus_params);
|
|
if (!ab) {
|
|
dev_err(&pdev->dev, "failed to allocate ath12k base\n");
|
|
return -ENOMEM;
|
|
--- a/drivers/net/wireless/ath/ath12k/qmi.c
|
|
+++ b/drivers/net/wireless/ath/ath12k/qmi.c
|
|
@@ -2520,6 +2520,7 @@ static int ath12k_qmi_load_file_target_m
|
|
struct qmi_wlanfw_bdf_download_resp_msg_v01 resp;
|
|
struct qmi_txn txn = {};
|
|
const u8 *temp = data;
|
|
+ void __iomem *bdf_addr = NULL;
|
|
int ret;
|
|
u32 remaining = len;
|
|
|
|
@@ -2528,6 +2529,15 @@ static int ath12k_qmi_load_file_target_m
|
|
return -ENOMEM;
|
|
memset(&resp, 0, sizeof(resp));
|
|
|
|
+ if (ab->bus_params.fixed_bdf_addr) {
|
|
+ bdf_addr = ioremap(ab->hw_params->bdf_addr, ab->hw_params->fw.board_size);
|
|
+ if (!bdf_addr) {
|
|
+ ath12k_warn(ab, "qmi ioremap error for BDF\n");
|
|
+ ret = -EIO;
|
|
+ goto out_req;
|
|
+ }
|
|
+ }
|
|
+
|
|
while (remaining) {
|
|
req->valid = 1;
|
|
req->file_id_valid = 1;
|
|
@@ -2548,7 +2558,8 @@ static int ath12k_qmi_load_file_target_m
|
|
req->end = 1;
|
|
}
|
|
|
|
- if (type == ATH12K_QMI_FILE_TYPE_EEPROM) {
|
|
+ if ((ab->bus_params.fixed_bdf_addr) ||
|
|
+ (type == ATH12K_QMI_FILE_TYPE_EEPROM)) {
|
|
req->data_valid = 0;
|
|
req->end = 1;
|
|
req->data_len = ATH12K_QMI_MAX_BDF_FILE_NAME_SIZE;
|
|
@@ -2556,6 +2567,13 @@ static int ath12k_qmi_load_file_target_m
|
|
memcpy(req->data, temp, req->data_len);
|
|
}
|
|
|
|
+ if (ab->bus_params.fixed_bdf_addr) {
|
|
+ if (type == ATH12K_QMI_FILE_TYPE_CALDATA)
|
|
+ bdf_addr += ab->hw_params->fw.cal_offset;
|
|
+
|
|
+ memcpy_toio(bdf_addr, temp, len);
|
|
+ }
|
|
+
|
|
ret = qmi_txn_init(&ab->qmi.handle, &txn,
|
|
qmi_wlanfw_bdf_download_resp_msg_v01_ei,
|
|
&resp);
|
|
@@ -2585,15 +2603,22 @@ static int ath12k_qmi_load_file_target_m
|
|
goto out;
|
|
}
|
|
|
|
- remaining -= req->data_len;
|
|
- temp += req->data_len;
|
|
- req->seg_id++;
|
|
- ath12k_dbg(ab, ATH12K_DBG_QMI,
|
|
- "qmi bdf download request remaining %i\n",
|
|
- remaining);
|
|
+ if (ab->bus_params.fixed_bdf_addr) {
|
|
+ remaining = 0;
|
|
+ } else {
|
|
+ remaining -= req->data_len;
|
|
+ temp += req->data_len;
|
|
+ req->seg_id++;
|
|
+ ath12k_dbg(ab, ATH12K_DBG_QMI,
|
|
+ "qmi bdf download request remaining %i\n",
|
|
+ remaining);
|
|
+ }
|
|
}
|
|
|
|
out:
|
|
+ if (ab->bus_params.fixed_bdf_addr)
|
|
+ iounmap(bdf_addr);
|
|
+out_req:
|
|
kfree(req);
|
|
return ret;
|
|
}
|
|
@@ -3079,10 +3104,12 @@ static int ath12k_qmi_event_load_bdf(str
|
|
return ret;
|
|
}
|
|
|
|
- ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_REGDB);
|
|
- if (ret < 0) {
|
|
- ath12k_warn(ab, "qmi failed to load regdb file:%d\n", ret);
|
|
- return ret;
|
|
+ if (!ab->bus_params.fixed_bdf_addr) {
|
|
+ ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_REGDB);
|
|
+ if (ret < 0) {
|
|
+ ath12k_warn(ab, "qmi failed to load regdb file:%d\n", ret);
|
|
+ return ret;
|
|
+ }
|
|
}
|
|
|
|
ret = ath12k_qmi_load_bdf_qmi(ab, ATH12K_QMI_BDF_TYPE_ELF);
|
|
--- a/drivers/net/wireless/ath/ath12k/hw.h
|
|
+++ b/drivers/net/wireless/ath/ath12k/hw.h
|
|
@@ -133,6 +133,7 @@ struct ath12k_hw_hal_params {
|
|
struct ath12k_hw_params {
|
|
const char *name;
|
|
u16 hw_rev;
|
|
+ u32 bdf_addr;
|
|
|
|
struct {
|
|
const char *dir;
|