* [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer
@ 2025-09-24 15:06 Christophe Leroy
2025-09-24 23:48 ` Jakub Kicinski
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Christophe Leroy @ 2025-09-24 15:06 UTC (permalink / raw)
To: Herve Codina, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Christophe Leroy, linux-kernel, netdev
Lantiq PEF2256 framer has some little differences in behaviour
depending on its version.
Add a sysfs attribute to allow user applications to know the
version.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v3:
- Added documentation Documentation/ABI/testing/sysfs-driver-framer-pef2256
v2: https://lore.kernel.org/all/2e01f4ed00d0c1475863ffa30bdc2503f330b688.1758089951.git.christophe.leroy@csgroup.eu
- Split version_show() prototype to 80 chars
- Make DEVICE_ATTR_RO(version) static
v1: https://lore.kernel.org/all/f9aaa89946f1417dc0a5e852702410453e816dbc.1757754689.git.christophe.leroy@csgroup.eu/
---
.../ABI/testing/sysfs-driver-framer-pef2256 | 8 +++++++
drivers/net/wan/framer/pef2256/pef2256.c | 24 +++++++++++++++----
2 files changed, 27 insertions(+), 5 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-driver-framer-pef2256
diff --git a/Documentation/ABI/testing/sysfs-driver-framer-pef2256 b/Documentation/ABI/testing/sysfs-driver-framer-pef2256
new file mode 100644
index 000000000000..ead1ae84ef2a
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-framer-pef2256
@@ -0,0 +1,8 @@
+What: /sys/bus/platform/devices/xxx/version
+Date: Sep 2025
+Contact: netdev@vger.kernel.org
+Description: Reports the version of the PEF2256 framer
+
+ Access: Read
+
+ Valid values: Represented as string
diff --git a/drivers/net/wan/framer/pef2256/pef2256.c b/drivers/net/wan/framer/pef2256/pef2256.c
index 1e4c8e85d598..a2166b424428 100644
--- a/drivers/net/wan/framer/pef2256/pef2256.c
+++ b/drivers/net/wan/framer/pef2256/pef2256.c
@@ -37,6 +37,7 @@ struct pef2256 {
struct device *dev;
struct regmap *regmap;
enum pef2256_version version;
+ const char *version_txt;
struct clk *mclk;
struct clk *sclkr;
struct clk *sclkx;
@@ -114,6 +115,16 @@ enum pef2256_version pef2256_get_version(struct pef2256 *pef2256)
}
EXPORT_SYMBOL_GPL(pef2256_get_version);
+static ssize_t version_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ struct pef2256 *pef2256 = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%s\n", pef2256->version_txt);
+}
+
+static DEVICE_ATTR_RO(version);
+
enum pef2256_gcm_config_item {
PEF2256_GCM_CONFIG_1544000 = 0,
PEF2256_GCM_CONFIG_2048000,
@@ -697,7 +708,6 @@ static int pef2256_probe(struct platform_device *pdev)
unsigned long sclkr_rate, sclkx_rate;
struct framer_provider *framer_provider;
struct pef2256 *pef2256;
- const char *version_txt;
void __iomem *iomem;
int ret;
int irq;
@@ -763,18 +773,18 @@ static int pef2256_probe(struct platform_device *pdev)
pef2256->version = pef2256_get_version(pef2256);
switch (pef2256->version) {
case PEF2256_VERSION_1_2:
- version_txt = "1.2";
+ pef2256->version_txt = "1.2";
break;
case PEF2256_VERSION_2_1:
- version_txt = "2.1";
+ pef2256->version_txt = "2.1";
break;
case PEF2256_VERSION_2_2:
- version_txt = "2.2";
+ pef2256->version_txt = "2.2";
break;
default:
return -ENODEV;
}
- dev_info(pef2256->dev, "Version %s detected\n", version_txt);
+ dev_info(pef2256->dev, "Version %s detected\n", pef2256->version_txt);
ret = pef2556_of_parse(pef2256, np);
if (ret)
@@ -835,6 +845,8 @@ static int pef2256_probe(struct platform_device *pdev)
return ret;
}
+ device_create_file(pef2256->dev, &dev_attr_version);
+
return 0;
}
@@ -849,6 +861,8 @@ static void pef2256_remove(struct platform_device *pdev)
pef2256_write8(pef2256, PEF2256_IMR3, 0xff);
pef2256_write8(pef2256, PEF2256_IMR4, 0xff);
pef2256_write8(pef2256, PEF2256_IMR5, 0xff);
+
+ device_remove_file(pef2256->dev, &dev_attr_version);
}
static const struct of_device_id pef2256_id_table[] = {
--
2.49.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer
2025-09-24 15:06 [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer Christophe Leroy
@ 2025-09-24 23:48 ` Jakub Kicinski
2025-09-25 7:06 ` Christophe Leroy
2025-09-26 22:20 ` patchwork-bot+netdevbpf
2025-09-29 7:45 ` Herve Codina
2 siblings, 1 reply; 6+ messages in thread
From: Jakub Kicinski @ 2025-09-24 23:48 UTC (permalink / raw)
To: Christophe Leroy
Cc: Herve Codina, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, linux-kernel, netdev
On Wed, 24 Sep 2025 17:06:47 +0200 Christophe Leroy wrote:
> Lantiq PEF2256 framer has some little differences in behaviour
> depending on its version.
>
> Add a sysfs attribute to allow user applications to know the
> version.
Outsider question perhaps but what is the version of?
It sounds like a HW revision but point releases for ASICs are quite
uncommon. So I suspect it's some SW/FW version?
We generally recommend using devlink dev info for reporting all sort
of versions...
--
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer
2025-09-24 23:48 ` Jakub Kicinski
@ 2025-09-25 7:06 ` Christophe Leroy
2025-09-26 20:35 ` Jakub Kicinski
0 siblings, 1 reply; 6+ messages in thread
From: Christophe Leroy @ 2025-09-25 7:06 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Herve Codina, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, linux-kernel, netdev
Le 25/09/2025 à 01:48, Jakub Kicinski a écrit :
> On Wed, 24 Sep 2025 17:06:47 +0200 Christophe Leroy wrote:
>> Lantiq PEF2256 framer has some little differences in behaviour
>> depending on its version.
>>
>> Add a sysfs attribute to allow user applications to know the
>> version.
>
> Outsider question perhaps but what is the version of?
> It sounds like a HW revision but point releases for ASICs are quite
> uncommon. So I suspect it's some SW/FW version?
The datasheet of the component just calls it 'version'.
Among all registers there is a register called 'version status register'
which contains a single field named 'Version Number of chip'. This field
is an 8 bits value and the documentation tells that value 0x00 is
version 1.2, value 0x10 is version 2.1, etc...
>
> We generally recommend using devlink dev info for reporting all sort
> of versions...
Ok, I'll look at devlink. Based on the above, what type of
DEVLINK_INFO_VERSION_GENERIC_XXXX would you use here ?
Thanks
Christophe
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer
2025-09-25 7:06 ` Christophe Leroy
@ 2025-09-26 20:35 ` Jakub Kicinski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2025-09-26 20:35 UTC (permalink / raw)
To: Christophe Leroy
Cc: Herve Codina, Andrew Lunn, David S. Miller, Eric Dumazet,
Paolo Abeni, linux-kernel, netdev
On Thu, 25 Sep 2025 09:06:13 +0200 Christophe Leroy wrote:
> Le 25/09/2025 à 01:48, Jakub Kicinski a écrit :
> > On Wed, 24 Sep 2025 17:06:47 +0200 Christophe Leroy wrote:
> >> Lantiq PEF2256 framer has some little differences in behaviour
> >> depending on its version.
> >>
> >> Add a sysfs attribute to allow user applications to know the
> >> version.
> >
> > Outsider question perhaps but what is the version of?
> > It sounds like a HW revision but point releases for ASICs are quite
> > uncommon. So I suspect it's some SW/FW version?
>
> The datasheet of the component just calls it 'version'.
>
> Among all registers there is a register called 'version status register'
> which contains a single field named 'Version Number of chip'. This field
> is an 8 bits value and the documentation tells that value 0x00 is
> version 1.2, value 0x10 is version 2.1, etc...
>
> > We generally recommend using devlink dev info for reporting all sort
> > of versions...
>
> Ok, I'll look at devlink. Based on the above, what type of
> DEVLINK_INFO_VERSION_GENERIC_XXXX would you use here ?
That all sounds very mysterious. Maybe let's stick with sysfs if
we don't really know the details and where to put the value..
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer
2025-09-24 15:06 [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer Christophe Leroy
2025-09-24 23:48 ` Jakub Kicinski
@ 2025-09-26 22:20 ` patchwork-bot+netdevbpf
2025-09-29 7:45 ` Herve Codina
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-26 22:20 UTC (permalink / raw)
To: Christophe Leroy
Cc: herve.codina, andrew+netdev, davem, edumazet, kuba, pabeni,
linux-kernel, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 24 Sep 2025 17:06:47 +0200 you wrote:
> Lantiq PEF2256 framer has some little differences in behaviour
> depending on its version.
>
> Add a sysfs attribute to allow user applications to know the
> version.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>
> [...]
Here is the summary with links:
- [v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer
https://git.kernel.org/netdev/net-next/c/0e41b0af4743
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer
2025-09-24 15:06 [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer Christophe Leroy
2025-09-24 23:48 ` Jakub Kicinski
2025-09-26 22:20 ` patchwork-bot+netdevbpf
@ 2025-09-29 7:45 ` Herve Codina
2 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2025-09-29 7:45 UTC (permalink / raw)
To: Christophe Leroy
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-kernel, netdev
Hi Christophe,
On Wed, 24 Sep 2025 17:06:47 +0200
Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
> Lantiq PEF2256 framer has some little differences in behaviour
> depending on its version.
>
> Add a sysfs attribute to allow user applications to know the
> version.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
Acked-by: Herve Codina <herve.codina@bootlin.com>
Best regards,
Hervé
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-29 7:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-24 15:06 [PATCH v3] net: wan: framer: Add version sysfs attribute for the Lantiq PEF2256 framer Christophe Leroy
2025-09-24 23:48 ` Jakub Kicinski
2025-09-25 7:06 ` Christophe Leroy
2025-09-26 20:35 ` Jakub Kicinski
2025-09-26 22:20 ` patchwork-bot+netdevbpf
2025-09-29 7:45 ` Herve Codina
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).