linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: micrel: make sure the factory test bit is cleared
@ 2019-04-26 16:41 Antoine Tenart
  2019-04-26 16:47 ` Andrew Lunn
  2019-04-30  3:17 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Antoine Tenart @ 2019-04-26 16:41 UTC (permalink / raw)
  To: davem, andrew, f.fainelli, hkallweit1
  Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
	nicolas.ferre, ludovic.desroches, alexandre.belloni

The KSZ8081 PHY has a factory test mode which is set at the de-assertion
of the reset line based on the RXER (KSZ8081RNA/RND) or TXC
(KSZ8081MNX/RNB) pin. If a pull-down is missing, or if the pin has a
pull-up, the factory test mode should be cleared by manually writing a 0
(according to the datasheet). This patch makes sure this factory test
bit is cleared in config_init().

Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/phy/micrel.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index ddd6b6374d8c..3c8186f269f9 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -28,6 +28,7 @@
 
 /* Operation Mode Strap Override */
 #define MII_KSZPHY_OMSO				0x16
+#define KSZPHY_OMSO_FACTORY_TEST		BIT(15)
 #define KSZPHY_OMSO_B_CAST_OFF			BIT(9)
 #define KSZPHY_OMSO_NAND_TREE_ON		BIT(5)
 #define KSZPHY_OMSO_RMII_OVERRIDE		BIT(1)
@@ -340,6 +341,18 @@ static int ksz8041_config_aneg(struct phy_device *phydev)
 	return genphy_config_aneg(phydev);
 }
 
+static int ksz8081_config_init(struct phy_device *phydev)
+{
+	/* KSZPHY_OMSO_FACTORY_TEST is set at de-assertion of the reset line
+	 * based on the RXER (KSZ8081RNA/RND) or TXC (KSZ8081MNX/RNB) pin. If a
+	 * pull-down is missing, the factory test mode should be cleared by
+	 * manually writing a 0.
+	 */
+	phy_clear_bits(phydev, MII_KSZPHY_OMSO, KSZPHY_OMSO_FACTORY_TEST);
+
+	return kszphy_config_init(phydev);
+}
+
 static int ksz8061_config_init(struct phy_device *phydev)
 {
 	int ret;
@@ -1038,7 +1051,7 @@ static struct phy_driver ksphy_driver[] = {
 	/* PHY_BASIC_FEATURES */
 	.driver_data	= &ksz8081_type,
 	.probe		= kszphy_probe,
-	.config_init	= kszphy_config_init,
+	.config_init	= ksz8081_config_init,
 	.ack_interrupt	= kszphy_ack_interrupt,
 	.config_intr	= kszphy_config_intr,
 	.get_sset_count = kszphy_get_sset_count,
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: micrel: make sure the factory test bit is cleared
  2019-04-26 16:41 [PATCH net-next] net: phy: micrel: make sure the factory test bit is cleared Antoine Tenart
@ 2019-04-26 16:47 ` Andrew Lunn
  2019-04-30  3:17 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2019-04-26 16:47 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: davem, f.fainelli, hkallweit1, netdev, linux-kernel,
	thomas.petazzoni, nicolas.ferre, ludovic.desroches,
	alexandre.belloni

On Fri, Apr 26, 2019 at 06:41:23PM +0200, Antoine Tenart wrote:
> The KSZ8081 PHY has a factory test mode which is set at the de-assertion
> of the reset line based on the RXER (KSZ8081RNA/RND) or TXC
> (KSZ8081MNX/RNB) pin. If a pull-down is missing, or if the pin has a
> pull-up, the factory test mode should be cleared by manually writing a 0
> (according to the datasheet). This patch makes sure this factory test
> bit is cleared in config_init().
> 
> Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: micrel: make sure the factory test bit is cleared
  2019-04-26 16:41 [PATCH net-next] net: phy: micrel: make sure the factory test bit is cleared Antoine Tenart
  2019-04-26 16:47 ` Andrew Lunn
@ 2019-04-30  3:17 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-04-30  3:17 UTC (permalink / raw)
  To: antoine.tenart
  Cc: andrew, f.fainelli, hkallweit1, netdev, linux-kernel,
	thomas.petazzoni, nicolas.ferre, ludovic.desroches,
	alexandre.belloni

From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Fri, 26 Apr 2019 18:41:23 +0200

> The KSZ8081 PHY has a factory test mode which is set at the de-assertion
> of the reset line based on the RXER (KSZ8081RNA/RND) or TXC
> (KSZ8081MNX/RNB) pin. If a pull-down is missing, or if the pin has a
> pull-up, the factory test mode should be cleared by manually writing a 0
> (according to the datasheet). This patch makes sure this factory test
> bit is cleared in config_init().
> 
> Tested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-30  3:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-26 16:41 [PATCH net-next] net: phy: micrel: make sure the factory test bit is cleared Antoine Tenart
2019-04-26 16:47 ` Andrew Lunn
2019-04-30  3:17 ` David Miller

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).