[PATCH 2/2] ath11k: search DT for qcom,ath11k-board-id

From: Robert Marko
Date: Tue Jun 21 2022 - 09:53:54 EST


bus + qmi-chip-id + qmi-board-id and optionally the variant are currently
used for identifying the correct board data file.

This however is sometimes not enough as all of the IPQ8074 boards that I
have access to dont have the qmi-board-id properly fused and simply return
the default value of 0xFF.

So, to provide the correct qmi-board-id look for the qcom,ath11k-board-id
property and use that.
This is what vendors have been doing in the stock firmwares that were
shipped on boards I have.

It should be added to DTS like:
wifi@c000000 {
status = "okay";

qcom,ath11k-board-id = <658>;
qcom,ath11k-calibration-variant = "Edgecore-EAP102";
};

Signed-off-by: Robert Marko <robimarko@xxxxxxxxx>
---
drivers/net/wireless/ath/ath11k/qmi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index 00136601cb7d..9d27b4968d10 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -2172,12 +2172,14 @@ static int ath11k_qmi_request_device_info(struct ath11k_base *ab)

static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
{
+ struct device *dev = ab->dev;
struct qmi_wlanfw_cap_req_msg_v01 req;
struct qmi_wlanfw_cap_resp_msg_v01 resp;
struct qmi_txn txn;
int ret = 0;
int r;
char *fw_build_id;
+ unsigned int board_id;
int fw_build_id_mask_len;

memset(&req, 0, sizeof(req));
@@ -2219,7 +2221,9 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
ab->qmi.target.chip_family = resp.chip_info.chip_family;
}

- if (resp.board_info_valid)
+ if (!of_property_read_u32(dev->of_node, "qcom,ath11k-board-id", &board_id))
+ ab->qmi.target.board_id = board_id;
+ else if (resp.board_info_valid)
ab->qmi.target.board_id = resp.board_info.board_id;
else
ab->qmi.target.board_id = 0xFF;
--
2.36.1