From patchwork Tue Oct 17 19:05:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13425842 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2235CCDB474 for ; Tue, 17 Oct 2023 19:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=HR7Pa1imMdJjoevww05gl/OOldYtptl3xZCsYgwZhLU=; b=gnFI0t6MTNPcfS ek1uJobu89oId0zZmTv9WlnAInMfuIZeM5NsngWqndAUYiWfMaMPqvCRDmxXSuxYEfm/z9xUIqQ1+ ECCkGFteHok6ziCaN066woioBo3yEFaJ7n0VpI41htAuX0umAM+B0DI6SvwsHG9HwD7d9RAMyWMMO 42Dttgj20UFpXHf896NkMCVpzXoVQM30cNivNQ0tvdqdO7TQ5DaD+rd60AHTMmHna57fu9tKD/kNf NYhNh7hWRu36+dAiNM47MY3sirg+q0OsqV2tcOUnS9rwFx7RrriYz/FldQoBbAN5DjUFWUrpFMonN YlTtge1Kd9ghOVl8N+pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qspjO-00D5k0-0h; Tue, 17 Oct 2023 19:27:54 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qspjM-00D5ij-1M; Tue, 17 Oct 2023 19:27:53 +0000 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-32dc918d454so605426f8f.2; Tue, 17 Oct 2023 12:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697570869; x=1698175669; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/WIYTERMpa/hQ3nYRT3WjhR5KvI3DYiqFx8C9H6a/AQ=; b=PJGnpj3IrSE49jh+zuRLwn8I6+YmxnREZsvCWtN7RYbsJ6bNSksb8w3pEwPbw/B6Q3 TTTCx+xoI9b8Oz5DylW5WF6saXZbxo4Wg3jOB1sb8d+nK6UIfV22N05vMOFIG2WDuuyM Xnv923JD0dXM7FAZ0SprJz6IbGwxBbZPoQXjkpzZdUXC9jlNjaByOdx59QTaKEt5fzTn cV/tPUOTQkPouLEpJeWbmBfBUTNSyDmNJZvWDz6c9zZ+AnznmKEwcDi9ln/3cEThm9lz E3XhZtsc6SAlz6uYpBCS6gF+WJouXp2IpIfdE9iqWZwUeok009E+o3gTXlchOE7WP7No qKbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697570869; x=1698175669; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/WIYTERMpa/hQ3nYRT3WjhR5KvI3DYiqFx8C9H6a/AQ=; b=v4acyOLw9SLgAziOqZ8tcjrnurQl2mYR8el/v196UWqyiwoBqYbUssjl9rb4A2oOPE 9fHO84xjgM2dz7RyKS0kt8ftdwstmpK5Xs15ZGCzRELs/AD+wbnVB4K3BqHPk03krYvn kHThIsQJc+bA6lZlN27F6eI3p3qB/62wrURPLOHZycUuXqdS2gouFg+cBEhtoT351Ubj +YlX+RlxOW+4ZhdyG/ndrXWgIaM/qdOD6AqGl8gXFj2/h5mYqSJi3jtnu8BIh/RLxni3 CdMCHAPNtoWZrwaT2uPuSIdDmCctgwM9Wgjo36Ud7+vE5sKW9jEK60owct9x+cSaUDly Yfug== X-Gm-Message-State: AOJu0Yx4XHY7erPoPeNNBr13j7aAFelQOiz3h5LAAiZPHaJD8giQXc2W 2S946R54uKnwlNohudncrYs= X-Google-Smtp-Source: AGHT+IH1sIJVj6vXFk3PsUqXsDejVqOQyTaC/4Gh2c9aKr1SO/xiGQdSW9KnyI9IseCxWCSAKxk3+A== X-Received: by 2002:adf:f7c3:0:b0:32d:89b5:7fd9 with SMTP id a3-20020adff7c3000000b0032d89b57fd9mr2562686wrq.56.1697570868914; Tue, 17 Oct 2023 12:27:48 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id o2-20020adfeac2000000b0032cc35c2ef7sm435897wrn.29.2023.10.17.12.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:27:48 -0700 (PDT) From: Christian Marangi To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Simon Horman , Alexander Couzens , Nicolas Cavallari , Daniel Golle , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Cc: stable@vger.kernel.org Subject: [net-next RFC PATCH 1/6] wifi: mt76: fix broken precal loading from MTD for mt7915 Date: Tue, 17 Oct 2023 21:05:05 +0200 Message-Id: <20231017190510.27163-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_122752_484573_57E42617 X-CRM114-Status: GOOD ( 14.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 495184ac91bb ("mt76: mt7915: add support for applying pre-calibration data") was fundamentally broken and never worked. The idea (before NVMEM support) was to expand the MTD function and pass an additional offset. For normal EEPROM load the offset would always be 0. For the purpose of precal loading, an offset was passed that was internally the size of EEPROM, since precal data is right after the EEPROM. Problem is that the offset value passed is never handled and is actually overwrite by offset = be32_to_cpup(list); ret = mtd_read(mtd, offset, len, &retlen, eep); resulting in the passed offset value always ingnored. (and even passing garbage data as precal as the start of the EEPROM is getting read) Fix this by adding to the current offset value, the offset from DT to correctly read the piece of data at the requested location. Cc: stable@vger.kernel.org Fixes: 495184ac91bb ("mt76: mt7915: add support for applying pre-calibration data") Signed-off-by: Christian Marangi --- drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c index 36564930aef1..2558788f7ffb 100644 --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c @@ -67,7 +67,7 @@ static int mt76_get_of_epprom_from_mtd(struct mt76_dev *dev, void *eep, int offs goto out_put_node; } - offset = be32_to_cpup(list); + offset += be32_to_cpup(list); ret = mtd_read(mtd, offset, len, &retlen, eep); put_mtd_device(mtd); if (mtd_is_bitflip(ret)) From patchwork Tue Oct 17 19:05:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13425844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 800D9CDB482 for ; Tue, 17 Oct 2023 19:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w6Ua6m9RVDGCa46crh+Lg6XwOqdA8y9lx6CSBy6xFF8=; b=cEPlitwDjS38j0 LZtrzsMdi+WxSvHmFbIC+ohlxP5wbvSXqMpLfvmOcwmEEePyMsMiwmbbMCOIvjj9PVNrb5xJRlkFN 8TDLOWjD6Y2Zg1bAE7HrNwmj4+ciCK8TXRqrk4ERp5qf3CuG++gIRO2mEPCueeMbX52a8//y/n5OC gPFL1SOT/a/0Z+OiD2DuYHoGKzSWIuUGUI1AXEsJ1aRitXj7si8+7yTMuOvT7AgI26DQ+Etrhc6of uPhaTOeJkTUQf9khKEJ9mGP0GGs6TRPF5KduIBonFMc9sN/X17EFR3T0U15t6ZZVPEkZObKDwJQQ1 UAJirmwKQQBnTAsGlGEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qspjV-00D5ng-0y; Tue, 17 Oct 2023 19:28:01 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qspjN-00D5j0-0J; Tue, 17 Oct 2023 19:27:54 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-32db8924201so1898872f8f.1; Tue, 17 Oct 2023 12:27:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697570870; x=1698175670; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=I2HMXOLF5eJrUMENCt8aiW3aj9mFErqyM1uPwOqtdoQ=; b=atngvBeCTI+FA+g4bQi4JNkAELWtYstAXzSjwL7agxeh94LI+Tb1LUzAgiBNIXCTMg nsSJKkXPBUyuqIr7aNDMFR2AqENOS8p4Rut1sxfWKa92IBVV0FMtp7PclaS2eHRAWqmk LS+GEun+Fc8RSrHuhhjIX0/YrICfjSnIwNvUZm/fTsr396NCGBSowdM5wDDPbLWz8Fwv Lr0b5qaJMnITpnNWLMOM32xEisHiCMDUqevxAyLe9IMOnKJDEMFmrFn7TsYP3jN/2CiG ci8K7Qy1Nlw5jcxeOBoV0LyldN/8uTmHWu741wVrZAA1UNrzNrmrsjgHiJssY7r3+bNm FFnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697570870; x=1698175670; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I2HMXOLF5eJrUMENCt8aiW3aj9mFErqyM1uPwOqtdoQ=; b=D64Xzdk74jSh9+yQXc6bgf1RS0XT7A0c8mTpMUApEbTuFUAuNcsoApejrAUnKGNw6g rqOyPoyIi9nZ/G1rvH9sCCQLIQkqcklJYY/khKFmRXKMlwqrTYxwD6/5McyvM5mdNuHQ NIQZkV65BKqRtpe3SFu/25eQ4QfvEj/H5hMerJZCcmf17/gIKlZNpcGvZ9EQmCqrcmc7 WXTNEEu+eSz2QBIDcF4GaGS8IIY7tx+LLjiDBACoGt0rauAfmAP1O5ZqlPZ6ZxCQh34s 3We7+MmCyPfUhAa72VqL3Lw1GeQZtoivF+ONKAaN1xh6p1g36OFuevHo3de3XGeztu51 M8EQ== X-Gm-Message-State: AOJu0YyuH65EDhzxq/USF094SDdmrhfxH1AVQW+f0Deg7uplpYrEE1bd IMoa7S9ZcZ4O4NTJR8zPcbg= X-Google-Smtp-Source: AGHT+IHaxYR/ji/TpEeQiKOxetQQnrm2fznjqODcepcXxmiYcoSadf6rAytgEwutDBenrBNoao4Scg== X-Received: by 2002:a05:6000:1375:b0:32d:a98c:aa1f with SMTP id q21-20020a056000137500b0032da98caa1fmr2431879wrz.1.1697570870180; Tue, 17 Oct 2023 12:27:50 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id o2-20020adfeac2000000b0032cc35c2ef7sm435897wrn.29.2023.10.17.12.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:27:49 -0700 (PDT) From: Christian Marangi To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Simon Horman , Alexander Couzens , Nicolas Cavallari , Daniel Golle , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH 2/6] wifi: mt76: fix typo in mt76_get_of_eeprom_from_nvmem function Date: Tue, 17 Oct 2023 21:05:06 +0200 Message-Id: <20231017190510.27163-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017190510.27163-1-ansuelsmth@gmail.com> References: <20231017190510.27163-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_122753_134619_EDC3398E X-CRM114-Status: GOOD ( 13.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix typo in mt76_get_of_eeprom_from_nvmem where eeprom was misspelled as epprom. Fixes: 5bef3a406c6e ("wifi: mt76: add support for providing eeprom in nvmem cells") Signed-off-by: Christian Marangi --- drivers/net/wireless/mediatek/mt76/eeprom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c index 2558788f7ffb..1de3c734e136 100644 --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c @@ -106,7 +106,7 @@ static int mt76_get_of_epprom_from_mtd(struct mt76_dev *dev, void *eep, int offs #endif } -static int mt76_get_of_epprom_from_nvmem(struct mt76_dev *dev, void *eep, int len) +static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int len) { struct device_node *np = dev->dev->of_node; struct nvmem_cell *cell; @@ -153,7 +153,7 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len) if (!ret) return 0; - return mt76_get_of_epprom_from_nvmem(dev, eep, len); + return mt76_get_of_eeprom_from_nvmem(dev, eep, len); } EXPORT_SYMBOL_GPL(mt76_get_of_eeprom); From patchwork Tue Oct 17 19:05:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13425845 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88CC8CDB483 for ; Tue, 17 Oct 2023 19:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HDYBVJZ++XKtHTjIUq+EOvR5vk+evbQH/oyw2GzGqK0=; b=sc70AbVIkXx0gg wmz8h88YIpqs0Zdx7cvWs0jeKoYK/E2PFiF7Gp3rws5usKM9GkBtblEqnsar/MBMZuIgDD2A1HBSb JNI235Bvn431AEG0h7VrRwuwquAiFWtf5xsywER8ro+G37kXjJtlxyByNOR/9aB7XB8Ozs0yz/syp t+WIe09T/NxYI04WJ9wBBnad23/ileTdZRCFo7RDvn0sXel7GtZr71iFPrwwANUJC0+zFmjqEXjpF JVGaGRCrOzzQ60DmgH6bop+N/FMrSFxZbUkjUBVyeZytgPdv93+WMv8JLS0SkruUcNXt+Q7avrSyZ UkFAbnbeJcWr2FFltmqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qspjW-00D5oo-2X; Tue, 17 Oct 2023 19:28:02 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qspjP-00D5j7-0S; Tue, 17 Oct 2023 19:27:56 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-405361bb94eso66706845e9.0; Tue, 17 Oct 2023 12:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697570871; x=1698175671; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+0xHAajk9RnoZnMNxnlpPx/L53pYS94eDmnmY1A3Dok=; b=EeFQEhfJLMJ8QEju3t8qXiqSDMtHRbUi6o/sHyioGb/VLbIBLoe1D+2RSRZAK1tG4O kdIUPcNIopgK7tMO9yP7AiaLKo6GNG3SaOOKaDmZrsVZJnnFJIMT0C7nuv3TDfSWZNb0 MrEr61iujXrEoApT0u/C/mOK9q55IJTu+8bEXdypJ8DyZ6O74vXF0IahbFt/SepgFs4P 4B1CkEl/Ipca/s5P3h8gLQ9G2467Si+EZ36ZkaQZkSvRAqBUVs+YDoDcuKpVP7bldpG0 A5ItGKT0AoK95IwyehCWPdCM4UdGs9noOnkrr46ja8HlSR4HBHTOFZNYskto6Zvm6eXT JRpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697570871; x=1698175671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+0xHAajk9RnoZnMNxnlpPx/L53pYS94eDmnmY1A3Dok=; b=m7jqMZydMGLTBhD0hQZDwT5j5XvGHPzkYcq0ZPp2ezu15yRWFMLWrsHcjjMYR5UcoK TCSvgMw1tVnVDolr91yXTHKdRT61U/DCNzgzhC93lXDRQRLUFDOOvYzIbc9HQwxHOTIn BgZoRhzn8z9V45N3JZ+3D6b77HX18OHfFhEXF5Rei3iiMzeDb5Vfq+tyomehtdMClxTt vngMAWDNSLI/QBcdAW3vLkd8cqGu8ST8MB4JPcmo7dl7iFZP0GSe7gbOGg8WGQHWgeIP OjMKjKleYru2gVIgGMAqo4iWJxlTss+3UmP8hfHUSQwOM9SdBw+/8mQJABpwBjPmxk6f 9uDg== X-Gm-Message-State: AOJu0Yz1tQMJ+h2vW0T/LCBpsl3CnZEYdpTRrUvkgVvUgqC60FoU10jx udiNdF4IioSIGA34/+RV2UQ= X-Google-Smtp-Source: AGHT+IHzX9yaXcV3QWlXu9GSfGAVCIcJ0SoqRGEZUbBLGj/4l7W7+zG+ktg0AVC5pcCKK+R9qYOBXQ== X-Received: by 2002:a5d:5947:0:b0:32d:9e4f:7190 with SMTP id e7-20020a5d5947000000b0032d9e4f7190mr2723978wri.60.1697570871353; Tue, 17 Oct 2023 12:27:51 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id o2-20020adfeac2000000b0032cc35c2ef7sm435897wrn.29.2023.10.17.12.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:27:51 -0700 (PDT) From: Christian Marangi To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Simon Horman , Alexander Couzens , Nicolas Cavallari , Daniel Golle , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH 3/6] wifi: mt76: limit support of precal loading for mt7915 to MTD only Date: Tue, 17 Oct 2023 21:05:07 +0200 Message-Id: <20231017190510.27163-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017190510.27163-1-ansuelsmth@gmail.com> References: <20231017190510.27163-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_122755_178547_AE8C7C56 X-CRM114-Status: GOOD ( 14.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Limit support for precal loading for mt7915 only to MTD. Passing data from DT doesn't support offset and NVMEM require a different cell name and doesn't support offset hence only MTD way is actually supported. Rename mt76_get_of_eeprom_from_mtd to mt76_get_of_data_from_mtd as it is now used for a more generic purpose and export it. Signed-off-by: Christian Marangi --- drivers/net/wireless/mediatek/mt76/eeprom.c | 5 +++-- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c index 1de3c734e136..817074a5d2fc 100644 --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c @@ -28,7 +28,7 @@ static int mt76_get_of_eeprom_data(struct mt76_dev *dev, void *eep, int len) return 0; } -static int mt76_get_of_epprom_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len) +int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len) { #ifdef CONFIG_MTD struct device_node *np = dev->dev->of_node; @@ -105,6 +105,7 @@ static int mt76_get_of_epprom_from_mtd(struct mt76_dev *dev, void *eep, int offs return -ENOENT; #endif } +EXPORT_SYMBOL_GPL(mt76_get_of_data_from_mtd); static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int len) { @@ -149,7 +150,7 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len) if (!ret) return 0; - ret = mt76_get_of_epprom_from_mtd(dev, eep, offset, len); + ret = mt76_get_of_data_from_mtd(dev, eep, offset, len); if (!ret) return 0; diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index e8757865a3d0..f6c850557447 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -1095,6 +1095,7 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str, int mt76_eeprom_init(struct mt76_dev *dev, int len); void mt76_eeprom_override(struct mt76_phy *phy); +int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len); int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len); struct mt76_queue * diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c index 76be7308460b..5228f710b3da 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c @@ -25,7 +25,7 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev) offs = is_mt7915(&dev->mt76) ? MT_EE_PRECAL : MT_EE_PRECAL_V2; - return mt76_get_of_eeprom(mdev, dev->cal, offs, val); + return mt76_get_of_data_from_mtd(mdev, dev->cal, offs, val); } static int mt7915_check_eeprom(struct mt7915_dev *dev) From patchwork Tue Oct 17 19:05:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13425843 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D0208CDB474 for ; Tue, 17 Oct 2023 19:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CcJQ6+V4GSScgISLnK7/hlMuFND+aYBOfYK7S5oXmag=; b=k3Hr7r4CNVhTQw 96TbOK2jyGibBzI5FXYI0Hf4Yg42B0W/0obij/q8bKiRQYcoPmU3Bmk82LJYIYCq4DGMqBHQFJ+oc lxR83hqxbaUk/r3zKB+3vDHYJ2JZkGM23Pcr4ZGCx/RtV5TEdeAwN+BvsvK6SGQOoA2Xjju2MT2vi UY7wio5aIbwznFsOv9STkoBQ+7UlFCxMDps3X4lCcUzOAZOrk+ghqxb4wA6ndiV1qntkzNVRF5dGP 6OckvqykocZvXGdC4FAz4e7WqDSdaZabAaYR7oQ/2I+gYUWsAUT15/7VjxPSIZi7eGvsw540nUtSq F/fJvqMsB0zldAyNYI/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qspjY-00D5q9-0I; Tue, 17 Oct 2023 19:28:04 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qspjQ-00D5jk-2O; Tue, 17 Oct 2023 19:27:58 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40837ebba42so4304935e9.0; Tue, 17 Oct 2023 12:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697570873; x=1698175673; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=3IL6KY3EzM2BxcqkNoWLsWmWA0zN5X5Kl3affJBzO2c=; b=BF88jsJRvsKxXK1XlXguyVK/JzsNvCYQFz2vuHWPpkYlZLuUGAQ6vqE0XjMhNonwl5 4/V/X308WUIVymA227pxZS5Asyb3f5iKNIwWsmu+nSPj05Y4my4oKo5irisJI1r7LTJr V8So8KPf+zd9LF6uzpkykoGUwdOZnsvWwTtcufMExM9qnV9jcLnP+2jWrSuKsGRv41Fp sHFVo2Kxri6/P+K+e8THxpUWOqdoUGlSl/3c2prcXZ5p1Bx3rZuHAGvs7LbmmY0EHiyd VcVwIbCGUAxMJ2O5ANe1ilyFZfxBJ9l07iUvDzYRK4ZOUC6W+gm09hiMH09vEC7FvOh8 Hfpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697570873; x=1698175673; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3IL6KY3EzM2BxcqkNoWLsWmWA0zN5X5Kl3affJBzO2c=; b=icLbZ8/KNBSlVruLjJumo/4dtRwtD2+sToq6zCmWWbxoFICBxwbUTROcQ588+OjT1c Q1fApha0ArQtp5zhz/Hlo7jXPyp5lykjWHMHBcYJ6nKz8phiQvczpgRT7qIVQTosjM8D etfYlvvMOuZIXnStvS75TrKcKKTpPL6q77SumXWd3B2wZX0J6on/+lnql9jsMA6496BD JUUcnJyb5YA1EKAtuPzrBElsjHzq9FWPxt8NK6TVCPgpe5GMfDiLOGm5MdxGbh1TzcnN c1o8otH1xXswzIEJNqpPZ4GGZAGrJzlx8Hstslt4NKCF8fJIXAnXJHmZGFdQuiIy1YJM svww== X-Gm-Message-State: AOJu0YzhJ8CnmPVngYgFDZfkezvN0ZPt6wAadoTtPCSdFmh5FTkX+fde QKfV+snpcn7YIZErwP6nURg= X-Google-Smtp-Source: AGHT+IG5U1O8F0WYcC/ShlvOiLSsSiY7RwLNMBcm6vpZV2ouHYIJnXX4mFscSuxO+x0YZ3wBKSLK9Q== X-Received: by 2002:adf:f982:0:b0:32d:b06c:80b2 with SMTP id f2-20020adff982000000b0032db06c80b2mr2969857wrr.0.1697570872715; Tue, 17 Oct 2023 12:27:52 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id o2-20020adfeac2000000b0032cc35c2ef7sm435897wrn.29.2023.10.17.12.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:27:52 -0700 (PDT) From: Christian Marangi To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Simon Horman , Alexander Couzens , Nicolas Cavallari , Daniel Golle , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH 4/6] wifi: mt76: make mt76_get_of_eeprom static again Date: Tue, 17 Oct 2023 21:05:08 +0200 Message-Id: <20231017190510.27163-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017190510.27163-1-ansuelsmth@gmail.com> References: <20231017190510.27163-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_122756_796603_56A7A532 X-CRM114-Status: GOOD ( 14.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since mt76_get_of_eeprom is not used by mt7915 anymore, unexport it and make it static again. Also drop offset arg as it's only supported for MTD and was always set to 0, hardcode the MTD functio instead. Signed-off-by: Christian Marangi --- drivers/net/wireless/mediatek/mt76/eeprom.c | 7 +++---- drivers/net/wireless/mediatek/mt76/mt76.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c index 817074a5d2fc..748f4b643a5e 100644 --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c @@ -138,7 +138,7 @@ static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int le return ret; } -int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len) +static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len) { struct device_node *np = dev->dev->of_node; int ret; @@ -150,13 +150,12 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int offset, int len) if (!ret) return 0; - ret = mt76_get_of_data_from_mtd(dev, eep, offset, len); + ret = mt76_get_of_data_from_mtd(dev, eep, 0, len); if (!ret) return 0; return mt76_get_of_eeprom_from_nvmem(dev, eep, len); } -EXPORT_SYMBOL_GPL(mt76_get_of_eeprom); void mt76_eeprom_override(struct mt76_phy *phy) @@ -410,6 +409,6 @@ mt76_eeprom_init(struct mt76_dev *dev, int len) if (!dev->eeprom.data) return -ENOMEM; - return !mt76_get_of_eeprom(dev, dev->eeprom.data, 0, len); + return !mt76_get_of_eeprom(dev, dev->eeprom.data, len); } EXPORT_SYMBOL_GPL(mt76_eeprom_init); diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index f6c850557447..41e4f398083e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -1096,7 +1096,6 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str, int mt76_eeprom_init(struct mt76_dev *dev, int len); void mt76_eeprom_override(struct mt76_phy *phy); int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len); -int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len); struct mt76_queue * mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, From patchwork Tue Oct 17 19:05:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13425846 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A20BCDB485 for ; Tue, 17 Oct 2023 19:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7Hp/tAyNopUjiL2zWdB9sw/nQoUbQJZk/E0rno+KO/0=; b=3V+qhRNLt7U/XU GP3W8fpWMUCldvGj0edd9wLTf10bX47qEx5Q+VZ1uTmoyYYxVx1lzQ1elsnvwCc3/pEF99xgZRIpu D1gjZoiC/PSCjL6LkwmBacAH/2sxFQkY/NjjqyHM8qIeBzdWTNng4Ez4zdBw4V8AgzWCl37uPLC+c rW0H+JzlUx7N2hjTCZGbtnPWF8dWZh1hmnAyX5LCGu59UFS948KEjn2LNcs6NtTG4EEbv1U4+k/9l 7FidOHu8emGCLhhLjkW3ukNvN/4EKZUvrm/TUSCg3NuALPudIf783/PDPgupokEDScuHnuwbVfX+V eF1hQgEOVdOZea/nqsCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qspjW-00D5oM-0a; Tue, 17 Oct 2023 19:28:02 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qspjP-00D5kE-0e; Tue, 17 Oct 2023 19:27:56 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-40806e40fccso6965275e9.2; Tue, 17 Oct 2023 12:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697570874; x=1698175674; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=g6jQJsBRBLmDkm3I/0qquR/3BJtEfnv9Twl5IETKE8Y=; b=izPmPsVliM8Awzf0gyVUgOUlGbidmnCtwsgwzFPuaoOEk7TS5FhP8gRmAOXTYotWpV fJEJCBTGWG8CxbHziGBmyQq4QVHksK3NmE2/zupczzXCJfmHyzKZWh7cVLAWSkeLHXCX nfp+K3hcVoZ4lCkPO4h5ic8tc8mvgZwmb+4GzHJTrLLtgygFdLQT68nVUkzgNX+yLNm8 vWjKMN0DhcuVXgQue6RgnJ6ce+EW2szRPUQxMNHkp5z9C/eDGpPcU0DV6OoW4jy9UuwK /rLOIMVhmtL3ALH1+D3Fp6FULx/vu14YcbMIDK7OWb+MVNv82dLsn6jwJQPEuX4RPv0v hUSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697570874; x=1698175674; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g6jQJsBRBLmDkm3I/0qquR/3BJtEfnv9Twl5IETKE8Y=; b=GXQI+MoFidypYLqpVZWepkHiZxLq6Eq2iDOjU67WVbzu3fTAtthbaT/XoPa56tC2E5 4hNgI+GbnmUeu2hX999dEQzP7uQY8Zt/Il0xFnC05FLE29b3N11SV3RyHCPEfvybQUOw bqyNeKHqgcRxzUvkgDq4MuJmIFV3RNJbLMeocKfCA0P5Qc/NV1fdemtLzzdNalsAk/Ay Y4BkAPX6dkqDixkm4wu8jUhnJDMY5WctVMkUMfKTCTJwLiWfbDaUk2DB8l14OaWLaxrA t8+xx/Nz6lJoEqf0oD3xgOhmx+emjCtD1nNRzxXqgm5S36/6OnTrtRHrmrJ0k51tL2VF bXGw== X-Gm-Message-State: AOJu0Yx71AhKW024OoeWckoDsrbZg8PAXdPHRo0ZSnFdikqnvZedCC0p qfdw2bjqSeHkx76s8yyHxOYDlfk7pNI= X-Google-Smtp-Source: AGHT+IEnQ5HC+BuPuzufGE10gWuIiTfP965Vnpx9uNXzZJjYccZpAg+E7wcKaRLYSLxC56LOmeRrdA== X-Received: by 2002:a05:6000:8b:b0:31f:a62d:264 with SMTP id m11-20020a056000008b00b0031fa62d0264mr2704276wrx.37.1697570873841; Tue, 17 Oct 2023 12:27:53 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id o2-20020adfeac2000000b0032cc35c2ef7sm435897wrn.29.2023.10.17.12.27.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:27:53 -0700 (PDT) From: Christian Marangi To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Simon Horman , Alexander Couzens , Nicolas Cavallari , Daniel Golle , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH 5/6] wifi: mt76: permit to use alternative cell name to eeprom NVMEM load Date: Tue, 17 Oct 2023 21:05:09 +0200 Message-Id: <20231017190510.27163-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017190510.27163-1-ansuelsmth@gmail.com> References: <20231017190510.27163-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_122755_244677_21FD10FA X-CRM114-Status: GOOD ( 13.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Generilize mt76_get_of_eeprom_from_nvmem to use alternative cell name by passing the cell name as an arg and expose it. Rename it to mt76_get_of_data_from_nvmem to better reflect the now more generic usage. This is to permit driver to load additional cell, like precal cell. Signed-off-by: Christian Marangi --- drivers/net/wireless/mediatek/mt76/eeprom.c | 8 +++++--- drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c index 748f4b643a5e..ac6c0a0e876f 100644 --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c @@ -107,7 +107,8 @@ int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int l } EXPORT_SYMBOL_GPL(mt76_get_of_data_from_mtd); -static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int len) +int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep, + const char *cell_name, int len) { struct device_node *np = dev->dev->of_node; struct nvmem_cell *cell; @@ -115,7 +116,7 @@ static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int le size_t retlen; int ret = 0; - cell = of_nvmem_cell_get(np, "eeprom"); + cell = of_nvmem_cell_get(np, cell_name); if (IS_ERR(cell)) return PTR_ERR(cell); @@ -137,6 +138,7 @@ static int mt76_get_of_eeprom_from_nvmem(struct mt76_dev *dev, void *eep, int le return ret; } +EXPORT_SYMBOL_GPL(mt76_get_of_data_from_nvmem); static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len) { @@ -154,7 +156,7 @@ static int mt76_get_of_eeprom(struct mt76_dev *dev, void *eep, int len) if (!ret) return 0; - return mt76_get_of_eeprom_from_nvmem(dev, eep, len); + return mt76_get_of_data_from_nvmem(dev, eep, "eeprom", len); } void diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 41e4f398083e..c9934258c49d 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -1096,6 +1096,8 @@ void mt76_seq_puts_array(struct seq_file *file, const char *str, int mt76_eeprom_init(struct mt76_dev *dev, int len); void mt76_eeprom_override(struct mt76_phy *phy); int mt76_get_of_data_from_mtd(struct mt76_dev *dev, void *eep, int offset, int len); +int mt76_get_of_data_from_nvmem(struct mt76_dev *dev, void *eep, + const char *cell_name, int len); struct mt76_queue * mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, From patchwork Tue Oct 17 19:05:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13425847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 91BF1CDB482 for ; Tue, 17 Oct 2023 19:28:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CMEsFDQeBS4pY1az15QXp62MRgzQRlKv8AIVd+aJIQU=; b=GcIVk7Pe7+UP9K xw2qdVKZKX4A/DSclzCdcUbxljydggI254QiPEnlgIHTILFeCpK4RTnINU/K/jcxvAKHS0noEumd1 a3EPJEfGT0EwYzG/qOlfAk+U3LEf5neU87nlDksh/2OWzN34IwQoukeowbf1fanO+weeytr/0VW6l un+LUE++Y8SXRarBiPXLjo1uerpVFs1BurFG4bLMbeM3gWWiHMctWUkAOIbciMLgYuqFFy+DPvlg0 ffVyaJpk1LyEAG8pyRUIgjDbSwlnsZpV9iiTQKaVYvKH0aUTlKhh7Unh5aJLaa0Xug4AApmnxZWml 5g5t9Tjvl8kJ+uoG8cpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qspjZ-00D5rJ-0b; Tue, 17 Oct 2023 19:28:05 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qspjS-00D5lD-1J; Tue, 17 Oct 2023 19:27:59 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-32daeed7771so2467320f8f.3; Tue, 17 Oct 2023 12:27:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697570875; x=1698175675; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mw4sfthIPjM3BfawqG9k28qO9mlhU0PnICKHznmlMio=; b=BrmYiDqJwBo7IT/OyQ72xwMMDsbY6Ou1TsWCUlr1ADRIibJSlsUDoFDRIM/M/ogfDZ VnPdAsFD7j2KSYbxooN9mgE40s08UwNUi8NHLd2EsMyGx8okfbL0IuQAb6l3c9jLIoq4 wdCWk1Q3dQt5kYMIMX7ATb5y0DnATbMjtn8EJn3SkM/RReXJvvxY7uJtwohlvMj2lw1N FBGEog3kYirar0WHuLilJxCfqgMBisx37QSiQLXInAx3lsKL5RxXVMasIN/QV/Ab8hs8 x1PZ89bG4ENlFwx4jNhQ/c2rb2L0/L4X8YPznP8qqKAiSNGGAfF1fZsRCvkFKGech/E2 HzRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697570875; x=1698175675; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mw4sfthIPjM3BfawqG9k28qO9mlhU0PnICKHznmlMio=; b=GgIz0Yp8ESBdo5m7i1Su7e0kBigZGyFNSjARQI+X6sBn3abqjuRZrg+ISXl2lwcdnH nZZJmW+rwr+4wgdx4bFLB37MnOviW1coxcGDdHFrQfFXrXA6LisoQfIv20yOt23hM/3c KPUp8nuo0jGcB3ITDVVkz/n6kPBNIGn1oFxsu4e5FP+SDy/v+T6/w1Yq+AV+ToP9iLnm FI6n6c72/gvdMzu8yisBXjlaBH2u42qkECKk6fU6tFRV4J29CACRXUB4c4zD0mUBMcZJ UwMOCoB+AYh3TM0t7UpaasDP11X+tcLPtAhDmUhojMt8eTOybbgMe+8QqmcYTDWf/gSr yFjA== X-Gm-Message-State: AOJu0YxZ2eG3QQH75hkHYwN1dFzVtbxf6R8aauY+ZYdMgjfYkUFK8OJR nZHoLB4s1LbeRqfRKGJz08I= X-Google-Smtp-Source: AGHT+IHglYUm70uW0GVWCXnzNjqxcIopFPc+GSa/J1yUXCB4sfKjA0wso4+1pkjiDF1KQL7RhyLuhg== X-Received: by 2002:adf:e5cb:0:b0:32d:9d3d:3025 with SMTP id a11-20020adfe5cb000000b0032d9d3d3025mr2390702wrn.26.1697570875023; Tue, 17 Oct 2023 12:27:55 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id o2-20020adfeac2000000b0032cc35c2ef7sm435897wrn.29.2023.10.17.12.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:27:54 -0700 (PDT) From: Christian Marangi To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , Christian Marangi , Simon Horman , Alexander Couzens , Nicolas Cavallari , Daniel Golle , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [net-next RFC PATCH 6/6] wifi: mt76: permit to load precal from NVMEM cell for mt7915 Date: Tue, 17 Oct 2023 21:05:10 +0200 Message-Id: <20231017190510.27163-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231017190510.27163-1-ansuelsmth@gmail.com> References: <20231017190510.27163-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231017_122758_453007_464637DE X-CRM114-Status: GOOD ( 12.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Permit to load precal from NVMEM cell for mt7915. The NVMEM cell must be named "precal" to be correctly loaded. NVMEM cell must already account the correct offset and be placed after the EEPROM as the function expect the data right from the start. Signed-off-by: Christian Marangi --- I would like to have some hint of the cell name... Is it ok to use precal? Should we use "precal-eeprom"? --- drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c index 5228f710b3da..3bb2643d1b26 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c @@ -11,6 +11,7 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev) u8 *eeprom = mdev->eeprom.data; u32 val = eeprom[MT_EE_DO_PRE_CAL]; u32 offs; + int ret; if (!dev->flash_mode) return 0; @@ -25,7 +26,11 @@ static int mt7915_eeprom_load_precal(struct mt7915_dev *dev) offs = is_mt7915(&dev->mt76) ? MT_EE_PRECAL : MT_EE_PRECAL_V2; - return mt76_get_of_data_from_mtd(mdev, dev->cal, offs, val); + ret = mt76_get_of_data_from_mtd(mdev, dev->cal, offs, val); + if (!ret) + return ret; + + return mt76_get_of_data_from_nvmem(mdev, dev->cal, "precal", val); } static int mt7915_check_eeprom(struct mt7915_dev *dev)