From: Jakub Kicinski <kuba@kernel.org>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: netdev@vger.kernel.org, "Lucien.Jheng" <lucienzx159@gmail.com>,
Daniel Golle <daniel@makrotopia.org>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 2/3] net: phy: air_en8811h: add Airoha AN8811HB support
Date: Mon, 26 Jan 2026 19:11:59 -0800 [thread overview]
Message-ID: <20260126191159.05b57b91@kernel.org> (raw)
In-Reply-To: <20260126065749.1334867-3-bjorn@mork.no>
On Mon, 26 Jan 2026 07:57:48 +0100 Bjørn Mork wrote:
> The Airoha AN8811HB is mostly compatible with the EN8811H, adding 10Base-T
> support and reducing power consumption.
>
> This driver is based on the air_an8811hb v0.0.4 out-of-tree driver
> written by "Lucien.Jheng <lucien.jheng@airoha.com>"
>
> Firmware is available in linux-firmware. The driver has been tested with
> firmware version 25110702
> +static int an8811hb_check_crc(struct phy_device *phydev, u32 set1,
> + u32 mon2, u32 mon3)
> +{
> + u32 pbus_value;
> + int retry = 25;
> + int ret;
> +
> + /* Configure CRC */
> + ret = air_buckpbus_reg_modify(phydev, set1,
> + AN8811HB_CRC_RD_EN,
> + AN8811HB_CRC_RD_EN);
> + if (ret < 0)
> + return ret;
> + air_buckpbus_reg_read(phydev, set1, &pbus_value);
> +
> + do {
> + mdelay(300);
Did you mean msleep()? mdelay(300) is a lot of spinning.
> + air_buckpbus_reg_read(phydev, mon2, &pbus_value);
> +
> + if (pbus_value & AN8811HB_CRC_ST) {
> + air_buckpbus_reg_read(phydev, mon3, &pbus_value);
> + phydev_dbg(phydev, "CRC Check %s!\n",
> + pbus_value & AN8811HB_CRC_CHECK_PASS ?
> + "PASS" : "FAIL");
AI code review points out on failure you just print a FAIL and carry on.
Is this because this is what the vendor driver does? Or we know bad CRC
FWs exist in the wild? A comment would be useful here..
> + return air_buckpbus_reg_modify(phydev, set1,
> + AN8811HB_CRC_RD_EN, 0);
> + }
> + } while (--retry);
> +
> +static int an8811hb_load_firmware(struct phy_device *phydev)
> +{
> + struct device *dev = &phydev->mdio.dev;
> + const struct firmware *fw1, *fw2;
> + int ret;
> +
> + ret = request_firmware_direct(&fw1, AN8811HB_MD32_DM, dev);
> + if (ret < 0)
> + return ret;
> +
> + ret = request_firmware_direct(&fw2, AN8811HB_MD32_DSP, dev);
> + if (ret < 0)
> + goto an8811hb_load_firmware_rel1;
Please name labels after what they jump to. Per CodingStyle..
> + ret = air_buckpbus_reg_write(phydev, EN8811H_FW_CTRL_1,
> + EN8811H_FW_CTRL_1_START);
> + if (ret < 0)
> + goto an8811hb_load_firmware_out;
> +
> + ret = air_write_buf(phydev, AIR_FW_ADDR_DM, fw1);
> + if (ret < 0)
> + goto an8811hb_load_firmware_out;
> +
> + ret = an8811hb_check_crc(phydev, AN8811HB_CRC_DM_SET1,
> + AN8811HB_CRC_DM_MON2,
> + AN8811HB_CRC_DM_MON3);
> + if (ret < 0)
> + goto an8811hb_load_firmware_out;
> +
> + ret = air_write_buf(phydev, AIR_FW_ADDR_DSP, fw2);
> + if (ret < 0)
> + goto an8811hb_load_firmware_out;
> +
> + ret = an8811hb_check_crc(phydev, AN8811HB_CRC_PM_SET1,
> + AN8811HB_CRC_PM_MON2,
> + AN8811HB_CRC_PM_MON3);
> + if (ret < 0)
> + goto an8811hb_load_firmware_out;
> +
> + ret = en8811h_wait_mcu_ready(phydev);
> + if (ret < 0)
> + goto an8811hb_load_firmware_out;
TBH the gotos are a bit hard to read, maybe factor out the logic that
can fail to a separate function? Then we can just capture ret here and
fall thru; and the helper itself can return ret; directly.
--
pw-bot: cr
next prev parent reply other threads:[~2026-01-27 3:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 6:57 [PATCH net-next v3 0/3] Airoha AN8811HB 2.5 Gbps phy support Bjørn Mork
2026-01-26 6:57 ` [PATCH net-next v3 1/3] net: phy: air_en8811h: factor out shareable code Bjørn Mork
2026-01-26 6:57 ` [PATCH net-next v3 2/3] net: phy: air_en8811h: add Airoha AN8811HB support Bjørn Mork
2026-01-27 3:11 ` Jakub Kicinski [this message]
2026-01-27 11:17 ` Bjørn Mork
2026-01-26 6:57 ` [PATCH net-next v3 3/3] net: phy: air_en8811h: Add clk provider for an8811hb Bjørn Mork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260126191159.05b57b91@kernel.org \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=bjorn@mork.no \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lucienzx159@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vladimir.oltean@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.