lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <trinity-da86cb70-f227-403a-be94-6e6a3fd0a0ca-1726082854312@3c-app-gmx-bs04>
Date: Wed, 11 Sep 2024 21:27:34 +0200
From: Hans-Frieder Vogt <hfdevel@....net>
To: netdev@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
 Russell King <linux@...linux.org.uk>, FUJITA Tomonori
 <fujita.tomonori@...il.com>, "David S. Miller" <davem@...emloft.net>, Eric
 Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
 Abeni <pabeni@...hat.com>
Subject: [PATCH net-next 3/5] net: phy: aquantia: search for firmware-name
 in fwnode

For loading of a firmware file over the filesystem, and
if the system is non-device-tree, try finding firmware-name from the software
node (or: fwnode) of the mdio device. This software node may have been
provided by the MAC or MDIO driver.

Signed-off-by: Hans-Frieder Vogt <hfdevel@....net>
---
 drivers/net/phy/aquantia/aquantia_firmware.c | 25 +++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/aquantia/aquantia_firmware.c b/drivers/net/phy/aquantia/aquantia_firmware.c
index 090fcc9a3413..f6154f815d72 100644
--- a/drivers/net/phy/aquantia/aquantia_firmware.c
+++ b/drivers/net/phy/aquantia/aquantia_firmware.c
@@ -324,14 +324,37 @@ static int aqr_firmware_load_nvmem(struct phy_device *phydev)
 static int aqr_firmware_load_fs(struct phy_device *phydev)
 {
 	struct device *dev = &phydev->mdio.dev;
+	struct fwnode_handle *fw_node;
 	const struct firmware *fw;
 	const char *fw_name;
+	u32 phy_id;
 	int ret;

 	ret = of_property_read_string(dev->of_node, "firmware-name",
 				      &fw_name);
-	if (ret)
+	/* check if there is an fwnode connected to mdio */
+	if (ret && dev->parent->fwnode) {
+		fw_node = fwnode_get_phy_node(dev->parent->fwnode);
+		if (fw_node) {
+			ret = fwnode_get_phy_id(fw_node, &phy_id);
+			if (ret)
+				goto cleanup_fwnode;
+			phy_id &= phydev->drv->phy_id_mask;
+			if (phy_id != (phydev->drv->phy_id &
+				       phydev->drv->phy_id_mask))
+				goto cleanup_fwnode;
+
+			ret = fwnode_property_read_string(fw_node,
+							  "firmware-name",
+							  &fw_name);
+		}
+cleanup_fwnode:
+		fwnode_handle_put(fw_node);
+	}
+	if (ret) {
+		phydev_err(phydev, "failed to read firmware name: %d\n", ret);
 		return ret;
+	}

 	ret = request_firmware(&fw, fw_name, dev);
 	if (ret) {
--
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