]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath12k: add string type to search board data in board-2.bin for WCN7850
authorWen Gong <quic_wgong@quicinc.com>
Sun, 17 Dec 2023 11:29:03 +0000 (13:29 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Mon, 18 Dec 2023 18:47:58 +0000 (20:47 +0200)
Currently ath12k only supports string type with bus, chip id and board id
such as "bus=ahb,qmi-chip-id=1,qmi-board-id=4" for AHB bus chip and
"bus=pci,qmi-chip-id=0,qmi-board-id=255" for PCI bus chip in board-2.bin.
For WCN7850, it is not enough to distinguish all different chips.

Add a new string type which includes bus, chip id, board id, vendor,
device, subsystem-vendor and subsystem-device for WCN7850.

ath12k will first load board-2.bin and searches in it for the board data
with the above parameters. If matched with one board data, ath12k downloads
it to firmware. And if not, downloads board.bin instead.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20231216060140.30611-2-quic_bqiang@quicinc.com
drivers/net/wireless/ath/ath12k/core.c
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/pci.c

index 6c01b282fcd330a73c8b3c9635b135e65cd4abc0..b8027f76a02ebffa3a19a61712ecbaad87517abc 100644 (file)
@@ -114,11 +114,26 @@ static int ath12k_core_create_board_name(struct ath12k_base *ab, char *name,
                scnprintf(variant, sizeof(variant), ",variant=%s",
                          ab->qmi.target.bdf_ext);
 
-       scnprintf(name, name_len,
-                 "bus=%s,qmi-chip-id=%d,qmi-board-id=%d%s",
-                 ath12k_bus_str(ab->hif.bus),
-                 ab->qmi.target.chip_id,
-                 ab->qmi.target.board_id, variant);
+       switch (ab->id.bdf_search) {
+       case ATH12K_BDF_SEARCH_BUS_AND_BOARD:
+               scnprintf(name, name_len,
+                         "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x,qmi-chip-id=%d,qmi-board-id=%d%s",
+                         ath12k_bus_str(ab->hif.bus),
+                         ab->id.vendor, ab->id.device,
+                         ab->id.subsystem_vendor,
+                         ab->id.subsystem_device,
+                         ab->qmi.target.chip_id,
+                         ab->qmi.target.board_id,
+                         variant);
+               break;
+       default:
+               scnprintf(name, name_len,
+                         "bus=%s,qmi-chip-id=%d,qmi-board-id=%d%s",
+                         ath12k_bus_str(ab->hif.bus),
+                         ab->qmi.target.chip_id,
+                         ab->qmi.target.board_id, variant);
+               break;
+       }
 
        ath12k_dbg(ab, ATH12K_DBG_BOOT, "boot using board name '%s'\n", name);
 
@@ -356,7 +371,7 @@ int ath12k_core_fetch_board_data_api_1(struct ath12k_base *ab,
        return 0;
 }
 
-#define BOARD_NAME_SIZE 100
+#define BOARD_NAME_SIZE 200
 int ath12k_core_fetch_bdf(struct ath12k_base *ab, struct ath12k_board_data *bd)
 {
        char boardname[BOARD_NAME_SIZE];
index 8458dc292821a3bdbfcfcd92365dab0f3ef734b9..385fda03e913c581ec53fdc8edd21931705f69c8 100644 (file)
 #define ATH12K_RECONFIGURE_TIMEOUT_HZ          (10 * HZ)
 #define ATH12K_RECOVER_START_TIMEOUT_HZ                (20 * HZ)
 
+enum ath12k_bdf_search {
+       ATH12K_BDF_SEARCH_DEFAULT,
+       ATH12K_BDF_SEARCH_BUS_AND_BOARD,
+};
+
 enum wme_ac {
        WME_AC_BE,
        WME_AC_BK,
@@ -793,6 +798,14 @@ struct ath12k_base {
        /* true means radio is on */
        bool rfkill_radio_on;
 
+       struct {
+               enum ath12k_bdf_search bdf_search;
+               u32 vendor;
+               u32 device;
+               u32 subsystem_vendor;
+               u32 subsystem_device;
+       } id;
+
        /* must be last */
        u8 drv_priv[] __aligned(sizeof(void *));
 };
index f0d2e2d8719c006a90ebd3656d29050f6854f4a4..76438b3afd55b51fad60a1bcddfc8b25d1d89122 100644 (file)
@@ -1310,6 +1310,15 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
                goto err_free_core;
        }
 
+       ath12k_dbg(ab, ATH12K_DBG_BOOT, "pci probe %04x:%04x %04x:%04x\n",
+                  pdev->vendor, pdev->device,
+                  pdev->subsystem_vendor, pdev->subsystem_device);
+
+       ab->id.vendor = pdev->vendor;
+       ab->id.device = pdev->device;
+       ab->id.subsystem_vendor = pdev->subsystem_vendor;
+       ab->id.subsystem_device = pdev->subsystem_device;
+
        switch (pci_dev->device) {
        case QCN9274_DEVICE_ID:
                ab_pci->msi_config = &ath12k_msi_config[0];
@@ -1333,6 +1342,7 @@ static int ath12k_pci_probe(struct pci_dev *pdev,
                }
                break;
        case WCN7850_DEVICE_ID:
+               ab->id.bdf_search = ATH12K_BDF_SEARCH_BUS_AND_BOARD;
                ab_pci->msi_config = &ath12k_msi_config[0];
                ab->static_window_map = false;
                ab_pci->pci_ops = &ath12k_pci_ops_wcn7850;