Message ID | 20231018130942.31187-1-ansuelsmth@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4779458vqb; Wed, 18 Oct 2023 06:11:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEIjpaYChqoOE2i6pfElu4IsfWzwYUuwlKoS3LcHeRgQbHUR2bx+CQarmkBYdsTEIc5auPK X-Received: by 2002:a17:902:d1c2:b0:1c7:1eed:10f2 with SMTP id g2-20020a170902d1c200b001c71eed10f2mr5152503plb.2.1697634686136; Wed, 18 Oct 2023 06:11:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697634686; cv=none; d=google.com; s=arc-20160816; b=blErNsM0+vSsTx+ZD6hGi/l7y+vf0+7IU0+peDtJnhyCKiYaheH2DfE7yq5jbDwXtc CXcDl7tu0sAzrGa8bTSA8g3Z4PZDdVLa5IlhzN8nUfJFDKXNOmKAoYPpLALCGqsC+4rE NqCEfuSbNqawtQwjd3FxWHADYYvLkp4vpvtOjcKlz6Iux1ERalKQ+uvpPGMvWouZKbtm X8mBaTYKKC5UJUH1txzIyhfO7bu11MejvQciSZid7facoV122wKz0azwCqFHLxs33vLP S2rKgFbAOpGJBb1IS6982wk+gczjOjaqFYpf6m11Jr+453bpMBEWe1aYaSAQFcqyMGHl yN9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/WIYTERMpa/hQ3nYRT3WjhR5KvI3DYiqFx8C9H6a/AQ=; fh=+C/dFJPKsXp3UqkZqlbySto96kARtzQP8w7690xpP9Q=; b=lZAr4FAfOSx/F91svmDJDTtWqjqwEGzSgPDFpNm6GyDoV4WUHVFfEKyDUsUatcsqVT WKLSTCG6QGJcbCSutJphYkxLRih1QQwPXhXU2xUfgJp9HxipSPxohqVjgz6EpZ8gzDUu Ks22G20s5UIUwprjnxnIv/82sfqxFvZykqxvQWN4Ttc52tNyZHvsHC6Naj5sy91QncwU 0BtRqblERrxd2jEAtGy6pjCaSA1pobXRQ2ISyq//Gj/vxLcsjzq4X/zaZd3vukEHtRId ue8MAfFJi5XV8PgjfRocN+zHjzjuELNSFoHixfuaEPs65MpgX9g5mP/auZwDcKhsZWIt Xiqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lNWsNGay; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id y20-20020a170902ed5400b001c3da86939csi3920462plb.546.2023.10.18.06.11.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:11:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lNWsNGay; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 1EC3E802965E; Wed, 18 Oct 2023 06:11:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231414AbjJRNKs (ORCPT <rfc822;zwp10758@gmail.com> + 23 others); Wed, 18 Oct 2023 09:10:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbjJRNKp (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Oct 2023 09:10:45 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12AD8F7; Wed, 18 Oct 2023 06:10:43 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c518a1d83fso60329821fa.3; 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=vger.kernel.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=lNWsNGayi00fyI33JdnRcA9H0i70H+ss+eHrV8nraqgUvwKzP18+oBgmJP/Ffdtxvw 0uENuC1dN3qRym5YW/ozONK0y+c5vj3Y8NTWz8fYnn0g1Fvyveh5I/mvaADyke2NQpc8 3/c5s+gfmg7xyQ6IWQGH1DDTXP3fCmL4YZ5FRqHhAXuUIwiuMCjR/PLKVnjNjVtbxDOL LPRpFTTssZcZHDVBKi3YkaUEBbybOlRpYeMcBLQtfImmTgEdj57cXT65laoC3+5lHw6B B+bHZo2T7wcD8j5xvFcR80LAATYgFb0M4tB8cXBmR7WLVPLCTqWY4iLv3R4/U9tEJIHR Nu6w== 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=HBqgwY4fPFv2dkKFCb0c/K4rxLs7JKqb1yJnEJYD4CKxq47RBoMO5B55RMMS52cwFY B9SzDM5fu0xZeUFL4ahdA4SZ/+t9IShQ4kcDmez4SfarHHi8QwiyNyHy+jPrYl3jLF/S Iy2r3HDLs8fydXUFOsQrhyIj/leH2dFHw4WbPjMMO8LbpoIlKm9z0/nIBIlSeNc4esv/ wkmGCUvwcr+LdSCXI330u8UdioEpGVUlFR4J2bSZJNIuCfjK5mrcl4sdBQJ4DsfqNU7+ aEniEwHyy4bb8eururvkNJ9FdGWjQ7QePFc+uyXZ7Z3qt+HxJbruddLCWqcQNz7KC3z+ hv5A== X-Gm-Message-State: AOJu0YycjdldEcYZLYx5rRq61bKvoN7vMu8LyUQmfSf0J6ZPfyoi1FiQ mT7CFpKh1vm/qURQzyxh4hc= 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 <ansuelsmth@gmail.com> To: Felix Fietkau <nbd@nbd.name>, Lorenzo Bianconi <lorenzo@kernel.org>, Ryder Lee <ryder.lee@mediatek.com>, Shayne Chen <shayne.chen@mediatek.com>, Sean Wang <sean.wang@mediatek.com>, Kalle Valo <kvalo@kernel.org>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Christian Marangi <ansuelsmth@gmail.com>, Alexander Couzens <lynxis@fe80.eu>, Nicolas Cavallari <nicolas.cavallari@green-communications.fr>, Daniel Golle <daniel@makrotopia.org>, 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 18 Oct 2023 06:11:14 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780098988729263301 X-GMAIL-MSGID: 1780098988729263301 |
Series |
[v2,1/6] wifi: mt76: fix broken precal loading from MTD for mt7915
|
|
Commit Message
Christian Marangi
Oct. 18, 2023, 1:09 p.m. UTC
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 <ansuelsmth@gmail.com>
---
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))