1 From d06f26c5c8a41f246a9c40862a77a55725cedbd3 Mon Sep 17 00:00:00 2001
2 From: Sven Eckelmann <sven.eckelmann@openmesh.com>
3 Date: Fri, 8 Dec 2017 11:37:42 +0100
4 Subject: ath10k: search DT for qcom,ath10k-calibration-variant
6 Board Data File (BDF) is loaded upon driver boot-up procedure. The right
7 board data file is identified on QCA4019 using bus, bmi-chip-id and
10 The problem, however, can occur when the (default) board data file cannot
11 fulfill with the vendor requirements and it is necessary to use a different
14 This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8.
15 Something similar has to be provided for systems without SMBIOS but with
16 device trees. No solution was specified by QCA and therefore a new one has
17 to be found for ath10k.
19 The device tree requires addition strings to define the variant name
23 qcom,ath10k-calibration-variant = "RT-AC58U";
28 qcom,ath10k-calibration-variant = "RT-AC58U";
31 This would create the boarddata identifiers for the board-2.bin search
33 * bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U
34 * bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U
36 Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
37 Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
39 drivers/net/wireless/ath/ath10k/core.c | 40 ++++++++++++++++++++++++++++------
40 1 file changed, 33 insertions(+), 7 deletions(-)
42 --- a/drivers/net/wireless/ath/ath10k/core.c
43 +++ b/drivers/net/wireless/ath/ath10k/core.c
44 @@ -860,6 +860,28 @@ static int ath10k_core_check_smbios(stru
48 +static int ath10k_core_check_dt(struct ath10k *ar)
50 + struct device_node *node;
51 + const char *variant = NULL;
53 + node = ar->dev->of_node;
57 + of_property_read_string(node, "qcom,ath10k-calibration-variant",
62 + if (strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext)) < 0)
63 + ath10k_dbg(ar, ATH10K_DBG_BOOT,
64 + "bdf variant string is longer than the buffer can accommodate (variant: %s)\n",
70 static int ath10k_download_and_run_otp(struct ath10k *ar)
72 u32 result, address = ar->hw_params.patch_load_addr;
73 @@ -1231,19 +1253,19 @@ static int ath10k_core_create_board_name
74 /* strlen(',variant=') + strlen(ar->id.bdf_ext) */
75 char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 };
77 + if (ar->id.bdf_ext[0] != '\0')
78 + scnprintf(variant, sizeof(variant), ",variant=%s",
81 if (ar->id.bmi_ids_valid) {
82 scnprintf(name, name_len,
83 - "bus=%s,bmi-chip-id=%d,bmi-board-id=%d",
84 + "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s",
85 ath10k_bus_str(ar->hif.bus),
87 - ar->id.bmi_board_id);
88 + ar->id.bmi_board_id, variant);
92 - if (ar->id.bdf_ext[0] != '\0')
93 - scnprintf(variant, sizeof(variant), ",variant=%s",
96 scnprintf(name, name_len,
97 "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s",
98 ath10k_bus_str(ar->hif.bus),
99 @@ -2343,7 +2365,11 @@ static int ath10k_core_probe_fw(struct a
101 ret = ath10k_core_check_smbios(ar);
103 - ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n");
104 + ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n");
106 + ret = ath10k_core_check_dt(ar);
108 + ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n");
110 ret = ath10k_core_fetch_board_file(ar);