public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Damien Dejean <dam.dejean@gmail.com>
Cc: andrew@lunn.ch, krzk+dt@kernel.org, robh@kernel.org,
	kuba@kernel.org, maxime.chevallier@bootlin.com,
	pabeni@redhat.com, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	edumazet@google.com, davem@davemloft.net, hkallweit1@gmail.com
Subject: Re: [PATCH net-next v9 2/4] net: phy: realtek: add RTL8224 pair order support
Date: Fri, 20 Mar 2026 08:21:56 +0000	[thread overview]
Message-ID: <20260320082156.GX1753385@horms.kernel.org> (raw)
In-Reply-To: <20260318215502.106528-3-dam.dejean@gmail.com>

On Wed, Mar 18, 2026 at 10:54:59PM +0100, Damien Dejean wrote:

...

> diff --git a/drivers/net/phy/realtek/realtek_main.c b/drivers/net/phy/realtek/realtek_main.c

...

> +static int rtl8224_mdi_config_order(struct phy_device *phydev)
> +{
> +	struct device_node *np = phydev->mdio.dev.of_node;
> +	u8 port_offset = phydev->mdio.addr & 3;
> +	u32 order = 0;
> +	int ret;
> +
> +	ret = of_property_read_u32(np, "enet-phy-pair-order", &order);
> +
> +	/* Do nothing in case the property is not present */
> +	if (ret == -EINVAL || ret == -ENOSYS)
> +		return 0;

Checkpatch warns that ENOSYS only means 'invalid syscall nr'.

Looking over the implementation of of_property_read_u32() it seems to me
that -EINVAL is sufficient to detect that a property is not present. Which
may be appropriate here.

Likewise in patch 4/4.

Using a quick grep of the tree, I do notice the same pattern as above is
also present (only?) in aquantia_main.c.  So depending on the outcome of this
discussion it might be appropriate to update that too.

> +
> +	if (ret)
> +		return ret;
> +
> +	if (order & ~1)
> +		return -EINVAL;
> +
> +	return rtl8224_package_modify_mmd(phydev, MDIO_MMD_VEND1,
> +					  RTL8224_VND1_MDI_PAIR_SWAP,
> +					  BIT(port_offset),
> +					  order ? BIT(port_offset) : 0);
> +}
> +
> +static int rtl8224_config_init(struct phy_device *phydev)
> +{
> +	return rtl8224_mdi_config_order(phydev);
> +}

...

> @@ -2395,6 +2457,8 @@ static struct phy_driver realtek_drvs[] = {
>  		PHY_ID_MATCH_EXACT(0x001ccad0),
>  		.name		= "RTL8224 2.5Gbps PHY",
>  		.flags		= PHY_POLL_CABLE_TEST,
> +		.probe		= rtl8224_probe,
> +		.config_init	= rtl8224_config_init,
>  		.get_features	= rtl822x_c45_get_features,
>  		.config_aneg	= rtl822x_c45_config_aneg,
>  		.read_status	= rtl822x_c45_read_status,
> -- 
> 2.47.3
> 

  reply	other threads:[~2026-03-20  8:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 21:54 [PATCH net-next v9 0/4] net: phy: realtek: pair order and polarity Damien Dejean
2026-03-18 21:54 ` [PATCH net-next v9 1/4] dt-bindings: net: ethernet-phy: add property enet-phy-pair-order Damien Dejean
2026-03-18 21:54 ` [PATCH net-next v9 2/4] net: phy: realtek: add RTL8224 pair order support Damien Dejean
2026-03-20  8:21   ` Simon Horman [this message]
2026-03-20 18:17     ` Damien Dejean
2026-03-21  9:20       ` Simon Horman
2026-03-18 21:55 ` [PATCH net-next v9 3/4] dt-bindings: net: ethernet-phy: add property enet-phy-pair-polarity Damien Dejean
2026-03-18 21:55 ` [PATCH net-next v9 4/4] net: phy: realtek: add RTL8224 polarity support Damien Dejean
2026-03-21  2:20 ` [PATCH net-next v9 0/4] net: phy: realtek: pair order and polarity patchwork-bot+netdevbpf

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=20260320082156.GX1753385@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=dam.dejean@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox