diff options
author | Sven Eckelmann <sven.eckelmann@openmesh.com> | 2017-12-08 05:37:42 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2017-12-14 10:27:54 -0500 |
commit | d06f26c5c8a41f246a9c40862a77a55725cedbd3 (patch) | |
tree | 95498a2515eb0365e742753bdf2dc1bba54acc9b | |
parent | 40fb0eab30ba44bcfc5eb29eb8c78a30025f9e12 (diff) |
ath10k: search DT for qcom,ath10k-calibration-variant
Board Data File (BDF) is loaded upon driver boot-up procedure. The right
board data file is identified on QCA4019 using bus, bmi-chip-id and
bmi-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 solved for SMBIOS by adding a special SMBIOS type 0xF8.
Something similar has to be provided for systems without SMBIOS but with
device trees. No solution was specified by QCA and therefore a new one has
to be found for ath10k.
The device tree requires addition strings to define the variant name
wifi@a000000 {
status = "okay";
qcom,ath10k-calibration-variant = "RT-AC58U";
};
wifi@a800000 {
status = "okay";
qcom,ath10k-calibration-variant = "RT-AC58U";
};
This would create the boarddata identifiers for the board-2.bin search
* bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U
* bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U
Signed-off-by: Sven Eckelmann <sven.eckelmann@openmesh.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath10k/core.c | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index b29fdbd21ead..6264e2cc4c0d 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c | |||
@@ -860,6 +860,28 @@ static int ath10k_core_check_smbios(struct ath10k *ar) | |||
860 | return 0; | 860 | return 0; |
861 | } | 861 | } |
862 | 862 | ||
863 | static int ath10k_core_check_dt(struct ath10k *ar) | ||
864 | { | ||
865 | struct device_node *node; | ||
866 | const char *variant = NULL; | ||
867 | |||
868 | node = ar->dev->of_node; | ||
869 | if (!node) | ||
870 | return -ENOENT; | ||
871 | |||
872 | of_property_read_string(node, "qcom,ath10k-calibration-variant", | ||
873 | &variant); | ||
874 | if (!variant) | ||
875 | return -ENODATA; | ||
876 | |||
877 | if (strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext)) < 0) | ||
878 | ath10k_dbg(ar, ATH10K_DBG_BOOT, | ||
879 | "bdf variant string is longer than the buffer can accommodate (variant: %s)\n", | ||
880 | variant); | ||
881 | |||
882 | return 0; | ||
883 | } | ||
884 | |||
863 | static int ath10k_download_and_run_otp(struct ath10k *ar) | 885 | static int ath10k_download_and_run_otp(struct ath10k *ar) |
864 | { | 886 | { |
865 | u32 result, address = ar->hw_params.patch_load_addr; | 887 | u32 result, address = ar->hw_params.patch_load_addr; |
@@ -1231,19 +1253,19 @@ static int ath10k_core_create_board_name(struct ath10k *ar, char *name, | |||
1231 | /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ | 1253 | /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ |
1232 | char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; | 1254 | char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; |
1233 | 1255 | ||
1256 | if (ar->id.bdf_ext[0] != '\0') | ||
1257 | scnprintf(variant, sizeof(variant), ",variant=%s", | ||
1258 | ar->id.bdf_ext); | ||
1259 | |||
1234 | if (ar->id.bmi_ids_valid) { | 1260 | if (ar->id.bmi_ids_valid) { |
1235 | scnprintf(name, name_len, | 1261 | scnprintf(name, name_len, |
1236 | "bus=%s,bmi-chip-id=%d,bmi-board-id=%d", | 1262 | "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s", |
1237 | ath10k_bus_str(ar->hif.bus), | 1263 | ath10k_bus_str(ar->hif.bus), |
1238 | ar->id.bmi_chip_id, | 1264 | ar->id.bmi_chip_id, |
1239 | ar->id.bmi_board_id); | 1265 | ar->id.bmi_board_id, variant); |
1240 | goto out; | 1266 | goto out; |
1241 | } | 1267 | } |
1242 | 1268 | ||
1243 | if (ar->id.bdf_ext[0] != '\0') | ||
1244 | scnprintf(variant, sizeof(variant), ",variant=%s", | ||
1245 | ar->id.bdf_ext); | ||
1246 | |||
1247 | scnprintf(name, name_len, | 1269 | scnprintf(name, name_len, |
1248 | "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s", | 1270 | "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s", |
1249 | ath10k_bus_str(ar->hif.bus), | 1271 | ath10k_bus_str(ar->hif.bus), |
@@ -2343,7 +2365,11 @@ static int ath10k_core_probe_fw(struct ath10k *ar) | |||
2343 | 2365 | ||
2344 | ret = ath10k_core_check_smbios(ar); | 2366 | ret = ath10k_core_check_smbios(ar); |
2345 | if (ret) | 2367 | if (ret) |
2346 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n"); | 2368 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n"); |
2369 | |||
2370 | ret = ath10k_core_check_dt(ar); | ||
2371 | if (ret) | ||
2372 | ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n"); | ||
2347 | 2373 | ||
2348 | ret = ath10k_core_fetch_board_file(ar); | 2374 | ret = ath10k_core_fetch_board_file(ar); |
2349 | if (ret) { | 2375 | if (ret) { |