All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Artem Shimko" <a.shimko.dev@gmail.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH net-next v3 2/2] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver
Date: Fri, 17 Jul 2026 17:33:44 +0000	[thread overview]
Message-ID: <20260717173344.81F261F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260716173325.653164-3-a.shimko.dev@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] The fallback logic for missing delay properties incorrectly applies default delays to both RX and TX paths for RGMII_TXID and RGMII_RXID modes, breaking RGMII semantics.
- [High] Silent truncation of negative MDIO read errors due to `u16` variable typing causes the PHY reset polling loop to falsely report success.
- [High] The RGMII configuration is written to the PHY after the software reset, preventing the settings from taking effect.
--

--- Patch [2]: [PATCH net-next v3 2/2] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver ---
commit cafde85b2bbf112f7902c7badc2f66ec1f9c7bc5
Author: Artem Shimko <a.shimko.dev@gmail.com>

    net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver

This commit adds a new driver for the DAPU Telecom DAP8211R(I) Gigabit
Ethernet PHY. It supports RGMII delay configuration through device tree
properties and optional 180-degree TX clock phase shifting.

> diff --git a/drivers/net/phy/dap8211r.c b/drivers/net/phy/dap8211r.c
> new file mode 100644
> index 0000000000000..e6381fd8c98c2
> --- /dev/null
> +++ b/drivers/net/phy/dap8211r.c
[ ... ]
> +static int dap8211r_config_init(struct phy_device *phydev)
> +{
> +	struct device_node *phydev_node = phydev->mdio.dev.of_node;
> +	u16 set = 0, val = 0;

[Severity: High]
Does declaring val as u16 truncate negative error codes returned by 
dap8211r_read_ext() during polling? 

If dap8211r_read_ext() returns a negative error like -EIO, the truncated 
value will still have its high bit set, which might cause the polling 
loop below to exit early and falsely report success.

> +	int ret;
> +	s32 internal_delay;
> +
> +	if (of_property_read_bool(phydev_node, "dapu,tx-inverted-clk"))
> +		set |= DAP8211R_RGMII_CLK_INVERT;
> +
> +	internal_delay = phy_get_internal_delay(phydev, dap8211r_internal_delay,
> +						DAP8211R_DELAY_SIZE, true);
> +	if (internal_delay < 0) {
> +		if (phydev->interface == PHY_INTERFACE_MODE_RGMII)
> +			internal_delay = 0;
> +		else
> +			internal_delay = DAP8211R_DEFAULT_DEL_SEL;
> +	}

[Severity: High]
If the rx-internal-delay-ps property is missing and the interface mode is 
PHY_INTERFACE_MODE_RGMII_TXID, does this fallback logic incorrectly apply 
the default delay (DAP8211R_DEFAULT_DEL_SEL) to the RX path? 

For RGMII_TXID, should the RX delay instead be 0?

> +
> +	set |= FIELD_PREP(DAP8211R_RGMII_RX_DEL_MASK, internal_delay);
> +
> +	internal_delay = phy_get_internal_delay(phydev, dap8211r_internal_delay,
> +						DAP8211R_DELAY_SIZE, false);
> +	if (internal_delay < 0) {
> +		if (phydev->interface == PHY_INTERFACE_MODE_RGMII)
> +			internal_delay = DAP8211R_INIT_TX_DEL_VAL;
> +		else
> +			internal_delay = DAP8211R_DEFAULT_DEL_SEL;
> +	}

[Severity: High]
Similarly, if tx-internal-delay-ps is missing and the interface mode is 
PHY_INTERFACE_MODE_RGMII_RXID, will this incorrectly apply the default delay 
to the TX path when it should be 0?

> +
> +	set |= FIELD_PREP(DAP8211R_RGMII_TX_DEL_MASK, internal_delay);
> +
> +	ret = dap8211r_modify_ext(phydev, DAP8211R_PHY_CON, DAP8211R_PHY_SW_RST, 0);
> +	if (ret)
> +		return ret;
> +
> +	/* Wait for reset self-clear (max 200 us) */
> +	ret = read_poll_timeout(dap8211r_read_ext, val,
> +				(val & DAP8211R_PHY_SW_RST),
> +				20, 200, false, phydev, DAP8211R_PHY_CON);
> +	if (ret)
> +		return ret;
> +
> +	ret = dap8211r_modify_ext(phydev, DAP8211R_RGMII_CON, DAP8211R_RGMII_CONFIG_MASK, set);

[Severity: High]
Is the RGMII configuration written to the PHY after the software reset 
completes? 

The initialization comment mentions a software reset is used to apply 
settings. If we write the RGMII configuration after the reset, will the 
settings take effect, or will the PHY operate with uninitialized values?

> +	if (ret)
> +		return ret;
> +
> +	return 0;
> +}
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260716173325.653164-1-a.shimko.dev@gmail.com?part=2

  reply	other threads:[~2026-07-17 17:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 17:33 [PATCH net-next v3 0/2] Add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
2026-07-16 17:33 ` [PATCH net-next v3 1/2] dt-bindings: net: add DAPU Telecom DAP8211R(I) PHY binding Artem Shimko
2026-07-16 19:04   ` Rob Herring (Arm)
2026-07-17 10:54     ` Artem Shimko
2026-07-17 17:33   ` sashiko-bot
2026-07-16 17:33 ` [PATCH net-next v3 2/2] net: phy: add DAPU Telecom DAP8211R(I) Gigabit Ethernet PHY driver Artem Shimko
2026-07-17 17:33   ` sashiko-bot [this message]
2026-07-16 18:11 ` [PATCH net-next v3 0/2] Add " Maxime Chevallier
2026-07-16 18:32   ` Andrew Lunn
2026-07-17 10:51     ` Artem Shimko
2026-07-17 10:50   ` Artem Shimko

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=20260717173344.81F261F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a.shimko.dev@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.