From: Andrew Lunn <andrew@lunn.ch>
To: Dimitri Fedrau <dima.fedrau@gmail.com>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Stefan Eichenberger <eichest@gmail.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 net-next 09/14] net: phy: marvell-88q2xxx: add cable test support
Date: Fri, 16 Feb 2024 00:43:28 +0100 [thread overview]
Message-ID: <ecfac8c1-de0d-4ccc-ad24-5e62b3d1bf5a@lunn.ch> (raw)
In-Reply-To: <20240215210350.GB3103@debian>
On Thu, Feb 15, 2024 at 10:03:50PM +0100, Dimitri Fedrau wrote:
> Am Wed, Feb 14, 2024 at 06:54:58PM +0100 schrieb Andrew Lunn:
> > > +static int mv88q222x_cable_test_get_status(struct phy_device *phydev,
> > > + bool *finished)
> > > +{
> > > + int ret;
> > > + u32 dist;
> > > +
> > > + ret = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_MMD_PCS_MV_TDR_STATUS);
> > > + if (ret < 0)
> > > + return ret;
> > > +
> > > + *finished = true;
> >
> > That looks odd. Is there no status bit which says it has completed? Is
> > it guaranteed to complete within a fixed time? How is it guaranteed that
> > mv88q222x_cable_test_get_status() is called at the necessary delay after
> > mv88q222x_cable_test_start()?
> >
> According to the datasheet and the Marvell API bits(0:1) can be used to
> check if the test has completed. Sample code waits 500ms before checking
> the bits. If the test is not completed after the delay the corresponding
> function returns with an error.
Thanks for the explanation.
>
> I just used bits(7:4) where 2'b1000 means that the test is in progress,
> and setting *finished = false. I didn't introduced any delay, relying
> on the reschedule delay of the PHY state machine. I didn't notice any
> problems with this approach. Anyway if the test does not complete for
> whatever reasons we get stuck here, right ?
It should not happen, and if it does, its a bug in the PHY
firmware. And if that happens, the PHY is probably dead anyway.
phylib does allow you to break out of the cable test state by calling
phy_stop(). That generally happens when you admin down the interface.
So please do check the test has completed.
Andrew
next prev parent reply other threads:[~2024-02-15 23:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 21:39 [PATCH v6 net-next 00/14] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 01/14] net: phy: Add BaseT1 auto-negotiation constants Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 02/14] net: phy: Support 100/1000BT1 linkmode advertisements Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 03/14] net: phy: c45: detect 100/1000BASE-T1 " Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 04/14] net: phy: marvell-88q2xxx: fix typos Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 05/14] net: phy: marvell-88q2xxx: add driver for the Marvell 88Q2220 PHY Dimitri Fedrau
2024-02-14 13:20 ` Gregor Herburger
2024-02-15 20:24 ` Dimitri Fedrau
2024-02-16 9:18 ` Gregor Herburger
2024-02-16 20:53 ` Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 06/14] net: phy: marvell-88q2xxx: add interrupt support for link detection Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 07/14] net: phy: marvell-88q2xxx: add suspend / resume ops Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 08/14] net: phy: marvell-88q2xxx: add support for temperature sensor Dimitri Fedrau
2024-02-13 22:52 ` Guenter Roeck
2024-02-14 17:50 ` Andrew Lunn
2024-02-13 21:39 ` [PATCH v6 net-next 09/14] net: phy: marvell-88q2xxx: add cable test support Dimitri Fedrau
2024-02-14 17:54 ` Andrew Lunn
2024-02-15 21:03 ` Dimitri Fedrau
2024-02-15 23:43 ` Andrew Lunn [this message]
2024-02-13 21:39 ` [PATCH v6 net-next 10/14] net: phy: marvell-88q2xxx: make mv88q2xxx_config_aneg generic Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 11/14] net: phy: marvell-88q2xxx: switch to mv88q2xxx_config_aneg Dimitri Fedrau
2024-02-13 21:39 ` [PATCH v6 net-next 12/14] net: phy: marvell-88q2xxx: cleanup mv88q2xxx_config_init Dimitri Fedrau
2024-02-14 6:39 ` Stefan Eichenberger
2024-02-13 21:39 ` [PATCH v6 net-next 13/14] net: phy: marvell-88q2xxx: remove duplicated assignment of pma_extable Dimitri Fedrau
2024-02-14 17:55 ` Andrew Lunn
2024-02-13 21:39 ` [PATCH v6 net-next 14/14] net: phy: marvell-88q2xxx: move interrupt configuration Dimitri Fedrau
2024-02-14 6:56 ` Stefan Eichenberger
2024-02-14 17:56 ` Andrew Lunn
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=ecfac8c1-de0d-4ccc-ad24-5e62b3d1bf5a@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=dima.fedrau@gmail.com \
--cc=edumazet@google.com \
--cc=eichest@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--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
all inboxes | Powered by JetHome®