]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wifi: ath10k: support board-specific firmware overrides
authorDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Thu, 4 Apr 2024 10:17:25 +0000 (13:17 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Fri, 5 Apr 2024 12:04:03 +0000 (15:04 +0300)
Different Qualcomm platforms using WCN3990 WiFI chip use SoC-specific
firmware versions with different features. For example firmware for
SDM845 doesn't use single-chan-info-per-channel feature, while firmware
for QRB2210 / QRB4210 requires that feature. Allow board DT files to
override the subdir of the fw dir used to lookup the firmware-N.bin file
decribing corresponding WiFi firmware.

For example:

- ath10k/WCN3990/hw1.0/wlanmdsp.mbn,
  ath10k/WCN3990/hw1.0/firmware-5.bin: main firmware files, used by default

- ath10k/WCN3990/hw1.0/qcm2290/wlanmdsp.mbn,
  ath10k/WCN3990/hw1.0/qcm2290/firmware-5.bin: SoC specific firmware
    with different signature and feature bits

Note, while board files lookup uses the same function and thus it is
possible to provide board-specific board-2.bin files, this is not
required in 99% of cases as board-2.bin already contains a way to
provide board-specific data with finer granularity than DT overrides.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240306-wcn3990-firmware-path-v2-2-f89e98e71a57@linaro.org
drivers/net/wireless/ath/ath10k/core.c
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/snoc.c

index 9ce6f49ab2614e58baf88c75cff51159e40b6dad..d21fd290034e059c9386150851550124fed4d942 100644 (file)
@@ -942,11 +942,20 @@ static const struct firmware *ath10k_fetch_fw_file(struct ath10k *ar,
        if (dir == NULL)
                dir = ".";
 
+       if (ar->board_name) {
+               snprintf(filename, sizeof(filename), "%s/%s/%s",
+                        dir, ar->board_name, file);
+               ret = firmware_request_nowarn(&fw, filename, ar->dev);
+               ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot fw request '%s': %d\n",
+                          filename, ret);
+               if (!ret)
+                       return fw;
+       }
+
        snprintf(filename, sizeof(filename), "%s/%s", dir, file);
        ret = firmware_request_nowarn(&fw, filename, ar->dev);
        ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot fw request '%s': %d\n",
                   filename, ret);
-
        if (ret)
                return ERR_PTR(ret);
 
index c110d15528bd05d53f371882d1bd9ae91a191e3f..3595c8abce02b8e0b9b354a8cf57bcf6508cc085 100644 (file)
@@ -1081,6 +1081,8 @@ struct ath10k {
         */
        const struct ath10k_fw_components *running_fw;
 
+       const char *board_name;
+
        const struct firmware *pre_cal_file;
        const struct firmware *cal_file;
 
index 2c39bad7ebfb9acab22a2d06e5434883814cf15e..8a77ce51f229b23bfc44437775198e559ec6e026 100644 (file)
@@ -1338,6 +1338,9 @@ static void ath10k_snoc_quirks_init(struct ath10k *ar)
        struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
        struct device *dev = &ar_snoc->dev->dev;
 
+       /* ignore errors, keep NULL if there is no property */
+       of_property_read_string(dev->of_node, "firmware-name", &ar->board_name);
+
        if (of_property_read_bool(dev->of_node, "qcom,snoc-host-cap-8bit-quirk"))
                set_bit(ATH10K_SNOC_FLAG_8BIT_HOST_CAP_QUIRK, &ar_snoc->flags);
 }