[PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW

Shayne Chen shayne.chen at mediatek.com
Tue May 4 05:52:25 PDT 2021


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 <shayne.chen at mediatek.com>
---
 .../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


More information about the Linux-mediatek mailing list