netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Marek Vasut <marex@denx.de>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Oleksij Rempel <linux@rempel-privat.de>,
	Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH] net: phy: micrel: ksz9031/ksz9131: add cabletest support
Date: Thu, 7 Apr 2022 03:31:54 +0200	[thread overview]
Message-ID: <Yk4/Cm3uuBF7vplL@lunn.ch> (raw)
In-Reply-To: <20220406185020.301197-1-marex@denx.de>

> +static int ksz9x31_cable_test_start(struct phy_device *phydev)
> +{
> +	int ret;
> +
> +	/* KSZ9131RNX, DS00002841B-page 38, 4.14 LinkMD (R) Cable Diagnostic
> +	 * Prior to running the cable diagnostics, Auto-negotiation should
> +	 * be disabled, full duplex set and the link speed set to 1000Mbps
> +	 * via the Basic Control Register.
> +	 */
> +	ret = phy_modify(phydev, MII_BMCR,
> +			 BMCR_SPEED1000 | BMCR_FULLDPLX |
> +			 BMCR_ANENABLE | BMCR_SPEED100,
> +			 BMCR_SPEED1000 | BMCR_FULLDPLX);
> +	if (ret)
> +		return ret;
> +
> +	/* KSZ9131RNX, DS00002841B-page 38, 4.14 LinkMD (R) Cable Diagnostic
> +	 * The Master-Slave configuration should be set to Slave by writing
> +	 * a value of 0x1000 to the Auto-Negotiation Master Slave Control
> +	 * Register.
> +	 */
> +	return phy_modify(phydev, MII_CTRL1000,
> +			  CTL1000_ENABLE_MASTER | CTL1000_AS_MASTER,
> +			  CTL1000_ENABLE_MASTER);

Did you check if this gets undone when the cable test is
completed? The phy state machine will call phy_init_hw(), but i've no
idea if that is sufficient to reset the master selection.

Otherwise, this looks good.

	   Andrew

  reply	other threads:[~2022-04-07  1:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 18:50 [PATCH] net: phy: micrel: ksz9031/ksz9131: add cabletest support Marek Vasut
2022-04-07  1:31 ` Andrew Lunn [this message]
2022-04-07  2:07   ` Marek Vasut

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=Yk4/Cm3uuBF7vplL@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@rempel-privat.de \
    --cc=marex@denx.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).