net: phy: aquantia: Switch to generic firmware loader
Subsystems (3)
v2 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 fwloader and 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 aligns binding document with upstream and prepares for the migration.
- The third patch aligns binding for MDI with upstream.
- The final and main patch replaces the custom loader with generic one.
Kept smb-addr intact as NXP is the only consumer.
This change has been tested on a Buffalo WXR18000BE10P router, loading firmware from a UBIFS volume for Marvell CUX3410.
Changes in v2:
- doc: bindings: use upstream bindings for aquantia phy
- net: phy: aquantia: replace the "mdi-reversal" node with "marvell,mdi-cfg-order"
- Add support for script based loader
Beiyan Yun (4):
net: phy: aquantia: switch to use phy_get_ofnode()
doc: bindings: use upstream bindings for aquantia phy
net: phy: aquantia: replace the "mdi-reversal" node with
"marvell,mdi-cfg-order"
net: phy: aquantia: use generic firmware loader
arch/arm/dts/fsl-sch-30841.dtsi | 8 +- arch/arm/dts/fsl-sch-30842.dtsi | 2 +- doc/device-tree-bindings/net/aquantia-phy.txt | 15 +- drivers/net/phy/Kconfig | 23 +-- drivers/net/phy/aquantia.c | 139 ++++++++++-------- 5 files changed, 98 insertions(+), 89 deletions(-)
Signature · 4 lines
2.47.3 base-commit: 48f21e66e360552c75d70a50421d0e0ed1f59e90 branch: aquantia-fsloader-v2
PATCH v2 1/4 net: phy: aquantia: switch to use phy_get_ofnode()
Use PHY API phy_get_ofnode() helper to get PHY DT node.
---
(no changes since v1)
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 v2 2/4 doc: bindings: use upstream bindings for aquantia phy
In reply to Beiyan YunPrepare for the switch to upstream bindings and generic firmware loader, remove reference to upstreamed bindings, also add a firmware-name example.
---
Changes in v2:
- New
doc/device-tree-bindings/net/aquantia-phy.txt | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
doc/device-tree-bindings/net/aquantia-phy.txt +3 -12
@@ -1,25 +1,16 @@ PHY nodes for Aquantia devices. 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 -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. -Several optional bindings are defined that allow these configuration points to -be driven by the PHY driver and reduce dependency on specific FW versions. +addition to the bindings in upstream and phy.txt. 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. Example node: phy@00 { reg = <0x00>; - mdi-reversal = <1>; + marvell,mdi-cfg-order = <1>; smb-addr = <0x25>; + firmware-name = "aqr-firmware.cld"; };
Signature · 1 line
2.47.3
PATCH v2 3/4 net: phy: aquantia: replace the "mdi-reversal" node with "marvell, mdi-cfg-order"
In reply to Beiyan YunAs part of the effort of making U-Boot work with the same device tree as Linux, align with upstream node name.
---
Changes in v2:
- New
arch/arm/dts/fsl-sch-30841.dtsi | 8 ++++---- arch/arm/dts/fsl-sch-30842.dtsi | 2 +- drivers/net/phy/aquantia.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/dts/fsl-sch-30841.dtsi +4 -4
@@ -15,24 +15,24 @@ */ phy@00 { reg = <0x00>; - mdi-reversal = <1>; + marvell,mdi-cfg-order = <1>; smb-addr = <0x25>; }; phy@01 { reg = <0x01>; - mdi-reversal = <1>; + marvell,mdi-cfg-order = <1>; smb-addr = <0x26>; }; phy@02 { reg = <0x02>; - mdi-reversal = <1>; + marvell,mdi-cfg-order = <1>; smb-addr = <0x27>; }; phy@03 { reg = <0x03>; - mdi-reversal = <1>; + marvell,mdi-cfg-order = <1>; smb-addr = <0x28>; };
arch/arm/dts/fsl-sch-30842.dtsi +1 -1
@@ -13,6 +13,6 @@ */ phy@02 { reg = <0x02>; - mdi-reversal = <1>; + marvell,mdi-cfg-order = <1>; smb-addr = <0x25>; };
drivers/net/phy/aquantia.c +2 -2
@@ -350,8 +350,8 @@ static int aquantia_dts_config(struct phy_device *phydev)if (!ofnode_valid (node))return 0 ; -if (!ofnode_read_u32 (node,"mdi-reversal" , &prop)) { -debug ("mdi-reversal = %d\n" , (int )prop); +if (!ofnode_read_u32 (node,"marvell,mdi-cfg-order" , &prop)) { +debug ("marvell,mdi-cfg-order = %d\n" , (int )prop); reg =phy_read (phydev,MDIO_MMD_PMAPMD ,AQUANTIA_PMA_RX_VENDOR_P1 ); reg &= ~AQUANTIA_PMA_RX_VENDOR_P1_MDI_MSK ;
Signature · 1 line
2.47.3
PATCH v2 4/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 and runtime override of firmware source. (e.g., USB).
Tested on Buffalo WXR18000BE10P with UBIFS.
---
Changes in v2:
- Add support for script based loader
drivers/net/phy/Kconfig | 23 ++++--- drivers/net/phy/aquantia.c | 133 ++++++++++++++++++++----------------- 2 files changed, 87 insertions(+), 69 deletions(-)
drivers/net/phy/Kconfig +14 -9
@@ -1,4 +1,3 @@ - config BITBANGMII bool "Bit-banged ethernet MII management channel support"
@@ -90,23 +89,29 @@ 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. + + This option enables loading the firmware using the generic + file system firmware loader framework. -config PHY_AQUANTIA_FW_PART - string "Aquantia firmware partition" +config PHY_AQUANTIA_FW_MAX_SIZE + hex "Max firmware size" depends on PHY_AQUANTIA_UPLOAD_FW + default 0x80000 help - Partition containing the firmware file. + The maximum size of the Aquantia PHY firmware. This is used to + allocate a buffer to load the firmware into. -config PHY_AQUANTIA_FW_NAME - string "Aquantia firmware filename" +config PHY_AQUANTIA_FW_LOADER_SCRIPT + string "Aquantia firmware loader script" depends on PHY_AQUANTIA_UPLOAD_FW + default "aqr_phy_load_firmware" help - Firmware filename. + The firmware loading script variable name. config PHY_ATHEROS bool "Atheros Ethernet PHYs support"
drivers/net/phy/aquantia.c +73 -60
181 lines not on this page · raw message
Signature · 1 line
2.47.3