* [PATCH net-next] net: phy: air_en8811h: use firmware loaded by the bootloader
@ 2026-10-17 18:02 Aleksei Sviridkin
2026-10-18 19:13 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Aleksei Sviridkin @ 2026-10-17 18:02 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit, Russell King, netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Eric Woudstra, linux-kernel
On a Keenetic KN-1012 (MT7981) the EN8811H sits behind a port of an
MT7531 switch. The driver has to be built in there: as a module it loads
after DSA has validated the port against the generic PHY driver and
failed to set it up. Built in, it probes when the Ethernet MDIO bus is
registered, before the root filesystem is mounted, so
request_firmware_direct() fails with -ENOENT, the PHY stays without a
driver and the port never comes up, although the bootloader has already
loaded and started the MD32 firmware.
When the firmware files cannot be read and the MCU reports ready, keep
the running firmware and let the first .config_init() restart it, so the
PHY starts from a freshly started MCU as after a download rather than
from whatever state the bootloader left. Nothing changes when the files
are there. A board that relies on this must not give phylib a
reset-gpios line, as the pulse at registration stops the MCU. The
AN8811HB path is unchanged.
Tested on the KN-1012: with the bootloader load the PHY binds and links;
without it 0x8009 reads 0x0 and the probe fails as before; a rebind with
the files present downloads them as before.
Suggested-by: Andrew Lunn <andrew@lunn.ch>
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
---
This replaces "net: phylink: wait for a PHY that probes after the MAC"
https://lore.kernel.org/netdev/20261006124731.1528963-1-f@lex.la/
following Andrew's suggestion in
https://lore.kernel.org/netdev/b175c750-104a-4859-a137-09de78a6d8bb@lunn.ch/
drivers/net/phy/air_en8811h.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/air_en8811h.c b/drivers/net/phy/air_en8811h.c
index a03d63dd4ac9..efe4e64d213a 100644
--- a/drivers/net/phy/air_en8811h.c
+++ b/drivers/net/phy/air_en8811h.c
@@ -518,6 +518,17 @@ static int an8811hb_load_firmware(struct phy_device *phydev)
return en8811h_wait_mcu_ready(phydev);
}
+/* No firmware files, but the bootloader may have started the MCU */
+static int en8811h_use_running_fw(struct phy_device *phydev, int err)
+{
+ if (phy_read_mmd(phydev, MDIO_MMD_VEND1, EN8811H_PHY_FW_STATUS) !=
+ EN8811H_PHY_READY)
+ return err;
+
+ en8811h_print_fw_version(phydev);
+ return 1;
+}
+
static int en8811h_load_firmware(struct phy_device *phydev)
{
struct device *dev = &phydev->mdio.dev;
@@ -526,11 +537,13 @@ static int en8811h_load_firmware(struct phy_device *phydev)
ret = request_firmware_direct(&fw1, EN8811H_MD32_DM, dev);
if (ret < 0)
- return ret;
+ return en8811h_use_running_fw(phydev, ret);
ret = request_firmware_direct(&fw2, EN8811H_MD32_DSP, dev);
- if (ret < 0)
+ if (ret < 0) {
+ ret = en8811h_use_running_fw(phydev, ret);
goto en8811h_load_firmware_rel1;
+ }
ret = air_phy_buckpbus_reg_write(phydev, EN8811H_FW_CTRL_1,
EN8811H_FW_CTRL_1_START);
@@ -1214,8 +1227,8 @@ static int en8811h_probe(struct phy_device *phydev)
if (ret < 0)
return ret;
- /* mcu has just restarted after firmware load */
- priv->mcu_needs_restart = false;
+ /* drop whatever state the bootloader left in a running mcu */
+ priv->mcu_needs_restart = ret > 0;
/* MDIO_DEVS1/2 empty, so set mmds_present bits here */
phydev->c45_ids.mmds_present |= MDIO_DEVS_PMAPMD | MDIO_DEVS_AN;
--
2.53.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: phy: air_en8811h: use firmware loaded by the bootloader
2026-10-17 18:02 [PATCH net-next] net: phy: air_en8811h: use firmware loaded by the bootloader Aleksei Sviridkin
@ 2026-10-18 19:13 ` Andrew Lunn
2026-10-19 1:33 ` Aleksei Sviridkin
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2026-10-18 19:13 UTC (permalink / raw)
To: Aleksei Sviridkin
Cc: Heiner Kallweit, Russell King, netdev, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Eric Woudstra,
linux-kernel
On Sat, Oct 17, 2026 at 09:02:51PM +0300, Aleksei Sviridkin wrote:
> On a Keenetic KN-1012 (MT7981) the EN8811H sits behind a port of an
> MT7531 switch. The driver has to be built in there: as a module it loads
> after DSA has validated the port against the generic PHY driver and
> failed to set it up. Built in, it probes when the Ethernet MDIO bus is
> registered, before the root filesystem is mounted, so
> request_firmware_direct() fails with -ENOENT, the PHY stays without a
> driver and the port never comes up, although the bootloader has already
> loaded and started the MD32 firmware.
>
> When the firmware files cannot be read and the MCU reports ready, keep
> the running firmware and let the first .config_init() restart it, so the
> PHY starts from a freshly started MCU as after a download rather than
> from whatever state the bootloader left. Nothing changes when the files
> are there. A board that relies on this must not give phylib a
> reset-gpios line, as the pulse at registration stops the MCU. The
> AN8811HB path is unchanged.
>
> Tested on the KN-1012: with the bootloader load the PHY binds and links;
> without it 0x8009 reads 0x0 and the probe fails as before; a rebind with
> the files present downloads them as before.
>
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Assisted-by: LLM
> Signed-off-by: Aleksei Sviridkin <f@lex.la>
> ---
> This replaces "net: phylink: wait for a PHY that probes after the MAC"
> https://lore.kernel.org/netdev/20261006124731.1528963-1-f@lex.la/
> following Andrew's suggestion in
> https://lore.kernel.org/netdev/b175c750-104a-4859-a137-09de78a6d8bb@lunn.ch/
>
> drivers/net/phy/air_en8811h.c | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/phy/air_en8811h.c b/drivers/net/phy/air_en8811h.c
> index a03d63dd4ac9..efe4e64d213a 100644
> --- a/drivers/net/phy/air_en8811h.c
> +++ b/drivers/net/phy/air_en8811h.c
> @@ -518,6 +518,17 @@ static int an8811hb_load_firmware(struct phy_device *phydev)
> return en8811h_wait_mcu_ready(phydev);
> }
>
> +/* No firmware files, but the bootloader may have started the MCU */
> +static int en8811h_use_running_fw(struct phy_device *phydev, int err)
> +{
> + if (phy_read_mmd(phydev, MDIO_MMD_VEND1, EN8811H_PHY_FW_STATUS) !=
> + EN8811H_PHY_READY)
> + return err;
> +
> + en8811h_print_fw_version(phydev);
> + return 1;
> +}
> +
> static int en8811h_load_firmware(struct phy_device *phydev)
> {
> struct device *dev = &phydev->mdio.dev;
> @@ -526,11 +537,13 @@ static int en8811h_load_firmware(struct phy_device *phydev)
>
> ret = request_firmware_direct(&fw1, EN8811H_MD32_DM, dev);
> if (ret < 0)
> - return ret;
> + return en8811h_use_running_fw(phydev, ret);
>
> ret = request_firmware_direct(&fw2, EN8811H_MD32_DSP, dev);
> - if (ret < 0)
> + if (ret < 0) {
> + ret = en8811h_use_running_fw(phydev, ret);
> goto en8811h_load_firmware_rel1;
> + }
Is it possible to figure out from the firmware blob what version it
is?
There is no point spending time downloading firmware from the
filesystem if it is the same or older than what is already in the
device.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: phy: air_en8811h: use firmware loaded by the bootloader
2026-10-18 19:13 ` Andrew Lunn
@ 2026-10-19 1:33 ` Aleksei Sviridkin
2026-10-20 0:21 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Aleksei Sviridkin @ 2026-10-19 1:33 UTC (permalink / raw)
To: Andrew Lunn
Cc: Lucien Jheng, Albert-AL Lee, Heiner Kallweit, Russell King,
netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Eric Woudstra, linux-kernel
On Sun, Oct 18, 2026 at 09:13:46PM +0200, Andrew Lunn wrote:
> Is it possible to figure out from the firmware blob what version it
> is?
Not reliably, as far as I can tell. The version the driver prints is
written into DM by the running MCU; the file holds zeros at that
address. In the DSP blob the halves 0x2506 and 0x2302 sit eight bytes
apart, which looks like the code that builds the word, but that is a
guess at an offset in vendor code.
Lucien, Albert, does Airoha guarantee any field in EthMD32.dm.bin or
EthMD32.DSP.bin as the firmware version, at a fixed place that will not
move in later releases? Without such a guarantee I would rather not
compare versions in the driver.
Aleksei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: phy: air_en8811h: use firmware loaded by the bootloader
2026-10-19 1:33 ` Aleksei Sviridkin
@ 2026-10-20 0:21 ` Andrew Lunn
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-10-20 0:21 UTC (permalink / raw)
To: Aleksei Sviridkin
Cc: Lucien Jheng, Albert-AL Lee, Heiner Kallweit, Russell King,
netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Eric Woudstra, linux-kernel
On Mon, Oct 19, 2026 at 04:33:04AM +0300, Aleksei Sviridkin wrote:
> On Sun, Oct 18, 2026 at 09:13:46PM +0200, Andrew Lunn wrote:
> > Is it possible to figure out from the firmware blob what version it
> > is?
>
> Not reliably, as far as I can tell. The version the driver prints is
> written into DM by the running MCU; the file holds zeros at that
> address. In the DSP blob the halves 0x2506 and 0x2302 sit eight bytes
> apart, which looks like the code that builds the word, but that is a
> guess at an offset in vendor code.
>
> Lucien, Albert, does Airoha guarantee any field in EthMD32.dm.bin or
> EthMD32.DSP.bin as the firmware version, at a fixed place that will not
> move in later releases? Without such a guarantee I would rather not
> compare versions in the driver.
linux-firmware/airoha$ git log --oneline EthMD32.dm.bin
149f9b8e linux-firmware: update firmware for en8811h 2.5G ethernet phy
d88562a0 linux-firmware: update firmware for en8811h 2.5G ethernet phy
d3480463 linux-firmware: update firmware for en8811h 2.5G ethernet phy
75ac03a8 linux-firmware: update firmware for en8811h 2.5G ethernet phy
73b4429f linux-firmware: update firmware for en8811h 2.5G ethernet phy
ddc99b3d linux-firmware: add firmware for en8811h 2.5G ethernet phy
linux-firmware/airoha$ git log --oneline EthMD32.DSP.bin
149f9b8e linux-firmware: update firmware for en8811h 2.5G ethernet phy
d88562a0 linux-firmware: update firmware for en8811h 2.5G ethernet phy
d3480463 linux-firmware: update firmware for en8811h 2.5G ethernet phy
75ac03a8 linux-firmware: update firmware for en8811h 2.5G ethernet phy
73b4429f linux-firmware: update firmware for en8811h 2.5G ethernet phy
ddc99b3d linux-firmware: add firmware for en8811h 2.5G ethernet phy
Looks like there is 6 of each. Maybe you can look at all these
versions and see if there is a pattern?
But it is just nice to have. Its not required for this patch to be
merged.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-20 0:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17 18:02 [PATCH net-next] net: phy: air_en8811h: use firmware loaded by the bootloader Aleksei Sviridkin
2026-10-18 19:13 ` Andrew Lunn
2026-10-19 1:33 ` Aleksei Sviridkin
2026-10-20 0:21 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®