devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant
@ 2020-10-15 13:15 Sven Eckelmann
  2020-10-15 13:15 ` [PATCH 2/2] ath11k: search DT for qcom,ath11k-calibration-variant Sven Eckelmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sven Eckelmann @ 2020-10-15 13:15 UTC (permalink / raw)
  To: linux-wireless
  Cc: ath11k, Rob Herring, Kalle Valo, devicetree, Sven Eckelmann

The bus + qmi-chip-id + qmi-board-id is not enough to identify the correct
board data file on IPQ6018 based devices. Multiple different boards share
the same values. Only the original reference designs can currently be
identified and loaded from the board-2.bin. But these will not result in
the correct calibration data when combined with the pre-calibration data
from the device.

An additional "variant" information has to be provided to select the
correct board data for a design which was modified by an ODM. This follows
the same approach as ath10k.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 .../devicetree/bindings/net/wireless/qcom,ath11k.yaml       | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
index 4b365c9d9378..6af999191559 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k.yaml
@@ -144,6 +144,12 @@ properties:
         * reg
         * reg-names
 
+  qcom,ath11k-calibration-variant:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      string to uniquely identify variant of the calibration data in the
+      board-2.bin for designs with colliding bus and device specific ids
+
 required:
   - compatible
   - reg
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ath11k: search DT for qcom,ath11k-calibration-variant
  2020-10-15 13:15 [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant Sven Eckelmann
@ 2020-10-15 13:15 ` Sven Eckelmann
  2020-10-19 21:18 ` [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant Rob Herring
  2020-11-07  8:01 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Sven Eckelmann @ 2020-10-15 13:15 UTC (permalink / raw)
  To: linux-wireless
  Cc: ath11k, Rob Herring, Kalle Valo, devicetree, Sven Eckelmann

Board Data File (BDF) is loaded upon driver boot-up procedure. The right
board data file is identified on IPQ6018 using bus, qmi-chip-id and
qmi-board-id.

The problem, however, can occur when the (default) board data file cannot
fulfill with the vendor requirements and it is necessary to use a different
board data file.

This problem was already solved on ath10k by adding a ",variant=.*" at the
end of the board name. The same functionality must also be provided for
ath11k.

The device tree requires an additional string to define the variant name

    wifi@c000000 {
        status = "okay";
        qcom,ath11k-calibration-variant = "Cigtech-WF-188";
    };

This would create the boarddata identifier for the board-2.bin search

 *  bus=ahb,qmi-chip-id=0,qmi-board-id=18,variant=Cigtech-WF-188

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 drivers/net/wireless/ath/ath11k/core.c | 35 ++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath11k/core.h |  1 +
 drivers/net/wireless/ath/ath11k/qmi.c  |  5 ++++
 drivers/net/wireless/ath/ath11k/qmi.h  |  2 ++
 4 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index ebd6886a8c18..c3af41226379 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -7,6 +7,7 @@
 #include <linux/slab.h>
 #include <linux/remoteproc.h>
 #include <linux/firmware.h>
+#include <linux/of.h>
 #include "core.h"
 #include "dp_tx.h"
 #include "dp_rx.h"
@@ -141,14 +142,44 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
 	},
 };
 
+int ath11k_core_check_dt(struct ath11k_base *ab)
+{
+	size_t max_len = sizeof(ab->qmi.target.bdf_ext);
+	const char *variant = NULL;
+	struct device_node *node;
+
+	node = ab->dev->of_node;
+	if (!node)
+		return -ENOENT;
+
+	of_property_read_string(node, "qcom,ath11k-calibration-variant",
+				&variant);
+	if (!variant)
+		return -ENODATA;
+
+	if (strscpy(ab->qmi.target.bdf_ext, variant, max_len) < 0)
+		ath11k_dbg(ab, ATH11K_DBG_BOOT,
+			   "bdf variant string is longer than the buffer can accommodate (variant: %s)\n",
+			    variant);
+
+	return 0;
+}
+
 static int ath11k_core_create_board_name(struct ath11k_base *ab, char *name,
 					 size_t name_len)
 {
+	/* strlen(',variant=') + strlen(ab->qmi.target.bdf_ext) */
+	char variant[9 + ATH11K_QMI_BDF_EXT_STR_LENGTH] = { 0 };
+
+	if (ab->qmi.target.bdf_ext[0] != '\0')
+		scnprintf(variant, sizeof(variant), ",variant=%s",
+			  ab->qmi.target.bdf_ext);
+
 	scnprintf(name, name_len,
-		  "bus=%s,qmi-chip-id=%d,qmi-board-id=%d",
+		  "bus=%s,qmi-chip-id=%d,qmi-board-id=%d%s",
 		  ath11k_bus_str(ab->hif.bus),
 		  ab->qmi.target.chip_id,
-		  ab->qmi.target.board_id);
+		  ab->qmi.target.board_id, variant);
 
 	ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot using board name '%s'\n", name);
 
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 18b97420f0d8..18c961c9fd30 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -883,6 +883,7 @@ void ath11k_core_free(struct ath11k_base *ath11k);
 int ath11k_core_fetch_bdf(struct ath11k_base *ath11k,
 			  struct ath11k_board_data *bd);
 void ath11k_core_free_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd);
+int ath11k_core_check_dt(struct ath11k_base *ath11k);
 
 void ath11k_core_halt(struct ath11k *ar);
 
diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index c2b165158225..9fb4dea149bf 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -1793,6 +1793,7 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
 	struct qmi_wlanfw_cap_resp_msg_v01 resp;
 	struct qmi_txn txn = {};
 	int ret = 0;
+	int r;
 
 	memset(&req, 0, sizeof(req));
 	memset(&resp, 0, sizeof(resp));
@@ -1858,6 +1859,10 @@ static int ath11k_qmi_request_target_cap(struct ath11k_base *ab)
 		    ab->qmi.target.fw_build_timestamp,
 		    ab->qmi.target.fw_build_id);
 
+	r = ath11k_core_check_dt(ab);
+	if (r)
+		ath11k_dbg(ab, ATH11K_DBG_QMI, "DT bdf variant name not set.\n");
+
 out:
 	return ret;
 }
diff --git a/drivers/net/wireless/ath/ath11k/qmi.h b/drivers/net/wireless/ath/ath11k/qmi.h
index b0a818f0401b..7b170bc9a913 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.h
+++ b/drivers/net/wireless/ath/ath11k/qmi.h
@@ -24,6 +24,7 @@
 #define ATH11K_QMI_RESP_LEN_MAX			8192
 #define ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01	32
 #define ATH11K_QMI_CALDB_SIZE			0x480000
+#define ATH11K_QMI_BDF_EXT_STR_LENGTH		0x20
 
 #define QMI_WLFW_REQUEST_MEM_IND_V01		0x0035
 #define QMI_WLFW_FW_MEM_READY_IND_V01		0x0037
@@ -101,6 +102,7 @@ struct target_info {
 	u32 fw_version;
 	char fw_build_timestamp[ATH11K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01 + 1];
 	char fw_build_id[ATH11K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01 + 1];
+	char bdf_ext[ATH11K_QMI_BDF_EXT_STR_LENGTH];
 };
 
 struct m3_mem_region {
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant
  2020-10-15 13:15 [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant Sven Eckelmann
  2020-10-15 13:15 ` [PATCH 2/2] ath11k: search DT for qcom,ath11k-calibration-variant Sven Eckelmann
