[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1ebc6d0d-6eca-4c99-be1a-3fbfa524ac71@gmx.net>
Date: Thu, 12 Sep 2024 20:48:38 +0200
From: Hans-Frieder Vogt <hfdevel@....net>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org, 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: Re: [PATCH net-next 3/5] net: phy: aquantia: search for firmware-name
in fwnode
On 11.09.2024 22.58, Andrew Lunn wrote:
> On Wed, Sep 11, 2024 at 09:27:34PM +0200, Hans-Frieder Vogt wrote:
>> 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);
> Did you try just replacing this with:
>
> ret = device_property_read_string(dev, "firmware-name", &fw_name);
>
> As far as i understand, the device_property_ functions will look
> around in OF, ACPI and swnode to find the given property. As long as
> the MAC driver puts the property in the right place, i _think_ this
> will just work.
>
> Andrew
device_property_read_string() would would be very elegant, but it only
looks for properties in the swnode of this device.
However, I did not find a way to add a swnode directly to the phy, but
only to the mdiobus.
I could have added the firmware-name directly to the swnode of the
mdiobus of course, then
ret = device_property_read_string(dev->parent, "firmware-name",
&fw_name);
would have succeeded.
But adding a "firmware-name" property to an mdiobus seemed not sensible
to me.
Did I maybe overlook a clever way to directly add a swnode to the
phy_device?
I'll certainly investigate this another time.
Thanks!
Hans
Powered by blists - more mailing lists