net: phy: aquantia: Switch to generic firmware loader
Subsystems (2)
cover net: phy: aquantia: Switch to generic firmware loader
Hi,
This patch series refactors the Aquantia PHY firmware loader to use the generic fsloader framework.
The existing loader is limited to loading firmware from an MMC device, which restricts its use on many devices (e.g., routers) that may use other storage like USB or have a UBIFS root filesystem. Migrating to the generic firmware loader allows firmware to be sourced from any backend supported by the fsloader framework.
The series is structured as follows:
- The first patch is a minor cleanup, switching to the phy_get_ofnode() helper.
- The second patch fixes a small typo in the binding document.
- The third and main patch replaces the custom loader with generic one.
- The final patch updates the device tree binding documentation to introduce the firmware-name property and provide usage examples.
This change has been tested on a Buffalo WXR18000BE10P router, loading firmware from a UBIFS volume for Marvell CUX3410.
Beiyan Yun (4):
net: phy: aquantia: switch to use phy_get_ofnode()
doc: bindings: fix aquantia-phy.txt typo
net: phy: aquantia: use generic firmware loader
doc: bindings: add Aquantia PHY node's "firmware-name" binding
doc/device-tree-bindings/net/aquantia-phy.txt | 32 ++++- drivers/net/phy/Kconfig | 19 ++- drivers/net/phy/aquantia.c | 124 +++++++++--------- 3 files changed, 103 insertions(+), 72 deletions(-)
Signature · 4 lines
2.47.3 base-commit: d33b21b7e261691e8d6613a24cc9b0ececba3b01 branch: aquantia-fsloader
PATCH RESEND 1/4 net: phy: aquantia: switch to use phy_get_ofnode()
Use PHY API phy_get_ofnode() helper to get PHY DT node.
---
drivers/net/phy/aquantia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/aquantia.c +1 -1
@@ -338,7 +338,7 @@ static int aquantia_set_proto(struct phy_device *phydev,static int aquantia_dts_config (struct phy_device *phydev) { -ofnode node = phydev->node; +ofnode node =phy_get_ofnode (phydev);u32 prop;u16 reg;
Signature · 1 line
2.47.3
PATCH RESEND 2/4 doc: bindings: fix aquantia-phy.txt typo
In reply to Beiyan YunFix typo: "weays" -> "ways"
---
doc/device-tree-bindings/net/aquantia-phy.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
doc/device-tree-bindings/net/aquantia-phy.txt +1 -1
@@ -4,7 +4,7 @@ This text describes properties that are applicable to Aquantia PHY nodes in addition to the bindings in phy.txt. Aquantia PHYs allow some flexibility in the way they are wired in a system, -they allow MDI pins to be reversed, LEDs linked up in different weays, have an +they allow MDI pins to be reversed, LEDs linked up in different ways, have an I2C slave interface that can be used for debug. Normally the configuration corresponding to these is driven by the PHY firmware with the downside that a custom firmware is needed for each integration of a PHY.
Signature · 1 line
2.47.3
PATCH RESEND 3/4 net: phy: aquantia: use generic firmware loader
In reply to Beiyan YunAquantia PHYs are being used w/o SPI flash in some routers recently. Current firmware loader only attempts to load from FS on top of MMC, limiting the use on many devices.
Removed the old firmware loader, migrate to generic firmware loader to allow a wider range of firmware source (e.g., USB, UBIFS).
Tested on Buffalo WXR18000BE10P with UBIFS.
---
drivers/net/phy/Kconfig | 19 +++--- drivers/net/phy/aquantia.c | 122 +++++++++++++++++++------------------ 2 files changed, 71 insertions(+), 70 deletions(-)
drivers/net/phy/Kconfig +9 -10
@@ -90,23 +90,22 @@ menuconfig PHY_AQUANTIA config PHY_AQUANTIA_UPLOAD_FW bool "Aquantia firmware loading support" depends on PHY_AQUANTIA + select FS_LOADER help Aquantia PHYs use firmware which can be either loaded automatically from storage directly attached to the phy or loaded by the boot loader - via MDIO commands. The firmware is loaded from a file, specified by - the PHY_AQUANTIA_FW_PART and PHY_AQUANTIA_FW_NAME options. + via MDIO commands. -config PHY_AQUANTIA_FW_PART - string "Aquantia firmware partition" - depends on PHY_AQUANTIA_UPLOAD_FW - help - Partition containing the firmware file. + This option enables loading the firmware using the generic + file system firmware loader framework. -config PHY_AQUANTIA_FW_NAME - string "Aquantia firmware filename" +config PHY_AQUANTIA_FW_MAX_SIZE + hex "Max firmware size" depends on PHY_AQUANTIA_UPLOAD_FW + default 0x80000 help - Firmware filename. + The maximum size of the Aquantia PHY firmware. This is used to + allocate a buffer to load the firmware into. config PHY_ATHEROS bool "Atheros Ethernet PHYs support"
drivers/net/phy/aquantia.c +62 -60
170 lines not on this page · raw message
Signature · 1 line
2.47.3
PATCH RESEND 4/4 doc: bindings: add Aquantia PHY node's "firmware-name" binding
In reply to Beiyan YunWith the switch to generic firmware loader, "firmware-name" binding was introduced to define the firmware filename.
Provide the document and usage examples.
---
doc/device-tree-bindings/net/aquantia-phy.txt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+)
doc/device-tree-bindings/net/aquantia-phy.txt +30 -0
@@ -11,15 +11,45 @@ a custom firmware is needed for each integration of a PHY. Several optional bindings are defined that allow these configuration points to be driven by the PHY driver and reduce dependency on specific FW versions. +Aquantia PHY's firmware is often provided by PHY-resident SPI flash; if absent +or outdated, U-Boot can upload firmware over MDIO during PHY initialization. +The driver uploads only when the PHY reports missing firmware or a fault. + Optional properties: mdi-reversal: 0 or 1 indicating that reversal must be disabled/enabled. Firmware default is used if the property is missing. smb-addr: I2C/SMBus address to use, firmware default is used if the property is missing. +firmware-name: String containing the filename of the PHY firmware to load + (only when CONFIG_PHY_AQUANTIA_UPLOAD_FW is enabled). Example node: phy@00 { reg = <0x00>; mdi-reversal = <1>; smb-addr = <0x25>; + firmware-name = "aqr-firmware.cld"; +}; + +Example using the generic firmware loader: +/ { + chosen { + /* Select default firmware loader instance */ + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader@0 { + bootph-all; + compatible = "u-boot,fs-loader"; + /* Load from MMC0, partition 1 */ + phandlepart = <&mmc_0 1>; + }; + + mdio { + phy@0 { + reg = <0>; + /* Load this file via the selected fs-loader */ + firmware-name = "aqr-firmware.cld"; + }; + }; };
Signature · 1 line
2.47.3
Re: [PATCH RESEND 4/4] doc: bindings: add Aquantia PHY node's "firmware-name" binding
Quoted 5 lines · Beiyan Yun
With the switch to generic firmware loader, "firmware-name" binding was introduced to define the firmware filename.
Provide the document and usage examples.Signed-off-by Beiyan Yun <[email protected]>
IMO this patch should go before the driver change.
Quoted 14 lines
---
doc/device-tree-bindings/net/aquantia-phy.txt | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+)doc/device-tree-bindings/net/aquantia-phy.txt +1
-0@@ -11,15 +11,45 @@ a custom firmware is needed for each integration of a PHY. Several optional bindings are defined that allow these configuration points to be driven by the PHY driver and reduce dependency on specific FW versions. +Aquantia PHY's firmware is often provided by PHY-resident SPI flash; if absent
doc/device-tree-bindings/net/aquantia-phy.txt a custom firmware is needed for each integration of a PHY. · line 24
Quoted 10 lines
doc/device-tree-bindings/net/aquantia-phy.txt +5
-0+or outdated, U-Boot can upload firmware over MDIO during PHY initialization. +The driver uploads only when the PHY reports missing firmware or a fault. + Optional properties: mdi-reversal: 0 or 1 indicating that reversal must be disabled/enabled. Firmware default is used if the property is missing. smb-addr: I2C/SMBus address to use, firmware default is used if the property is missing. +firmware-name: String containing the filename of the PHY firmware to load + (only when CONFIG_PHY_AQUANTIA_UPLOAD_FW is enabled).
This looks good to me, but I have a question: should we switch to the upstream binding for aquantia phys? It's already documented as marvell,aquantia.yaml, and we could avoid the burden of maintaining a separate binding file.
The "firmware-name" property is already described in the upstream marvell,aquantia.yaml, and it only misses the smb-addr property. The only U-Boot boards making use of this property are fsl-sch-30841 and fsl-sch-30842, thus such conversion shouldn't be a big job.
Best regards,
Yao Zi
Quoted 33 lines
doc/device-tree-bindings/net/aquantia-phy.txt +24
-0Example node: phy@00 { reg = <0x00>; mdi-reversal = <1>; smb-addr = <0x25>; + firmware-name = "aqr-firmware.cld"; +}; + +Example using the generic firmware loader: +/ { + chosen { + /* Select default firmware loader instance */ + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader@0 { + bootph-all; + compatible = "u-boot,fs-loader"; + /* Load from MMC0, partition 1 */ + phandlepart = <&mmc_0 1>; + }; + + mdio { + phy@0 { + reg = <0>; + /* Load this file via the selected fs-loader */ + firmware-name = "aqr-firmware.cld"; + }; + }; };Signature · 1 line
2.47.3
Re: [PATCH RESEND 4/4] doc: bindings: add Aquantia PHY node's "firmware-name" binding
Quoted 43 lines · Yao Zi
Quoted 5 lines · Beiyan Yun
With the switch to generic firmware loader, "firmware-name" binding was introduced to define the firmware filename.
Provide the document and usage examples.Signed-off-by Beiyan Yun <[email protected] <mailto:[email protected]>>IMO this patch should go before the driver change.
Quoted 22 lines
---
doc/device-tree-bindings/net/aquantia-phy.txt| 30 +++++++++++++++++++1 file changed, 30 insertions(+)doc/device-tree-bindings/net/aquantia-phy.txt +0
-0@@ -11,15 +11,45 @@ a custom firmware is needed for each integration of a PHY.Several optional bindings are defined that allow these configuration points to be driven by the PHY driver and reduce dependency on specific FW versions.
doc/device-tree-bindings/net/aquantia-phy.txt +4
-0+Aquantia PHY's firmware is often provided by PHY-resident SPI flash; if absent +or outdated, U-Boot can upload firmware over MDIO during PHY initialization. +The driver uploads only when the PHY reports missing firmware or a fault. +Optional properties:
mdi-reversal: 0 or 1 indicating that reversal must be disabled/enabled.
Firmware default is used if the property is missing.
smb-addr: I2C/SMBus address to use, firmware default is used if the property
is missing.doc/device-tree-bindings/net/aquantia-phy.txt a custom firmware is needed for each integration of a PHY. · line 24
Quoted 2 lines
doc/device-tree-bindings/net/aquantia-phy.txt +2
-0+firmware-name: String containing the filename of the PHY firmware to load + (only when CONFIG_PHY_AQUANTIA_UPLOAD_FW is enabled).This looks good to me, but I have a question: should we switch to the upstream binding for aquantia phys? It's already documented as marvell,aquantia.yaml, and we could avoid the burden of maintaining a separate binding file.
Quoted 4 lines
The "firmware-name" property is already described in the upstream marvell,aquantia.yaml, and it only misses the smb-addr property. The only U-Boot boards making use of this property are fsl-sch-30841 and fsl-sch-30842, thus such conversion shouldn't be a big job.
Good point. I’ll add a bit more info in related Kconfig options and drop the doc.
Quoted 28 lines
Best regards,
Yao ZiQuoted 24 lines
Example node:
phy@00 { reg = <0x00>; mdi-reversal = <1>; smb-addr = <0x25>;doc/device-tree-bindings/net/aquantia-phy.txt +19
-0+ firmware-name = "aqr-firmware.cld"; +}; + +Example using the generic firmware loader: +/ { + chosen { + /* Select default firmware loader instance */ + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader@0 { + bootph-all; + compatible = "u-boot,fs-loader"; + /* Load from MMC0, partition 1 */ + phandlepart = <&mmc_0 1>; + }; + + mdio { + phy@0 {
Quoted 8 lines
Quoted 8 lines
doc/device-tree-bindings/net/aquantia-phy.txt +5
-0+ reg = <0>; + /* Load this file via the selected fs-loader */ + firmware-name = "aqr-firmware.cld"; + }; + };};
Signature · 1 line
2.47.3
Cheers,
Beiyan Yun
Re: [PATCH RESEND 4/4] doc: bindings: add Aquantia PHY node's "firmware-name" binding
Quoted 47 lines · Beiyan Yun
Quoted 44 lines · On 23 Sep 2025, at 8:44 PM, Yao Zi <[email protected]…
Quoted 5 lines · Beiyan Yun
With the switch to generic firmware loader, "firmware-name" binding was introduced to define the firmware filename.
Provide the document and usage examples.Signed-off-by Beiyan Yun <[email protected] <mailto:[email protected]> <mailto:[email protected]>>IMO this patch should go before the driver change.
Quoted 22 lines
---
doc/device-tree-bindings/net/aquantia-phy.txt| 30 +++++++++++++++++++1 file changed, 30 insertions(+)doc/device-tree-bindings/net/aquantia-phy.txt +0
-0@@ -11,15 +11,45 @@ a custom firmware is needed for each integration of a PHY.Several optional bindings are defined that allow these configuration points to be driven by the PHY driver and reduce dependency on specific FW versions.
doc/device-tree-bindings/net/aquantia-phy.txt +4
-0+Aquantia PHY's firmware is often provided by PHY-resident SPI flash; if absent +or outdated, U-Boot can upload firmware over MDIO during PHY initialization. +The driver uploads only when the PHY reports missing firmware or a fault. +Optional properties:
mdi-reversal: 0 or 1 indicating that reversal must be disabled/enabled.
Firmware default is used if the property is missing.
smb-addr: I2C/SMBus address to use, firmware default is used if the property
is missing.doc/device-tree-bindings/net/aquantia-phy.txt a custom firmware is needed for each integration of a PHY. · line 24
Quoted 2 lines
doc/device-tree-bindings/net/aquantia-phy.txt +2
-0+firmware-name: String containing the filename of the PHY firmware to load + (only when CONFIG_PHY_AQUANTIA_UPLOAD_FW is enabled).This looks good to me, but I have a question: should we switch to the upstream binding for aquantia phys? It's already documented as marvell,aquantia.yaml, and we could avoid the burden of maintaining a separate binding file.
Quoted 6 lines
Quoted 4 lines
The "firmware-name" property is already described in the upstream marvell,aquantia.yaml, and it only misses the smb-addr property. The only U-Boot boards making use of this property are fsl-sch-30841 and fsl-sch-30842, thus such conversion shouldn't be a big job.
Good point. I’ll add a bit more info in related
Kconfigoptions and drop the doc.
Hmm, I’m a bit lost. Here’s some of my concerns:
- Upstream binding has an optional nvmem cell as firmware source, such mechanism simply doesn’t exist in U-Boot. This could be misleading.
- About “smb-addr”, what’s the best move? Do we upstream them to Linux?
Any idea on how to fix these issues?
Thanks,
Beiyan Yun
Quoted 40 lines
Quoted 29 lines
Best regards,
Yao ZiQuoted 24 lines
Example node:
phy@00 { reg = <0x00>; mdi-reversal = <1>; smb-addr = <0x25>;doc/device-tree-bindings/net/aquantia-phy.txt +19
-0+ firmware-name = "aqr-firmware.cld"; +}; + +Example using the generic firmware loader: +/ { + chosen { + /* Select default firmware loader instance */ + firmware-loader = &fs_loader0; + }; + + fs_loader0: fs-loader@0 { + bootph-all; + compatible = "u-boot,fs-loader"; + /* Load from MMC0, partition 1 */ + phandlepart = <&mmc_0 1>; + }; + + mdio { + phy@0 {Quoted 8 lines
Quoted 8 lines
doc/device-tree-bindings/net/aquantia-phy.txt +5
-0+ reg = <0>; + /* Load this file via the selected fs-loader */ + firmware-name = "aqr-firmware.cld"; + }; + };};
Signature · 1 line
2.47.3Cheers,
Beiyan Yun
Re: [PATCH RESEND 4/4] doc: bindings: add Aquantia PHY node's "firmware-name" binding
Quoted 52 lines · Beiyan Yun
Quoted 52 lines · Beiyan Yun
Quoted 48 lines · On 23 Sep 2025, at 8:44 PM, Yao Zi <[email protected]…
Quoted 5 lines · Beiyan Yun
With the switch to generic firmware loader, "firmware-name" binding was introduced to define the firmware filename.
Provide the document and usage examples.Signed-off-by Beiyan Yun <[email protected] <mailto:[email protected]> <mailto:[email protected]>>IMO this patch should go before the driver change.
Quoted 22 lines
---
doc/device-tree-bindings/net/aquantia-phy.txt| 30 +++++++++++++++++++1 file changed, 30 insertions(+)doc/device-tree-bindings/net/aquantia-phy.txt +0
-0@@ -11,15 +11,45 @@ a custom firmware is needed for each integration of a PHY.Several optional bindings are defined that allow these configuration points to be driven by the PHY driver and reduce dependency on specific FW versions.
doc/device-tree-bindings/net/aquantia-phy.txt +4
-0+Aquantia PHY's firmware is often provided by PHY-resident SPI flash; if absent +or outdated, U-Boot can upload firmware over MDIO during PHY initialization. +The driver uploads only when the PHY reports missing firmware or a fault. +Optional properties:
mdi-reversal: 0 or 1 indicating that reversal must be disabled/enabled.
Firmware default is used if the property is missing.
smb-addr: I2C/SMBus address to use, firmware default is used if the property
is missing.doc/device-tree-bindings/net/aquantia-phy.txt a custom firmware is needed for each integration of a PHY. · line 24
Quoted 2 lines
doc/device-tree-bindings/net/aquantia-phy.txt +2
-0+firmware-name: String containing the filename of the PHY firmware to load + (only when CONFIG_PHY_AQUANTIA_UPLOAD_FW is enabled).This looks good to me, but I have a question: should we switch to the upstream binding for aquantia phys? It's already documented as marvell,aquantia.yaml, and we could avoid the burden of maintaining a separate binding file.
The "firmware-name" property is already described in the upstream marvell,aquantia.yaml, and it only misses the smb-addr property. The only U-Boot boards making use of this property are fsl-sch-30841 and fsl-sch-30842, thus such conversion shouldn't be a big job.
Quoted 6 lines
Quoted 1 line
Good point. I’ll add a bit more info in related
Kconfigoptions and drop the doc.Hmm, I’m a bit lost. Here’s some of my concerns:
- Upstream binding has an optional nvmem cell as firmware source, such mechanism simply doesn’t exist in U-Boot. This could be misleading.
I think it's okay to support part of the binding in U-Boot: the goal is to reuse upstream binding, avoiding the burden of maintaining a duplication, and making it possible to share devicetree between kernel and firmware (same binding means same ABI).
I did a brief search in the upstream dts tree, and found no consumer of this nvmem-cells property, thus I don't think it's a problem, at least for now.
Quoted 1 line
- About “smb-addr”, what’s the best move? Do we upstream them to Linux?
Yes, if it's really necesary for the phy to work. If you decide to adapt the upstream binding in the series, then I suggest upstreaming the property to dt-bindings first.
Anyway I think your original patch looks good to me as well, it isn't a must (at least to me) to switch to the upstream binding.
Quoted 4 lines
Any idea on how to fix these issues?
Thanks,
Beiyan Yun
Best regards,
Yao Zi
Re: [PATCH RESEND 4/4] doc: bindings: add Aquantia PHY node's "firmware-name" binding
Quoted 69 lines · Yao Zi
Quoted 52 lines · Beiyan Yun
Quoted 52 lines · Beiyan Yun
Quoted 48 lines · On 23 Sep 2025, at 8:44 PM, Yao Zi <[email protected]…
Quoted 5 lines · Beiyan Yun
With the switch to generic firmware loader, "firmware-name" binding was introduced to define the firmware filename.
Provide the document and usage examples.Signed-off-by Beiyan Yun <[email protected] <mailto:[email protected]> <mailto:[email protected]>>IMO this patch should go before the driver change.
Quoted 22 lines
---
doc/device-tree-bindings/net/aquantia-phy.txt| 30 +++++++++++++++++++1 file changed, 30 insertions(+)doc/device-tree-bindings/net/aquantia-phy.txt +0
-0@@ -11,15 +11,45 @@ a custom firmware is needed for each integration of a PHY.Several optional bindings are defined that allow these configuration points to be driven by the PHY driver and reduce dependency on specific FW versions.
doc/device-tree-bindings/net/aquantia-phy.txt +4
-0+Aquantia PHY's firmware is often provided by PHY-resident SPI flash; if absent +or outdated, U-Boot can upload firmware over MDIO during PHY initialization. +The driver uploads only when the PHY reports missing firmware or a fault. +Optional properties:
mdi-reversal: 0 or 1 indicating that reversal must be disabled/enabled.
Firmware default is used if the property is missing.
smb-addr: I2C/SMBus address to use, firmware default is used if the property
is missing.doc/device-tree-bindings/net/aquantia-phy.txt a custom firmware is needed for each integration of a PHY. · line 24
Quoted 2 lines
doc/device-tree-bindings/net/aquantia-phy.txt +2
-0+firmware-name: String containing the filename of the PHY firmware to load + (only when CONFIG_PHY_AQUANTIA_UPLOAD_FW is enabled).This looks good to me, but I have a question: should we switch to the upstream binding for aquantia phys? It's already documented as marvell,aquantia.yaml, and we could avoid the burden of maintaining a separate binding file.
The "firmware-name" property is already described in the upstream marvell,aquantia.yaml, and it only misses the smb-addr property. The only U-Boot boards making use of this property are fsl-sch-30841 and fsl-sch-30842, thus such conversion shouldn't be a big job.
Quoted 6 lines
Quoted 1 line
Good point. I’ll add a bit more info in related
Kconfigoptions and drop the doc.Hmm, I’m a bit lost. Here’s some of my concerns:
- Upstream binding has an optional nvmem cell as firmware source, such mechanism simply doesn’t exist in U-Boot. This could be misleading.
I think it's okay to support part of the binding in U-Boot: the goal is to reuse upstream binding, avoiding the burden of maintaining a duplication, and making it possible to share devicetree between kernel and firmware (same binding means same ABI).
I did a brief search in the upstream dts tree, and found no consumer of this nvmem-cells property, thus I don't think it's a problem, at least for now.
Quoted 8 lines
Quoted 1 line
- About “smb-addr”, what’s the best move? Do we upstream them to Linux?
Yes, if it's really necesary for the phy to work. If you decide to adapt the upstream binding in the series, then I suggest upstreaming the property to dt-bindings first.
Anyway I think your original patch looks good to me as well, it isn't a must (at least to me) to switch to the upstream binding.
Figuring out how to use the upstream binding, and addressing issues / short-comings there is the best path forward. Maybe U-Boot will need some method for being able to load firmware blobs from nvme cells in the future for example.
Signature · 1 line
Tom