mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: javen <javen_xu@realsil.com.cn>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, freddy_gu@realsil.com.cn,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	daniel@makrotopia.org, vladimir.oltean@nxp.com
Subject: Re: [PATCH net-next v2 2/4] net: phy: c45: add genphy_c45_config_master_slave()
Date: Thu, 04 Jun 2026 10:49:25 +0200	[thread overview]
Message-ID: <521e53fe8f22eb938ea7b9073516378f@tipi-net.de> (raw)
In-Reply-To: <20260604074209.93-3-javen_xu@realsil.com.cn>

Hi Javen

On 4.6.2026 09:42, javen wrote:
> From: Javen Xu <javen_xu@realsil.com.cn>
> 
> Add a generic helper to configure forced master/slave mode for Clause 
> 45
> PHYs using the 10GBASE-T AN control register.
> 
> Signed-off-by: Javen Xu <javen_xu@realsil.com.cn>

> [...]

> +/**
> + * genphy_c45_config_master_slave - Configure Master/Slave setting for 
> C45 PHYs
> + * @phydev: target phy_device struct
> + *
> + * Description: Configures the Master/Slave manual setting in the
> + * 10GBASE-T control register (MMD 7, Register 0x0020) according to
> + * IEEE 802.3 standards.
> + */

Please document the return value (0 = unchanged, 1 = changed, <0 errno), 
like
it is done for genphy_c45_an_config_aneg().

> +int genphy_c45_config_master_slave(struct phy_device *phydev)
> +{
> +	u16 val = 0;
> +
> +	switch (phydev->master_slave_set) {
> +	case MASTER_SLAVE_CFG_MASTER_FORCE:
> +		val = MDIO_AN_10GBT_CTRL_MS_ENABLE | MDIO_AN_10GBT_CTRL_MS_VALUE;
> +		break;
> +	case MASTER_SLAVE_CFG_SLAVE_FORCE:
> +		val = MDIO_AN_10GBT_CTRL_MS_ENABLE;
> +		break;
> +	case MASTER_SLAVE_CFG_UNKNOWN:
> +	case MASTER_SLAVE_CFG_MASTER_PREFERRED:
> +	case MASTER_SLAVE_CFG_SLAVE_PREFERRED:
> +	default:
> +		break;
> +	}

Per IEEE 802.3 (45.2.7.10.3), 7.32.13 (port type) is a copy of 9.10 /
CTL1000_PREFER_MASTER, like it is done in c22's 
genphy_setup_master_slave().

So set it for MASTER_PREFERRED, clear it for SLAVE_PREFERRED and leave 
UNKNOWN/UNSUPPORTED
untouched (return 0). Use -EOPNOTSUPP only for default.

> [...]

Thanks,
Nicolai

  reply	other threads:[~2026-06-04  8:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04  7:42 [PATCH net-next v2 0/4] Add support for RTL8261C_CG javen
2026-06-04  7:42 ` [PATCH net-next v2 1/4] net: phy: c45: add genphy_c45_soft_reset() javen
2026-06-04  8:17   ` Nicolai Buchwitz
2026-06-04 12:21   ` Andrew Lunn
2026-06-04  7:42 ` [PATCH net-next v2 2/4] net: phy: c45: add genphy_c45_config_master_slave() javen
2026-06-04  8:49   ` Nicolai Buchwitz [this message]
2026-06-04 12:27     ` Andrew Lunn
2026-06-05  3:19     ` Javen
2026-06-04  7:42 ` [PATCH net-next v2 3/4] net: phy: realtek: add support for RTL8261C_CG javen
2026-06-04  8:57   ` Nicolai Buchwitz
2026-06-04  7:42 ` [PATCH net-next v2 4/4] net: phy: realtek: load firmware " javen

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=521e53fe8f22eb938ea7b9073516378f@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=freddy_gu@realsil.com.cn \
    --cc=hkallweit1@gmail.com \
    --cc=javen_xu@realsil.com.cn \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox