Add LED blink support for i225 series NICs. This is mostly identical to
IGC driver, with some minor differences due to the way IGC driver was
originally generated.

Signed-off-by: Anatoly Burakov <anatoly.bura...@intel.com>
---
 drivers/net/intel/e1000/base/e1000_i225.c | 44 +++++++++++++++++++++++
 drivers/net/intel/e1000/base/e1000_i225.h | 15 ++++++++
 2 files changed, 59 insertions(+)

diff --git a/drivers/net/intel/e1000/base/e1000_i225.c 
b/drivers/net/intel/e1000/base/e1000_i225.c
index ccabfdca83..a7a42e2f0e 100644
--- a/drivers/net/intel/e1000/base/e1000_i225.c
+++ b/drivers/net/intel/e1000/base/e1000_i225.c
@@ -50,6 +50,11 @@ STATIC s32 e1000_init_mac_params_i225(struct e1000_hw *hw)
 
        mac->ops.write_vfta = e1000_write_vfta_generic;
 
+       /* LED */
+       mac->ops.cleanup_led = e1000_cleanup_led_generic;
+       mac->ops.id_led_init = e1000_id_led_init_i225;
+       mac->ops.blink_led = e1000_blink_led_i225;
+
        return E1000_SUCCESS;
 }
 
@@ -316,3 +321,42 @@ s32 e1000_set_d3_lplu_state_i225(struct e1000_hw *hw, bool 
active)
        E1000_WRITE_REG(hw, E1000_I225_PHPM, data);
        return E1000_SUCCESS;
 }
+
+/**
+ *  e1000_blink_led_i225 - Blink SW controllable LED
+ *  @hw: pointer to the HW structure
+ *
+ *  This starts the adapter LED blinking.
+ *  Request the LED to be setup first.
+ **/
+s32 e1000_blink_led_i225(struct e1000_hw *hw)
+{
+       u32 blink = 0;
+
+       DEBUGFUNC("e1000_blink_led_i225");
+
+       e1000_id_led_init_i225(hw);
+
+       blink = hw->mac.ledctl_default;
+       blink &= ~(E1000_GLOBAL_BLINK_MODE | E1000_LED1_MODE_MASK | 
E1000_LED2_MODE_MASK);
+       blink |= E1000_LED1_BLINK;
+
+       E1000_WRITE_REG(hw, E1000_LEDCTL, blink);
+
+       return E1000_SUCCESS;
+}
+
+/**
+ *  e1000_id_led_init_i225 - store LED configurations in SW
+ *  @hw: pointer to the HW structure
+ *
+ *  Initializes the LED config in SW.
+ **/
+s32 e1000_id_led_init_i225(struct e1000_hw *hw)
+{
+       DEBUGFUNC("e1000_id_led_init_i225");
+
+       hw->mac.ledctl_default = E1000_READ_REG(hw, E1000_LEDCTL);
+
+       return E1000_SUCCESS;
+}
diff --git a/drivers/net/intel/e1000/base/e1000_i225.h 
b/drivers/net/intel/e1000/base/e1000_i225.h
index fd79f08216..03e0f4fb89 100644
--- a/drivers/net/intel/e1000/base/e1000_i225.h
+++ b/drivers/net/intel/e1000/base/e1000_i225.h
@@ -5,9 +5,24 @@
 #ifndef _E1000_I225_H_
 #define _E1000_I225_H_
 
+s32 e1000_id_led_init_i225(struct e1000_hw *hw);
+s32 e1000_blink_led_i225(struct e1000_hw *hw);
 s32 e1000_init_hw_i225(struct e1000_hw *hw);
 s32 e1000_setup_copper_link_i225(struct e1000_hw *hw);
 s32 e1000_set_d0_lplu_state_i225(struct e1000_hw *hw, bool active);
 s32 e1000_set_d3_lplu_state_i225(struct e1000_hw *hw, bool active);
 
+#define ID_LED_DEFAULT_I225            ((ID_LED_OFF1_ON2  << 8) | \
+                                        (ID_LED_DEF1_DEF2 <<  4) | \
+                                        (ID_LED_OFF1_OFF2))
+#define ID_LED_DEFAULT_I225_SERDES     ((ID_LED_DEF1_DEF2 << 8) | \
+                                        (ID_LED_DEF1_DEF2 <<  4) | \
+                                        (ID_LED_OFF1_ON2))
+
+/* LED Control */
+#define E1000_GLOBAL_BLINK_MODE        0x00000020 /*Blink at 200 ms on and 200 
ms off.*/
+#define E1000_LED1_MODE_MASK   0x00000F00
+#define E1000_LED1_BLINK       0x00008000
+#define E1000_LED2_MODE_MASK   0x000F0000
+
 #endif
-- 
2.43.5

Reply via email to