* [PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW
@ 2021-05-04 12:52 ` Shayne Chen
0 siblings, 0 replies; 6+ messages in thread
From: Shayne Chen @ 2021-05-04 12:52 UTC (permalink / raw)
To: Felix Fietkau
Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, linux-mediatek, Shayne Chen
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@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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW
@ 2021-05-04 12:52 ` Shayne Chen
0 siblings, 0 replies; 6+ messages in thread
From: Shayne Chen @ 2021-05-04 12:52 UTC (permalink / raw)
To: Felix Fietkau
Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, linux-mediatek, Shayne Chen
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@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
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW
2021-05-04 12:52 ` Shayne Chen
@ 2021-05-28 8:56 ` Felix Fietkau
-1 siblings, 0 replies; 6+ messages in thread
From: Felix Fietkau @ 2021-05-28 8:56 UTC (permalink / raw)
To: Shayne Chen; +Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, linux-mediatek
On 2021-05-04 14:52, Shayne Chen wrote:
> 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@mediatek.com>
I'd prefer if we read the entire efuse and put it in a "otp" debugfs
file, like on older chips.
- Felix
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW
@ 2021-05-28 8:56 ` Felix Fietkau
0 siblings, 0 replies; 6+ messages in thread
From: Felix Fietkau @ 2021-05-28 8:56 UTC (permalink / raw)
To: Shayne Chen; +Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, linux-mediatek
On 2021-05-04 14:52, Shayne Chen wrote:
> 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@mediatek.com>
I'd prefer if we read the entire efuse and put it in a "otp" debugfs
file, like on older chips.
- Felix
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW
2021-05-28 8:56 ` Felix Fietkau
@ 2021-05-28 14:20 ` Shayne Chen
-1 siblings, 0 replies; 6+ messages in thread
From: Shayne Chen @ 2021-05-28 14:20 UTC (permalink / raw)
To: Felix Fietkau; +Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, linux-mediatek
On Fri, 2021-05-28 at 10:56 +0200, Felix Fietkau wrote:
> On 2021-05-04 14:52, Shayne Chen wrote:
> > 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@mediatek.com>
>
> I'd prefer if we read the entire efuse and put it in a "otp" debugfs
> file, like on older chips.
>
> - Felix
Hi Felix,
Got it. I'll send another patch, please drop this one.
Thanks,
Shayne
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW
@ 2021-05-28 14:20 ` Shayne Chen
0 siblings, 0 replies; 6+ messages in thread
From: Shayne Chen @ 2021-05-28 14:20 UTC (permalink / raw)
To: Felix Fietkau; +Cc: linux-wireless, Lorenzo Bianconi, Ryder Lee, linux-mediatek
On Fri, 2021-05-28 at 10:56 +0200, Felix Fietkau wrote:
> On 2021-05-04 14:52, Shayne Chen wrote:
> > 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@mediatek.com>
>
> I'd prefer if we read the entire efuse and put it in a "otp" debugfs
> file, like on older chips.
>
> - Felix
Hi Felix,
Got it. I'll send another patch, please drop this one.
Thanks,
Shayne
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-05-28 14:26 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 12:52 [PATCH] mt76: mt7915: add debugfs knob to read efuse value from FW Shayne Chen
2021-05-04 12:52 ` Shayne Chen
2021-05-28 8:56 ` Felix Fietkau
2021-05-28 8:56 ` Felix Fietkau
2021-05-28 14:20 ` Shayne Chen
2021-05-28 14:20 ` Shayne Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.