linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Revanth Kumar Uppala <ruppala@nvidia.com>
To: <linux@armlinux.org.uk>, <andrew@lunn.ch>, <hkallweit1@gmail.com>,
	<netdev@vger.kernel.org>
Cc: <linux-tegra@vger.kernel.org>, Revanth Kumar Uppala <ruppala@nvidia.com>
Subject: [PATCH 3/4] net: phy: aquantia: Poll for TX ready at PHY system side
Date: Wed, 28 Jun 2023 18:13:25 +0530	[thread overview]
Message-ID: <20230628124326.55732-3-ruppala@nvidia.com> (raw)
In-Reply-To: <20230628124326.55732-1-ruppala@nvidia.com>

Lane bring-up failures are seen during interface up, as interface
speed settings are configured while the PHY is still initializing.

So, poll until PHY system side interface gets ready and the interface
speed settings are configured.

Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
---
 drivers/net/phy/aquantia_main.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c
index faca2a0b1d49..a27ff4733050 100644
--- a/drivers/net/phy/aquantia_main.c
+++ b/drivers/net/phy/aquantia_main.c
@@ -41,6 +41,7 @@
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII	6
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI	7
 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII	10
+#define MDIO_PHYXS_VEND_IF_STATUS_TX_READY	BIT(12)
 
 #define MDIO_AN_VEND_PROV			0xc400
 #define MDIO_AN_VEND_PROV_1000BASET_FULL	BIT(15)
@@ -467,6 +468,19 @@ static int aqr107_read_status(struct phy_device *phydev)
 		break;
 	}
 
+	/* Lane bring-up failures are seen during interface up, as interface
+	 * speed settings are configured while the PHY is still initializing.
+	 * To resolve this, poll until PHY system side interface gets ready
+	 * and the interface speed settings are configured.
+	 */
+	ret = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_PHYXS, MDIO_PHYXS_VEND_IF_STATUS,
+					val, (val & MDIO_PHYXS_VEND_IF_STATUS_TX_READY),
+					20000, 2000000, false);
+	if (ret) {
+		phydev_err(phydev, "PHY system interface is not yet ready\n");
+		return ret;
+	}
+
 	/* Read possibly downshifted rate from vendor register */
 	return aqr107_read_rate(phydev);
 }
-- 
2.17.1


  parent reply	other threads:[~2023-06-28 12:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 12:43 [PATCH 1/4] net: phy: aquantia: Enable Tx/Rx pause frame support in aquantia PHY Revanth Kumar Uppala
2023-06-28 12:43 ` [PATCH 2/4] net: phy: aquantia: Enable MAC Controlled EEE Revanth Kumar Uppala
2023-06-28 13:54   ` Andrew Lunn
2023-07-24 11:29     ` Revanth Kumar Uppala
2023-07-24 11:52       ` Russell King (Oracle)
2023-06-28 12:43 ` Revanth Kumar Uppala [this message]
2023-06-28 13:33   ` [PATCH 3/4] net: phy: aquantia: Poll for TX ready at PHY system side Russell King (Oracle)
2023-07-24 11:29     ` Revanth Kumar Uppala
2023-07-24 11:57       ` Russell King (Oracle)
2023-06-28 12:43 ` [PATCH 4/4] net: phy: aqr113c: Enable Wake-on-LAN (WOL) Revanth Kumar Uppala
2023-06-28 13:43   ` Russell King (Oracle)
2023-07-24 11:29     ` Revanth Kumar Uppala
2023-07-24 12:29       ` Russell King (Oracle)
2023-06-28 14:17   ` Andrew Lunn
2023-07-24 11:30     ` Revanth Kumar Uppala
2023-06-28 18:57   ` kernel test robot
2023-06-28 13:30 ` [PATCH 1/4] net: phy: aquantia: Enable Tx/Rx pause frame support in aquantia PHY Russell King (Oracle)
2023-06-28 13:46   ` Andrew Lunn
2023-07-24 11:29     ` Revanth Kumar Uppala
2023-07-24 11:47       ` Russell King (Oracle)
2023-06-28 13:46 ` Russell King (Oracle)

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=20230628124326.55732-3-ruppala@nvidia.com \
    --to=ruppala@nvidia.com \
    --cc=andrew@lunn.ch \
    --cc=hkallweit1@gmail.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.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).