linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Marko <robimarko@gmail.com>
To: kvalo@kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, ath11k@lists.infradead.org,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Robert Marko <robimarko@gmail.com>
Subject: [PATCH 2/2] ath11k: search DT for qcom,ath11k-board-id
Date: Tue, 21 Jun 2022 15:53:39 +0200	[thread overview]
Message-ID: <20220621135339.1269409-2-robimarko@gmail.com> (raw)
In-Reply-To: <20220621135339.1269409-1-robimarko@gmail.com>

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@gmail.com>
---
 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


  reply	other threads:[~2022-06-21 13:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 13:53 [PATCH 1/2] dt-bindings: net: wireless: ath11k: add new DT entry for board ID Robert Marko
2022-06-21 13:53 ` Robert Marko [this message]
2022-06-21 15:58 ` Krzysztof Kozlowski
2022-06-21 18:47   ` Robert Marko
2022-06-22 14:55     ` Krzysztof Kozlowski
2022-06-23 20:16       ` Robert Marko
2022-06-27 10:26 ` Kalle Valo
2022-06-27 10:30   ` Robert Marko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220621135339.1269409-2-robimarko@gmail.com \
    --to=robimarko@gmail.com \
    --cc=ath11k@lists.infradead.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).