DPDK patches and discussions
 help / color / mirror / Atom feed
From: Zaiyu Wang <zaiyuwang@trustnetic.com>
To: dev@dpdk.org
Cc: Zaiyu Wang <zaiyuwang@trustnetic.com>,
	Jiawen Wu <jiawenwu@trustnetic.com>,
	Jian Wang <jianwang@trustnetic.com>
Subject: [PATCH v4 15/20] net/txgbe: add support for TX laser enable/disable
Date: Tue, 30 Sep 2025 17:59:47 +0800	[thread overview]
Message-ID: <20250930095953.18508-16-zaiyuwang@trustnetic.com> (raw)
In-Reply-To: <20250930095953.18508-1-zaiyuwang@trustnetic.com>

Add enable/disable TX laser configuration code for Amber-Lite NICs.
Due to hardware design differences, the GPIO controlling the TX
laser on Amber-Lite NICs differs from Sapphire NICs, requiring
corresponding configuration changes.

Signed-off-by: Zaiyu Wang <zaiyuwang@trustnetic.com>
---
 drivers/net/txgbe/base/txgbe_hw.c   | 31 ++++++++++++++++++++++++-----
 drivers/net/txgbe/base/txgbe_regs.h | 10 ++++++++++
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/net/txgbe/base/txgbe_hw.c b/drivers/net/txgbe/base/txgbe_hw.c
index d845fd0a69..3cbb21a686 100644
--- a/drivers/net/txgbe/base/txgbe_hw.c
+++ b/drivers/net/txgbe/base/txgbe_hw.c
@@ -3179,12 +3179,28 @@ void txgbe_disable_tx_laser_multispeed_fiber(struct txgbe_hw *hw)
 {
 	u32 esdp_reg = rd32(hw, TXGBE_GPIODATA);
 
-	if (txgbe_close_notify(hw))
-		txgbe_led_off(hw, TXGBE_LEDCTL_UP | TXGBE_LEDCTL_10G |
-				TXGBE_LEDCTL_1G | TXGBE_LEDCTL_ACTIVE);
+	if (txgbe_close_notify(hw)) {
+		/* over write led when ifconfig down */
+		if (hw->mac.type == txgbe_mac_aml40) {
+			txgbe_led_off(hw, TXGBE_LEDCTL_UP | TXGBE_AMLITE_LED_LINK_40G |
+					TXGBE_AMLITE_LED_LINK_ACTIVE);
+		} else if  (hw->mac.type == txgbe_mac_aml)
+			txgbe_led_off(hw, TXGBE_LEDCTL_UP | TXGBE_AMLITE_LED_LINK_25G |
+					TXGBE_AMLITE_LED_LINK_10G | TXGBE_AMLITE_LED_LINK_ACTIVE);
+		else
+			txgbe_led_off(hw, TXGBE_LEDCTL_UP | TXGBE_LEDCTL_10G |
+					TXGBE_LEDCTL_1G | TXGBE_LEDCTL_ACTIVE);
+	}
 
 	/* Disable Tx laser; allow 100us to go dark per spec */
-	esdp_reg |= (TXGBE_GPIOBIT_0 | TXGBE_GPIOBIT_1);
+	if (hw->mac.type == txgbe_mac_aml40) {
+		wr32m(hw, TXGBE_GPIODIR, TXGBE_GPIOBIT_1, TXGBE_GPIOBIT_1);
+		esdp_reg &= ~TXGBE_GPIOBIT_1;
+	} else if (hw->mac.type == txgbe_mac_aml) {
+		esdp_reg |= TXGBE_GPIOBIT_1;
+	} else {
+		esdp_reg |= (TXGBE_GPIOBIT_0 | TXGBE_GPIOBIT_1);
+	}
 	wr32(hw, TXGBE_GPIODATA, esdp_reg);
 	txgbe_flush(hw);
 	usec_delay(100);
@@ -3206,7 +3222,12 @@ void txgbe_enable_tx_laser_multispeed_fiber(struct txgbe_hw *hw)
 		wr32(hw, TXGBE_LEDCTL, 0);
 
 	/* Enable Tx laser; allow 100ms to light up */
-	esdp_reg &= ~(TXGBE_GPIOBIT_0 | TXGBE_GPIOBIT_1);
+	if (hw->mac.type == txgbe_mac_aml40) {
+		wr32m(hw, TXGBE_GPIODIR, TXGBE_GPIOBIT_1, TXGBE_GPIOBIT_1);
+		esdp_reg |= TXGBE_GPIOBIT_1;
+	} else {
+		esdp_reg &= ~(TXGBE_GPIOBIT_0 | TXGBE_GPIOBIT_1);
+	}
 	wr32(hw, TXGBE_GPIODATA, esdp_reg);
 	txgbe_flush(hw);
 	msec_delay(100);
diff --git a/drivers/net/txgbe/base/txgbe_regs.h b/drivers/net/txgbe/base/txgbe_regs.h
index 00c41a5b86..2e0ac9c742 100644
--- a/drivers/net/txgbe/base/txgbe_regs.h
+++ b/drivers/net/txgbe/base/txgbe_regs.h
@@ -302,6 +302,16 @@
 #define   TXGBE_PORT_LINK1000M          MS(2, 0x1)
 #define   TXGBE_PORT_LINK100M           MS(3, 0x1)
 #define   TXGBE_PORT_LANID(r)           RS(r, 8, 0x1)
+#define   TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL  MS(5, 0x1)
+#define   TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL  MS(4, 0x1)
+#define   TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL  MS(3, 0x1)
+#define   TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL  MS(2, 0x1)
+#define   TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL  MS(1, 0x1)
+#define   TXGBE_AMLITE_LED_LINK_ACTIVE    TXGBE_AMLITE_CFG_LED_CTL_LINK_BSY_SEL
+#define   TXGBE_AMLITE_LED_LINK_10G       TXGBE_AMLITE_CFG_LED_CTL_LINK_10G_SEL
+#define   TXGBE_AMLITE_LED_LINK_25G       TXGBE_AMLITE_CFG_LED_CTL_LINK_25G_SEL
+#define   TXGBE_AMLITE_LED_LINK_40G       TXGBE_AMLITE_CFG_LED_CTL_LINK_40G_SEL
+#define   TXGBE_AMLITE_LED_LINK_50G       TXGBE_AMLITE_CFG_LED_CTL_LINK_50G_SEL
 #define TXGBE_EXTAG                     0x014408
 #define   TXGBE_EXTAG_ETAG_MASK         MS(0, 0xFFFF)
 #define   TXGBE_EXTAG_ETAG(v)           LS(v, 0, 0xFFFF)
-- 
2.21.0.windows.1


  parent reply	other threads:[~2025-09-30 10:02 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-18  9:41 [PATCH 0/2] *** Wangxun new NIC support *** Zaiyu Wang
2025-04-18  9:41 ` [PATCH 1/2] net/txgbe: add support for Wangxun new NIC Amber-Lite 25g/40g Zaiyu Wang
2025-04-18  9:41 ` [PATCH 2/2] net/txgbe: add basic code for Amber-Liter NIC configuration Zaiyu Wang
2025-06-25 12:50 ` [PATCH v2 00/15] Wangxun new NIC support Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 01/15] net/txgbe: add basic information for Amber-Lite 25G/40G NICs Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 02/15] net/txgbe: add new SW-FW mailbox interface Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 03/15] net/txgbe: add identification support for new SFP/QSFP modules Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 04/15] net/txgbe: add basic link configuration for Amber-Lite NICs Zaiyu Wang
2025-08-04  6:34     ` Jiawen Wu
2025-06-25 12:50   ` [PATCH v2 05/15] net/txgbe: add support for PHY configuration via SW-FW mailbox Zaiyu Wang
2025-08-04  6:51     ` Jiawen Wu
2025-06-25 12:50   ` [PATCH v2 06/15] net/txgbe: add RX&TX support for Amber-Lite NICs Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 07/15] net/txgbe: add hardware reset change " Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 08/15] net/txgbe: add MAC reconfiguration to avoid packet loss Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 09/15] net/txgbe: add TX head Write-Back mode for Amber-Lite NICs Zaiyu Wang
2025-08-04  7:15     ` Jiawen Wu
2025-06-25 12:50   ` [PATCH v2 10/15] net/txgbe: add RX desc merge " Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 11/15] net/txgbe: add FEC support for Amber-Lite 25G NICs Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 12/15] net/txgbe: add GPIO configuration Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 13/15] net/txgbe: disable unstable features Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 14/15] net/txgbe: add other hardware-related changes Zaiyu Wang
2025-06-25 12:50   ` [PATCH v2 15/15] doc: update for txgbe Zaiyu Wang
2025-06-26  8:02 ` [PATCH v3 00/15] Wangxun new NIC support Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 01/15] net/txgbe: add basic information for Amber-Lite 25G/40G NICs Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 02/15] net/txgbe: add new SW-FW mailbox interface Zaiyu Wang
2025-08-04  6:12     ` Jiawen Wu
2025-06-26  8:02   ` [PATCH v3 03/15] net/txgbe: add identification support for new SFP/QSFP modules Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 04/15] net/txgbe: add basic link configuration for Amber-Lite NICs Zaiyu Wang
2025-08-03 16:42     ` Stephen Hemminger
2025-06-26  8:02   ` [PATCH v3 05/15] net/txgbe: add support for PHY configuration via SW-FW mailbox Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 06/15] net/txgbe: add RX&TX support for Amber-Lite NICs Zaiyu Wang
2025-08-04  7:07     ` Jiawen Wu
2025-06-26  8:02   ` [PATCH v3 07/15] net/txgbe: add hardware reset change " Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 08/15] net/txgbe: add MAC reconfiguration to avoid packet loss Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 09/15] net/txgbe: add TX head Write-Back mode for Amber-Lite NICs Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 10/15] net/txgbe: add RX desc merge " Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 11/15] net/txgbe: add FEC support for Amber-Lite 25G NICs Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 12/15] net/txgbe: add GPIO configuration Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 13/15] net/txgbe: disable unstable features Zaiyu Wang
2025-06-26  8:02   ` [PATCH v3 14/15] net/txgbe: add other hardware-related changes Zaiyu Wang
2025-08-04  7:23     ` Jiawen Wu
2025-06-26  8:02   ` [PATCH v3 15/15] doc: update for txgbe Zaiyu Wang
2025-06-30 19:40   ` [PATCH v3 00/15] Wangxun new NIC support Stephen Hemminger
2025-09-30  9:59 ` [PATCH v4 00/20] " Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 01/20] net/txgbe: add basic information for Amber-Lite 25G/40G NICs Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 02/20] net/txgbe: add new SW-FW mailbox interface Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 03/20] net/txgbe: add identification support for new SFP/QSFP modules Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 04/20] net/txgbe: rename raptor to sp for Sapphire-specific code Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 05/20] net/txgbe: add basic link configuration for Amber-Lite NICs Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 06/20] net/txgbe: add support for PHY configuration via SW-FW mailbox Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 07/20] net/txgbe: add RX&TX support for Amber-Lite NICs Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 08/20] net/txgbe: add hardware reset change " Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 09/20] net/txgbe: add MAC reconfiguration to avoid packet loss Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 10/20] net/txgbe: add TX head Write-Back mode for Amber-Lite NICs Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 11/20] net/txgbe: add RX desc merge " Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 12/20] net/txgbe: add FEC support for Amber-Lite 25G NICs Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 13/20] net/txgbe: add GPIO configuration Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 14/20] net/txgbe: disable unstable features Zaiyu Wang
2025-09-30  9:59   ` Zaiyu Wang [this message]
2025-09-30  9:59   ` [PATCH v4 16/20] net/txgbe: add support for TX queue rate limiting Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 17/20] net/txgbe: add support for getting PHY ID Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 18/20] net/txgbe: add thermal sensor configuration for Amber-Lite NICs Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 19/20] net/txgbe: add RSS " Zaiyu Wang
2025-09-30  9:59   ` [PATCH v4 20/20] doc: update for txgbe Zaiyu Wang

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=20250930095953.18508-16-zaiyuwang@trustnetic.com \
    --to=zaiyuwang@trustnetic.com \
    --cc=dev@dpdk.org \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.com \
    /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).