From: Jiawen Wu <jiawenwu@trustnetic.com>
To: dev@dpdk.org
Cc: Jiawen Wu <jiawenwu@trustnetic.com>
Subject: [PATCH v2 7/7] net/ngbe: support YT PHY SGMII to RGMII mode
Date: Wed, 22 Jun 2022 14:56:13 +0800 [thread overview]
Message-ID: <20220622065613.661679-8-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20220622065613.661679-1-jiawenwu@trustnetic.com>
Add SGMII to RGMII mode for yt8521s and yt8531s PHY.
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
doc/guides/rel_notes/release_22_07.rst | 1 +
drivers/net/ngbe/base/ngbe_phy_yt.c | 49 ++++++++++++++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index a84c5b486b..6baa63e3bf 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -168,6 +168,7 @@ New Features
* Added support for yt8531s PHY.
* Added support for OEM subsystem vendor ID.
* Added autoneg on/off for external PHY SFI mode.
+ * Added support for yt8521s/yt8531s PHY SGMII to RGMII mode.
* **Updated Wangxun txgbe driver.**
diff --git a/drivers/net/ngbe/base/ngbe_phy_yt.c b/drivers/net/ngbe/base/ngbe_phy_yt.c
index bc1921e68a..562a0dede5 100644
--- a/drivers/net/ngbe/base/ngbe_phy_yt.c
+++ b/drivers/net/ngbe/base/ngbe_phy_yt.c
@@ -298,6 +298,55 @@ s32 ngbe_setup_phy_link_yt(struct ngbe_hw *hw, u32 speed,
value &= ~YT_SMI_PHY_SW_RST;
ngbe_write_phy_reg_ext_yt(hw, YT_CHIP, 0, value);
+ hw->phy.set_phy_power(hw, true);
+ } else if ((value & YT_CHIP_MODE_MASK) == YT_CHIP_MODE_SEL(5)) {
+ /* sgmii_to_rgmii */
+ if (!hw->mac.autoneg) {
+ switch (speed) {
+ case NGBE_LINK_SPEED_1GB_FULL:
+ value = YT_BCR_SPEED_SELECT1;
+ break;
+ case NGBE_LINK_SPEED_100M_FULL:
+ value = YT_BCR_SPEED_SELECT0;
+ break;
+ case NGBE_LINK_SPEED_10M_FULL:
+ value = 0;
+ break;
+ default:
+ value = YT_BCR_SPEED_SELECT0 |
+ YT_BCR_SPEED_SELECT1;
+ DEBUGOUT("unknown speed = 0x%x", speed);
+ break;
+ }
+ /* duplex full */
+ value |= YT_BCR_DUPLEX | YT_BCR_RESET;
+ hw->phy.write_reg(hw, YT_BCR, 0, value);
+
+ goto skip_an_sr;
+ }
+
+ value = 0;
+ if (speed & NGBE_LINK_SPEED_1GB_FULL) {
+ hw->phy.autoneg_advertised |= NGBE_LINK_SPEED_1GB_FULL;
+ value |= YT_BCR_SPEED_SELECT1;
+ }
+ if (speed & NGBE_LINK_SPEED_100M_FULL) {
+ hw->phy.autoneg_advertised |= NGBE_LINK_SPEED_100M_FULL;
+ value |= YT_BCR_SPEED_SELECT0;
+ }
+ if (speed & NGBE_LINK_SPEED_10M_FULL)
+ hw->phy.autoneg_advertised |= NGBE_LINK_SPEED_10M_FULL;
+
+ /* duplex full */
+ value |= YT_BCR_DUPLEX | YT_BCR_RESET;
+ hw->phy.write_reg(hw, YT_BCR, 0, value);
+
+ /* software reset to make the above configuration take effect */
+ hw->phy.read_reg(hw, YT_BCR, 0, &value);
+ value |= YT_BCR_RESET | YT_BCR_ANE | YT_BCR_RESTART_AN;
+ hw->phy.write_reg(hw, 0x0, 0, value);
+
+skip_an_sr:
hw->phy.set_phy_power(hw, true);
}
--
2.27.0
next prev parent reply other threads:[~2022-06-22 6:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 6:56 [PATCH v2 0/7] Fixes and supports for Wangxun NICs Jiawen Wu
2022-06-22 6:56 ` [PATCH v2 1/7] net/txgbe: support OEM subsystem vendor ID Jiawen Wu
2022-06-22 6:56 ` [PATCH v2 2/7] net/ngbe: " Jiawen Wu
2022-06-22 6:56 ` [PATCH v2 3/7] net/txgbe: fix register polling Jiawen Wu
2022-06-22 6:56 ` [PATCH v2 4/7] net/ngbe: add more packet statistics Jiawen Wu
2022-06-22 6:56 ` [PATCH v2 5/7] net/ngbe: fix YT PHY UTP mode to link up Jiawen Wu
2022-06-22 6:56 ` [PATCH v2 6/7] net/ngbe: support autoneg on/off for external PHY SFI mode Jiawen Wu
2022-06-22 6:56 ` Jiawen Wu [this message]
2022-06-22 10:56 ` [PATCH v2 0/7] Fixes and supports for Wangxun NICs Ferruh Yigit
2022-06-23 3:26 ` Jiawen Wu
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=20220622065613.661679-8-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).