[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yk4/Cm3uuBF7vplL@lunn.ch>
Date: Thu, 7 Apr 2022 03:31:54 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Marek Vasut <marex@...x.de>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
Heiner Kallweit <hkallweit1@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Oleksij Rempel <linux@...pel-privat.de>,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH] net: phy: micrel: ksz9031/ksz9131: add cabletest support
> +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
Powered by blists - more mailing lists