Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp230471pxb; Mon, 13 Sep 2021 17:48:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUiLGf2YL0QMzXn0+Ot9OIZ42ysvZ3c6kjIc2Msg8UwoF+GiPlz09rWOvz7IPZplRXnVvp X-Received: by 2002:a05:6e02:1c86:: with SMTP id w6mr10133168ill.52.1631580529357; Mon, 13 Sep 2021 17:48:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631580529; cv=none; d=google.com; s=arc-20160816; b=aUSL3cN/ezFgX/gRNBSX/48ecy3jsCt1mffDJR5/3l0IRa7uDpfFMqENANU+CzN3DU AmNQ48GRCrDhm+7uG6pi5eVmrciD1uPeN/OsRksUIs3ZKYfRKG1tRN1O65INsKWeLpmz IUntlg3YzMcHOZj6U4qZYVaqojcgp3kI6j6vqa8z65SewtZM/bvh9DVD8cuvX1mYIzvG kRRIG72qrRq5Q8r69sKnlIJ/8xLtjw1Xto7/ABrDPMwLbV8h5m3NPIQhuTW3Xz5thsB7 PBT/hK0SXX9EcMNvs3kfKGu6OQzrTT78rKX2GXDVrA63Y79rvqFJPE/FG2DYOAjzCnUu FcWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dmarc-filter:sender :dkim-signature; bh=FX/1sta2YnAZClmgdE6oKf2tiE1gnDdzAL7dWMqTYQc=; b=JBkC7Y2p7kASudugCpn8P+5sFouCX8g+/ZjpHOiCOtNoB/Sq4EZwQ20l7xWkD11gR7 jWu1fOFuXHEdx7dXfAaWVvoJCLbn4/cuvKe1bcG42aPR4/TCkhm7zrCN0zmXyWu0LhZm +i+D/zobLPbJQu0Klsk4daAQANkgLHqZHf870txhLTjrUL85cTe4Y6cXNvyvmu98BGKd 8xhR8neZZsswHSkFue88oXasxqRGGwtaKWsEKbQxdPgWfDZu4ICeHoDNINkaTOB+Y3AK sFtOMFpvW2S/KYNGH7gUPbffBaqj3sSuVkVrKDEm0hej85ljlgrEbE+fFanB3FnGQWpI bwlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=kG4T2d1M; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c39si7602644jaf.12.2021.09.13.17.48.38; Mon, 13 Sep 2021 17:48:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=kG4T2d1M; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346869AbhIMSNC (ORCPT + 99 others); Mon, 13 Sep 2021 14:13:02 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:29745 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238489AbhIMSMw (ORCPT ); Mon, 13 Sep 2021 14:12:52 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1631556696; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Cc: To: From: Sender; bh=FX/1sta2YnAZClmgdE6oKf2tiE1gnDdzAL7dWMqTYQc=; b=kG4T2d1MfcJHELeo4AaAyAUSMcWGX1Qbdc4eRiIBgKbJbBfxhNQdYK/cJkj0hQJFuWXOLXDV NnaTZOSrGlhf6avdTcX+RVHA12tZy9HfjXeipP+l6Lbxj0FH+jMSKyMPVY4aZ96XeTfT9vXA m9x2B/m9ssowaj00P4xizkENG00= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-west-2.postgun.com with SMTP id 613f9458648642cc1c7b5cc2 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 13 Sep 2021 18:11:36 GMT Sender: jouni=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8CC9CC43460; Mon, 13 Sep 2021 18:11:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from jouni.codeaurora.org (85-76-72-211-nat.elisa-mobile.fi [85.76.72.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jouni) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3257EC4338F; Mon, 13 Sep 2021 18:11:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org 3257EC4338F Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Jouni Malinen To: Kalle Valo Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, Wen Gong , Jouni Malinen Subject: [PATCH] ath11k: add string type to search board data in board-2.bin for WCN6855 Date: Mon, 13 Sep 2021 21:11:31 +0300 Message-Id: <20210913181131.194024-1-jouni@codeaurora.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Wen Gong Currently ath11k only support 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 PCIe bus chip in board-2.bin. For WCN6855, it is not enough to distinguish all different chips. This is to add a new string type which include bus, chip id, board id, vendor, device, subsystem-vendor and subsystem-device for WCN6855. ath11k will first load board-2.bin and search in it for the board data with the above parameters, if matched one board data, then download it to firmware, if not matched any one, then ath11k will download the file board.bin to firmware. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1 Signed-off-by: Wen Gong Signed-off-by: Jouni Malinen --- drivers/net/wireless/ath/ath11k/core.c | 27 ++++++++++++++++++++------ drivers/net/wireless/ath/ath11k/core.h | 13 +++++++++++++ drivers/net/wireless/ath/ath11k/pci.c | 10 ++++++++++ drivers/net/wireless/ath/ath11k/qmi.h | 3 +++ 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 8f09ae827170..a8c6f7cf33d5 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -406,11 +406,26 @@ static int ath11k_core_create_board_name(struct ath11k_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", - ath11k_bus_str(ab->hif.bus), - ab->qmi.target.chip_id, - ab->qmi.target.board_id, variant); + switch (ab->id.bdf_search) { + case ATH11K_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", + ath11k_bus_str(ab->hif.bus), + ab->id.vendor, ab->id.device, + ab->id.subsystem_vendor, + ab->id.subsystem_device, + FIELD_GET(ATH11K_CHIP_ID_MASK, ab->qmi.target.chip_id), + ab->qmi.target.board_id & 0xFF, + variant); + break; + default: + scnprintf(name, name_len, + "bus=%s,qmi-chip-id=%d,qmi-board-id=%d%s", + ath11k_bus_str(ab->hif.bus), + ab->qmi.target.chip_id, + ab->qmi.target.board_id, variant); + break; + } ath11k_dbg(ab, ATH11K_DBG_BOOT, "boot using board name '%s'\n", name); @@ -647,7 +662,7 @@ static int ath11k_core_fetch_board_data_api_1(struct ath11k_base *ab, return 0; } -#define BOARD_NAME_SIZE 100 +#define BOARD_NAME_SIZE 200 int ath11k_core_fetch_bdf(struct ath11k_base *ab, struct ath11k_board_data *bd) { char boardname[BOARD_NAME_SIZE]; diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index d58ca38d78c7..eda90776cee1 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -47,6 +47,11 @@ enum ath11k_supported_bw { ATH11K_BW_160 = 3, }; +enum ath11k_bdf_search { + ATH11K_BDF_SEARCH_DEFAULT, + ATH11K_BDF_SEARCH_BUS_AND_BOARD, +}; + enum wme_ac { WME_AC_BE, WME_AC_BK, @@ -761,6 +766,14 @@ struct ath11k_base { struct completion htc_suspend; struct ath11k_num_vdevs_peers num_vdevs_peers; + struct { + enum ath11k_bdf_search bdf_search; + u32 vendor; + u32 device; + u32 subsystem_vendor; + u32 subsystem_device; + } id; + /* must be last */ u8 drv_priv[0] __aligned(sizeof(void *)); }; diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index c6540d562c42..40f7e70693c0 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -1290,6 +1290,15 @@ static int ath11k_pci_probe(struct pci_dev *pdev, goto err_free_core; } + ath11k_dbg(ab, ATH11K_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 QCA6390_DEVICE_ID: ath11k_pci_read_hw_version(ab, &soc_hw_version_major, @@ -1312,6 +1321,7 @@ static int ath11k_pci_probe(struct pci_dev *pdev, ab->hw_rev = ATH11K_HW_QCN9074_HW10; break; case WCN6855_DEVICE_ID: + ab->id.bdf_search = ATH11K_BDF_SEARCH_BUS_AND_BOARD; ath11k_pci_read_hw_version(ab, &soc_hw_version_major, &soc_hw_version_minor); switch (soc_hw_version_major) { diff --git a/drivers/net/wireless/ath/ath11k/qmi.h b/drivers/net/wireless/ath/ath11k/qmi.h index 3bb0f9ef7996..a7c01b51d9a6 100644 --- a/drivers/net/wireless/ath/ath11k/qmi.h +++ b/drivers/net/wireless/ath/ath11k/qmi.h @@ -97,6 +97,9 @@ struct target_mem_chunk { u32 *vaddr; }; +/* used to get the chip id in struct target_info */ +#define ATH11K_CHIP_ID_MASK 0x10 + struct target_info { u32 chip_id; u32 chip_family; -- 2.25.1