Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp921855lqs; Wed, 6 Mar 2024 00:17:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUZtAdz/EyLA+VYw555daVl5CeDlI3dqewdEnb8KYvohPjVCh7onA2YlDBUoNJgtwYbZF8X4kC8kOyRPhzN9iqp98yltHbsRcdAPEn/EQ== X-Google-Smtp-Source: AGHT+IESVxxhjDoo94Jt5Xc5lpLVbu2i8Wph/0uhvy9NYgLX4z/YpZz6QmYPig0Pf/7gUcAHD6Hx X-Received: by 2002:a37:e114:0:b0:788:2eff:de32 with SMTP id c20-20020a37e114000000b007882effde32mr6427947qkm.26.1709713044246; Wed, 06 Mar 2024 00:17:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709713044; cv=pass; d=google.com; s=arc-20160816; b=qc4OIdB+9wR64ulYKZqXuij8VSLdGRU5pckimUCFJz90s+40MKcD1YaW26fs8aJ6Gu MHDEthvrdDuywgJvk/mTXNF3Xq82bxHo665uVRv0olqUJuhoSI2PB2KugEWiAEidqRU5 0KQjec4/tZlno06TztlY+NIM1nHvep/+qBpvUaHaiXnwi7+qso7+vMOSUPNgwgcMST+X pfAdbZS+i7Y9s68eXuAK8ADluBUDtI1jgWazD0ho79uECpP+gYzsR622Hx+gXo5kCWO3 KfPuDY0X2YoDbUCkrd8NgvRSzlTKFjP2fPUYN/HojVxC2vFsgHyVXHcAz9kP72WsMlRX jsvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=egzIXxC/26zl7qojV0TXJfRYkPw4VuHflVYupD8Ab2w=; fh=tCqJkXntgrHd6Zpa8yJ7amIXBXj620IyeqYK7zN/usk=; b=chIYygRtf1MU5W5WSH1ivD+7fHDa3pMVrTkr3pdPeM/+eqg1QCSf3c16NxK6hGGtAf T6/E4kmQT0m6m1tQZHUhzFFeNxp4q/E6cxLaf+Ms7i5+98PmpuuQ+j3xwkH1+LE4bN32 cOnFThntGZBNSMt+PWQC0aD0RdziDZd7KsY6bjS3kCRrOkT3kgT0qCiAhR98qle46bxi SR8ElK206f7ud7FnS0VM7lWFu11FEDgtNJZN3IVzY81PQkoBYLB4kV/xASr1daq+bMeg oYY1diYFUi/waaTi0Gd/4BGsJ0WZylqG9y5HnSI4Bpve9loMtNDmKISzn6gIZKuSPtpg cfXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aIoizNsY; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-wireless+bounces-4418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a27-20020a05620a439b00b0078822c7c526si9041968qkp.86.2024.03.06.00.17.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 00:17:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aIoizNsY; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-wireless+bounces-4418-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4418-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id F418B1C21972 for ; Wed, 6 Mar 2024 08:17:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7D4B5D905; Wed, 6 Mar 2024 08:16:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aIoizNsY" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB95E5D72D for ; Wed, 6 Mar 2024 08:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709713014; cv=none; b=SMWEU+2Qv8IP/XZKruoFrpWoSsmTSl/oe+MTrSKA3ukivb6ssp6QNY6qrk2ZuugDrwE0NsU1m80JUiUGN6wG5UxNC/Yd8NzpAA3EukDbrBfsAImtD8OS6csI+7ZWCYNF3M49zMUdvMJagehX04qP6RaTNL0zGqIMQdq4olYFNV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709713014; c=relaxed/simple; bh=TGLpVD8klKJhc/Vps+sIORuT4Ns7ke6Nt//MUKnxoZ4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bSSdZl/dexFWpzL/CD0ND8gTKxbiwN9gHPRxZFYXjCq4y4KzEP0KOqTTIVY0s2UaEUvUPtrvb/ff1VXB1vCYzr5GFB7wb/orm8tIHsgJ5bQWj7gyYzGP8EuXQBF1sQzdfvkQAa9fuD6cWex9mH+z+RzZRu+Hg2wxc1BY08hpcIY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=aIoizNsY; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-512b3b04995so5027607e87.3 for ; Wed, 06 Mar 2024 00:16:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709713011; x=1710317811; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=egzIXxC/26zl7qojV0TXJfRYkPw4VuHflVYupD8Ab2w=; b=aIoizNsYYc/0PnkXULmqxy2tlxUgHSM2wzTbebH3PYWk5myEu2aVOd6Fo2BUYAD/vy 52vJr0h6ArHKzi6atH/sUCKvdc7qsOUhuVlavV90xKWx/aty5S6BzGo6fDzYm7tMZIEo wTKjg5jXDcmXJmGUGBLygwYRGlORSxrRty/YSI8xgH99XPaLo0T3EjlI+k0OxG2VVsN6 cAypKyfFLCSFEs7EttFbbORek6zYsjwrpmWSfrYhYYi39avBNG4aya+kM3WxMRWQ/bH9 KgUjtdWgvBDF1mi/O4SItNmJpvYyA5l5bK/2e1ucqN2bJUstkH4hGlMQNBpQFMwuv9GB SqOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709713011; x=1710317811; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=egzIXxC/26zl7qojV0TXJfRYkPw4VuHflVYupD8Ab2w=; b=d92SbkX8NM17fn/FCB9pg39fLjVsIKmb3Pw2PNRpFY1LGdw5R8LSmVLDokhSPbuJZ4 3jEbg9afx0r3iww8oN+X662WfoYDVRnLeudVxcqrXF7cJ+OxXmWqxK4KdSWsNDx4K1YP ZFV6GdtTRSkzXJJMTScPc0R+HEj//yAmoDI3yMllx8UhMhTd7Dnw6qOMoc8J0gTSqXhT h/lw3HpE9fIb2sjovvbSslB5sd8xIL8A/PnTiDlhtSIhCz0APzYl/Z+LA8dGHd9QDvU8 WpWKgI5w5Mkgjlb8XCDM2LJBXT0+Q+OyKf8S0RwLtDx6YqSkjuA9JF9bL3xCUNCDV8wS /0Xg== X-Forwarded-Encrypted: i=1; AJvYcCWnMfC0OAr4/SyYIlHK5dxMSk5gzlQbjZoddZ9p3vFOhaXl8xuVKZHspIoEFscPxb1xEIfcBxNsJTsV1AqqPpseMd6FgYg3TSWO5o//e9k= X-Gm-Message-State: AOJu0YzV6bFtyO3lyRCWaC+pO6BwSh6LocuB7LFOSWQqZPtDeWm/uMPd BJXcOBXEAea22T5D/Gib8sj4nTon/6pswL/OlU7OcwrI1ZObyGGc2NCnY5mhzac= X-Received: by 2002:a19:f519:0:b0:512:9e78:998c with SMTP id j25-20020a19f519000000b005129e78998cmr2649685lfb.9.1709713011058; Wed, 06 Mar 2024 00:16:51 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id s9-20020ac24649000000b00512dc23bedcsm2162366lfo.99.2024.03.06.00.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 00:16:50 -0800 (PST) From: Dmitry Baryshkov Date: Wed, 06 Mar 2024 10:16:46 +0200 Subject: [PATCH RFC v2 2/4] wifi: ath10k: support board-specific firmware overrides Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240306-wcn3990-firmware-path-v2-2-f89e98e71a57@linaro.org> References: <20240306-wcn3990-firmware-path-v2-0-f89e98e71a57@linaro.org> In-Reply-To: <20240306-wcn3990-firmware-path-v2-0-f89e98e71a57@linaro.org> To: Kalle Valo , Jeff Johnson , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3302; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=TGLpVD8klKJhc/Vps+sIORuT4Ns7ke6Nt//MUKnxoZ4=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ+oLtXyfrbvX3FPn+byzee7LOc0PTeOWvbT8dT9dTP1T3 NruF6wGnYzGLAyMXAyyYoosPgUtU2M2JYd92DG1HmYQKxPIFAYuTgGYSOd29v9J0RrRScG+rg/s g37UhO46EnfCZc2OKqnwoE+dMo+uF/rf9/2SErFUS2ix8P1OKzfG9RPvHCn/87KJMS2/xCrOutr w+7LL/xeXih/S1mR78++b7yq31G9dZ/l9ziuWFCZbbXv55+L2nIOln41PWYVmvLrdI6ry3jh9Hb d4l+vSK85ep6S5/XeFrrvMUlvS9vfd5l+5mww++7Yq9v0/sV+5odPSSmH/Z6bT6RFvrAT1HwmGR p48kPXTu9DYpeLSRacouaACufMbM9Qa2FlUPWUvt0tr57B4MHBNV7K68flcqrVluWShS01S//c9 jzfVNkr85pr6JsHNJp53csiuRJOMPydLk2NqvyltufwXAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 --- drivers/net/wireless/ath/ath10k/core.c | 11 ++++++++++- drivers/net/wireless/ath/ath10k/core.h | 2 ++ drivers/net/wireless/ath/ath10k/snoc.c | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 0032f8aa892f..ef7ce8b3f8fb 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -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); diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index c110d15528bd..3595c8abce02 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -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; diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c index a1db5a973780..5de911d0255e 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -1337,6 +1337,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); } -- 2.39.2