From patchwork Wed Oct 18 13:09:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13427056 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 E4F71CDB483 for ; Wed, 18 Oct 2023 13:11:12 +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=y+t5EU24giUV8j OFTbLjdaS0THoAWUEt+tF7TG83ujXdSUfxg9X2FWTC+UvpzGbK+DP9GzguZ4htTyDeZYl/0FVoCzF hd4ejgdVfQlXitv2Ml9/PdMhCu804bokSp8ZKyLTKkp2i3OioUNHqWZC51GQAjW0wuTlEdTFnObb0 i84NI0nWvUMC0ZwEmIJeXORy1QjXauyfvELzLDlrqmCq3e3VWDgKkODT+9TgmeZ6ONUP9SK6SO/M3 8Edh2HPO/XyUVUdwZ7nTGN/y5zw/yN7TrOE3RNZnoDF9bn1kfK/tdr4Zg/63d1gVjrZwjgmqPhLAC PXBalpGr5vak0rK0DTiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt6Jy-00EkMq-1i; Wed, 18 Oct 2023 13:10:46 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qt6Ju-00EkLN-2s; Wed, 18 Oct 2023 13:10:44 +0000 Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2c5071165d5so7784331fa.0; Wed, 18 Oct 2023 06:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697634641; x=1698239441; 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=nAPLq+y9ox0BDqN6H9E3fd1ajU9v3ucR4Q+MQe1aySQ+orgGqujC8jQYwBZJS43A9S eD6mDS4KWAHn2NNcKelEqe01PBnz9wSYhxUVlQztMECmpUlUqN1JePoY6qyQCphSXAyr U7lYOVJDvqqQwfi9cM15LrRLSjfY6rrOPp/eEYEGTCUSfIhTqFnqX1arbNW0yWlIe81f eZMJUpNWQFMI3SL7etKmVC6kC4JFBnKFWdBzjoIYte5AHs2/552DGI43UoL9ehmsavJG qx5+HXApQeXoVXHXX/L+gQt8iMIq107HWuusU+8VRCy86R/tIiEz5521jlHo9nHSvfQ4 THCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634641; x=1698239441; 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=n8CedQll4ilqLl6GWoGI2phny3jl6PW3KFhffInQDG/sLWbU8C19RutAZF9e3hwcN7 HEGzgArg7H4CWgfZcLW33x+xriftNNWMKzf3eA89HGdjRj+ooerikSDDUo35eYgL50pa KhVOFJcHG6DdpjP856NtYpwX+ETCSzkYLFiPL7EtH8zPKrnDOO/BY4xVVfn5y0viphJa M+9VHluEqF80RGMS1QT4K3Jnm6ZKSKDHqptzO1cL7v7il1/3qyNmdtJqyHClRppYj9gn Ple1k1G2wwXCKfLKqVvWmG1ag8ccewU/6ncsoROlcvymcUMxixPgtr4me8uyFxLD+k/2 ajCg== X-Gm-Message-State: AOJu0YwTKUc7vq1jBszXRIleuWVKcKuLDgVbkRaKnW/1BeBN2bSez7jF EC1hipyjmIK3/BoZ9gF8S5w= X-Google-Smtp-Source: AGHT+IGfdJUpk8Rdt2SKdTJZt1PuOoBqvCcCill/y7BxjK6YaWEs7dFTajSyDUWp2IXypz6opVTCQA== X-Received: by 2002:a2e:9c43:0:b0:2c5:234b:d1eb with SMTP id t3-20020a2e9c43000000b002c5234bd1ebmr3001799ljj.50.1697634640737; Wed, 18 Oct 2023 06:10:40 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id u6-20020a05600c138600b004064288597bsm1677426wmf.30.2023.10.18.06.10.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:10:40 -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 , 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: [PATCH v2 1/6] wifi: mt76: fix broken precal loading from MTD for mt7915 Date: Wed, 18 Oct 2023 15:09:37 +0200 Message-Id: <20231018130942.31187-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-20231018_061042_926441_6635E9B0 X-CRM114-Status: GOOD ( 15.24 ) 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 Wed Oct 18 13:09:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13427057 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 A2F2DCDB484 for ; Wed, 18 Oct 2023 13:11:14 +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=xxT4T/z8PuOon1 jox7cWrbswOBLD2DTJsi9AJUYPvJjW+uLHz59PICclCX0NQWAXpIOTzP9o4Rj9y9ry2Jz5UUP1tQ7 WHMyYY4LwQstMKSyEuZtQM0T63zIaWcj11kVLq7rPN4981ZZkPrkFsFwxBA4NrgycQyz4kZ+Nea7d J1SNQPJPf7QZ5GP5gmF9He/qog0+U4kzt9zIU2Hni0snpRy4SFtbrq/1MLlZ4NO/oR1AxqWTulGto CZXFRJosHjuMGFqoULeSNRUd/MaBOc7pAf/GYmO7xa9NyxEkk6IrsPi8AWvWnEt8gul14dH0N5eRL RsY3Lfe40Kii9CnQR1aQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt6K5-00EkPt-01; Wed, 18 Oct 2023 13:10:53 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qt6Jx-00EkLQ-0g; Wed, 18 Oct 2023 13:10:46 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40566f8a093so63965535e9.3; Wed, 18 Oct 2023 06:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697634642; x=1698239442; 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=E8vXf6mHNfLuFT6eXCyQpNgmT0sztiQKH8ijM5KtcFpGB5WRtKOWPOp0csFgRSIqOG xncTiCEuYw4yY+m7YrWYDh2wCcQxZzF2iqnEZitAE79QU4KqAQU7NueJ8ePZ1qYDIp00 S3ydM74q+Ipr7nHP06JdaoXBC874ThOXmrrgKdkn5MtTYSOqnOS13/cbrNjoQWm1zozk dob1Fh/Sr+kVy7e4h3iHZcmDYa5tuO9c/iRqpuK50Qfyam2Hrn90Chg+5HVixCKTl2lc etbmm8GzzU3GCm6EyvXvvUJDR7/4jwLoJrjWa6q54gd+XFLQB3LQ32vQL7v+Bl4bYQ3u WK1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634642; x=1698239442; 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=xM4tfADJv6rRqnJ882h6EZBek/9pkB2XJHkmkRZk5maJOfJyNbEp30wy8f6ZUYyQBD fds3gMK6Ur8/gpUPt/WtClk0J+1/W3fuWwh/o5Xv22GU7TqN17RhTQA3dfrJGxbGx72f Og/j/lpSYjgzE0Ue5WUP0a2YwGYDnierxtzP/ed8/T9CU3Y8REim2wglef2X7Zc1QiWx HHE9lakiJb8U4l2mlXOmy5w4VYTmA8KpAwr68jCECFFpTvN1XJ/RmAgfQCL1HcBGc+Td zUXOYcJqNs3sQmkjiA/7KCyGn1Z+aIPShw/YR/FaxnNxl3xD78DCOrjwch7ycUT+Mo9x YYQw== X-Gm-Message-State: AOJu0YzzIZM9EjSAEHW87iMu7JPKHeUANdwFveQo/Lujjz6qUM/E4AKS mRl7adqSRfLpQxU/DRq2Ktk= X-Google-Smtp-Source: AGHT+IGmg6G6k+IuVKLb4jSB/GGObbEUK/LFeHNrmueMinKJQgCi6tbVJYrMJG5JhYp3Ipf9kO4icw== X-Received: by 2002:a05:600c:3112:b0:406:7d74:a2a4 with SMTP id g18-20020a05600c311200b004067d74a2a4mr4096893wmo.12.1697634642056; Wed, 18 Oct 2023 06:10:42 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id u6-20020a05600c138600b004064288597bsm1677426wmf.30.2023.10.18.06.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:10:41 -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 , 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: [PATCH v2 2/6] wifi: mt76: fix typo in mt76_get_of_eeprom_from_nvmem function Date: Wed, 18 Oct 2023 15:09:38 +0200 Message-Id: <20231018130942.31187-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231018130942.31187-1-ansuelsmth@gmail.com> References: <20231018130942.31187-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_061045_255067_A303843A X-CRM114-Status: GOOD ( 13.63 ) 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 Wed Oct 18 13:09:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13427058 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 345A9C46CA1 for ; Wed, 18 Oct 2023 13:11: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: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=IVbLVFf9yWsTtC AXXOm47pJ1ok5I0T3dhs5HHvbRLMBfVFpck+csOYxunHUu8SqEEgau+4g64/rn1rDoVVNBWnRCAap dT3FIQSwwhv9InsC9HXSdh24pcS5s5su/G7H3nM/gQ+q654n4v1zGgxwSsD5lGw+sYGu1LI/E0arY iYbX6uguA2jGVH4aid8LY3VcZc7O2gXkCcX3t8ZP6APwop0V70KCoO3K/Q3Ch5O2zcjuW53dgcwtV wGYfMtkq9ce2HkDitxkJrhmCCWsJ/JOayrO3w7fKeyIDy8j2b2FHqVM0cmj3u5FJCuq4gSLE2+yyd Wg6sBpFsXtfIGK8MX0jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt6KB-00EkRs-09; Wed, 18 Oct 2023 13:10:59 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qt6Jy-00EkLt-03; Wed, 18 Oct 2023 13:10:47 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2c50305c5c4so83641911fa.1; Wed, 18 Oct 2023 06:10:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697634643; x=1698239443; 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=REZ2aTJ8IU8n1LL7F3xl+0kGAwSjHAv3CJ4oLkvEYJckvX7QQq6cH5kbxHs4NLyoSC zj7VI3q7aVn3bWl0yfQzqlrTpHF6oK2cgcxz2gaotXCGunELsnIdTuYEUJ1OK5VGGts3 SH0YGRUP0HGdq1iyGAOBgSFWcL0ljC80lVgVpeIr+qTAYyt8uFWM4YZky0N9fcV+Ib1V G10gxwcBBxZv9JByFbaWd3359qv+4nI09yJju5IV9WluYDA2XrBq7+tcgfDGtystCawl bCIre2O/xpr4wbr8B0MJL2ukGv1FjUoXVStBdxCpKZrvtrc5mY6njhlUDv4tiBghaAyK aHqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634643; x=1698239443; 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=C0IZyDAI60Ghu/2xVZAdF7B2l9/Q4/o3o7iqnSGFgPz9LVKsGl71O9Tk5H0lVyj0rN DXr5cCaN7Xpu3/26HLkTpFysuAepkQXKouL0e0z7nlswsivNTQYupXP7t5EKeMhdcyD0 JyKFlbrv1A90dl6aJso2/iGuZ/6xj66Tbqz6OU2vTkaFq3G/ibyT8BSK49Sa3jYzJ/6i WoUdjeSFNCVaiqcIPPNo6xOxvMqn6pvoyTn9aIBVhhjlOjhwSI3YEwwf5tu3Y1gkTuw9 yKQwpZOkKhtksY4Trno6mwX+9P4gRW4xMjeh/ho4vZs7tkayFcGMGnGtI7G0fUrnYB8+ NkFg== X-Gm-Message-State: AOJu0YwxiNQk4vKl0u4A23KtwwHfpDQ3n7vFflt1maEIyk0PN/g0cgm5 h8TIpD6SqpuKM1N8+lEXzGY= X-Google-Smtp-Source: AGHT+IHZCFm/FKSHMNPJ/gTl2cJ2yrV7x+5Y+s67036BkIQ4yBSpE954a8LCaTXr/6eaaE0F0B7daA== X-Received: by 2002:ac2:4550:0:b0:507:9a13:27bd with SMTP id j16-20020ac24550000000b005079a1327bdmr3842384lfm.7.1697634643446; Wed, 18 Oct 2023 06:10:43 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id u6-20020a05600c138600b004064288597bsm1677426wmf.30.2023.10.18.06.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:10:43 -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 , 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: [PATCH v2 3/6] wifi: mt76: limit support of precal loading for mt7915 to MTD only Date: Wed, 18 Oct 2023 15:09:39 +0200 Message-Id: <20231018130942.31187-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231018130942.31187-1-ansuelsmth@gmail.com> References: <20231018130942.31187-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_061046_052667_52A7548C X-CRM114-Status: GOOD ( 15.32 ) 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 Wed Oct 18 13:09:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13427059 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 D20C1CDB47E for ; Wed, 18 Oct 2023 13:11: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=CcJQ6+V4GSScgISLnK7/hlMuFND+aYBOfYK7S5oXmag=; b=h8ec84AnUBJmuZ AQfLld8H7kTnWWaCD8biVVwY4JvrQcZaviWuKzP6uJ3SgvIZLhSW8y1MrxTTzSFJ46M7Gv2bW0X2z Hnj1WsF6Nwgkb9iRbmqI51dsUypvN+gyF/sjzMY2WMkp7ev+N/SEoQgoMPJv7ue1ka4OVW0LlntsK T5LYevkNWVJivwXwglFDjpiUplNBX02CG2sGsIkfCiCwXvNM1livTW3qu2xNHCC2XMs3XshlEX+jW ajxUkzfipUr5wVdCachDg7TbD81YsQW+2BsM+VkBSral+MHRB+imVzvHDtiI5tRMgZH37PFYCmSy4 qY2wc9We0uL0WCfH0FOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt6KG-00EkTk-0M; Wed, 18 Oct 2023 13:11:04 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qt6Jy-00EkMb-33; Wed, 18 Oct 2023 13:10:48 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-507a936f4a9so4786260e87.1; Wed, 18 Oct 2023 06:10:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697634645; x=1698239445; 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=H5RpWJbV4bSZfLTEQHAQh2SKp5Fzrolh8L0KGGALk7tBjsStf6wRH20uy4eh+3WJPT qdhBQ88Tp5NHnY3SwcDuldENXE9dvdD5pgeemfOovCoJ67jTdf0yktg/BX7+465f9GKR rL78gJ0SMQWMn1KqafKkK/4Y0qQoMIK4GF2kZBYsBK8bAeEP/weVPkmpHa/lO4dm6a6D dE7UGJcNh34jkwIYPj4E9mPKkXBHBYk/yy4OBPSbBCQ4i1zhfXeY0UmTbTkndlyB/hv7 nhewTtV0tZDnZwJDgeeQh0vQKgLtex0hyEDEznswXoZML8/hHBACbADTf68T8yeNxzlF 6Vbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634645; x=1698239445; 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=aesiw+rY0h8f1C320ipkZM01gZgoSrjBLBz0OVhTguLoP9aoEa2NBIL+h+T4cxg+wi EQ3P5Ii8oIxKnPhfSHmU7EH1CGqj1BXQ5VHbqtQ9bzWtcO4bn7oYFNt065wX6mwxHsOk LmKWCeQUOL4b5Wgi744cPO0NMKOSbqK3KDPbEjvIAgZ+jzI/OWTthWzOWYac76G2Tl4H Q2GGSSXSSLPzcsMIQ7JWogvOdc+jQ/jg8EjdluLiLrI2XfAJJBZDBnSjYjgsMF+KaYch TxyG/iLX6UCzHthGt2DJsViVcaFhCYqTw+wm+ge4+SkC7C7E8psO0x0JOBh0bafjSdba puzg== X-Gm-Message-State: AOJu0YyrTV+VtlbxqP+gtbWYWhdZE06fMLyYtf6gUrBp8zERTMCChxRI /z2yHltcaZkTdHzgKvjsxOs= X-Google-Smtp-Source: AGHT+IHVrlIY0nKXXNIA7AIoU3XvDxI2gChao7CZ4wvCGgAaU+xe/hqRNOJjT76PDnhKoWnpatNjrA== X-Received: by 2002:ac2:4245:0:b0:4f8:77db:1d9e with SMTP id m5-20020ac24245000000b004f877db1d9emr4117861lfl.12.1697634644820; Wed, 18 Oct 2023 06:10:44 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id u6-20020a05600c138600b004064288597bsm1677426wmf.30.2023.10.18.06.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:10:44 -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 , 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: [PATCH v2 4/6] wifi: mt76: make mt76_get_of_eeprom static again Date: Wed, 18 Oct 2023 15:09:40 +0200 Message-Id: <20231018130942.31187-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231018130942.31187-1-ansuelsmth@gmail.com> References: <20231018130942.31187-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_061046_985950_63B86293 X-CRM114-Status: GOOD ( 14.56 ) 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 Wed Oct 18 13:09:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13427061 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 6A8ADC46CA1 for ; Wed, 18 Oct 2023 13:11:37 +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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/uhykENhW4A0Z6hBwIbhMh7U0t/YUNT8HqAbZsuxOdI=; b=2fvjgZNdO4qN9F HgmknPi01UCEmH7WLqlSb11lQqRNDsqLesGaPGNIMsX/4lM6ltb1B/n6jrNyWDgnuiKm6DctAJIIj rtHpQZkRtkGukRBGCTbM6lSrqcTPxzB5Dypb5iADxWOcoBVWEuQGzLRTARYbIoZu5B3BtjzUE5sWz 028zMob7j2xGwEzNbEYPZFpF4BBJ5u/yndxgYhtclLTqYCFfNrkUem+M0GarVJRkZU84dqul8EMQA iCVHHTZYJUBOq88GhcN6IEVHk0v/EC+cSR0/46naLL5ofGuMiQ+SPixNiTeOz0XL6qggMIPlaNHnY +OHMb3YFke1xVb6A91/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt6KN-00EkWo-0i; Wed, 18 Oct 2023 13:11:11 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qt6K0-00EkNH-2r; Wed, 18 Oct 2023 13:10:50 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40839807e82so6244205e9.0; Wed, 18 Oct 2023 06:10:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697634646; x=1698239446; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z3Xg+Zl530t6+yLtJ2L7UJ10F06niahRGDT6Y4EkH+w=; b=Y5Qi+BeywyQLOZ7Pd5e3dOuGgfxBO/VLAGkhE8ErVQRdfNgsL00+vDBBt2QC4rU1zk 1Lx6RGuGALY9a2CnOK6W7ncPOftYNtlq8rr1kyNqdxn9H+tqnxIZ3PbQ8a1LerHdch+C VQ7+oVQ6skpxTYCIgjZ2+hIEcZFPaEMvhx15VClnea0TONucHM9nYSHOwNGLOUOjG5y7 YAR7kvHNepcItWRcqmlUb41KY+tBQN2V8i75bc/zVctpfuZUsbehCRBOijEzFUl4xbBn wm8wgTBu+LjzM5Q5+ukQxEn1Q1b3O2ziW2YS3XkELpwXHmiDZRbww14dzRttYqBgsSfp DNgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634646; x=1698239446; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z3Xg+Zl530t6+yLtJ2L7UJ10F06niahRGDT6Y4EkH+w=; b=jlZAWOPBcg47xdE3mHKBa1nFaOd6Rc6iUiKs/eS5FmWx9OwMjJRgeH9gf66Kk1QQ2l N44No6TX5HjQNVE2afpMyQlWF2FKNKoX2HL/336/jFP2VOj/WbL7+HOcxKQBl6jU8BBE 0L684pzlGS+0UP3D36y2OfArARLFcz8O8dFqFJBg2+bemfJtwNrPoXsvpIyJBU571Qag CXcDRuyTP6IKLK4V0rp1weCosjOSQFG8ZqCLH0difw0gdqtmx4yeX4onIhkTsjgmzdxR h+klmnTopDHmM4qnoNJMKjTvYVB8l9OGR3hRLVMnGcr5827XSYW6ghMbu05rQcpjRirE Z9YQ== X-Gm-Message-State: AOJu0YwWb1XtAYu2Grv6Dg/CVqENVcP/exjmw4E7Dt5Wucw6dnExtIVD J1ONcBovhMpX9xPwKLG7OMI= X-Google-Smtp-Source: AGHT+IHEbRqesj7l3D4EwIgtEAeke37ZIpRp6Fma1JEUtHbnVo9gJbSp4GsHnwTbRcZjmmaHwkjWiA== X-Received: by 2002:a05:600c:4d0d:b0:405:3f06:d2ef with SMTP id u13-20020a05600c4d0d00b004053f06d2efmr4621449wmp.4.1697634646084; Wed, 18 Oct 2023 06:10:46 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id u6-20020a05600c138600b004064288597bsm1677426wmf.30.2023.10.18.06.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:10:45 -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 , 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: Shiji Yang Subject: [PATCH v2 5/6] wifi: mt76: permit to use alternative cell name to eeprom NVMEM load Date: Wed, 18 Oct 2023 15:09:41 +0200 Message-Id: <20231018130942.31187-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231018130942.31187-1-ansuelsmth@gmail.com> References: <20231018130942.31187-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_061048_925510_D73C209C X-CRM114-Status: GOOD ( 13.36 ) 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. Tested-by: Shiji Yang 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 Wed Oct 18 13:09:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13427060 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 46E43CDB482 for ; Wed, 18 Oct 2023 13:11:37 +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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=swwgQ6w5RvpQJiqTdFSYQ+BdoApjq85lo5wQ/ucIL4k=; b=pT3wBWN/nYE70n eKUyTDUzH4VP/en3WZkEU4xkp6cCEFRNQvF562UkHwreZBZazleFfIPV2VHRCLzbsl7oihQYMruA3 xUOMpCIEDNUV7J6vRuebWhSvMho3LhDAtpRzVhXOuvLgxFdSTPsyPlsvJZup9YJmk/UN5kI7wludw PZZk3BvC3G0K4DQAnaAMJOrBCo9FmQoCID8ffdNg8B7bxKdgUJ/FWu24BboC2hsTOPvXVlM/iCjEV gBZMEFFgT6bagjPSuiI0Zm3qWKjMFygcpRgac1VTz9K3zDE/tgYM0uzAmlM/ZLQZUZCOko2QWbUoh eGOyTj6OC3iOfVN712hQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qt6KO-00EkXM-0D; Wed, 18 Oct 2023 13:11:12 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qt6K2-00EkOE-1r; Wed, 18 Oct 2023 13:10:51 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40839807e82so6244575e9.0; Wed, 18 Oct 2023 06:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697634648; x=1698239448; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DGsOIe2+gPILwGffb1seZvDCNStpRAryY2lIF4RhpfU=; b=lvTUjnnqlpG3cYdnct1Kb82d0iyLKfYoK/jyNOnzF99M9mcBD6BXcx0XevXPa0WB7Z j3sU2me2AnMlHPOtBhR3QgDLwk2+lzfPVAWkE1h3Qr6W05bBlihtXycpNNLyBPl2eRZ+ V0R2eM/aYPytxsD9UjLiPjyE2Cbm0oeCxVGApV4wvhC2PoSrv91nQdRgb9zXIB0WvFNj Hr3Mzhg2rqgAFNRbvtD9GTd2Z1k80yU2PsON9lvKMZV7FK4WjJAcQPNYsla7kWcA3bZH WfeKEugCrfyTUyLfQM/tB4GrO2583YJSnvPi3Em7/9KM6gYqXap+pjI89OijHZrTFnzz BX+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697634648; x=1698239448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DGsOIe2+gPILwGffb1seZvDCNStpRAryY2lIF4RhpfU=; b=ljrljTheU5gm3oFF5+SGMbeclCUBjDS4NU8bxhwwqpZOBmXxzJMHSfZXzPmwvF9yQK tGLKzHNfxOc92gjZDpH9Y55mx9fPr2Dj1eXjGw+2B2FrEyZQWL969wV1qrXDzU55nQM4 DVt5+FDBrtxFqXpiSNlpQ8kC97M0mXgu7ZfXOF8IKrpjq3rNKU0bGENQ0/fQJpLBw6kE 4mwPegHgXAKZNRO4AuBPWhkQc3PNnQJBs1qiDsT9N5167Y/pj2tH9YgCpwECOfUjiVwK zmyTGzdqKMWgjH3o6nHhNv2GIxKa5ADQElPK/1lLquGko9uS+vF+xdUQiImV7MRVhmoH fsbA== X-Gm-Message-State: AOJu0YztXPrhPpoYg1dXgdcYndrcj7aW+PDLDBYeV2HT3ZEgSBqzPQgJ TgKHMlAvQo4MCrZk8EOzE7s= X-Google-Smtp-Source: AGHT+IE+sCuWLXpMpKKSnIlfOUq+4N22pU9jPx36Nsbry/7Ty+ZgoJU7ODY9iOR5ZJrkAcpV+SNbSw== X-Received: by 2002:a05:600c:4ecb:b0:3fe:1fd9:bedf with SMTP id g11-20020a05600c4ecb00b003fe1fd9bedfmr4798254wmq.11.1697634647542; Wed, 18 Oct 2023 06:10:47 -0700 (PDT) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id u6-20020a05600c138600b004064288597bsm1677426wmf.30.2023.10.18.06.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:10:47 -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 , 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: Shiji Yang Subject: [PATCH v2 6/6] wifi: mt76: permit to load precal from NVMEM cell for mt7915 Date: Wed, 18 Oct 2023 15:09:42 +0200 Message-Id: <20231018130942.31187-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231018130942.31187-1-ansuelsmth@gmail.com> References: <20231018130942.31187-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231018_061050_641470_0FA1D32B X-CRM114-Status: GOOD ( 12.14 ) 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. Tested-by: Shiji Yang Signed-off-by: Christian Marangi --- 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)