mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Kyle Switch <kyle.switch@motor-comm.com>
Cc: Frank.Sae@motor-comm.com, hkallweit1@gmail.com,
	linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, ming.xu@motor-comm.com,
	xiaolin.xu@motor-comm.com, jianmin.wang@motor-comm.com,
	jie.han@motor-comm.com
Subject: Re: [PATCH net-next v17 2/2] net: phy: Add driver for Motorcomm Quad 2.5GbE phy
Date: Tue, 15 Sep 2026 03:48:11 +0200	[thread overview]
Message-ID: <03664dd8-8f95-4ee3-8237-3c64febd90c3@lunn.ch> (raw)
In-Reply-To: <20260912065224.2723883-3-kyle.switch@motor-comm.com>

> +struct yt8824_shared_priv {
> +	unsigned int interface_mode;

phy_interface_t

> +	if (!of_property_read_string(np, "phy-mode",
> +				     &interface_mode_name)) {
> +		if (!strcasecmp(interface_mode_name,
> +				phy_modes(PHY_INTERFACE_MODE_USXGMII))) {
> +			priv->interface_mode = PHY_INTERFACE_MODE_USXGMII;
> +		} else if (!strcasecmp
> +				(interface_mode_name,
> +				 phy_modes(PHY_INTERFACE_MODE_INTERNAL))) {
> +			priv->interface_mode = PHY_INTERFACE_MODE_INTERNAL;
> +		} else {
> +			return -EINVAL;
> +		}
> +	} else {
> +		phydev_warn(phydev, "%s, phy-mode missing in DTS.\n",
> +			    __func__);
> +	}

Please don't reinvent the wheel. Look around to find an existing
wheel.

> +/**
> + * genphy_c45_template_testmode - configure template testmode registers
> + * @phydev: target phy_device struct
> + * @test_mode: testmode includes Normal to Test mode 7
> + *
> + * Description: Set template testmode include Normal to Test mode 7
> + *
> + * Return: 0 on success, or a negative error code on failure (e.g. register
> + *	read/write error).
> + */
> +int genphy_c45_template_testmode(struct phy_device *phydev, int test_mode)
> +{
> +	int ctrl = 0;
> +
> +	switch (test_mode) {
> +	case 0:
> +		ctrl = MDIO_PMA_10GBT_TESTMODE_NORMAL;
> +		break;
> +
> +	case 1:
> +		ctrl = MDIO_PMA_10GBT_TESTMODE_1;
> +		break;
> +
> +	case 2:
> +		ctrl = MDIO_PMA_10GBT_TESTMODE_2;
> +		break;
> +
> +	case 3:
> +		ctrl = MDIO_PMA_10GBT_TESTMODE_3;
> +		break;
> +
> +	case 4:
> +		ctrl = MDIO_PMA_10GBT_TESTMODE_4;
> +		break;
> +
> +	case 5:
> +		ctrl = MDIO_PMA_10GBT_TESTMODE_5;
> +		break;
> +
> +	case 6:
> +		ctrl = MDIO_PMA_10GBT_TESTMODE_6;
> +		break;
> +
> +	case 7:
> +		ctrl = MDIO_PMA_10GBT_TESTMODE_7;
> +		break;
> +
> +	default:
> +		return -EINVAL;
> +	}
> +	return phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_PMA_10GBT_TESTMODE,
> +			      MDIO_PMA_10GBT_TESTMODE_MASK, ctrl);
> +}
> +EXPORT_SYMBOL_GPL(genphy_c45_template_testmode);

It would be normal to put this in a patch of its own. We just need to
see a user of it within the same patchset.


    Andrew

---
pw-bot: cr

  reply	other threads:[~2026-09-15  1:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12  6:52 [PATCH net-next v17 0/2] " Kyle Switch
2026-09-12  6:52 ` [PATCH net-next v17 1/2] dt-bindings: net: Document Motorcomm YT8824 PHY package Kyle Switch
2026-09-16  3:54   ` netdev-bot+sashiko
2026-09-12  6:52 ` [PATCH net-next v17 2/2] net: phy: Add driver for Motorcomm Quad 2.5GbE phy Kyle Switch
2026-09-15  1:48   ` Andrew Lunn [this message]
2026-09-15  8:19     ` Kyle Switch
2026-09-15  1:57   ` Andrew Lunn
2026-09-15  8:18     ` Kyle Switch
2026-09-16  3:54   ` netdev-bot+sashiko

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=03664dd8-8f95-4ee3-8237-3c64febd90c3@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Frank.Sae@motor-comm.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=jianmin.wang@motor-comm.com \
    --cc=jie.han@motor-comm.com \
    --cc=kuba@kernel.org \
    --cc=kyle.switch@motor-comm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=ming.xu@motor-comm.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=xiaolin.xu@motor-comm.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

all inboxes | Powered by JetHome®