Article View: linux.kernel.netdev
Article #4639Re: [PATCH net-next] net: phy: air_en8811h: use firmware loaded by the bootloader
From: Andrew Lunn
Date: Sun, 18 Oct 2026 19:13
Date: Sun, 18 Oct 2026 19:13
79 lines
9019 bytes
9019 bytes
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
Technical Details
Message-ID:
<2d6df47b-2cc3-4003-85db-f72b878427d9@lunn.ch>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348155-linux-kernel-netdev=dewy.ruReferences:
<20261017180251.3618606-1-f@lex.la>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348155-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next] net: phy: air_en8811h: use firmware loaded by the bootloader Date: Sun, 18 Oct 2026 21:13:46 +0200 Organization: Usenet Network Message-ID: <2d6df47b-2cc3-4003-85db-f72b878427d9@lunn.ch> References: <20261017180251.3618606-1-f@lex.la> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3405592"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:FHSez0ueLD95qAB5SGsG7Rq+xtI= sha256:/xw7B8TfK3jxO18TLneOLbsQA+n/TOvMhjZM9fQhArI= sha1:z0iENjfHC48Ru/B/raznNeCn3AE= sha256:XUEeY6MxwpeVrp8t4Q4C0ho0J6Q/RzBFJ0ehF2ouhUQ= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id D575E110886; Sun, 18 Oct 2026 22:14:27 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sxD5E6-oB5f6; Sun, 18 Oct 2026 22:14:24 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-348155-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 2631811083E; Sun, 18 Oct 2026 22:14:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by tor.lore.kernel.org (Postfix) with ESMTP id 6C4E22F5B8; Sun, 18 Oct 2026 19:14:12 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E18633F44D5; Sun, 18 Oct 2026 19:14:09 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="yPYY2r0i" X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05DBD3822B7; Sun, 18 Oct 2026 19:14:07 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792350849; cv=none; b=Fqqq6zEllXcx75rTvj6IbNTcPOaQYRnKQyuGk7snN+bbs1GdoHStRkTiH4kul8CaHb9V+WRqfxt1JpipQvHEcU57XoWgHVTS8w79oI/V94uBnzy5DwLEgSbmT6+QYVZ59kgQnlOSUC5tq5A1eRG2g/dOK61GsLl0HYC5YGwkClg= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792350849; c=relaxed/simple; bh=ZZ4Jr6igQloVs1kOy3pHxivzGlidTY6Iphg3SZY0OEs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DX6BtsXmBd7i10MSuyqMuaG6R3R8yJSfUfEXtM1DO/uHmRaJ6ayT0wtyFW5pbSXPRKXBUV9Kl7hNKCQkwwMCrELOwbO49sUKRrEd7GHCDea+DFZ19LsPH17EeG7dHu3SYtpaC+XVr7foMauTP5ywV5VArIzpjc+8f2gX3irv34c= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=yPYY2r0i; arc=none smtp.client-ip=156.67.10.101 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=qHbV8LAtUSWSGGDa0h86rBDpCNFJieHVVQNqm9YZ5qo=; b=yPYY2r0i/4SBAk3Wp2l0SNL8ht UhECU/Z+YTPeuUAGG4bK05uHGVaL9zmDZqEXfQpSxbMN8xQ53XZ/VsSLCh/3gbNaBOqCucVd18NNh Odoib4cVuTRL0P2imPCAQ79rahZeX1PMcn30hXj9SuRp/KcfqjRUCi8YpdJmjnXyFHsA=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xIWKI-00BWKf-O9; Sun, 18 Oct 2026 21:13:46 +0200 X-Cc: Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Eric Woudstra <ericwouds@gmail.com>, linux-kernel@vger.kernel.org X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-In-Reply-To: <20261017180251.3618606-1-f@lex.la>