@ 2020-10-19 21:18 ` Rob Herring
  2020-11-07  8:01 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2020-10-19 21:18 UTC (permalink / raw)
  To: Sven Eckelmann
  Cc: Kalle Valo, linux-wireless, ath11k, Rob Herring, devicetree

On Thu, 15 Oct 2020 15:15:00 +0200, Sven Eckelmann wrote:
> The bus + qmi-chip-id + qmi-board-id is not enough to identify the correct
> board data file on IPQ6018 based devices. Multiple different boards share
> the same values. Only the original reference designs can currently be
> identified and loaded from the board-2.bin. But these will not result in
> the correct calibration data when combined with the pre-calibration data
> from the device.
> 
> An additional "variant" information has to be provided to select the
> correct board data for a design which was modified by an ODM. This follows
> the same approach as ath10k.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  .../devicetree/bindings/net/wireless/qcom,ath11k.yaml       | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant
  2020-10-15 13:15 [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant Sven Eckelmann
  2020-10-15 13:15 ` [PATCH 2/2] ath11k: search DT for qcom,ath11k-calibration-variant Sven Eckelmann
  2020-10-19 21:18 ` [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant Rob Herring
@ 2020-11-07  8:01 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2020-11-07  8:01 UTC (permalink / raw)
  To: Sven Eckelmann
  Cc: linux-wireless, ath11k, Rob Herring, devicetree, Sven Eckelmann

Sven Eckelmann <sven@narfation.org> wrote:

> The bus + qmi-chip-id + qmi-board-id is not enough to identify the correct
> board data file on IPQ6018 based devices. Multiple different boards share
> the same values. Only the original reference designs can currently be
> identified and loaded from the board-2.bin. But these will not result in
> the correct calibration data when combined with the pre-calibration data
> from the device.
> 
> An additional "variant" information has to be provided to select the
> correct board data for a design which was modified by an ODM. This follows
> the same approach as ath10k.
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

2 patches applied to ath-next branch of ath.git, thanks.

77581df8639f dt: bindings: add new dt entry for ath11k calibration variant
14f43c5fca57 ath11k: search DT for qcom,ath11k-calibration-variant

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20201015131501.1939685-1-sven@narfation.org/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-07  8:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 13:15 [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant Sven Eckelmann
2020-10-15 13:15 ` [PATCH 2/2] ath11k: search DT for qcom,ath11k-calibration-variant Sven Eckelmann
2020-10-19 21:18 ` [PATCH 1/2] dt: bindings: add new dt entry for ath11k calibration variant Rob Herring
2020-11-07  8:01 ` Kalle Valo

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).