DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Namburu, Chandu-babu" <chandu@amd.com>
To: "Sebastian, Selwin" <Selwin.Sebastian@amd.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [PATCH v2 2/6] net/axgbe: toggle PLL settings during rate change
Date: Thu, 27 Jan 2022 13:39:55 +0000	[thread overview]
Message-ID: <MW2PR12MB2538C72C1284114CDF37DB83C8219@MW2PR12MB2538.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20220125121747.344631-3-ssebasti@amd.com>

[Public]

Acked-by: Chandubabu Namburu <chandu@amd.com>

-----Original Message-----
From: ssebasti@amd.com <ssebasti@amd.com> 
Sent: Tuesday, January 25, 2022 5:48 PM
To: dev@dpdk.org
Subject: [PATCH v2 2/6] net/axgbe: toggle PLL settings during rate change

From: Selwin Sebastian <selwin.sebastian@amd.com>

For each rate change command submission, the FW has to do a phy power off sequence internally. For this to happen correctly, the PLL re-initialization control setting has to be turned off before sending mailbox commands and re-enabled once the command submission is complete. Without the PLL control setting, the link up takes longer time in a fixed phy configuration.

Signed-off-by: Selwin Sebastian <selwin.sebastian@amd.com>
---
 drivers/net/axgbe/axgbe_common.h   |  9 +++++++++
 drivers/net/axgbe/axgbe_phy_impl.c | 22 ++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h
index df0aa21a9b..5a7ac35b6a 100644
--- a/drivers/net/axgbe/axgbe_common.h
+++ b/drivers/net/axgbe/axgbe_common.h
@@ -1314,6 +1314,11 @@
 #define MDIO_VEND2_PMA_CDR_CONTROL	0x8056
 #endif
 
+#ifndef MDIO_VEND2_PMA_MISC_CTRL0
+#define MDIO_VEND2_PMA_MISC_CTRL0	0x8090
+#endif
+
+
 #ifndef MDIO_CTRL1_SPEED1G
 #define MDIO_CTRL1_SPEED1G		(MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
 #endif
@@ -1392,6 +1397,10 @@ static inline uint32_t high32_value(uint64_t addr)
 	return (addr >> 32) & 0x0ffffffff;
 }
 
+#define XGBE_PMA_PLL_CTRL_MASK         BIT(15)
+#define XGBE_PMA_PLL_CTRL_SET          BIT(15)
+#define XGBE_PMA_PLL_CTRL_CLEAR                0x0000
+
 /*END*/
 
 /* Bit setting and getting macros
diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c
index 72104f8a3f..08d3484a11 100644
--- a/drivers/net/axgbe/axgbe_phy_impl.c
+++ b/drivers/net/axgbe/axgbe_phy_impl.c
@@ -1196,8 +1196,22 @@ static void axgbe_phy_set_redrv_mode(struct axgbe_port *pdata)
 	axgbe_phy_put_comm_ownership(pdata);
 }
 
+static void axgbe_phy_pll_ctrl(struct axgbe_port *pdata, bool enable) {
+	XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0,
+			XGBE_PMA_PLL_CTRL_MASK,
+			enable ? XGBE_PMA_PLL_CTRL_SET
+			: XGBE_PMA_PLL_CTRL_CLEAR);
+
+	/* Wait for command to complete */
+	rte_delay_us(150);
+}
+
 static void axgbe_phy_start_ratechange(struct axgbe_port *pdata)  {
+	/* Clear the PLL so that it helps in power down sequence */
+	axgbe_phy_pll_ctrl(pdata, false);
+
 	/* Log if a previous command did not complete */
 	if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
 		PMD_DRV_LOG(NOTICE, "firmware mailbox not ready for command\n"); @@ -1213,10 +1227,14 @@ static void axgbe_phy_complete_ratechange(struct axgbe_port *pdata)
 	wait = AXGBE_RATECHANGE_COUNT;
 	while (wait--) {
 		if (!XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS))
-			return;
-
+			goto reenable_pll;
 		rte_delay_us(1500);
 	}
+
+reenable_pll:
+	 /* Re-enable the PLL control */
+	axgbe_phy_pll_ctrl(pdata, true);
+
 	PMD_DRV_LOG(NOTICE, "firmware mailbox command did not complete\n");  }
 
--
2.25.1

  reply	other threads:[~2022-01-27 13:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25 12:17 [PATCH v2 0/6] axgbe pmd updates ssebasti
2022-01-25 12:17 ` [PATCH v2 1/6] net/axgbe: always attempt link training in KR mode ssebasti
2022-01-27 13:45   ` Namburu, Chandu-babu
2022-01-25 12:17 ` [PATCH v2 2/6] net/axgbe: toggle PLL settings during rate change ssebasti
2022-01-27 13:39   ` Namburu, Chandu-babu [this message]
2022-01-25 12:17 ` [PATCH v2 3/6] net/axgbe: simplify mailbox interface rate change code ssebasti
2022-01-27 13:39   ` Namburu, Chandu-babu
2022-01-25 12:17 ` [PATCH v2 4/6] net/axgbe: reset PHY Rx when mailbox command timeout ssebasti
2022-01-27 13:39   ` Namburu, Chandu-babu
2022-01-25 12:17 ` [PATCH v2 5/6] net/axgbe: add support for new port mode ssebasti
2022-01-27 13:39   ` Namburu, Chandu-babu
2022-01-25 12:17 ` [PATCH v2 6/6] net/axgbe: alter the port speed bit range ssebasti
2022-01-25 16:21   ` Namburu, Chandu-babu
2022-01-27 14:31     ` Ferruh Yigit
2022-01-25 12:47 ` [PATCH v2 0/6] axgbe pmd updates Ferruh Yigit
2022-01-25 12:50 ` Ferruh Yigit

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=MW2PR12MB2538C72C1284114CDF37DB83C8219@MW2PR12MB2538.namprd12.prod.outlook.com \
    --to=chandu@amd.com \
    --cc=Selwin.Sebastian@amd.com \
    --cc=dev@dpdk.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).