* [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs
@ 2025-09-01 12:16 Martin Kaistra
2025-09-02 1:12 ` Ping-Ke Shih
2025-09-09 1:21 ` Ping-Ke Shih
0 siblings, 2 replies; 5+ messages in thread
From: Martin Kaistra @ 2025-09-01 12:16 UTC (permalink / raw)
To: linux-wireless; +Cc: Jes Sorensen, Ping-Ke Shih, Bitterblue Smith
The efuse contains the mac address and calibration data. During
manufacturing and testing it can be necessary to read and check this
data.
Add a debugfs interface to make it available to userspace.
Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
---
Changes in v2:
- remove unnecessary comment
- use debugfs_short_fops
drivers/net/wireless/realtek/rtl8xxxu/core.c | 22 ++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 831b5025c6349..aea706f0251d8 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -1901,6 +1901,27 @@ static void rtl8xxxu_dump_efuse(struct rtl8xxxu_priv *priv)
priv->efuse_wifi.raw, EFUSE_MAP_LEN, true);
}
+static ssize_t read_file_efuse(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct rtl8xxxu_priv *priv = file_inode(file)->i_private;
+
+ return simple_read_from_buffer(user_buf, count, ppos,
+ priv->efuse_wifi.raw, EFUSE_MAP_LEN);
+}
+
+static const struct debugfs_short_fops fops_efuse = {
+ .read = read_file_efuse,
+};
+
+static void rtl8xxxu_debugfs_init(struct rtl8xxxu_priv *priv)
+{
+ struct dentry *phydir;
+
+ phydir = debugfs_create_dir("rtl8xxxu", priv->hw->wiphy->debugfsdir);
+ debugfs_create_file("efuse", 0400, phydir, priv, &fops_efuse);
+}
+
void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv)
{
u8 val8;
@@ -7974,6 +7995,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
}
rtl8xxxu_init_led(priv);
+ rtl8xxxu_debugfs_init(priv);
return 0;
--
2.39.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs
2025-09-01 12:16 [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs Martin Kaistra
@ 2025-09-02 1:12 ` Ping-Ke Shih
2025-09-02 7:41 ` Martin Kaistra
2025-09-09 1:21 ` Ping-Ke Shih
1 sibling, 1 reply; 5+ messages in thread
From: Ping-Ke Shih @ 2025-09-02 1:12 UTC (permalink / raw)
To: Martin Kaistra, linux-wireless@vger.kernel.org
Cc: Jes Sorensen, Bitterblue Smith
Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> The efuse contains the mac address and calibration data. During
> manufacturing and testing it can be necessary to read and check this
> data.
>
> Add a debugfs interface to make it available to userspace.
>
> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
> ---
> Changes in v2:
> - remove unnecessary comment
> - use debugfs_short_fops
>
> drivers/net/wireless/realtek/rtl8xxxu/core.c | 22 ++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> index 831b5025c6349..aea706f0251d8 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> @@ -1901,6 +1901,27 @@ static void rtl8xxxu_dump_efuse(struct rtl8xxxu_priv *priv)
> priv->efuse_wifi.raw, EFUSE_MAP_LEN, true);
> }
>
> +static ssize_t read_file_efuse(struct file *file, char __user *user_buf,
> + size_t count, loff_t *ppos)
> +{
> + struct rtl8xxxu_priv *priv = file_inode(file)->i_private;
> +
> + return simple_read_from_buffer(user_buf, count, ppos,
> + priv->efuse_wifi.raw, EFUSE_MAP_LEN);
> +}
> +
> +static const struct debugfs_short_fops fops_efuse = {
> + .read = read_file_efuse,
> +};
> +
> +static void rtl8xxxu_debugfs_init(struct rtl8xxxu_priv *priv)
> +{
> + struct dentry *phydir;
> +
> + phydir = debugfs_create_dir("rtl8xxxu", priv->hw->wiphy->debugfsdir);
> + debugfs_create_file("efuse", 0400, phydir, priv, &fops_efuse);
> +}
> +
Could you please try if this would encounter build error without
CFG80211_DEBUGFS?
Otherwise, looks good to me.
> void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv)
> {
> u8 val8;
> @@ -7974,6 +7995,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
> }
>
> rtl8xxxu_init_led(priv);
> + rtl8xxxu_debugfs_init(priv);
>
> return 0;
>
> --
> 2.39.5
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs
2025-09-02 1:12 ` Ping-Ke Shih
@ 2025-09-02 7:41 ` Martin Kaistra
2025-09-02 7:46 ` Ping-Ke Shih
0 siblings, 1 reply; 5+ messages in thread
From: Martin Kaistra @ 2025-09-02 7:41 UTC (permalink / raw)
To: Ping-Ke Shih, linux-wireless@vger.kernel.org
Cc: Jes Sorensen, Bitterblue Smith
Am 02.09.25 um 03:12 schrieb Ping-Ke Shih:
> Martin Kaistra <martin.kaistra@linutronix.de> wrote:
>> The efuse contains the mac address and calibration data. During
>> manufacturing and testing it can be necessary to read and check this
>> data.
>>
>> Add a debugfs interface to make it available to userspace.
>>
>> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
>> ---
>> Changes in v2:
>> - remove unnecessary comment
>> - use debugfs_short_fops
>>
>> drivers/net/wireless/realtek/rtl8xxxu/core.c | 22 ++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c
>> b/drivers/net/wireless/realtek/rtl8xxxu/core.c
>> index 831b5025c6349..aea706f0251d8 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
>> @@ -1901,6 +1901,27 @@ static void rtl8xxxu_dump_efuse(struct rtl8xxxu_priv *priv)
>> priv->efuse_wifi.raw, EFUSE_MAP_LEN, true);
>> }
>>
>> +static ssize_t read_file_efuse(struct file *file, char __user *user_buf,
>> + size_t count, loff_t *ppos)
>> +{
>> + struct rtl8xxxu_priv *priv = file_inode(file)->i_private;
>> +
>> + return simple_read_from_buffer(user_buf, count, ppos,
>> + priv->efuse_wifi.raw, EFUSE_MAP_LEN);
>> +}
>> +
>> +static const struct debugfs_short_fops fops_efuse = {
>> + .read = read_file_efuse,
>> +};
>> +
>> +static void rtl8xxxu_debugfs_init(struct rtl8xxxu_priv *priv)
>> +{
>> + struct dentry *phydir;
>> +
>> + phydir = debugfs_create_dir("rtl8xxxu", priv->hw->wiphy->debugfsdir);
>> + debugfs_create_file("efuse", 0400, phydir, priv, &fops_efuse);
>> +}
>> +
>
> Could you please try if this would encounter build error without
> CFG80211_DEBUGFS?
Builds and runs without errors when CFG80211_DEBUGFS is disabled:
# ls /sys/kernel/debug/ieee80211/phy0/
rtl8xxxu
I also don't see any build errors when DEBUG_FS is disabled completely.
>
> Otherwise, looks good to me.
>
>> void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv)
>> {
>> u8 val8;
>> @@ -7974,6 +7995,7 @@ static int rtl8xxxu_probe(struct usb_interface *interface,
>> }
>>
>> rtl8xxxu_init_led(priv);
>> + rtl8xxxu_debugfs_init(priv);
>>
>> return 0;
>>
>> --
>> 2.39.5
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs
2025-09-02 7:41 ` Martin Kaistra
@ 2025-09-02 7:46 ` Ping-Ke Shih
0 siblings, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2025-09-02 7:46 UTC (permalink / raw)
To: Martin Kaistra, linux-wireless@vger.kernel.org
Cc: Jes Sorensen, Bitterblue Smith
Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> Am 02.09.25 um 03:12 schrieb Ping-Ke Shih:
> > Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> >> The efuse contains the mac address and calibration data. During
> >> manufacturing and testing it can be necessary to read and check this
> >> data.
> >>
> >> Add a debugfs interface to make it available to userspace.
> >>
> >> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
> >> ---
> >> Changes in v2:
> >> - remove unnecessary comment
> >> - use debugfs_short_fops
> >>
> >> drivers/net/wireless/realtek/rtl8xxxu/core.c | 22 ++++++++++++++++++++
> >> 1 file changed, 22 insertions(+)
> >>
> >> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> >> b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> >> index 831b5025c6349..aea706f0251d8 100644
> >> --- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
> >> +++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
> >> @@ -1901,6 +1901,27 @@ static void rtl8xxxu_dump_efuse(struct rtl8xxxu_priv *priv)
> >> priv->efuse_wifi.raw, EFUSE_MAP_LEN, true);
> >> }
> >>
> >> +static ssize_t read_file_efuse(struct file *file, char __user *user_buf,
> >> + size_t count, loff_t *ppos)
> >> +{
> >> + struct rtl8xxxu_priv *priv = file_inode(file)->i_private;
> >> +
> >> + return simple_read_from_buffer(user_buf, count, ppos,
> >> + priv->efuse_wifi.raw, EFUSE_MAP_LEN);
> >> +}
> >> +
> >> +static const struct debugfs_short_fops fops_efuse = {
> >> + .read = read_file_efuse,
> >> +};
> >> +
> >> +static void rtl8xxxu_debugfs_init(struct rtl8xxxu_priv *priv)
> >> +{
> >> + struct dentry *phydir;
> >> +
> >> + phydir = debugfs_create_dir("rtl8xxxu", priv->hw->wiphy->debugfsdir);
> >> + debugfs_create_file("efuse", 0400, phydir, priv, &fops_efuse);
> >> +}
> >> +
> >
> > Could you please try if this would encounter build error without
> > CFG80211_DEBUGFS?
>
> Builds and runs without errors when CFG80211_DEBUGFS is disabled:
>
> # ls /sys/kernel/debug/ieee80211/phy0/
> rtl8xxxu
>
> I also don't see any build errors when DEBUG_FS is disabled completely.
Thanks for the test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs
2025-09-01 12:16 [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs Martin Kaistra
2025-09-02 1:12 ` Ping-Ke Shih
@ 2025-09-09 1:21 ` Ping-Ke Shih
1 sibling, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2025-09-09 1:21 UTC (permalink / raw)
To: Martin Kaistra, linux-wireless
Cc: Jes Sorensen, Ping-Ke Shih, Bitterblue Smith
Martin Kaistra <martin.kaistra@linutronix.de> wrote:
> The efuse contains the mac address and calibration data. During
> manufacturing and testing it can be necessary to read and check this
> data.
>
> Add a debugfs interface to make it available to userspace.
>
> Signed-off-by: Martin Kaistra <martin.kaistra@linutronix.de>
> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
1 patch(es) applied to rtw-next branch of rtw.git, thanks.
00afddfe4c99 wifi: rtl8xxxu: expose efuse via debugfs
---
https://github.com/pkshih/rtw.git
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-09 1:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01 12:16 [PATCH rtw-next v2] wifi: rtl8xxxu: expose efuse via debugfs Martin Kaistra
2025-09-02 1:12 ` Ping-Ke Shih
2025-09-02 7:41 ` Martin Kaistra
2025-09-02 7:46 ` Ping-Ke Shih
2025-09-09 1:21 ` Ping-Ke Shih
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox