Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3597807pxy; Tue, 4 May 2021 06:02:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyObUQO6mnvTgcoZu6+PhkOpFy0C7ToChMS7z1+5+V1lhW/dDaI3v5MbxIvjpFBxQ9MfENb X-Received: by 2002:a17:906:79c8:: with SMTP id m8mr16101738ejo.260.1620133373865; Tue, 04 May 2021 06:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620133373; cv=none; d=google.com; s=arc-20160816; b=UXdpl4YshGap/8JSGmcmtKjcEkLRvUadcEcsp0dk82tVGQSffPytTk+jKArgqDFAfS NYOyROPhvxmG7uABPBJ98m2RjeAqi234phq4B7En8d620uAxOZoMAalywrprjUv2VzsG xJLz4pJp07KWF2WZIlqBVRZUpDn5AS+A+p4pnNtC2X1QL06OhqEWFwd7C10s9FM7F7MK RX7JRH/ENCTMD9ym8WlOyzcyuT9GIn020SYe/zc5r/pfsoI3cF6D7HRm+weLXEGmXJmB +9H/f7c7obkbj7H7VVEJIn4EYqGNYzNw0HvWFNPj2hAXYkj3VRXi2v9Cp9IwtCpQr9ZL 9jcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=X/+UA+tmaxTMonn3SOL3fFsdn1tN13ywHQI8vj+U6os=; b=hFYZYVDUS/ihIUUib4Q9kuHC5aGVMVbItGMdESvYIoT+OY0W/+T5P2XEBRDqn4w7/R TP/FUqiilZfbSfY5OsLDzsOdDVqZWCv9C5UTDbVWO7nQQEXSVDoBCPgnaT7iGhwjd+/R rdz6MPwCL/rLTTyNlEwvBofHhEf/hc+0aaSXsr+ny+DqthPbliogW8LElLdb6bWqoyAM xhgRHaWJW8DcE9OrSo2nW/S9DP5mGE6eg/LYOqZtwOL1/PiOa59zF0tyXwf9tN3yLkA2 KEfIHuWEZf+2jfLoDFM0qAi48gUfcBBCQdtSxhKTSCgrZogJFpBpjBpmHblrK9NKZAFW islQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y22si11190142edr.245.2021.05.04.06.02.28; Tue, 04 May 2021 06:02:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230385AbhEDM7M (ORCPT + 99 others); Tue, 4 May 2021 08:59:12 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:55874 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S230187AbhEDM7K (ORCPT ); Tue, 4 May 2021 08:59:10 -0400 X-UUID: 0a11770fe8b64f6f82ae09cf97a11a9c-20210504 X-UUID: 0a11770fe8b64f6f82ae09cf97a11a9c-20210504 Received: from mtkmrs01.mediatek.inc [(172.21.131.159)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 834467344; Tue, 04 May 2021 20:52:33 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs06n2.mediatek.inc (172.21.101.130) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 4 May 2021 20:52:32 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 4 May 2021 20:52:31 +0800 From: Shayne Chen To: Felix Fietkau CC: linux-wireless , Lorenzo Bianconi , Ryder Lee , linux-mediatek , Shayne Chen Subject: [PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW Date: Tue, 4 May 2021 20:52:25 +0800 Message-ID: <20210504125225.2536-1-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: BC4AA88CC25A608AA38ABC03DA3762F8B883086173EF8A88791D8397AACCCE642000:8 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In efuse mode, mt7915 only reads efuse values from FW which driver need. Add a debugfs knob to read addtional efuse values from a specific field, which is useful in some cases such as checking if rf values in efuse are properly burned. An example of usage: echo 0x400 > efuse_idx hexdump -C eeprom Signed-off-by: Shayne Chen --- .../net/wireless/mediatek/mt76/mt7915/debugfs.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c index 6a8ddee..0526459 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -73,6 +73,21 @@ mt7915_radar_trigger(void *data, u64 val) DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL, mt7915_radar_trigger, "%lld\n"); +static int +mt7915_efuse_idx_set(void *data, u64 val) +{ + struct mt7915_dev *dev = data; + u8 *eep = dev->mt76.eeprom.data; + + if (eep[val] == 0xff && !dev->flash_mode) + mt7915_mcu_get_eeprom(dev, val); + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(fops_efuse_idx, NULL, + mt7915_efuse_idx_set, "0x%llx\n"); + static int mt7915_fw_debug_set(void *data, u64 val) { @@ -390,6 +405,7 @@ int mt7915_init_debugfs(struct mt7915_dev *dev) debugfs_create_file("radar_trigger", 0200, dir, dev, &fops_radar_trigger); debugfs_create_file("ser_trigger", 0200, dir, dev, &fops_ser_trigger); + debugfs_create_file("efuse_idx", 0200, dir, dev, &fops_efuse_idx); debugfs_create_devm_seqfile(dev->mt76.dev, "temperature", dir, mt7915_read_temperature); debugfs_create_devm_seqfile(dev->mt76.dev, "txpower_sku", dir, -- 2.18.0