From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [PATCH 11/11] net/ngbe: add YT PHY fiber mode autoneg 100M support
Date: Thu, 28 Sep 2023 17:47:58 +0800 [thread overview]
Message-ID: <20230928094758.1076236-12-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20230928094758.1076236-1-jiawenwu@trustnetic.com>
Support auto-neg 100M for YT PHY fiber mode.
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
doc/guides/rel_notes/release_23_11.rst | 4 ++
drivers/net/ngbe/base/ngbe_phy_yt.c | 66 +++++++++++++++++++-------
2 files changed, 52 insertions(+), 18 deletions(-)
diff --git a/doc/guides/rel_notes/release_23_11.rst b/doc/guides/rel_notes/release_23_11.rst
index 9746809a66..578900f504 100644
--- a/doc/guides/rel_notes/release_23_11.rst
+++ b/doc/guides/rel_notes/release_23_11.rst
@@ -41,6 +41,10 @@ DPDK Release 23.11
New Features
------------
+* **Updated Wangxun ngbe driver.**
+
+ * Added 100M and auto-neg support in YT PHY fiber mode.
+
.. This section should contain new features added in this release.
Sample format:
diff --git a/drivers/net/ngbe/base/ngbe_phy_yt.c b/drivers/net/ngbe/base/ngbe_phy_yt.c
index 754faadd6a..ea313cd9a5 100644
--- a/drivers/net/ngbe/base/ngbe_phy_yt.c
+++ b/drivers/net/ngbe/base/ngbe_phy_yt.c
@@ -205,38 +205,68 @@ s32 ngbe_setup_phy_link_yt(struct ngbe_hw *hw, u32 speed,
hw->phy.set_phy_power(hw, true);
} else if ((value & YT_CHIP_MODE_MASK) == YT_CHIP_MODE_SEL(1)) {
/* fiber to rgmii */
- hw->phy.autoneg_advertised |= NGBE_LINK_SPEED_1GB_FULL;
+ if (!hw->mac.autoneg) {
+ switch (speed) {
+ case NGBE_LINK_SPEED_1GB_FULL:
+ value = NGBE_LINK_SPEED_1GB_FULL;
+ break;
+ case NGBE_LINK_SPEED_100M_FULL:
+ value = NGBE_LINK_SPEED_100M_FULL;
+ break;
+ default:
+ value = NGBE_LINK_SPEED_1GB_FULL;
+ break;
+ }
+ hw->phy.autoneg_advertised |= value;
+ goto skip_an_fiber;
+ }
- /* RGMII_Config1 : Config rx and tx training delay */
- value = YT_RGMII_CONF1_RXDELAY |
- YT_RGMII_CONF1_TXDELAY_FE |
- YT_RGMII_CONF1_TXDELAY;
+ value = 0;
+ if (speed & NGBE_LINK_SPEED_1GB_FULL)
+ hw->phy.autoneg_advertised |= NGBE_LINK_SPEED_1GB_FULL;
+ if (speed & NGBE_LINK_SPEED_100M_FULL)
+ hw->phy.autoneg_advertised |= NGBE_LINK_SPEED_100M_FULL;
+
+skip_an_fiber:
rte_spinlock_lock(&hw->phy_lock);
- ngbe_write_phy_reg_ext_yt(hw, YT_RGMII_CONF1, 0, value);
- value = YT_CHIP_MODE_SEL(1) |
- YT_CHIP_SW_LDO_EN |
- YT_CHIP_SW_RST;
- ngbe_write_phy_reg_ext_yt(hw, YT_CHIP, 0, value);
+ ngbe_read_phy_reg_ext_yt(hw, YT_MISC, 0, &value);
+ if (hw->phy.autoneg_advertised & NGBE_LINK_SPEED_1GB_FULL)
+ value |= YT_MISC_RESV;
+ else if (hw->phy.autoneg_advertised & NGBE_LINK_SPEED_100M_FULL)
+ value &= ~YT_MISC_RESV;
+ ngbe_write_phy_reg_ext_yt(hw, YT_MISC, 0, value);
+ /* close auto sensing */
ngbe_read_phy_reg_sds_ext_yt(hw, YT_AUTO, 0, &value);
value &= ~YT_AUTO_SENSING;
ngbe_write_phy_reg_sds_ext_yt(hw, YT_AUTO, 0, value);
- ngbe_read_phy_reg_ext_yt(hw, YT_MISC, 0, &value);
- value |= YT_MISC_RESV;
- ngbe_write_phy_reg_ext_yt(hw, YT_MISC, 0, value);
-
ngbe_read_phy_reg_ext_yt(hw, YT_CHIP, 0, &value);
value &= ~YT_CHIP_SW_RST;
ngbe_write_phy_reg_ext_yt(hw, YT_CHIP, 0, value);
+ /* RGMII_Config1 : Config rx and tx training delay */
+ value = YT_RGMII_CONF1_RXDELAY |
+ YT_RGMII_CONF1_TXDELAY_FE |
+ YT_RGMII_CONF1_TXDELAY;
+
+ ngbe_write_phy_reg_ext_yt(hw, YT_RGMII_CONF1, 0, value);
+ value = YT_CHIP_MODE_SEL(1) |
+ YT_CHIP_SW_LDO_EN |
+ YT_CHIP_SW_RST;
+ ngbe_write_phy_reg_ext_yt(hw, YT_CHIP, 0, value);
+
/* software reset */
- if (hw->mac.autoneg)
+ if (hw->mac.autoneg) {
value = YT_BCR_RESET | YT_BCR_ANE | YT_BCR_RESTART_AN |
YT_BCR_DUPLEX | YT_BCR_SPEED_SELECT1;
- else
- value = YT_BCR_RESET | YT_BCR_DUPLEX |
- YT_BCR_SPEED_SELECT1;
+ } else {
+ value = YT_BCR_RESET | YT_BCR_DUPLEX;
+ if (speed & NGBE_LINK_SPEED_1GB_FULL)
+ value |= YT_BCR_SPEED_SELECT1;
+ if (speed & NGBE_LINK_SPEED_100M_FULL)
+ value |= YT_BCR_SPEED_SELECT0;
+ }
hw->phy.write_reg(hw, YT_BCR, 0, value);
rte_spinlock_unlock(&hw->phy_lock);
--
2.27.0
next prev parent reply other threads:[~2023-09-28 9:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-28 9:47 [PATCH 00/11] Wanguxn NICs fixes and supports Jiawen Wu
2023-09-28 9:47 ` [PATCH 01/11] net/txgbe: add Tx queue maximum limit Jiawen Wu
2023-09-28 9:47 ` [PATCH 02/11] net/txgbe: fix GRE tunnel packet checksum Jiawen Wu
2023-09-28 9:47 ` [PATCH 03/11] net/ngbe: fix to set flow control Jiawen Wu
2023-09-28 9:47 ` [PATCH 04/11] net/ngbe: prevent the NIC from slowing down link speed Jiawen Wu
2023-09-28 9:47 ` [PATCH 05/11] net/txgbe: reconfigure MAC Rx when link update Jiawen Wu
2023-09-28 9:47 ` [PATCH 06/11] net/ngbe: " Jiawen Wu
2023-09-28 9:47 ` [PATCH 07/11] net/txgbe: fix to keep link down after device close Jiawen Wu
2023-09-28 9:47 ` [PATCH 08/11] net/ngbe: " Jiawen Wu
2023-09-28 9:47 ` [PATCH 09/11] net/txgbe: check process type in close operation Jiawen Wu
2023-09-28 9:47 ` [PATCH 10/11] net/ngbe: " Jiawen Wu
2023-09-28 9:47 ` Jiawen Wu [this message]
2023-09-29 13:33 ` [PATCH 11/11] net/ngbe: add YT PHY fiber mode autoneg 100M support Ferruh Yigit
2023-09-29 13:33 ` [PATCH 00/11] Wanguxn NICs fixes and supports 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=20230928094758.1076236-12-jiawenwu@trustnetic.com \
--to=jiawenwu@trustnetic.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).