[02/10] net/ixgbe/base: add interface for LED control on E610

Message ID 20250114101024.159941-3-yuanx.wang@intel.com (mailing list archive)
State Accepted
Delegated to: Bruce Richardson
Headers
Series update net/ixgbe base driver |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Yuan Wang Jan. 14, 2025, 10:10 a.m. UTC
From: Dawid Zielinski <dawid.zielinski@intel.com>

Add interface for sending ACI command for setting port
identification LED on E610.

Signed-off-by: Dawid Zielinski <dawid.zielinski@intel.com>
Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
---
 drivers/net/ixgbe/base/ixgbe_e610.c      | 29 ++++++++++++++++++++++++
 drivers/net/ixgbe/base/ixgbe_e610.h      |  1 +
 drivers/net/ixgbe/base/ixgbe_type_e610.h | 15 ++++++++++++
 3 files changed, 45 insertions(+)
  

Patch

diff --git a/drivers/net/ixgbe/base/ixgbe_e610.c b/drivers/net/ixgbe/base/ixgbe_e610.c
index b0d55a2411..ee8614d3db 100644
--- a/drivers/net/ixgbe/base/ixgbe_e610.c
+++ b/drivers/net/ixgbe/base/ixgbe_e610.c
@@ -2004,6 +2004,35 @@  s32 ixgbe_aci_write_i2c(struct ixgbe_hw *hw,
 	return ixgbe_aci_send_cmd(hw, &desc, NULL, 0);
 }
 
+/**
+ * ixgbe_aci_set_port_id_led - set LED value for the given port
+ * @hw: pointer to the HW struct
+ * @orig_mode: set LED original mode
+ *
+ * Set LED value for the given port (0x06E9)
+ *
+ * Return: the exit code of the operation.
+ */
+s32 ixgbe_aci_set_port_id_led(struct ixgbe_hw *hw, bool orig_mode)
+{
+	struct ixgbe_aci_cmd_set_port_id_led *cmd;
+	struct ixgbe_aci_desc desc;
+
+	cmd = &desc.params.set_port_id_led;
+
+	ixgbe_fill_dflt_direct_cmd_desc(&desc, ixgbe_aci_opc_set_port_id_led);
+
+	cmd->lport_num = (u8)hw->bus.func;
+	cmd->lport_num_valid = IXGBE_ACI_PORT_ID_PORT_NUM_VALID;
+
+	if (orig_mode)
+		cmd->ident_mode = IXGBE_ACI_PORT_IDENT_LED_ORIG;
+	else
+		cmd->ident_mode = IXGBE_ACI_PORT_IDENT_LED_BLINK;
+
+	return ixgbe_aci_send_cmd(hw, &desc, NULL, 0);
+}
+
 /**
  * ixgbe_aci_set_gpio - set GPIO pin state
  * @hw: pointer to the hw struct
diff --git a/drivers/net/ixgbe/base/ixgbe_e610.h b/drivers/net/ixgbe/base/ixgbe_e610.h
index 4babee821e..716bb86303 100644
--- a/drivers/net/ixgbe/base/ixgbe_e610.h
+++ b/drivers/net/ixgbe/base/ixgbe_e610.h
@@ -61,6 +61,7 @@  s32 ixgbe_aci_read_i2c(struct ixgbe_hw *hw,
 s32 ixgbe_aci_write_i2c(struct ixgbe_hw *hw,
 			struct ixgbe_aci_cmd_link_topo_addr topo_addr,
 			u16 bus_addr, __le16 addr, u8 params, u8 *data);
+s32 ixgbe_aci_set_port_id_led(struct ixgbe_hw *hw, bool orig_mode);
 s32 ixgbe_aci_set_gpio(struct ixgbe_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx,
 		       bool value);
 s32 ixgbe_aci_get_gpio(struct ixgbe_hw *hw, u16 gpio_ctrl_handle, u8 pin_idx,
diff --git a/drivers/net/ixgbe/base/ixgbe_type_e610.h b/drivers/net/ixgbe/base/ixgbe_type_e610.h
index bad332c6b8..4f09fcf3d5 100644
--- a/drivers/net/ixgbe/base/ixgbe_type_e610.h
+++ b/drivers/net/ixgbe/base/ixgbe_type_e610.h
@@ -477,6 +477,7 @@  enum ixgbe_aci_opc {
 	ixgbe_aci_opc_write_mdio			= 0x06E5,
 	ixgbe_aci_opc_set_gpio_by_func			= 0x06E6,
 	ixgbe_aci_opc_get_gpio_by_func			= 0x06E7,
+	ixgbe_aci_opc_set_port_id_led			= 0x06E9,
 	ixgbe_aci_opc_set_gpio				= 0x06EC,
 	ixgbe_aci_opc_get_gpio				= 0x06ED,
 	ixgbe_aci_opc_sff_eeprom			= 0x06EE,
@@ -1252,6 +1253,19 @@  struct ixgbe_aci_cmd_gpio_by_func {
 
 IXGBE_CHECK_PARAM_LEN(ixgbe_aci_cmd_gpio_by_func);
 
+/* Set Port Identification LED (direct, 0x06E9) */
+struct ixgbe_aci_cmd_set_port_id_led {
+	u8 lport_num;
+	u8 lport_num_valid;
+#define IXGBE_ACI_PORT_ID_PORT_NUM_VALID	BIT(0)
+	u8 ident_mode;
+#define IXGBE_ACI_PORT_IDENT_LED_BLINK		BIT(0)
+#define IXGBE_ACI_PORT_IDENT_LED_ORIG		0
+	u8 rsvd[13];
+};
+
+IXGBE_CHECK_PARAM_LEN(ixgbe_aci_cmd_set_port_id_led);
+
 /* Set/Get GPIO (direct, 0x06EC/0x06ED) */
 struct ixgbe_aci_cmd_gpio {
 	__le16 gpio_ctrl_handle;
@@ -1854,6 +1868,7 @@  struct ixgbe_aci_desc {
 		struct ixgbe_aci_cmd_mdio read_write_mdio;
 		struct ixgbe_aci_cmd_mdio read_mdio;
 		struct ixgbe_aci_cmd_mdio write_mdio;
+		struct ixgbe_aci_cmd_set_port_id_led set_port_id_led;
 		struct ixgbe_aci_cmd_gpio_by_func read_write_gpio_by_func;
 		struct ixgbe_aci_cmd_gpio read_write_gpio;
 		struct ixgbe_aci_cmd_sff_eeprom read_write_sff_param;