From: Sven Eckelmann <sven.eckelmann@openmesh.com>
To: ath10k@lists.infradead.org
Cc: mark.rutland@arm.com, devicetree@vger.kernel.org,
linux-wireless@vger.kernel.org, robh+dt@kernel.org,
Sven Eckelmann <sven.eckelmann@openmesh.com>,
ext.waldemar.rymarkiewicz@tieto.com, kvalo@codeaurora.org
Subject: [PATCH 2/2] ath10k: search DT for qcom,ath10k-calibration-variant
Date: Fri, 10 Mar 2017 09:06:15 +0100 [thread overview]
Message-ID: <20170310080615.22958-2-sven.eckelmann@openmesh.com> (raw)
In-Reply-To: <20170310080615.22958-1-sven.eckelmann@openmesh.com>
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>
---
Since RFC:
- initialize variant pointer to have it initialized to NULL when
of_property_read_string fails (thanks Christian Lamparter)
- Only print warning that DT doesn't contain string ones (thanks Christian
Lamparter)
- Split patch in DT doc and ath10k part (thanks Christian Lamparter)
- Allow to overwrite the variant string via DT and ignore that SMBIOS had
written anything to it
---
drivers/net/wireless/ath/ath10k/core.c | 37 +++++++++++++++++++++++++++-------
1 file changed, 30 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 0a8e29e9a0eb..e459e84afe9f 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -779,6 +779,25 @@ static int ath10k_core_check_smbios(struct ath10k *ar)
return 0;
}
+static int ath10k_core_check_dt(struct ath10k *ar)
+{
+ struct device_node *node;
+ const char *variant = NULL;
+
+ node = ar->dev->of_node;
+ if (!node)
+ return -ENOENT;
+
+ of_property_read_string(node, "qcom,ath10k-calibration-variant",
+ &variant);
+ if (!variant)
+ return -ENODATA;
+
+ strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext));
+
+ return 0;
+}
+
static int ath10k_download_and_run_otp(struct ath10k *ar)
{
u32 result, address = ar->hw_params.patch_load_addr;
@@ -1145,19 +1164,19 @@ static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
/* strlen(',variant=') + strlen(ar->id.bdf_ext) */
char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 };
+ if (ar->id.bdf_ext[0] != '\0')
+ scnprintf(variant, sizeof(variant), ",variant=%s",
+ ar->id.bdf_ext);
+
if (ar->id.bmi_ids_valid) {
scnprintf(name, name_len,
- "bus=%s,bmi-chip-id=%d,bmi-board-id=%d",
+ "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s",
ath10k_bus_str(ar->hif.bus),
ar->id.bmi_chip_id,
- ar->id.bmi_board_id);
+ ar->id.bmi_board_id, variant);
goto out;
}
- if (ar->id.bdf_ext[0] != '\0')
- scnprintf(variant, sizeof(variant), ",variant=%s",
- ar->id.bdf_ext);
-
scnprintf(name, name_len,
"bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s",
ath10k_bus_str(ar->hif.bus),
@@ -2221,7 +2240,11 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
ret = ath10k_core_check_smbios(ar);
if (ret)
- ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n");
+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n");
+
+ ret = ath10k_core_check_dt(ar);
+ if (ret)
+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n");
ret = ath10k_core_fetch_board_file(ar);
if (ret) {
--
2.11.0
next prev parent reply other threads:[~2017-03-10 8:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-10 8:06 [PATCH 1/2] dt: bindings: add new dt entry for ath10k calibration variant Sven Eckelmann
2017-03-10 8:06 ` Sven Eckelmann [this message]
[not found] ` <20170310080615.22958-2-sven.eckelmann-lv6y7wLVQPlWk0Htik3J/w@public.gmane.org>
2017-12-08 9:27 ` [PATCH 2/2] ath10k: search DT for qcom,ath10k-calibration-variant Kalle Valo
2017-03-20 15:07 ` [PATCH 1/2] dt: bindings: add new dt entry for ath10k calibration variant Rob Herring
2017-03-20 16:28 ` Sven Eckelmann
2017-03-20 16:42 ` Adrian Chadd
2017-03-21 7:29 ` Sven Eckelmann
2017-03-21 13:00 ` Rob Herring
[not found] ` <CAL_Jsq+aEdjq9MR--Hyrw17KoKv=uZ7OBsAqX1_0+Djpw+QUCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-03-21 14:33 ` Sven Eckelmann
2017-03-22 2:56 ` Rob Herring
2017-03-22 7:20 ` Sven Eckelmann
2017-12-08 9:22 ` Kalle Valo
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=20170310080615.22958-2-sven.eckelmann@openmesh.com \
--to=sven.eckelmann@openmesh.com \
--cc=ath10k@lists.infradead.org \
--cc=devicetree@vger.kernel.org \
--cc=ext.waldemar.rymarkiewicz@tieto.com \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mark.rutland@arm.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).