public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Christian Marangi <ansuelsmth@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [net-next PATCH v2 1/3] net: phy: as21xxx: save firmware version major/minor version
Date: Fri, 23 Jan 2026 13:00:29 +0100	[thread overview]
Message-ID: <20260123120117.10883-2-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20260123120117.10883-1-ansuelsmth@gmail.com>

On PHY probe, save the firmware version major/minor version to use it
later to validate if a command is supported in the loaded firmware.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/net/phy/as21xxx.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c
index 005277360656..a5344abde91a 100644
--- a/drivers/net/phy/as21xxx.c
+++ b/drivers/net/phy/as21xxx.c
@@ -183,6 +183,9 @@ struct as21xxx_led_pattern_info {
 };
 
 struct as21xxx_priv {
+	u8 fw_major_ver;
+	u8 fw_minor_ver;
+
 	bool parity_status;
 	/* Protect concurrent IPC access */
 	struct mutex ipc_lock;
@@ -570,6 +573,7 @@ static int aeon_ipc_sync_parity(struct phy_device *phydev,
 static int aeon_ipc_get_fw_version(struct phy_device *phydev)
 {
 	u16 ret_data[AEON_IPC_DATA_NUM_REGISTERS], data[1];
+	struct as21xxx_priv *priv = phydev->priv;
 	char fw_version[AEON_IPC_DATA_MAX + 1];
 	int ret;
 
@@ -585,6 +589,17 @@ static int aeon_ipc_get_fw_version(struct phy_device *phydev)
 	fw_version[ret] = '\0';
 
 	phydev_info(phydev, "Firmware Version: %s\n", fw_version);
+	/*
+	 * Firmware is the format x.x.x
+	 * Save in priv struct to check validate feature support
+	 * in new firmware version.
+	 */
+	ret = sscanf(fw_version, "%hhu.%hhu", &priv->fw_major_ver,
+		     &priv->fw_minor_ver);
+	if (ret < 2) {
+		priv->fw_major_ver = 0;
+		priv->fw_minor_ver = 0;
+	}
 
 	return 0;
 }
-- 
2.51.0


  reply	other threads:[~2026-01-23 12:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 12:00 [net-next PATCH v2 0/3] net: phy: as21xxx: toggle In Band feature support Christian Marangi
2026-01-23 12:00 ` Christian Marangi [this message]
2026-01-23 12:00 ` [net-next PATCH v2 2/3] net: phy: as21xxx: add support for DBG command Christian Marangi
2026-01-25 22:33   ` Jakub Kicinski
2026-01-23 12:00 ` [net-next PATCH v2 3/3] net: phy: as21xxx: fill in inband caps and better handle inband Christian Marangi
2026-01-23 12:16 ` [net-next PATCH v2 0/3] net: phy: as21xxx: toggle In Band feature support Russell King (Oracle)
2026-01-23 13:09   ` Christian Marangi
2026-01-23 13:35     ` Russell King (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260123120117.10883-2-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox