From: Andrew Lunn <andrew@lunn.ch>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Mark Rutland <mark.rutland@arm.com>,
Rob Herring <robh+dt@kernel.org>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Marek Vasut <marex@denx.de>,
David Jander <david@protonic.nl>,
devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v1] net: phy: tja11xx: add cable-test support
Date: Wed, 13 May 2020 15:39:25 +0200 [thread overview]
Message-ID: <20200513133925.GD499265@lunn.ch> (raw)
In-Reply-To: <20200513123440.19580-1-o.rempel@pengutronix.de>
On Wed, May 13, 2020 at 02:34:40PM +0200, Oleksij Rempel wrote:
> Add initial cable testing support.
> This PHY needs only 100usec for this test and it is recommended to run it
> before the link is up. For now, provide at least ethtool support, so it
> can be tested by more developers.
>
> This patch was tested with TJA1102 PHY with following results:
> - No cable, is detected as open
> - 1m cable, with no connected other end and detected as open
> - a 40m cable (out of spec, max lenght should be 15m) is detected as OK.
>
> Current patch do not provide polarity test support. This test would
> indicate not proper wire connection, where "+" wire of main phy is
> connected to the "-" wire of the link partner.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/phy/nxp-tja11xx.c | 106 +++++++++++++++++++++++++++++++++-
> 1 file changed, 105 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c
> index ca5f9d4dc57ed..8b743d25002b9 100644
> --- a/drivers/net/phy/nxp-tja11xx.c
> +++ b/drivers/net/phy/nxp-tja11xx.c
> @@ -5,6 +5,7 @@
> */
> #include <linux/delay.h>
> #include <linux/ethtool.h>
> +#include <linux/ethtool_netlink.h>
> #include <linux/kernel.h>
> #include <linux/mdio.h>
> #include <linux/mii.h>
> @@ -26,6 +27,7 @@
> #define MII_ECTRL_POWER_MODE_NO_CHANGE (0x0 << 11)
> #define MII_ECTRL_POWER_MODE_NORMAL (0x3 << 11)
> #define MII_ECTRL_POWER_MODE_STANDBY (0xc << 11)
> +#define MII_ECTRL_CABLE_TEST BIT(5)
> #define MII_ECTRL_CONFIG_EN BIT(2)
> #define MII_ECTRL_WAKE_REQUEST BIT(0)
>
> @@ -55,6 +57,11 @@
> #define MII_GENSTAT 24
> #define MII_GENSTAT_PLL_LOCKED BIT(14)
>
> +#define MII_EXTSTAT 25
> +#define MII_EXTSTAT_SHORT_DETECT BIT(8)
> +#define MII_EXTSTAT_OPEN_DETECT BIT(7)
> +#define MII_EXTSTAT_POLARITY_DETECT BIT(6)
> +
Do these registers all conform to the standard? Can we pull this code
out into a library which all standards conformant PHY drivers can use?
The code itself looks O.K.
Andrew
next prev parent reply other threads:[~2020-05-13 13:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 12:34 [PATCH net-next v1] net: phy: tja11xx: add cable-test support Oleksij Rempel
2020-05-13 13:39 ` Andrew Lunn [this message]
2020-05-13 17:40 ` Oleksij Rempel
2020-05-13 18:01 ` Andrew Lunn
2020-05-14 12:09 ` Oleksij Rempel
2020-05-14 13:38 ` Andrew Lunn
2020-05-14 15:47 ` [EXT] " Christian Herber
2020-05-14 16:01 ` Andrew Lunn
2020-05-14 17:27 ` Oleksij Rempel
2020-05-13 19:30 ` Andrew Lunn
2020-05-13 19:34 ` Florian Fainelli
2020-05-13 19:36 ` David Miller
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=20200513133925.GD499265@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=david@protonic.nl \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=mark.rutland@arm.com \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).