diff options
author | Sven Eckelmann <sven@narfation.org> | 2020-10-15 15:15:01 +0200 |
---|---|---|
committer | Kalle Valo <kvalo@codeaurora.org> | 2020-11-07 10:00:57 +0200 |
commit | 14f43c5fca57810e7a3788468aee482c85ab37a6 (patch) | |
tree | a0f2ab48ca6fada2a0feade5d3234cc0bac3f9fd /drivers/net/wireless/ath/ath11k/core.c | |
parent | 77581df8639faf28ae52fea170e48cdf9870468a (diff) |
ath11k: search DT for qcom,ath11k-calibration-variant
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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201015131501.1939685-2-sven@narfation.org
Diffstat (limited to 'drivers/net/wireless/ath/ath11k/core.c')
-rw-r--r-- | drivers/net/wireless/ath/ath11k/core.c | 35 |
1 files changed, 33 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); |