From: Erik Stromdahl <erik.stromdahl@gmail.com>
To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org,
ath10k@lists.infradead.org
Cc: Erik Stromdahl <erik.stromdahl@gmail.com>
Subject: [RFC 04/10] ath10k: new fw fetch functionality
Date: Fri, 13 Jan 2017 22:35:03 +0100 [thread overview]
Message-ID: <1484343309-6327-5-git-send-email-erik.stromdahl@gmail.com> (raw)
In-Reply-To: <1484343309-6327-1-git-send-email-erik.stromdahl@gmail.com>
A new function for creating the fw file name dynamically.
Since both SDIO and USB based chipsets will use different
firmware from the PCIe and AHB chipsets, the fw file name
is created dynamically.
The new firmware names are:
For PCIe and AHB:
firmware-<api_version>.bin (same as before)
For SDIO:
firmware-sdio-<api_version>.bin
For USB:
firmware-usb-<api_version>.bin
Signed-off-by: Erik Stromdahl <erik.stromdahl@gmail.com>
---
drivers/net/wireless/ath/ath10k/core.c | 56 ++++++++++++++++------------------
drivers/net/wireless/ath/ath10k/hw.h | 4 +++
2 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index e985316..c275a52 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1284,44 +1284,40 @@ int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
return ret;
}
+static void ath10k_core_get_fw_name(struct ath10k *ar, char *fw_name,
+ int fw_api)
+{
+ if ((ar->hif.bus != ATH10K_BUS_PCI) && (ar->hif.bus != ATH10K_BUS_AHB))
+ snprintf(fw_name, ATH10K_FW_FILE_NAME_MAX_LEN, "%s-%s-%d.bin",
+ ATH10K_FW_FILE_BASE, ath10k_bus_str(ar->hif.bus),
+ fw_api);
+ else
+ snprintf(fw_name, ATH10K_FW_FILE_NAME_MAX_LEN, "%s-%d.bin",
+ ATH10K_FW_FILE_BASE, fw_api);
+}
+
static int ath10k_core_fetch_firmware_files(struct ath10k *ar)
{
- int ret;
+ int ret, i;
+ char fw_name[ATH10K_FW_FILE_NAME_MAX_LEN];
/* calibration file is optional, don't check for any errors */
ath10k_fetch_cal_file(ar);
- ar->fw_api = 5;
- ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
-
- ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API5_FILE,
- &ar->normal_mode_fw.fw_file);
- if (ret == 0)
- goto success;
-
- ar->fw_api = 4;
- ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
-
- ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API4_FILE,
- &ar->normal_mode_fw.fw_file);
- if (ret == 0)
- goto success;
-
- ar->fw_api = 3;
- ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
-
- ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API3_FILE,
- &ar->normal_mode_fw.fw_file);
- if (ret == 0)
- goto success;
+ for (i = 5; i >= 2; i--) {
+ ar->fw_api = i;
+ ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n",
+ ar->fw_api);
- ar->fw_api = 2;
- ath10k_dbg(ar, ATH10K_DBG_BOOT, "trying fw api %d\n", ar->fw_api);
+ ath10k_core_get_fw_name(ar, fw_name, ar->fw_api);
+ ret = ath10k_core_fetch_firmware_api_n(ar, fw_name,
+ &ar->normal_mode_fw.fw_file);
+ if (!ret)
+ goto success;
+ }
- ret = ath10k_core_fetch_firmware_api_n(ar, ATH10K_FW_API2_FILE,
- &ar->normal_mode_fw.fw_file);
- if (ret)
- return ret;
+ /* We end up here if we couldn't fetch any firmware */
+ return ret;
success:
ath10k_dbg(ar, ATH10K_DBG_BOOT, "using fw api %d\n", ar->fw_api);
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 6bdea86..9f4cd76 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -128,6 +128,10 @@ enum qca9377_chip_id_rev {
#define QCA4019_HW_1_0_BOARD_DATA_FILE "board.bin"
#define QCA4019_HW_1_0_PATCH_LOAD_ADDR 0x1234
+#define ATH10K_FW_FILE_NAME_MAX_LEN 100
+
+#define ATH10K_FW_FILE_BASE "firmware"
+
#define ATH10K_FW_API2_FILE "firmware-2.bin"
#define ATH10K_FW_API3_FILE "firmware-3.bin"
--
2.7.4
next prev parent reply other threads:[~2017-01-13 21:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-13 21:34 [RFC 00/10] ath10k usb support Erik Stromdahl
2017-01-13 21:35 ` [RFC 01/10] ath10k: various usb related definitions Erik Stromdahl
2017-01-13 21:35 ` [RFC 02/10] ath10k: usb support Erik Stromdahl
2017-01-13 21:35 ` [RFC 03/10] ath10k: high_latency detection Erik Stromdahl
2017-01-13 21:35 ` Erik Stromdahl [this message]
2017-02-10 12:45 ` [RFC,04/10] ath10k: new fw fetch functionality Kalle Valo
2017-01-13 21:35 ` [RFC 05/10] ath10k: htt: RX ring config HL support Erik Stromdahl
2017-01-13 21:35 ` [RFC 06/10] ath10k: disable frame aggregation for high latency Erik Stromdahl
2017-01-13 21:35 ` [RFC 07/10] ath10k: per target configurablity of various items Erik Stromdahl
2017-01-13 21:35 ` [RFC 08/10] ath10k: add start_once support Erik Stromdahl
2017-01-13 21:35 ` [RFC 09/10] ath10k: htt: High latency TX support Erik Stromdahl
2017-01-13 21:35 ` [RFC 10/10] ath10k: htt: High latency RX support Erik Stromdahl
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=1484343309-6327-5-git-send-email-erik.stromdahl@gmail.com \
--to=erik.stromdahl@gmail.com \
--cc=ath10k@lists.infradead.org \
--cc=kvalo@qca.qualcomm.com \
--cc=linux-wireless@vger.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